From 7bf672fd0c6211909d94078b448032b1bd0916ef Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 23 Oct 2021 18:19:18 +0800 Subject: *misc --- Resources/DefaultContent/Libraries/GameLab/Class.lua | 2 +- .../Libraries/GameLab/Editor/GUI/EditorWindow.lua | 7 ++++++- Resources/Scripts/Editor/AssetBrowser.lua | 16 ++++++++++++++++ Resources/Scripts/Editor/ProjectWindow.lua | 20 -------------------- Resources/Scripts/EditorApplication.lua | 13 ++++++++----- Resources/Scripts/EditorGUI/EditorWindowManager.lua | 5 +++++ 6 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 Resources/Scripts/Editor/AssetBrowser.lua delete mode 100644 Resources/Scripts/Editor/ProjectWindow.lua create mode 100644 Resources/Scripts/EditorGUI/EditorWindowManager.lua (limited to 'Resources') diff --git a/Resources/DefaultContent/Libraries/GameLab/Class.lua b/Resources/DefaultContent/Libraries/GameLab/Class.lua index 8f74d10..cb08449 100644 --- a/Resources/DefaultContent/Libraries/GameLab/Class.lua +++ b/Resources/DefaultContent/Libraries/GameLab/Class.lua @@ -21,7 +21,7 @@ local Class = function(className, pkg) local child = _class(childName, childPkg) if cls then setmetatable(child, cls) - child._base = cls + child.base = cls end return child end diff --git a/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua b/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua index 2ec7f95..5b1b140 100644 --- a/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua +++ b/Resources/Libraries/GameLab/Editor/GUI/EditorWindow.lua @@ -1,6 +1,8 @@ local EditorWindow = GameLab.Class("EditorWindow", "GameLab.Editor.GUI") -EditorWindow.Ctor = function(self) +EditorWindow.Ctor = function(self, title) + self.title = title + self.guiWindow = nil end EditorWindow.OnGUI = function(self) @@ -15,4 +17,7 @@ end EditorWindow.OnStop = function(self) end +EditorWindow.OnFocus = function(self) +end + return EditorWindow \ No newline at end of file diff --git a/Resources/Scripts/Editor/AssetBrowser.lua b/Resources/Scripts/Editor/AssetBrowser.lua new file mode 100644 index 0000000..07cead4 --- /dev/null +++ b/Resources/Scripts/Editor/AssetBrowser.lua @@ -0,0 +1,16 @@ +local Debug = GameLab.Debug +local AssetBrowser = GameLab.Editor.GUI.EditorWindow.Extend("AssetBrowser", "GameLab.Editor") + +AssetBrowser.Ctor = function(self) + self.base.Ctor(self, "AssetBrowser") +end + +AssetBrowser.OnGUI = function(self) + Debug.Log("AssetBrowser.OnGUI()" .. self.title) +end + +AssetBrowser.OnFocus = function(self) + Debug.Log("AssetBrowser.OnFocus()" .. self.title) +end + +return AssetBrowser \ No newline at end of file diff --git a/Resources/Scripts/Editor/ProjectWindow.lua b/Resources/Scripts/Editor/ProjectWindow.lua deleted file mode 100644 index ffa9ef8..0000000 --- a/Resources/Scripts/Editor/ProjectWindow.lua +++ /dev/null @@ -1,20 +0,0 @@ -local GUI = GameLab.Editor.GUI -local GUILayout = GameLab.Editor.GUILayout - -local ProjectWindow = { - ["name"] = "Project", -} - -ProjectWindow.OnGUI = function(self) - if GUILayout.Button("click") then - - end -end - -ProjectWindow.OnUpdate = function(self) - -end - -GUI.RegisterEditorWindow("Project", ProjectWindow, "Custom/Project") - - diff --git a/Resources/Scripts/EditorApplication.lua b/Resources/Scripts/EditorApplication.lua index f09a197..8a175db 100644 --- a/Resources/Scripts/EditorApplication.lua +++ b/Resources/Scripts/EditorApplication.lua @@ -1,5 +1,7 @@ local json = require "LiteJson.json" local inspect = require "inspect" +local AssetBrowser = require "./Scripts/Editor/AssetBrowser" +local EditorWindowManager = require "./Scripts/EditorGUI/EditorWindowManager" local Debug = GameLab.Debug local GUI = GameLab.Editor.GUI @@ -17,10 +19,8 @@ mainWindow:SetIcon("./Icon/GameLab.ico") app:SetMainWindow(mainWindow) local guiWindow = GUI.GUIWindow.New() ---guiWindow:SetContainerWindow(mainWindow) ---guiWindow:SetPosition({0,0, 500, 400}) -guiWindow.a = 10 -guiWindow = nil +guiWindow:SetContainerWindow(mainWindow) +guiWindow:SetPosition({0,0, 500, 400}) collectgarbage() @@ -28,14 +28,17 @@ Debug.Log(GameLab.Path.GetRootDirectory()) Debug.Log(inspect{foo=1,2,3,4}) -local wnd = GUI.EditorWindow.New() +local wnd = AssetBrowser.New() Debug.Log(inspect(mainWindow._type)) +guiWindow:SetInstance(wnd) local v = GameLab.Engine.Math.Vector4.New(1,2,3,4) Debug.Log(inspect(v)) local V4 = GameLab.Engine.Math.Vector4.Extend("V4", "GameLab.Engine.Math") +Debug.Log(EditorWindowManager.name) + while true do app:PullMessage() diff --git a/Resources/Scripts/EditorGUI/EditorWindowManager.lua b/Resources/Scripts/EditorGUI/EditorWindowManager.lua new file mode 100644 index 0000000..707038b --- /dev/null +++ b/Resources/Scripts/EditorGUI/EditorWindowManager.lua @@ -0,0 +1,5 @@ +local EditorWindowManager = {} + +EditorWindowManager.name = "asd" + +return EditorWindowManager \ No newline at end of file -- cgit v1.1-26-g67d0