本文整理汇总了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;
}
示例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();
}
示例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;
}
}
示例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;
}
}
示例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 ());
});
}
}
示例6: LoadLevel
public void LoadLevel(Button button)
{
var buttonText = button.GetComponentInChildren<Text>();
Debug.Log(buttonText.text);
button.GetComponentInChildren<Text>().text = "locked";
}
示例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;
}
}
}
}
示例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();
}
示例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();
}