/// <summary> /// 从自身开始向上查找table /// </summary> private void GetTable() { if (this.variableTable == null) { this.variableTable = this.GetComponentInParentHard <UIVariableTable>(); } this.VariableTable = this.variableTable; }
static int _s_set_variableDic(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIVariableTable gen_to_be_invoked = (UIVariableTable)translator.FastGetCSObj(L, 1); gen_to_be_invoked.variableDic = (System.Collections.Generic.Dictionary <string, UIVariable>)translator.GetObject(L, 2, typeof(System.Collections.Generic.Dictionary <string, UIVariable>)); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(0); }
static int _g_get_variableDic(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIVariableTable gen_to_be_invoked = (UIVariableTable)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.variableDic); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
//激活自身bind private static void ActivateSelfBind(Transform transform) { //查找自身所有继承自UIVariableBind的实现类 将他们初始化 UIVariableBind[] variableBinds = transform.GetComponents <UIVariableBind>(); for (int i = 0; i < variableBinds.Length; i++) { variableBinds[i].Init(); } //遍历自身变换组件 可以遍历到所有子物体 (不包含孙子物体以及自身) foreach (Transform transform2 in transform) { UIVariableTable.ActivateChildBind(transform2); } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { UIVariableTable gen_ret = new UIVariableTable(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to UIVariableTable constructor!")); }
//激活子类bind private static void ActivateChildBind(Transform transform) { //如果子物体身上也存在UIVariableTable 则不进行操作 if (transform.HasComponent <UIVariableTable>()) { return; } UIVariableBind[] variableBinds = transform.GetComponents <UIVariableBind>(); for (int i = 0; i < variableBinds.Length; i++) { variableBinds[i].Init(); } //遍历自身变换组件 可以遍历到所有子物体 (不包含孙子物体以及自身) foreach (Transform transform2 in transform) { UIVariableTable.ActivateChildBind(transform2); } }
static int _m_InitializeBinds(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIVariableTable gen_to_be_invoked = (UIVariableTable)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.InitializeBinds( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
private void OnEnable() { //当前table对象 table = (UIVariableTable)target; var prop = serializedObject.FindProperty("variables"); list = new ReorderableList(serializedObject, prop, true, true, true, true); list.elementHeight = EditorGUIUtility.singleLineHeight * 2 + 4; list.drawElementCallback = (rect, index, isActive, isFocused) => { var element = prop.GetArrayElementAtIndex(index); rect.y += 2; rect.height = EditorGUIUtility.singleLineHeight * 3; EditorGUI.PropertyField(rect, element);//绘制一个variable 输入的值传递给variable }; list.drawHeaderCallback = (rect) => { EditorGUI.LabelField(rect, "Variables:"); }; }
static int _m_GetRepeatVariable(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIVariableTable gen_to_be_invoked = (UIVariableTable)translator.FastGetCSObj(L, 1); { System.Collections.Generic.List <string> gen_ret = gen_to_be_invoked.GetRepeatVariable( ); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_GetVariable(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIVariableTable gen_to_be_invoked = (UIVariableTable)translator.FastGetCSObj(L, 1); { int _index = LuaAPI.xlua_tointeger(L, 2); UIVariable gen_ret = gen_to_be_invoked.GetVariable(_index); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
protected override void Awake() { UIVariableTable.ActivateSelfBind(transform); }
//初始化绑定 游戏运行时调用 public void InitializeBinds() { UIVariableTable.ActivateSelfBind(base.transform); }