1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- public class WFCheckBox : MonoBehaviour
- {
- public virtual void Awake()
- {
- if (this.Button != null)
- {
- EventDelegate.Add(this.Button.onClick, new EventDelegate.Callback(this.OnClockEvent));
- }
- if (this.CheckMarkOffObject != null)
- {
- this.CheckMarkOffObject.SetActive(!this.check);
- }
- }
- protected virtual void OnClockEvent()
- {
- this.check = !this.check;
- for (int i = 0; i < this.onClick.Count; i++)
- {
- this.onClick[i](this);
- }
- }
- public new bool enabled
- {
- get
- {
- return this.Button.isEnabled;
- }
- set
- {
- this.Button.isEnabled = value;
- }
- }
- public bool visible
- {
- get
- {
- return base.gameObject.activeSelf;
- }
- set
- {
- base.gameObject.SetActive(value);
- }
- }
- public bool check
- {
- get
- {
- return this.CheckMarkObject.activeSelf;
- }
- set
- {
- this.CheckMarkObject.SetActive(value);
- if (this.CheckMarkOffObject != null)
- {
- this.CheckMarkOffObject.SetActive(!value);
- }
- }
- }
- public string text
- {
- get
- {
- return (!(this.LabelObject != null)) ? null : this.LabelObject.text;
- }
- set
- {
- if (this.LabelObject != null)
- {
- this.LabelObject.text = value;
- }
- }
- }
- public UILabel LabelObject;
- public GameObject CheckMarkObject;
- public GameObject CheckMarkOffObject;
- public UIButton Button;
- public List<Action<WFCheckBox>> onClick = new List<Action<WFCheckBox>>();
- }
|