Exemple #1
0
    static int ContainsValue(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        Dictionary <uint, BadgeAttrBaseConfig> obj = (Dictionary <uint, BadgeAttrBaseConfig>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BadgeAttrBaseConfig>");
        BadgeAttrBaseConfig arg0 = (BadgeAttrBaseConfig)LuaScriptMgr.GetNetObject(L, 2, typeof(BadgeAttrBaseConfig));
        bool o = obj.ContainsValue(arg0);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Exemple #2
0
    static int GetBaseConfig(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        BadgeAttrConfig     obj  = (BadgeAttrConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "BadgeAttrConfig");
        uint                arg0 = (uint)LuaScriptMgr.GetNumber(L, 2);
        BadgeAttrBaseConfig o    = obj.GetBaseConfig(arg0);

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Exemple #3
0
    static int Add(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        Dictionary <uint, BadgeAttrBaseConfig> obj = (Dictionary <uint, BadgeAttrBaseConfig>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BadgeAttrBaseConfig>");
        uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2);
        BadgeAttrBaseConfig arg1 = (BadgeAttrBaseConfig)LuaScriptMgr.GetNetObject(L, 3, typeof(BadgeAttrBaseConfig));

        obj.Add(arg0, arg1);
        return(0);
    }
Exemple #4
0
    static int get_Item(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        Dictionary <uint, BadgeAttrBaseConfig> obj = (Dictionary <uint, BadgeAttrBaseConfig>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BadgeAttrBaseConfig>");
        uint arg0             = (uint)LuaScriptMgr.GetNumber(L, 2);
        BadgeAttrBaseConfig o = obj[arg0];

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Exemple #5
0
    static int TryGetValue(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        Dictionary <uint, BadgeAttrBaseConfig> obj = (Dictionary <uint, BadgeAttrBaseConfig>)LuaScriptMgr.GetNetObjectSelf(L, 1, "Dictionary<uint,BadgeAttrBaseConfig>");
        uint arg0 = (uint)LuaScriptMgr.GetNumber(L, 2);
        BadgeAttrBaseConfig arg1 = null;
        bool o = obj.TryGetValue(arg0, out arg1);

        LuaScriptMgr.Push(L, o);
        LuaScriptMgr.PushObject(L, arg1);
        return(2);
    }
    //解析读取配置
    public void ReadConfig()
    {
        if (isLoadFinish == false)
        {
            return;
        }
        isLoadFinish = false;
        lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; }

        Debug.Log("Config reading " + name);
        string text = ResourceLoadManager.Instance.GetConfigText(name);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name);
            return;
        }
        allConfig.Clear();
        XmlDocument doc       = CommonFunction.LoadXmlConfig(name, text);
        XmlNode     node_data = doc.SelectSingleNode("Data");

        foreach (XmlNode node_line in node_data.SelectNodes("Line"))
        {
            if (node_line.SelectSingleNode("switch").InnerText == "#")
            {
                continue;
            }

            BadgeAttrBaseConfig data = new BadgeAttrBaseConfig();
            data.id    = uint.Parse(node_line.SelectSingleNode("id").InnerText);
            data.level = uint.Parse(node_line.SelectSingleNode("level").InnerText);
            string addAttrsString = node_line.SelectSingleNode("addn_attr").InnerText;
            if (addAttrsString != "")
            {
                string[] addattrs = addAttrsString.Split('&');
                for (int i = 0; i < addattrs.Length; i++)
                {
                    string[] detail = addattrs[i].Split(':');
                    data.addAttr.Add(uint.Parse(detail[0]), uint.Parse(detail[1]));
                }
            }

            string specAttrString = node_line.SelectSingleNode("spec_attr").InnerText;
            if (specAttrString != "")
            {
                string[] specAttrs = specAttrString.Split(':');
                data.specAttr = new KeyValuePair <uint, uint>(uint.Parse(specAttrs[0]), uint.Parse(specAttrs[1]));
            }
            allConfig.Add(data.id, data);
        }
    }
Exemple #7
0
    static int _CreateBadgeAttrBaseConfig(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            BadgeAttrBaseConfig obj = new BadgeAttrBaseConfig();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: BadgeAttrBaseConfig.New");
        }

        return(0);
    }
Exemple #8
0
    public int GetBookProvideTotalBadgeLevelByBookId(uint bookId)
    {
        BadgeBook           book       = GetBadgeBookByBookId(bookId);
        int                 totalLevel = 0;
        BadgeAttrBaseConfig tempConfig = null;

        if (book != null)
        {
            foreach (BadgeSlot slot in book.slot_list)
            {
                if (slot.badge_id != 0)
                {
                    tempConfig = GameSystem.Instance.BadgeAttrConfigData.GetBaseConfig(slot.badge_id);
                    if (tempConfig != null)
                    {
                        totalLevel += (int)tempConfig.level;
                    }
                }
            }
        }
        return(totalLevel);
    }
Exemple #9
0
    static int get_addAttr(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);
        BadgeAttrBaseConfig obj = (BadgeAttrBaseConfig)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name addAttr");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index addAttr on a nil value");
            }
        }

        LuaScriptMgr.PushObject(L, obj.addAttr);
        return(1);
    }
Exemple #10
0
    static int set_level(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);
        BadgeAttrBaseConfig obj = (BadgeAttrBaseConfig)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name level");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index level on a nil value");
            }
        }

        obj.level = (uint)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Exemple #11
0
    static int set_specAttr(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);
        BadgeAttrBaseConfig obj = (BadgeAttrBaseConfig)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name specAttr");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index specAttr on a nil value");
            }
        }

        obj.specAttr = (KeyValuePair <uint, uint>)LuaScriptMgr.GetNetObject(L, 3, typeof(KeyValuePair <uint, uint>));
        return(0);
    }