10
10
import com .taobao .luaview .global .LuaScriptLoader ;
11
11
import com .taobao .luaview .global .LuaView ;
12
12
import com .taobao .luaview .scriptbundle .ScriptBundle ;
13
+ import com .taobao .luaview .util .AssetUtil ;
13
14
import com .taobao .luaview .util .JsonUtil ;
14
15
import com .taobao .luaview .util .LogUtil ;
15
- import com .taobao .luaview .util .LuaUtil ;
16
16
import com .taobao .luaview .view .LVLoadingDialog ;
17
17
18
- import org .luaj .vm2 .LuaTable ;
19
18
import org .luaj .vm2 .LuaValue ;
20
19
20
+ import java .io .IOException ;
21
+ import java .io .InputStream ;
22
+
21
23
/**
22
24
* 通过LuaView、注入bridge对象,实现Lua-Java通信
23
25
*
@@ -70,6 +72,7 @@ public void registerNameBeforeLoad(final LuaView luaView) {
70
72
* 加载数据
71
73
*/
72
74
public void load (final LuaView luaView ) {
75
+ LogUtil .timeStart ("plain code" );
73
76
luaView .load (getLuaUri (), new LuaScriptLoader .ScriptExecuteCallback () {
74
77
@ Override
75
78
public boolean onScriptPrepared (ScriptBundle bundle ) {
@@ -83,6 +86,7 @@ public boolean onScriptCompiled(LuaValue value, LuaValue context, LuaValue view)
83
86
84
87
@ Override
85
88
public void onScriptExecuted (String uri , boolean executedSuccess ) {
89
+ LogUtil .timeEnd ("plain code" );
86
90
//测试调用 lua function
87
91
LogUtil .d ("call-lua-function return:" , luaView .callLuaFunction ("global_fun_test1" , 1 , "a" , 0.1 ));
88
92
LogUtil .d ("call-lua-function return:" , JsonUtil .toString (luaView .callLuaFunction ("global_fun_test2" , 2 , "b" , 0.2 )));
@@ -92,7 +96,23 @@ public void onScriptExecuted(String uri, boolean executedSuccess) {
92
96
});
93
97
94
98
//load bytecode directly
95
- // luaView.loadAssets("test/lvp/UI_Window.luap");
99
+ // LogUtil.timeStart("prototype");
100
+ // luaView.loadPrototype(AssetUtil.open(this, "test/lvp/UI_Window.luap"), "UI_window", new LuaScriptLoader.ScriptExecuteCallback() {
101
+ // @Override
102
+ // public boolean onScriptPrepared(ScriptBundle bundle) {
103
+ // return false;
104
+ // }
105
+ //
106
+ // @Override
107
+ // public boolean onScriptCompiled(LuaValue value, LuaValue context, LuaValue view) {
108
+ // return false;
109
+ // }
110
+ //
111
+ // @Override
112
+ // public void onScriptExecuted(String uri, boolean executedSuccess) {
113
+ // LogUtil.timeEnd("prototype");
114
+ // }
115
+ // });
96
116
}
97
117
98
118
/**
0 commit comments