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


C# Button.GetComponentInChildren方法代码示例

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


在下文中一共展示了Button.GetComponentInChildren方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

#pragma warning disable 0618
	void Awake() {
		button = gameObject.GetComponent<UnityEngine.UI.Button>() as UnityEngine.UI.Button;
		buttonRenderer = button.GetComponentInChildren<CanvasRenderer>() as CanvasRenderer;
		text = button.GetComponentInChildren<Text>() as Text;

		// Hide the button		
		button.enabled = false;
		buttonRenderer.SetAlpha(0);
		text.color = Color.clear;
	}
开发者ID:J-Dodds,项目名称:CanyonRun,代码行数:11,代码来源:UI_LaunchButton.cs

示例2: ButtonClick

        public void ButtonClick(Button button)
        {
            Text buttonText = button.GetComponentInChildren<Text>();
            int currentNumber = int.Parse(buttonText.text);

            if(currentNumber < buttonOrders.Length) buttonText.text = (currentNumber + 1).ToString();
            else buttonText.text = "1";
            UpdateTryButton();
        }
开发者ID:NashIlli,项目名称:calculandox,代码行数:9,代码来源:FractionsInOrderView.cs

示例3: SetButtonName

		/// <summary>
		/// Sets the name of the button.
		/// </summary>
		/// <param name="button">Button.</param>
		/// <param name="index">Index.</param>
		void SetButtonName(Button button, int index)
		{
			button.gameObject.SetActive(true);
			var text = button.GetComponentInChildren<Text>();
			if (text)
			{
				text.text = tabObjects[index].Name;
			}
		}
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:14,代码来源:Tabs.cs

示例4: LinkUIElements

        /**
         * Links the UI GameObjects to the class, based on the supplied uiButtonID.
         */
        public void LinkUIElements()
        {
            uiButton = Serializer.returnComponent <UnityEngine.UI.Button> (uiButtonID);
            if (uiButton)
            {
                if (uiButton.GetComponentInChildren <Text>())
                {
                    uiText = uiButton.GetComponentInChildren <Text>();
                }
                if (uiButton.GetComponentInChildren <Image>())
                {
                    uiImage = uiButton.GetComponentInChildren <Image>();
                }

                originalColour = uiButton.colors.normalColor;
            }
        }
开发者ID:mcbodge,项目名称:eidolon,代码行数:20,代码来源:UISlot.cs

示例5: LoadUnityUI

 /**
  * <summary>Initialises the linked Unity UI GameObject.</summary>
  * <param name = "_menu">The element's parent Menu<param>
  */
 public override void LoadUnityUI(AC.Menu _menu)
 {
     uiButton = LinkUIElement <UnityEngine.UI.Button>();
     if (uiButton)
     {
         if (uiButton.GetComponentInChildren <Text>())
         {
             uiText = uiButton.GetComponentInChildren <Text>();
         }
         uiButton.onClick.AddListener (() => {
             ProcessClick (_menu, 0, KickStarter.playerInput.GetMouseState ());
         });
     }
 }
开发者ID:farreltr,项目名称:OneLastSunset,代码行数:18,代码来源:MenuInteraction.cs

示例6: LoadLevel

 public void LoadLevel(Button button)
 {
     var buttonText = button.GetComponentInChildren<Text>();
     Debug.Log(buttonText.text);
     button.GetComponentInChildren<Text>().text = "locked";
 }
开发者ID:alfamegaxq,项目名称:Colored-Pixel-Wars,代码行数:6,代码来源:MenuManager.cs

示例7: SelectRace

 void SelectRace(Button chosen)
 {
     chosenRace.GetComponentInChildren<Text>().text = chosen.GetComponentInChildren<Text>().text;
     chosen.transform.parent.gameObject.SetActive(false);
     if (chosenClass.GetComponentInChildren<Text>().text != "Choose a Class") {
     for (int i = 0; i < 30; i++) {
         plusButtons[i].enabled = true;
         minusButtons[i].enabled = true;
         if(i < 4) {
             attributeMinus[i].enabled = true;
             attributePlus[i].enabled = true;
         }
     }
     }
 }
开发者ID:jr00t2,项目名称:MMO-Skillborn-Client,代码行数:15,代码来源:CharacterCreation.cs

示例8: GetRaceByName

        void GetRaceByName(Button cBtn)
        {
            string[] response = db.GetModsByName("racesbyname", cBtn.GetComponentInChildren<Text>().text);
            for (int i = 0; i < 30; i++)
            {
            raceMods[i] = Convert.ToInt32(response[i + 2]);
            }
            attributeLevel[0].text = response[32];
            attributeLevel[1].text = response[33];
            attributeLevel[2].text = response[34];
            attributeLevel[3].text = response[35];

            CalculateMods();
        }
开发者ID:jr00t2,项目名称:MMO-Skillborn-Client,代码行数:14,代码来源:CharacterCreation.cs

示例9: GetClassByName

 void GetClassByName(Button cBtn)
 {
     string[] response = db.GetModsByName("classesbyname", cBtn.GetComponentInChildren<Text>().text);
     for (int i = 0; i < 30; i++)
     {
     classMods[i] = Convert.ToInt32(response[i+2]);
     }
     CalculateMods();
 }
开发者ID:jr00t2,项目名称:MMO-Skillborn-Client,代码行数:9,代码来源:CharacterCreation.cs


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