Beispiel #1
0
        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);
        }
Beispiel #2
0
 public string getString(string key, string defaultValue = "")
 {
     try
     {
         GameConfigValue gcv = _configDic[(int)EnumConfigFileType.ConstValues] as GameConfigValue;
         string          str = gcv.getData(key);
         if (string.IsNullOrEmpty(str))
         {
             ConsoleLog.showErrorInfo(0, string.Format("getConfigValue:Key:{0}", key));
             return(defaultValue);
         }
         return(str);
     }
     catch
     {
         ConsoleLog.showErrorInfo(0, "getString:" + key);
         return(defaultValue);
     }
 }
Beispiel #3
0
        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);
        }