本文整理汇总了C#中Toggle.GetComponentInChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Toggle.GetComponentInChildren方法的具体用法?C# Toggle.GetComponentInChildren怎么用?C# Toggle.GetComponentInChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toggle
的用法示例。
在下文中一共展示了Toggle.GetComponentInChildren方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnChangeCategory
public void OnChangeCategory(Toggle toggle)
{
this.flipFlag = !this.flipFlag;
if (this.flipFlag) {
Text text = toggle.GetComponentInChildren<Text>();
if (text != null) {
this.selectedToggle = text.text;
}
}
}
示例2: InitialisePage
private void InitialisePage(int page, Toggle toggle)
{
toggle.onValueChanged.RemoveAllListeners();
toggle.onValueChanged.AddListener(active =>
{
if (active) SetPage(page);
});
toggle.GetComponentInChildren<Text>().text = (page + 1).ToString();
}
示例3: ClickToggle
public void ClickToggle(Toggle clicked)
{
SoundController.GetController().PlayClickSound();
if (lastToggle != null) lastToggle.isOn = false;
if (clicked.isOn)
{
lastToggle = clicked;
resultNumber.text = clicked.GetComponentInChildren<Text>().text;
}
else {
lastToggle = null;
resultNumber.text = "";
}
UpdateTryButton();
}
示例4: LoadUnityUI
public override void LoadUnityUI(AC.Menu _menu)
{
uiToggle = LinkUIElement <Toggle>();
if (uiToggle)
{
if (uiToggle.GetComponentInChildren <Text>())
{
uiText = uiToggle.GetComponentInChildren <Text>();
}
uiToggle.onValueChanged.AddListener ((isOn) => {
ProcessClick (_menu, 0, KickStarter.playerInput.mouseState);
});
}
}
示例5: Awake
// ######################################################################
// MonoBehaviour Functions
// ######################################################################
#region MonoBehaviour
// Awake is called when the script instance is being loaded.
void Awake()
{
#if HOTWEEN
#elif ITWEEN
#else
// HOTween: https://www.assetstore.unity3d.com/#/content/3311 Documentation: http://www.holoville.com/hotween/documentation.html
// LeanTween: https://www.assetstore.unity3d.com/#/content/3595 Documentation: http://dentedpixel.com/LeanTweenDocumentation/classes/LeanTween.html
// iTween: https://www.assetstore.unity3d.com/#/content/84 Documentation: http://itween.pixelplacement.com/documentation.php
// LEANTWEEN INITIALIZATION
LeanTween.init(3200); // This line is optional. Here you can specify the maximum number of tweens you will use (the default is 400). This must be called before any use of LeanTween is made for it to be effective.
#endif
// Keep Original position and scale
m_MoveOriginal = transform.position;
m_ScaleOriginal = transform.localScale;
m_FadeOriginal = 1.0f;
m_Image = this.gameObject.GetComponent<Image>();
m_Toggle = this.gameObject.GetComponent<Toggle>();
m_Text = this.gameObject.GetComponent<Text>();
m_RawImage = this.gameObject.GetComponent<RawImage>();
m_Slider = this.gameObject.GetComponent<Slider>();
m_CanvasRenderer = this.gameObject.GetComponent<CanvasRenderer>();
// Set begin alpha
if(this.gameObject.GetComponent<Renderer>()!=null)
{
if(m_Image)
{
m_FadeOriginal = m_Image.color.a;
}
if(m_Toggle)
{
m_FadeOriginal = m_Toggle.GetComponentInChildren<Image>().color.a;
}
if(m_Text)
{
m_FadeOriginal = m_Text.color.a;
}
if(m_RawImage)
{
m_FadeOriginal = m_RawImage.color.a;
}
if(m_Slider)
{
m_FadeOriginal = m_Slider.colors.normalColor.a;
}
}
}
示例6: SetupAlgorithmToggle
private void SetupAlgorithmToggle(Toggle toggle, MazeGenerator.Algorithm algorithm)
{
toggle.isOn = algorithm == generatorAlgorithm;
toggle.name = algorithm.ToString();
toggle.GetComponentInChildren<Text>().text = algorithmToString[algorithm];
toggle.onValueChanged.AddListener(isOn =>
{
if (isOn)
{
generatorAlgorithm = algorithm;
}
});
}