public void Read() { string text = ResourceLoadManager.Instance.GetConfigText(name1); if (text == null) { Debug.LogError("LoadConfig failed: " + name1); return; } levels.Clear(); XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_BULL_FIGHT, text); XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes; foreach (XmlElement xe in nodelist) { XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN); if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH) { continue; } BullFightLevel level = new BullFightLevel(); foreach (XmlElement xel in xe) { if (xel.Name == "hard") { uint.TryParse(xel.InnerText, out level.hard); } else if (xel.Name == "unlock_level") { uint.TryParse(xel.InnerText, out level.unlock_level); } else if (xel.Name == "win_hp_cost") { uint.TryParse(xel.InnerText, out level.win_hp_cost); } else if (xel.Name == "lose_hp_cost") { uint.TryParse(xel.InnerText, out level.lose_hp_cost); } else if (xel.Name == "reward_id") { uint.TryParse(xel.InnerText, out level.reward_id); } else if (xel.Name == "npc") { string[] array = xel.InnerText.Split('&'); foreach (string items in array) { uint npc; uint.TryParse(items, out npc); level.npc.Add(npc); } } } levels.Add(level.hard, level); } }
static int _CreateBullFightLevelKeyValuePair(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2) { uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 1); BullFightLevel arg1 = (BullFightLevel)LuaScriptMgr.GetNetObject(L, 2, typeof(BullFightLevel)); KeyValuePair <uint, BullFightLevel> obj = new KeyValuePair <uint, BullFightLevel>(arg0, arg1); LuaScriptMgr.PushValue(L, obj); return(1); } else if (count == 0) { KeyValuePair <uint, BullFightLevel> obj = new KeyValuePair <uint, BullFightLevel>(); LuaScriptMgr.PushValue(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: KeyValuePair<uint,BullFightLevel>.New"); } return(0); }
static int GetFightLevel(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); BullFightConfig obj = (BullFightConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "BullFightConfig"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); BullFightLevel o = obj.GetFightLevel(arg0); LuaScriptMgr.PushObject(L, o); return(1); }
static int ContainsValue(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); Dictionary <uint, BullFightLevel> obj = (Dictionary <uint, BullFightLevel>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BullFightLevel>"); BullFightLevel arg0 = (BullFightLevel)LuaScriptMgr.GetNetObject(L, 2, typeof(BullFightLevel)); bool o = obj.ContainsValue(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int Add(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); Dictionary <uint, BullFightLevel> obj = (Dictionary <uint, BullFightLevel>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BullFightLevel>"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); BullFightLevel arg1 = (BullFightLevel)LuaScriptMgr.GetNetObject(L, 3, typeof(BullFightLevel)); obj.Add(arg0, arg1); return(0); }
static int get_Item(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); Dictionary <uint, BullFightLevel> obj = (Dictionary <uint, BullFightLevel>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BullFightLevel>"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); BullFightLevel o = obj[arg0]; LuaScriptMgr.PushObject(L, o); return(1); }
static int TryGetValue(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); Dictionary <uint, BullFightLevel> obj = (Dictionary <uint, BullFightLevel>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BullFightLevel>"); uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2); BullFightLevel arg1 = null; bool o = obj.TryGetValue(arg0, out arg1); LuaScriptMgr.Push(L, o); LuaScriptMgr.PushObject(L, arg1); return(2); }
static int _CreateBullFightLevel(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { BullFightLevel obj = new BullFightLevel(); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: BullFightLevel.New"); } return(0); }
static int get_unlock_level(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); BullFightLevel obj = (BullFightLevel)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name unlock_level"); } else { LuaDLL.luaL_error(L, "attempt to index unlock_level on a nil value"); } } LuaScriptMgr.Push(L, obj.unlock_level); return(1); }
static int set_npc(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); BullFightLevel obj = (BullFightLevel)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name npc"); } else { LuaDLL.luaL_error(L, "attempt to index npc on a nil value"); } } obj.npc = (List <uint>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <uint>)); return(0); }
static int set_reward_id(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); BullFightLevel obj = (BullFightLevel)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name reward_id"); } else { LuaDLL.luaL_error(L, "attempt to index reward_id on a nil value"); } } obj.reward_id = (uint)LuaScriptMgr.GetNumber(L, 3); return(0); }