• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UI.Image类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnityEngine.UI.Image的典型用法代码示例。如果您正苦于以下问题:C# Image类的具体用法?C# Image怎么用?C# Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Image类属于UnityEngine.UI命名空间,在下文中一共展示了Image类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SetColor

 void SetColor(Transform _transform, Color _color)
 {
     mText = _transform.GetComponent<Text> ();
     if (mText != null){
         mText.color = _color;
     }
     mLight = _transform.GetComponent<Light>();
     if (mLight != null){
         mLight.color = _color;
     }
     mImage = _transform.GetComponent<Image> ();
     if (mImage != null) {
         mImage.color = _color;
     }
     mSpriteRender = _transform.GetComponent<SpriteRenderer> ();
     if (mSpriteRender != null) {
         mSpriteRender.color = _color;
     }
     if (_transform.GetComponent<Renderer>() != null) {
         mMat = _transform.GetComponent<Renderer>().material;
         if (mMat != null) {
             mMat.color = _color;
         }
     }
     if (includeChilds) {
         for (int i = 0; i < _transform.childCount; ++i) {
             Transform child = _transform.GetChild(i);
             SetColor(child, _color);
         }
     }
 }
开发者ID:nekodon,项目名称:Pinball,代码行数:31,代码来源:uTweenColor.cs


示例2: Start

 // Use this for initialization
 void Start()
 {
     _underWater = FindObjectOfType<UnderWater>();
     _healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent<Image>();
     _damageFlash = GameObject.FindGameObjectWithTag("DamageFlash").GetComponent<Image>();
     _currentHealth = _maxHealth;
 }
开发者ID:mcnedward,项目名称:unity-project,代码行数:8,代码来源:Health.cs


示例3: Start

        void Start()
        {
            //We keep it in game to be able to disconnect/have info on server
            DontDestroyOnLoad (gameObject);

            panelImage = GetComponent<Image> ();
        }
开发者ID:sdd4163,项目名称:HideSeekLobby,代码行数:7,代码来源:LobbyTopPanel.cs


示例4: Awake

        private void Awake()
        {
            characterRectTransform = GetComponent<RectTransform>();
            image = GetComponent<Image>();

            currentLookDirection = 0;
        }
开发者ID:ZeroZagarth,项目名称:SkillTheHackCat,代码行数:7,代码来源:TechnoRobotController.cs


示例5: Awake

 void Awake()
 {
     ToggleGameOverPanel(false);
     recognitionBoard = GetComponent<RecognitionBoard>();
     RecognitionBoard.GestureRecognized += OnGestureRecognized;
     indicatorImage = roundTimeIndicator.GetComponentInChildren<Image>();
 }
开发者ID:Pavelko007,项目名称:Shape-Replica,代码行数:7,代码来源:GameManager.cs


示例6: Start

	// Use this for initialization
	void Start () {
		anim = GetComponent<Animator> ();
		BarVie = GameObject.Find("MainCamera").transform.FindChild("Canvas").FindChild("BarVie").GetComponent<Image>();
		SetColor (1);


	}
开发者ID:MarcoKouyate,项目名称:MatthewGame,代码行数:8,代码来源:Player2.cs


示例7: Create

 public void Create(Image beatImage)
 {
     _beatImage = beatImage;
     Vector3 p = GetPosition();
     p.y = startPosition;
     UpdatePosition(p);
 }
开发者ID:TheDarkVoid,项目名称:MikuSecret,代码行数:7,代码来源:Beat.cs


示例8: Start

 // Use this for initialization
 void Start()
 {
     image = gameObject.GetComponent<UnityEngine.UI.Image>();
     index = 0;
     total = loadingSprites.Count;
     t = loopInterval;
 }
开发者ID:yueyoum,项目名称:one-client,代码行数:8,代码来源:LoadingGIF.cs


示例9: Start

 void Start()
 {
     fadingIn = fadingOut = false;
     myImage = this.GetComponent<Image>();
     myColor = myImage.color;
     Invoke ("fadeIn", timeBeforeFadeIn);
 }
开发者ID:kamcneal,项目名称:Conflict-Resolution-CSCI-401,代码行数:7,代码来源:FadeScene.cs


示例10: Init

 // Use this for initialization
 public void Init(float CdTime)
 {
     m_CdTime = 0.0f;
     m_MaxCdTime = CdTime;
     m_CdImg = transform.FindChild("cdImg").GetComponent<Image>();
     m_CdText = transform.FindChild("cdTime").GetComponent<Text>();
 }
开发者ID:spiritpig,项目名称:3DGame,代码行数:8,代码来源:SkillBtnCoolDownControl.cs


示例11: Awake

 // Use this for initialization
 void Awake()
 {
     m_Img = GetComponent<Image>();
     m_OriginSpr = m_Img.sprite;
     m_Type = DungonType.DT_WOLF;
     m_IsSelected = false;
 }
开发者ID:spiritpig,项目名称:3DGame,代码行数:8,代码来源:DungonItemControl.cs


示例12: Start

	void Start ()
	{
		// Set up and assign variables.
		occlusion_image = occlusion_panel.GetComponent<UnityEngine.UI.Image> ();
		sidebar_transform = this.gameObject.GetComponent<RectTransform> ();
		sidebar_height = sidebar_transform.offsetMax.y - sidebar_transform.offsetMin.y;
	}
开发者ID:hero919,项目名称:Unity,代码行数:7,代码来源:AdvancedSearchDisplay.cs


