void Awake() { uiButton = GetComponent <UIButton>(); uiButtonScale = GetComponent <UIButtonScale>(); uiButtonOffset = GetComponent <UIButtonOffset>(); uiButtonSound = GetComponent <UIButtonSound>(); }
public CheckBoxDuplicate(GameObject parentPanel, UICheckbox source) { Object = NGUITools.AddChild(parentPanel, source.gameObject); foreach (var component in Object.GetComponents <Component>()) { switch (component) { case BoxCollider boxCollider: Collider = boxCollider; break; case UICheckbox checkBox: Checkbox = checkBox; break; case UIButton button: Button = button; break; case UIButtonSound buttonSound: ButtonSound = buttonSound; break; } } }
private void Select(UILabel lbl, bool instant) { this.Highlight(lbl, instant); this.selection = lbl.gameObject.GetComponent <UIEventListener>().parameter as string; UIButtonSound[] components = base.GetComponents <UIButtonSound>(); int num = 0; int length = (int)components.Length; while (num < length) { UIButtonSound uIButtonSound = components[num]; if (uIButtonSound.trigger == UIButtonSound.Trigger.OnClick) { NGUITools.PlaySound(uIButtonSound.audioClip, uIButtonSound.volume, 1f); } num++; } }
private void Select(UILabel lbl, bool instant) { Highlight(lbl, instant); UIEventListener component = lbl.gameObject.GetComponent <UIEventListener>(); selection = (component.parameter as string); UIButtonSound[] components = GetComponents <UIButtonSound>(); int i = 0; for (int num = components.Length; i < num; i++) { UIButtonSound uIButtonSound = components[i]; if (uIButtonSound.trigger == UIButtonSound.Trigger.OnClick) { NGUITools.PlaySound(uIButtonSound.audioClip, uIButtonSound.volume, 1f); } } }
/// <summary> /// Select the specified label. /// </summary> void Select(UILabel lbl, bool instant) { Highlight(lbl, instant); UIEventListener listener = lbl.gameObject.GetComponent <UIEventListener>(); selection = listener.parameter as string; UIButtonSound[] sounds = GetComponents <UIButtonSound>(); for (int i = 0, imax = sounds.Length; i < imax; ++i) { UIButtonSound snd = sounds[i]; if (snd.trigger == UIButtonSound.Trigger.OnClick) { NGUITools.PlaySound(snd.audioClip, snd.volume, 1f); } } }
private void Select(UILabel lbl, bool instant) { this.Highlight(lbl, instant); UIEventListener component = lbl.gameObject.GetComponent <UIEventListener>(); this.selection = component.parameter as string; UIButtonSound[] components = base.GetComponents <UIButtonSound>(); int index = 0; int length = components.Length; while (index < length) { UIButtonSound sound = components[index]; if (sound.trigger == UIButtonSound.Trigger.OnClick) { NGUITools.PlaySound(sound.audioClip, sound.volume, 1f); } index++; } }
// Use this for initialization void Start() { _buttonScale=gameObject.GetComponentInChildren<UIButtonScale>(); _buttonSound=gameObject.GetComponentInChildren<UIButtonSound>(); _sprite=gameObject.GetComponentInChildren<UISprite>(); }
// Use this for initialization void Start() { _checkBox=gameObject.GetComponentInChildren<UICheckbox>(); _buttonScle=gameObject.GetComponentInChildren<UIButtonScale>(); _buttonSound=gameObject.GetComponentInChildren<UIButtonSound>(); }
void Start() { if (target == null) target = GetComponentInChildren<UISprite>(); _buttonScle=gameObject.GetComponentInChildren<UIButtonScale>(); _buttonSound=gameObject.GetComponentInChildren<UIButtonSound>(); }