当前位置: 首页>>代码示例>>C#>>正文


C# UI.Image类代码示例

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


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


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