protected override void OnInitElement() { soundManager = (ISoundManager)GameManager.GetManager("SoundManager"); ButtonText = transform.Find("Text").gameObject.GetComponent <Text>(); UISmallButtonNoText = transform.Find("UISmallButtonNo/Text").gameObject.GetComponent <Text>(); UISmallButtonYesText = transform.Find("UISmallButtonYes/Text").gameObject.GetComponent <Text>(); UISmallButtonNo = transform.Find("UISmallButtonNo").gameObject.GetComponent <Button>(); UISmallButtonYes = transform.Find("UISmallButtonYes").gameObject.GetComponent <Button>(); UISmallButtonNoImage = transform.Find("UISmallButtonNo").gameObject.GetComponent <Image>(); UISmallButtonYesImage = transform.Find("UISmallButtonYes").gameObject.GetComponent <Image>(); UISmallButtonNoImage.sprite = _Checked ? normalSprite : selectedSprite; UISmallButtonYesImage.sprite = _Checked ? selectedSprite : normalSprite; clickEventHandler = new GameHandlerList(); checkChangedEventHandler = new GameHandlerList(); UISmallButtonNo.onClick.AddListener(() => { Checked = false; OnClick(gameObject); }); UISmallButtonYes.onClick.AddListener(() => { Checked = true; OnClick(gameObject); }); EventTriggerListener eventTriggerListener = EventTriggerListener.Get(gameObject); eventTriggerListener.onClick = OnClick; base.OnInitElement(); }
protected override void OnInitElement() { GetText(); clickEventHandler = new GameHandlerList(); soundManager = (ISoundManager)GameManager.GetManager("SoundManager"); EventTriggerListener eventTriggerListener = EventTriggerListener.Get(gameObject); eventTriggerListener.onClick = OnClick; base.OnInitElement(); }
protected override void OnInitElement() { soundManager = (ISoundManager)GameManager.GetManager("SoundManager"); text = transform.Find("Text").gameObject.GetComponent <Text>(); Dropdown = GetComponent <Dropdown>(); Dropdown.onValueChanged.AddListener((int i) => { valueChangedEventHandler.CallEventHandler("valueChanged", this, i); OnClick(gameObject); }); clickEventHandler = new GameHandlerList(); valueChangedEventHandler = new GameHandlerList(); base.OnInitElement(); }
protected override void OnInitElement() { soundManager = (SoundManager)GameManager.GetManager(SoundManager.TAG); text = transform.Find("Text").gameObject.GetComponent <Text>(); ValueText = transform.Find("ValueText").gameObject.GetComponent <Text>(); Slider = transform.Find("Slider").gameObject.GetComponent <Slider>(); Slider.onValueChanged.AddListener((float v) => { ValueText.text = v.ToString(valFormatText); valueChangedEventHandler.CallEventHandler("valueChanged", this, v, ValueText); }); valueChangedEventHandler = new GameHandlerList(); base.OnInitElement(); }
protected override void OnInitElement() { soundManager = (ISoundManager)GameManager.GetManager("SoundManager"); LeftText = transform.Find("LeftText").gameObject.GetComponent <Text>(); RightText = transform.Find("RightText").gameObject.GetComponent <Text>(); Button = GetComponent <Button>(); clickEventHandler = new GameHandlerList(); keyChangedEventHandler = new GameHandlerList(); EventTriggerListener eventTriggerListener = EventTriggerListener.Get(gameObject); eventTriggerListener.onClick = (g) => { foreach (GameHandler h in clickEventHandler) { h.CallEventHandler("click", this, Name); } soundManager.PlayFastVoice("core.assets.sounds:Menu_click.wav", GameSoundType.UI); }; base.OnInitElement(); }