Beispiel #1
0
 public GameConfigRankingReward.rewardData getRankReward(int index)
 {
     if (_rwLock.TryEnterReadLock(_readWaiteTime))
     {
         try
         {
             GameConfigRankingReward rankReward = _configDic[(int)EnumConfigFileType.RankReward] as GameConfigRankingReward;
             return(rankReward.get(index));
         }
         catch
         {
             return(null);
         }
         finally
         {
             if (_rwLock.IsReadLockHeld)
             {
                 _rwLock.ExitReadLock();
             }
         }
     }
     else
     {
         GameConfigRankingReward rankReward = _configDic[(int)EnumConfigFileType.RankReward] as GameConfigRankingReward;
         return(rankReward._defaultValue);
     }
 }
Beispiel #2
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);
        }