12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System;
- using System.Collections.Generic;
- public class UIWFSelectButton : UIButton
- {
- protected override void OnClick()
- {
- if (UIWFSelectButton.current == null && this.isEnabled)
- {
- UIWFSelectButton uiwfselectButton = UIWFSelectButton.current;
- UIWFSelectButton.current = this;
- base.OnClick();
- UIWFSelectButton.current = uiwfselectButton;
- }
- }
- public bool isSelected
- {
- get
- {
- return this.selected_;
- }
- }
- protected override void OnInit()
- {
- base.OnInit();
- this.widget_ = base.gameObject.GetComponent<UIWidget>();
- if (this.widget_ == null && this.tweenTarget != null)
- {
- this.widget_ = this.tweenTarget.GetComponent<UIWidget>();
- }
- if (this.SelectSprite != null)
- {
- if (!this.SelectSprite.enabled)
- {
- this.SelectSprite.enabled = true;
- }
- this.SelectSprite.alpha = 0f;
- }
- }
- public virtual void SetSelect(bool is_select)
- {
- if (!this.mInitDone)
- {
- this.OnInit();
- }
- if (!this.isEnabled)
- {
- return;
- }
- this.selected_ = is_select;
- if (is_select)
- {
- if (this.SelectSprite != null)
- {
- this.SelectSprite.GetComponent<UIWidget>().depth = this.widget_.depth + 1;
- this.SelectSprite.alpha = 1f;
- }
- }
- else if (this.SelectSprite != null)
- {
- this.SelectSprite.alpha = 0f;
- }
- UIButton uibutton = UIButton.current;
- UIWFSelectButton uiwfselectButton = UIWFSelectButton.current;
- UIWFSelectButton.current = this;
- UIButton.current = this;
- UIWFSelectButton.selected = is_select;
- EventDelegate.Execute(this.onSelect);
- UIWFSelectButton.selected = false;
- UIWFSelectButton.current = uiwfselectButton;
- UIButton.current = uibutton;
- }
- public List<EventDelegate> onSelect = new List<EventDelegate>();
- public UISprite SelectSprite;
- public static bool selected;
- public new static UIWFSelectButton current;
- protected UIWidget widget_;
- protected bool selected_;
- }
|