示例13: Start

 // Use this for initialization
 private void Start()
 {
     _normalColor = new Color(0.5f, 0.5f, 0.5f, 0.5f);
     _underwaterColor = new Color(0.22f, 0.45f, 0.77f, 0.5f);
     _controller = FindObjectOfType<FirstPersonController>();
     _breathBar = GameObject.FindGameObjectWithTag("BreathBar").GetComponent<Image>();
 }
开发者ID:mcnedward,项目名称:unity-project,代码行数:8,代码来源:UnderWater.cs


示例14: SetStat

        private void SetStat(Text text, Image icon, int statValue)
        {
            string statText = "";

            if (statValue > 0)
            {
                statText = "+" + statValue.ToString();
                SetColor(text, colorPositive);
                SetColor(icon, colorPositive);
            }
            else if (statValue < 0)
            {
                statText = statValue.ToString();
                SetColor(text, colorNegative);
                SetColor(icon, colorNegative);
            }
            else
            {
                statText = "0";

                SetColor(text, colorNeutral);
                SetColor(icon, colorNeutral);
            }

            SetText(text, statText);
        }
开发者ID:MitchLindsay,项目名称:red-havoc,代码行数:26,代码来源:TilePreview.cs


示例15: InitGame

        //Initializes the game for each level.
        public void InitGame()
        {
            Instantiate (canvas);
            mainCamera = GameObject.Find ("Main Camera 2");
            //set Level number
            levelNumber = GameObject.Find ("LevelNumber").GetComponent<Text> ();
            levelNumber.text = "Level "+ level;
            //player reference and lifeText setup
            playerRef = GameObject.Find ("Player");
            playerController = playerRef.GetComponent<PlayerController>();
            playerController.score = score;
            prePlayerLife = playerController.life;
            levelImage = GameObject.Find ("LevelImage");
            faderScreen = GameObject.Find ("FaderScreen");
            Color.TryParseHexString ("#870000E4", out redSplashColor);
            Color.TryParseHexString ("#001187E4", out blueSplashColor);
            screenSplash = faderScreen.GetComponent<Image> ();
            screenSplash.color = redSplashColor;
            levelImage.SetActive (false);
            faderScreen.SetActive (false);
            playerLifeText = GameObject.Find ("LifePlayer").GetComponent<Text>();
            playerScoreText = GameObject.Find ("ScorePlayer").GetComponent<Text>();
            //Call the SetupScene function of the BoardManager script, pass it current level number.
            boardScript.SetupScene(level);
            allBlocks = GameObject.Find ("Blocks");
            isGameOver=false;

            InitLights();
        }
开发者ID:Danton19,项目名称:DrillUnity,代码行数:30,代码来源:GameManager.cs


示例16: Fade

 public static void Fade(Image element, float fadeTo, float fadeAfter, float timeToFade)
 {
     DOTween.Sequence()
         .AppendInterval(fadeAfter)
         .Append(element.DOFade(fadeTo, timeToFade)
         .SetEase(Ease.InOutExpo));
 }
开发者ID:Kurukshetran,项目名称:Unity2D-Components,代码行数:7,代码来源:MFX.cs


示例17: Update

        void Update()
        {
            if (!thisImage)
            {
                thisImage = gameObject.GetComponent<Image>();
            }

            if (!scaler)
            {
                scaler = gameObject.GetComponentInParent<Canvas>().GetComponent<MaterialUIScaler>();
            }
            else
            {
                if (scaleFactor != scaler.scaleFactor)
                {
                    scaleFactor = scaler.scaleFactor;

                    if (scaleFactor > 2f && sprite4x)
                        thisImage.sprite = sprite4x;
                    else if (scaleFactor > 1f && sprite2x)
                        thisImage.sprite = sprite2x;
                    else
                        thisImage.sprite = sprite1x;
                }
            }
        }
开发者ID:tejerolucas,项目名称:Social-Drive,代码行数:26,代码来源:SpriteSwapper.cs


示例18: Awake

	public override void Awake()
	{
		base.Awake();
		
		_UiSpriteReceiver = GetComponent<UISprite>();
		_uiImage = GetComponent<UnityEngine.UI.Image>();
	}
开发者ID:StarkTT,项目名称:TestTask,代码行数:7,代码来源:NguiFillAmountBinding.cs


示例19: Start

		public void Start()
		{
			// Resource Manager Component
			_ResourceManager = GameObject.FindGameObjectWithTag("DataManager").GetComponent<ResourceControll.ResourceManager>();

			// Image Component
			_Icon = this.transform.FindChild("Icon").GetComponent<Image>();
			
			// Text Component
			_CountText = this.transform.FindChild("Count Text").GetComponent<Text>();

			// Text Component
			_DescribedText = this.transform.FindChild("Described").GetComponent<Text>();


			// SETTING
			_Icon.sprite = Resources.Load<Sprite>("Sprites/Icon/" + _Index.ToString());

			if(_Article > 0)
				_CountText.text = ": " + "+ " + _Article.ToString();
			else
				_CountText.text = ": " + _Article.ToString();

			_DescribedText.text = _Described;

			this.transform.localScale = new Vector3(3.0f, 3.0f, 3.0f);
		}
开发者ID:SsangYoon,项目名称:Unity---RITUAL-GAME,代码行数:27,代码来源:EventInformation.cs


示例20: Start

 void Start()
 {
     background = transform.GetChild (0);
     sprite = transform.GetChild (1).GetComponent<UnityEngine.UI.Image> ();
     inventory_ui = transform.parent.parent.parent.GetComponent<InventoryScript> ();
     data = null;
 }
开发者ID:rvagner42,项目名称:RushUltime,代码行数:7,代码来源:InventorySlot.cs



注:本文中的UnityEngine.UI.Image类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UI.RawImage类代码示例发布时间:2022-05-26
下一篇:
C# UI.Button类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap