static int FindLast(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); Predicate <SkillConsumable> arg0 = null; LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (Predicate <SkillConsumable>)LuaScriptMgr.GetNetObject(L, 2, typeof(Predicate <SkillConsumable>)); } else { LuaFunction func = LuaScriptMgr.GetLuaFunction(L, 2); arg0 = (param0) => { int top = func.BeginPCall(); LuaScriptMgr.PushObject(L, param0); func.PCall(top, 1); object[] objs = func.PopValues(top); func.EndPCall(top); return((bool)objs[0]); }; } SkillConsumable o = obj.FindLast(arg0); LuaScriptMgr.PushObject(L, o); return(1); }
static int Add(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); SkillConsumable arg0 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillConsumable)); obj.Add(arg0); return(0); }
static int get_Item(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); SkillConsumable o = obj[arg0]; LuaScriptMgr.PushObject(L, o); return(1); }
static int Remove(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); SkillConsumable arg0 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillConsumable)); bool o = obj.Remove(arg0); LuaScriptMgr.Push(L, o); return(1); }
static int Insert(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 3); List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); SkillConsumable arg1 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 3, typeof(SkillConsumable)); obj.Insert(arg0, arg1); return(0); }
private void ReadSkillSlotConfig() { string text = ResourceLoadManager.Instance.GetConfigText(name4); if (text == null) { Debug.LogError("LoadConfig failed: " + name4); return; } slots.Clear(); //读取以及处理XML文本的类 XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_SKILL_SLOT, text); //解析xml的过程 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; } SkillSlot slot = new SkillSlot(); foreach (XmlElement xel in xe) { if (xel.Name == "id") { uint.TryParse(xel.InnerText, out slot.id); } else if (xel.Name == "need_level") { uint.TryParse(xel.InnerText, out slot.level_required); } } for (uint i = 1; ; ++i) { XmlElement elemId = xe.SelectSingleNode("consume_id" + i) as XmlElement; if (elemId == null) { break; } XmlElement elemValue = xe.SelectSingleNode("consume_value" + i) as XmlElement; if (elemValue == null) { break; } SkillConsumable consumable = new SkillConsumable(); uint.TryParse(elemId.InnerText, out consumable.consumable_id); uint.TryParse(elemValue.InnerText, out consumable.consumable_quantity); slot.consumables.Add(consumable); } slots.Add(slot.id, slot); } }
static int _CreateSkillConsumable(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { SkillConsumable obj = new SkillConsumable(); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: SkillConsumable.New"); } return(0); }
static int BinarySearch(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2) { List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); SkillConsumable arg0 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillConsumable)); int o = obj.BinarySearch(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 3) { List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); SkillConsumable arg0 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillConsumable)); IComparer <SkillConsumable> arg1 = (IComparer <SkillConsumable>)LuaScriptMgr.GetNetObject(L, 3, typeof(IComparer <SkillConsumable>)); int o = obj.BinarySearch(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); } else if (count == 5) { List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); int arg0 = (int)LuaScriptMgr.GetNumber(L, 2); int arg1 = (int)LuaScriptMgr.GetNumber(L, 3); SkillConsumable arg2 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 4, typeof(SkillConsumable)); IComparer <SkillConsumable> arg3 = (IComparer <SkillConsumable>)LuaScriptMgr.GetNetObject(L, 5, typeof(IComparer <SkillConsumable>)); int o = obj.BinarySearch(arg0, arg1, arg2, arg3); LuaScriptMgr.Push(L, o); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: List<SkillConsumable>.BinarySearch"); } return(0); }
static int set_consumable_id(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); SkillConsumable obj = (SkillConsumable)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name consumable_id"); } else { LuaDLL.luaL_error(L, "attempt to index consumable_id on a nil value"); } } obj.consumable_id = (uint)LuaScriptMgr.GetNumber(L, 3); return(0); }
static int get_consumable_quantity(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); SkillConsumable obj = (SkillConsumable)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name consumable_quantity"); } else { LuaDLL.luaL_error(L, "attempt to index consumable_quantity on a nil value"); } } LuaScriptMgr.Push(L, obj.consumable_quantity); return(1); }
static int LastIndexOf(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 2) { List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); SkillConsumable arg0 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillConsumable)); int o = obj.LastIndexOf(arg0); LuaScriptMgr.Push(L, o); return(1); } else if (count == 3) { List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); SkillConsumable arg0 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillConsumable)); int arg1 = (int)LuaScriptMgr.GetNumber(L, 3); int o = obj.LastIndexOf(arg0, arg1); LuaScriptMgr.Push(L, o); return(1); } else if (count == 4) { List <SkillConsumable> obj = (List <SkillConsumable>)LuaScriptMgr.GetNetObjectSelf(L, 1, "List<SkillConsumable>"); SkillConsumable arg0 = (SkillConsumable)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillConsumable)); int arg1 = (int)LuaScriptMgr.GetNumber(L, 3); int arg2 = (int)LuaScriptMgr.GetNumber(L, 4); int o = obj.LastIndexOf(arg0, arg1, arg2); LuaScriptMgr.Push(L, o); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: List<SkillConsumable>.LastIndexOf"); } return(0); }
private void ReadSkillLevelConfig() { string text = ResourceLoadManager.Instance.GetConfigText(name3); if (text == null) { Debug.LogError("LoadConfig failed: " + name3); return; } //读取以及处理XML文本的类 XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(name3, text); //解析xml的过程 XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes; Debug.Log("Start ReadSkilLevelConfig Parsing!"); foreach (XmlElement xe in nodelist) { XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN); if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH) { continue; } uint skill_id = 0; SkillLevel level = new SkillLevel(); foreach (XmlElement xel in xe) { if (xel.Name == "id") { uint.TryParse(xel.InnerText, out skill_id); } else if (xel.Name == "level") { uint.TryParse(xel.InnerText, out level.level); } else if (xel.Name == "consume") { SkillConsumable consumable = new SkillConsumable(); string[] array = xel.InnerText.Split('&'); foreach (string items in array) { string[] item = items.Split(':'); if (item.Length == 2) { uint id, v; uint.TryParse(item[0], out consumable.consumable_id); uint.TryParse(item[1], out consumable.consumable_quantity); } } level.consumables.Add(consumable); } else if (xel.Name == "addn_attr") { string[] array = xel.InnerText.Split('&'); foreach (string items in array) { string[] item = items.Split(':'); if (item.Length == 2) { uint id, v; uint.TryParse(item[0], out id); uint.TryParse(item[1], out v); level.additional_attrs.Add(GameSystem.Instance.AttrNameConfigData.GetAttrSymbol(id), v); } } } else if (xel.Name == "stama") { if (xel.InnerText == "") { level.stama = 0; } else { level.stama = uint.Parse(xel.InnerText); } } else if (xel.Name == "weight") { if (xel.InnerText == "") { level.weight = 0; } else { level.weight = uint.Parse(xel.InnerText); } } else if (xel.Name == "special_parameter") { string[] array = xel.InnerText.Split('&'); foreach (string items in array) { string[] item = items.Split(':'); if (item.Length == 2) { SkillSpec skillSpec = new SkillSpec(); skillSpec.paramOp = SkillSpecParamOp.eAdd; //float v = 0.0f; uint.TryParse(item[0], out skillSpec.paramId); if (!item[1].Contains("%")) { //bool resu = float.TryParse(item[1], out v); //Debug.Log("NOT %:str[" + item[1] + "]Result:" + resu); skillSpec.value = IM.Number.Parse(item[1]); } else { item[1].Remove(item[1].Length - 1); skillSpec.paramOp = SkillSpecParamOp.eMulti; string strValue = item[1].TrimEnd('%'); //bool resu = float.TryParse(strValue, out v); //Debug.Log("NOT %:str[" + strValue + "]Result:" + resu); skillSpec.value = IM.Number.Parse(strValue); } level.parameters.Add(skillSpec.paramId, skillSpec); } } } } SkillAttr skill; if (skills.TryGetValue(skill_id, out skill)) { skill.levels.Add(level.level, level); } } Debug.Log("SSS"); }