1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using System;
- using UnityEngine;
- public class EditOkCancel : MonoBehaviour
- {
- private void Awake()
- {
- this.m_goOk = UTY.GetChildObject(base.gameObject, "Ok", false);
- this.m_uiBtnOk = this.m_goOk.GetComponent<UIButton>();
- this.m_goCancel = UTY.GetChildObject(base.gameObject, "Cancel", false);
- this.m_uiBtnCancel = this.m_goCancel.GetComponent<UIButton>();
- this.m_goOk.SetActive(false);
- this.m_goCancel.SetActive(false);
- EventDelegate.Add(this.m_uiBtnOk.onClick, new EventDelegate.Callback(this.OnClickOk));
- EventDelegate.Add(this.m_uiBtnCancel.onClick, new EventDelegate.Callback(this.OnClickCancel));
- }
- private void Start()
- {
- }
- public void SetOnClickCallBack(EditOkCancel.OnClick f_dgOk, EditOkCancel.OnClick f_dgCancel = null)
- {
- this.m_dgOnClickOk = f_dgOk;
- this.m_dgOnClickCancel = f_dgCancel;
- }
- public void Show(EditOkCancel.TYPE f_eType)
- {
- this.m_goOk.SetActive(true);
- if (f_eType == EditOkCancel.TYPE.OK_CANCEL)
- {
- this.m_goCancel.SetActive(true);
- }
- else
- {
- this.m_goCancel.SetActive(false);
- }
- }
- public void Close()
- {
- this.m_goOk.SetActive(false);
- this.m_goCancel.SetActive(false);
- }
- private void OnClickOk()
- {
- if (this.m_dgOnClickOk != null)
- {
- this.m_dgOnClickOk();
- }
- }
- private void OnClickCancel()
- {
- if (this.m_dgOnClickCancel != null)
- {
- this.m_dgOnClickCancel();
- }
- }
- private void Update()
- {
- }
- private GameObject m_goOk;
- private UIButton m_uiBtnOk;
- private GameObject m_goCancel;
- private UIButton m_uiBtnCancel;
- private EditOkCancel.OnClick m_dgOnClickOk;
- private EditOkCancel.OnClick m_dgOnClickCancel;
- public delegate void OnClick();
- public enum TYPE
- {
- OK,
- OK_CANCEL
- }
- }
|