This repository was archived by the owner on Jul 11, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +9
-9
lines changed Expand file tree Collapse file tree 5 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
- local _testBtn;
2
1
3
2
function Enable()
4
3
print("Test--UI--Enable")
10
9
11
10
function Start()
12
11
print(self)
13
- --_testBtn= TestBtn:GetComponent("Button").onclick :AddListener(ButtonClick)
12
+ TestBtn:GetComponent("Button").onClick :AddListener(ButtonClick)
14
13
print("Test--UI--Start")
15
14
end
16
15
@@ -23,5 +22,5 @@ function Close()
23
22
end
24
23
25
24
function ButtonClick()
26
- print("button---------------")
25
+ print("button----Click -----------")
27
26
end
Original file line number Diff line number Diff line change 5
5
local View={}
6
6
7
7
local uiPrefabPath="Assets/Game/UI/"
8
+ local uiAssetBundle="ui"
8
9
9
10
-- 打开ui
10
11
function UI:Open(name)
11
12
view=View[name]
12
13
if(view==nil) then
13
14
viewPrefab=CS.UnityEngine.Object()
14
15
path=uiPrefabPath..name..".prefab"
15
- viewPrefab=Res:LoadAsset(viewPrefab,"ui" ,path)
16
+ viewPrefab=Res:LoadAsset(viewPrefab,uiAssetBundle ,path)
16
17
view=CS.UnityEngine.GameObject.Instantiate(viewPrefab)
17
18
--如果有LuaBehaviour的脚本则执行相应的脚本
18
19
luaBehaviour=view:GetComponent("GameFramework.Taurus.LuaBehaviour")
Original file line number Diff line number Diff line change 1
- local _testBtn ;
2
1
3
2
function Enable ()
4
3
print (" Test--UI--Enable" )
10
9
11
10
function Start ()
12
11
print (self )
13
- -- _testBtn= TestBtn:GetComponent("Button").onclick :AddListener(ButtonClick)
12
+ TestBtn :GetComponent (" Button" ).onClick :AddListener (ButtonClick )
14
13
print (" Test--UI--Start" )
15
14
end
16
15
@@ -23,5 +22,5 @@ function Close()
23
22
end
24
23
25
24
function ButtonClick ()
26
- print (" button---------------" )
25
+ print (" button----Click -----------" )
27
26
end
Original file line number Diff line number Diff line change 5
5
local View = {}
6
6
7
7
local uiPrefabPath = " Assets/Game/UI/"
8
+ local uiAssetBundle = " ui"
8
9
9
10
-- 打开ui
10
11
function UI :Open (name )
11
12
view = View [name ]
12
13
if (view == nil ) then
13
14
viewPrefab = CS .UnityEngine .Object ()
14
15
path = uiPrefabPath .. name .. " .prefab"
15
- viewPrefab = Res :LoadAsset (viewPrefab ," ui " ,path )
16
+ viewPrefab = Res :LoadAsset (viewPrefab ,uiAssetBundle ,path )
16
17
view = CS .UnityEngine .GameObject .Instantiate (viewPrefab )
17
18
-- 如果有LuaBehaviour的脚本则执行相应的脚本
18
19
luaBehaviour = view :GetComponent (" GameFramework.Taurus.LuaBehaviour" )
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public void Run(string luaScriptName)
44
44
meta . Set ( "__index" , GameMode . HotFix . LuaEnv . Global ) ;
45
45
scriptEnv . SetMetaTable ( meta ) ;
46
46
meta . Dispose ( ) ;
47
-
47
+
48
48
scriptEnv . Set ( "self" , this ) ;
49
49
foreach ( var injection in injections )
50
50
{
You can’t perform that action at this time.
0 commit comments