Пример #1
0
    static int GetLottery(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        LotteryConfig obj  = (LotteryConfig)LuaScriptMgr.GetNetObjectSelf(L, 1, "LotteryConfig");
        uint          arg0 = (uint)LuaScriptMgr.GetNumber(L, 2);
        uint          arg1 = (uint)LuaScriptMgr.GetNumber(L, 3);

        fogs.proto.config.LotteryConfig o = obj.GetLottery(arg0, arg1);
        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
    static int _Createfogs_proto_config_LotteryConfig(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

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

        return(0);
    }
Пример #3
0
    public void ReadConfig()
    {
        if (isLoadFinish == false)
        {
            return;
        }
        isLoadFinish = false;
        lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; }

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

        if (text == null)
        {
            UnityEngine.Debug.LogError("LoadConfig failed: " + name);
            return;
        }

        XmlDocument doc  = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_LOTTERY, text);
        XmlNode     root = doc.SelectSingleNode("Data");

        foreach (XmlNode line in root.SelectNodes("Line"))
        {
            if (CommonFunction.IsCommented(line))
            {
                continue;
            }
            fogs.proto.config.LotteryConfig data = new fogs.proto.config.LotteryConfig();
            data.type               = uint.Parse(line.SelectSingleNode("type").InnerText);
            data.level_min          = uint.Parse(line.SelectSingleNode("level_min").InnerText);
            data.level_max          = uint.Parse(line.SelectSingleNode("level_max").InnerText);
            data.goods_id           = uint.Parse(line.SelectSingleNode("goods_id").InnerText);
            data.consume_id         = uint.Parse(line.SelectSingleNode("consume_id").InnerText);
            data.consume_num_single = uint.Parse(line.SelectSingleNode("consume_num_single").InnerText);
            data.consume_num_multi  = uint.Parse(line.SelectSingleNode("consume_num_multi").InnerText);
            data.normal_award_pack  = uint.Parse(line.SelectSingleNode("normal_award_pack").InnerText);
            data.special_award_pack = uint.Parse(line.SelectSingleNode("special_award_pack").InnerText);
            List <fogs.proto.config.LotteryConfig> lotteries;
            if (!configs.TryGetValue(data.type, out lotteries))
            {
                lotteries = new List <fogs.proto.config.LotteryConfig>();
                configs.Add(data.type, lotteries);
            }
            lotteries.Add(data);
        }
    }
    static int get_level_min(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        fogs.proto.config.LotteryConfig obj = (fogs.proto.config.LotteryConfig)o;

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

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

        LuaScriptMgr.Push(L, obj.level_min);
        return(1);
    }
    static int set_first_lott(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        fogs.proto.config.LotteryConfig obj = (fogs.proto.config.LotteryConfig)o;

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

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

        obj.first_lott = (uint)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }