Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 03198d1

Browse files
committed
测试ui管理器
1 parent e61dc7b commit 03198d1

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Assets/Game/HotFix/Canvas.lua.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local _testBtn;
21

32
function Enable()
43
print("Test--UI--Enable")
@@ -10,7 +9,7 @@ end
109

1110
function Start()
1211
print(self)
13-
--_testBtn=TestBtn:GetComponent("Button").onclick:AddListener(ButtonClick)
12+
TestBtn:GetComponent("Button").onClick:AddListener(ButtonClick)
1413
print("Test--UI--Start")
1514
end
1615

@@ -23,5 +22,5 @@ function Close()
2322
end
2423

2524
function ButtonClick()
26-
print("button---------------")
25+
print("button----Click-----------")
2726
end

Assets/Game/HotFix/UI.lua.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ UI={}
55
local View={}
66

77
local uiPrefabPath="Assets/Game/UI/"
8+
local uiAssetBundle="ui"
89

910
-- 打开ui
1011
function UI:Open(name)
1112
view=View[name]
1213
if(view==nil) then
1314
viewPrefab=CS.UnityEngine.Object()
1415
path=uiPrefabPath..name..".prefab"
15-
viewPrefab=Res:LoadAsset(viewPrefab,"ui",path)
16+
viewPrefab=Res:LoadAsset(viewPrefab,uiAssetBundle,path)
1617
view=CS.UnityEngine.GameObject.Instantiate(viewPrefab)
1718
--如果有LuaBehaviour的脚本则执行相应的脚本
1819
luaBehaviour=view:GetComponent("GameFramework.Taurus.LuaBehaviour")

Assets/Game/Scripts/Lua/Canvas.lua

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local _testBtn;
21

32
function Enable()
43
print("Test--UI--Enable")
@@ -10,7 +9,7 @@ end
109

1110
function Start()
1211
print(self)
13-
--_testBtn=TestBtn:GetComponent("Button").onclick:AddListener(ButtonClick)
12+
TestBtn:GetComponent("Button").onClick:AddListener(ButtonClick)
1413
print("Test--UI--Start")
1514
end
1615

@@ -23,5 +22,5 @@ function Close()
2322
end
2423

2524
function ButtonClick()
26-
print("button---------------")
25+
print("button----Click-----------")
2726
end

Assets/Game/Scripts/Lua/UI.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ UI={}
55
local View={}
66

77
local uiPrefabPath="Assets/Game/UI/"
8+
local uiAssetBundle="ui"
89

910
-- 打开ui
1011
function UI:Open(name)
1112
view=View[name]
1213
if(view==nil) then
1314
viewPrefab=CS.UnityEngine.Object()
1415
path=uiPrefabPath..name..".prefab"
15-
viewPrefab=Res:LoadAsset(viewPrefab,"ui",path)
16+
viewPrefab=Res:LoadAsset(viewPrefab,uiAssetBundle,path)
1617
view=CS.UnityEngine.GameObject.Instantiate(viewPrefab)
1718
--如果有LuaBehaviour的脚本则执行相应的脚本
1819
luaBehaviour=view:GetComponent("GameFramework.Taurus.LuaBehaviour")

Assets/GameFramework/HotFix/LuaBehaviour.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void Run(string luaScriptName)
4444
meta.Set("__index", GameMode.HotFix.LuaEnv.Global);
4545
scriptEnv.SetMetaTable(meta);
4646
meta.Dispose();
47-
47+
4848
scriptEnv.Set("self", this);
4949
foreach (var injection in injections)
5050
{

0 commit comments

Comments
 (0)