Skip to content

Commit 6bd05be

Browse files
committed
添加了NGUI/UGUI Button单击例子。
1 parent 649e105 commit 6bd05be

File tree

13 files changed

+619
-208
lines changed

13 files changed

+619
-208
lines changed

Assets/Lua/3rd/luabitop/bit.c

Lines changed: 0 additions & 189 deletions
This file was deleted.

Assets/Lua/3rd/luabitop/bit.c.meta

Lines changed: 0 additions & 16 deletions
This file was deleted.

Assets/Lua/3rd/pblua/person_pb.lua

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
-- Generated By protoc-gen-lua Do not Edit
2+
local protobuf = require "protobuf"
3+
module('person_pb')
4+
5+
6+
local PERSON = protobuf.Descriptor();
7+
local PERSON_ID_FIELD = protobuf.FieldDescriptor();
8+
local PERSON_NAME_FIELD = protobuf.FieldDescriptor();
9+
local PERSON_EMAIL_FIELD = protobuf.FieldDescriptor();
10+
local PHONE = protobuf.Descriptor();
11+
local PHONE_PHONE_TYPE = protobuf.EnumDescriptor();
12+
local PHONE_PHONE_TYPE_MOBILE_ENUM = protobuf.EnumValueDescriptor();
13+
local PHONE_PHONE_TYPE_HOME_ENUM = protobuf.EnumValueDescriptor();
14+
local PHONE_NUM_FIELD = protobuf.FieldDescriptor();
15+
local PHONE_TYPE_FIELD = protobuf.FieldDescriptor();
16+
local PHONE_PHONES_FIELD = protobuf.FieldDescriptor();
17+
18+
PERSON_ID_FIELD.name = "id"
19+
PERSON_ID_FIELD.full_name = ".Person.id"
20+
PERSON_ID_FIELD.number = 1
21+
PERSON_ID_FIELD.index = 0
22+
PERSON_ID_FIELD.label = 2
23+
PERSON_ID_FIELD.has_default_value = false
24+
PERSON_ID_FIELD.default_value = 0
25+
PERSON_ID_FIELD.type = 5
26+
PERSON_ID_FIELD.cpp_type = 1
27+
28+
PERSON_NAME_FIELD.name = "name"
29+
PERSON_NAME_FIELD.full_name = ".Person.name"
30+
PERSON_NAME_FIELD.number = 2
31+
PERSON_NAME_FIELD.index = 1
32+
PERSON_NAME_FIELD.label = 2
33+
PERSON_NAME_FIELD.has_default_value = false
34+
PERSON_NAME_FIELD.default_value = ""
35+
PERSON_NAME_FIELD.type = 9
36+
PERSON_NAME_FIELD.cpp_type = 9
37+
38+
PERSON_EMAIL_FIELD.name = "email"
39+
PERSON_EMAIL_FIELD.full_name = ".Person.email"
40+
PERSON_EMAIL_FIELD.number = 3
41+
PERSON_EMAIL_FIELD.index = 2
42+
PERSON_EMAIL_FIELD.label = 1
43+
PERSON_EMAIL_FIELD.has_default_value = false
44+
PERSON_EMAIL_FIELD.default_value = ""
45+
PERSON_EMAIL_FIELD.type = 9
46+
PERSON_EMAIL_FIELD.cpp_type = 9
47+
48+
PERSON.name = "Person"
49+
PERSON.full_name = ".Person"
50+
PERSON.nested_types = {}
51+
PERSON.enum_types = {}
52+
PERSON.fields = {PERSON_ID_FIELD, PERSON_NAME_FIELD, PERSON_EMAIL_FIELD}
53+
PERSON.is_extendable = true
54+
PERSON.extensions = {}
55+
PHONE_PHONE_TYPE_MOBILE_ENUM.name = "MOBILE"
56+
PHONE_PHONE_TYPE_MOBILE_ENUM.index = 0
57+
PHONE_PHONE_TYPE_MOBILE_ENUM.number = 1
58+
PHONE_PHONE_TYPE_HOME_ENUM.name = "HOME"
59+
PHONE_PHONE_TYPE_HOME_ENUM.index = 1
60+
PHONE_PHONE_TYPE_HOME_ENUM.number = 2
61+
PHONE_PHONE_TYPE.name = "PHONE_TYPE"
62+
PHONE_PHONE_TYPE.full_name = ".Phone.PHONE_TYPE"
63+
PHONE_PHONE_TYPE.values = {PHONE_PHONE_TYPE_MOBILE_ENUM,PHONE_PHONE_TYPE_HOME_ENUM}
64+
PHONE_NUM_FIELD.name = "num"
65+
PHONE_NUM_FIELD.full_name = ".Phone.num"
66+
PHONE_NUM_FIELD.number = 1
67+
PHONE_NUM_FIELD.index = 0
68+
PHONE_NUM_FIELD.label = 1
69+
PHONE_NUM_FIELD.has_default_value = false
70+
PHONE_NUM_FIELD.default_value = ""
71+
PHONE_NUM_FIELD.type = 9
72+
PHONE_NUM_FIELD.cpp_type = 9
73+
74+
PHONE_TYPE_FIELD.name = "type"
75+
PHONE_TYPE_FIELD.full_name = ".Phone.type"
76+
PHONE_TYPE_FIELD.number = 2
77+
PHONE_TYPE_FIELD.index = 1
78+
PHONE_TYPE_FIELD.label = 1
79+
PHONE_TYPE_FIELD.has_default_value = false
80+
PHONE_TYPE_FIELD.default_value = nil
81+
PHONE_TYPE_FIELD.enum_type = PHONE_PHONE_TYPE
82+
PHONE_TYPE_FIELD.type = 14
83+
PHONE_TYPE_FIELD.cpp_type = 8
84+
85+
PHONE_PHONES_FIELD.name = "phones"
86+
PHONE_PHONES_FIELD.full_name = ".Phone.phones"
87+
PHONE_PHONES_FIELD.number = 10
88+
PHONE_PHONES_FIELD.index = 0
89+
PHONE_PHONES_FIELD.label = 3
90+
PHONE_PHONES_FIELD.has_default_value = false
91+
PHONE_PHONES_FIELD.default_value = {}
92+
PHONE_PHONES_FIELD.message_type = PHONE
93+
PHONE_PHONES_FIELD.type = 11
94+
PHONE_PHONES_FIELD.cpp_type = 10
95+
96+
PHONE.name = "Phone"
97+
PHONE.full_name = ".Phone"
98+
PHONE.nested_types = {}
99+
PHONE.enum_types = {PHONE_PHONE_TYPE}
100+
PHONE.fields = {PHONE_NUM_FIELD, PHONE_TYPE_FIELD}
101+
PHONE.is_extendable = false
102+
PHONE.extensions = {PHONE_PHONES_FIELD}
103+
104+
Person = protobuf.Message(PERSON)
105+
Phone = protobuf.Message(PHONE)
106+
107+
Person.RegisterExtension(PHONE_PHONES_FIELD)

