41 lines
738 B
C#
41 lines
738 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Ether
|
||
|
{
|
||
|
public abstract class OdinSubWindowBase
|
||
|
{
|
||
|
protected OdinSubWindowBase()
|
||
|
{
|
||
|
OnInit();
|
||
|
}
|
||
|
|
||
|
protected virtual void OnInit() { }
|
||
|
public abstract void OnShow();
|
||
|
|
||
|
public void OnGUI()
|
||
|
{
|
||
|
// 检查 Ctrl+S (Cmd+S on macOS)
|
||
|
Event e = Event.current;
|
||
|
if (e.type == EventType.KeyDown && (e.keyCode == KeyCode.S && (e.control || e.command)))
|
||
|
{
|
||
|
// 阻止默认的保存操作
|
||
|
e.Use();
|
||
|
|
||
|
// 执行自定义保存逻辑
|
||
|
Debug.Log("执行保存代码");
|
||
|
OnSave();
|
||
|
}
|
||
|
|
||
|
OnUpdata();
|
||
|
}
|
||
|
|
||
|
protected virtual void OnUpdata() { }
|
||
|
protected virtual void OnSave() { }
|
||
|
|
||
|
public virtual void OnClose() { }
|
||
|
}
|
||
|
}
|
||
|
|