1
This commit is contained in:
40
unity/Assets/Script/Managers/UIWindow.cs
Normal file
40
unity/Assets/Script/Managers/UIWindow.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class UIWindow : MonoBehaviour
|
||||
{
|
||||
public delegate void CloseHandler(UIWindow sender, WindowResult result);
|
||||
public event CloseHandler OnClose;
|
||||
|
||||
public GameObject Root;
|
||||
public virtual System.Type Type { get { return this.GetType(); } }
|
||||
|
||||
public enum WindowResult
|
||||
{
|
||||
None = 0,
|
||||
Yes,
|
||||
NO,
|
||||
}
|
||||
|
||||
public void Close(WindowResult result = WindowResult.None)
|
||||
{
|
||||
UIManager.Instance.Close(this.Type);
|
||||
if (this.OnClose != null)
|
||||
this.OnClose(this, result);
|
||||
this.OnClose = null;
|
||||
}
|
||||
|
||||
public virtual void OnCloseClick()
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
public virtual void OnYesClick()
|
||||
{
|
||||
this.Close(WindowResult.Yes);
|
||||
}
|
||||
public virtual void OnNoClick()
|
||||
{
|
||||
this.Close(WindowResult.NO);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user