Assets/Lua/3rd/pblua/person_pb.lua.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/uLua/Editor/BindLua.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using UnityEngine.UI;
1616
using SimpleFramework;
1717
using SimpleFramework.Manager;
18+
using UnityEngine.Events;
1819

1920
[InitializeOnLoad]
2021
public static class LuaBinding
@@ -194,10 +195,15 @@ static BindType _GT(Type t)
194195
_GT(typeof(LuaHelper)),
195196
_GT(typeof(LuaBehaviour)),
196197
_GT(typeof(RectTransform)),
198+
197199
_GT(typeof(DelegateFactory)),
198200
_GT(typeof(TestLuaDelegate)),
199201
_GT(typeof(TestDelegateListener)),
200202
_GT(typeof(TestEventListener)),
203+
_GT(typeof(Button)),
204+
_GT(typeof(Button.ButtonClickedEvent)),
205+
_GT(typeof(UnityEventBase)),
206+
_GT(typeof(UnityEvent)),
201207

202208
//unity
203209
_GT(typeof(Component)),

Assets/uLua/Examples/08_ProtoBuffer/LuaProtoBuffer01.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void Start()
2929
LuaScriptMgr mgr = new LuaScriptMgr();
3030
mgr.Start();
3131
TestProtolWrap.Register(mgr.GetL());
32-
mgr.DoFile("person_pb.lua");
32+
mgr.DoFile("3rd/pblua/person_pb.lua");
3333
mgr.DoString(script);
3434

3535
LuaFunction func = mgr.GetLuaFunction("encoder");

Assets/uLua/Examples/A4_ButtonClick.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)