void Init()
        {
            IP.Start();
            _configDic = new Dictionary <int, GameConfigBase>();
            TimerMgr.Singleton().add(TimeId, update, 1000, 10000);

            GameConfigValue constValue = new GameConfigValue(configFileFolderName + EnumConfigFileType.ConstValues.ToString());

            constValue.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.ConstValues, constValue);

            GameConfigUI gcu = new GameConfigUI(configFileFolderName + EnumConfigFileType.UI.ToString());

            gcu.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.UI, gcu);

            GameConfigActivity Activity = new GameConfigActivity(configFileFolderName + EnumConfigFileType.Activity.ToString());

            Activity.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.Activity, Activity);

            GameConfigOpenClose OpenClose = new GameConfigOpenClose(configFileFolderName + EnumConfigFileType.OpenClose.ToString());

            OpenClose.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.OpenClose, OpenClose);

            GameConfigNotSupportVersion NotSupportVersion = new GameConfigNotSupportVersion(configFileFolderName + EnumConfigFileType.NotSupportVersion.ToString());

            NotSupportVersion.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.NotSupportVersion, NotSupportVersion);

            GameConfigExchangeCode exchangeCode = new GameConfigExchangeCode(configFileFolderName + EnumConfigFileType.ExchangeCode.ToString());

            exchangeCode.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.ExchangeCode, exchangeCode);


            GameConfigRankingReward rankingReward = new GameConfigRankingReward(configFileFolderName + EnumConfigFileType.RankReward.ToString());

            rankingReward.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.RankReward, rankingReward);

            GameConfigProducts items = new GameConfigProducts(configFileFolderName + EnumConfigFileType.Products.ToString());

            items.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.Products, items);


            GameConfigHappyPoint happyPoint = new GameConfigHappyPoint(configFileFolderName + EnumConfigFileType.RealItems.ToString());

            happyPoint.setLock(_rwLock);
            _configDic.Add((int)EnumConfigFileType.RealItems, happyPoint);

            foreach (GameConfigBase gcb in _configDic.Values)
            {
                gcb.init();
            }
            update(null);
        }
Exemple #2
0
        public MainClass()
        {
            addAuthory();
            GameEnvironment.Setting.ActionDispatcher = new CustomActionDispatcher();
            LoadAuthoFromDb();
            GameSession.Timeout = 60;                                   // 60s
            int t = ConfigUtils.GetSetting("MainTime", 1000 * 10 * 60); // 1/50s

            TimerMgr.Singleton().add("Main", mainCB, 1000, t);
        }
Exemple #3
0
        /*
         * Method:	init
         * Desc:    初始化服务器负载均衡相关配置
         * Author:	guccang
         * Date:	2015-7-22
         */
        /// <summary>
        /// init  Document
        /// desc:	 初始化服务器负载均衡相关配置
        /// </summary>
        void init()
        {
            si = new ServerInfo();
            TimerMgr.Singleton().add("balanceWrite", write, 0, 5000);

            if (0 != (si.serverType & (int)EnumServerType.E_ServerType_Center))
            {
                TimerMgr.Singleton().add("balanceDo", balance, 0, 10000);
                TimerMgr.Singleton().add("balanceHeart", heart, 0, 3000);
            }
        }
        void Init()
        {
            var        cache   = new ShareCacheStruct <ShareRealItemCnt>();
            List <int> itemIds = GameConfigMgr.Instance().getHappyDataKeys();

            memoryRealInfoDataModel.HappyData hd = null;
            for (int i = 0; i < itemIds.Count; ++i)
            {
                if (null == cache.FindKey(itemIds[i])) // first add
                {
                    ShareRealItemCnt sric = new ShareRealItemCnt();
                    hd          = GameConfigMgr.Instance().getHappyData(itemIds[i]);
                    sric.itemID = hd.itemID;
                    sric.num    = hd.RefleshNum;
                    cache.Add(sric);
                }
            }

            string timestr = GameConfigMgr.Instance().getString("timer_item_cnt", "600000,600000");

            string[] tt = timestr.Split(',');
            int      b0 = int.Parse(tt[0]);
            int      b1 = int.Parse(tt[1]);

            TimerMgr.Singleton().add(typeof(RealItemCntUpdate).ToString(), actionrealItemCnt, b0, b1);

            bool openDebug = GameConfigMgr.Instance().getInt("timer_open_debug", 0) == 1;

            if (openDebug)
            {
                timestr = GameConfigMgr.Instance().getString("time_hdm_cnt", "600000,600000");
                tt      = timestr.Split(',');
                b0      = int.Parse(tt[0]);
                b1      = int.Parse(tt[1]);
                TimerMgr.Singleton().add("HappyModeData_EnterNum", action_HappyModeData_enterNum, b0, b1);
            }
            else
            {
                //每天05点执行
                try
                {
                    timestr = GameConfigMgr.Instance().getString("time_hdm_cnt_timming", "05:15");
                }
                catch
                {
                    timestr = "05:15";
                }
                TimeListener.Append(PlanConfig.EveryDayPlan(DoEveryDayExecute, "EveryDayTask", timestr));
                ConsoleLog.showNotifyInfo("HappyModeData_EnterNum begin:" + timestr);
            }
        }
        void init()
        {
            bool openDebug = GameConfigMgr.Instance().getInt("timer_open_debug", 0) == 1;

            if (openDebug)
            {
                string   debugParm = GameConfigMgr.Instance().getString("timer_user_ranking_clear", "330000,330000");
                string[] words     = debugParm.Split(',');
                TimerMgr.Singleton().add("RankingClear", ccccc, int.Parse(words[0]), int.Parse(words[1]));
            }
            else
            {
                string theStr = GameConfigMgr.Instance().getString("timer_user_ranking_clear_timming", "05:00");
                //每天0点执行
                TimeListener.Append(PlanConfig.EveryDayPlan(DoEveryWeekExecute, "EveryDayTask", theStr));
                ConsoleLog.showNotifyInfo("timer_user_ranking_clear_timming begin:" + theStr);
            }
        }