private void CheckStatus()
 {
     if (this.gameData == null)
     {
         this.gameData = GameData.instance;
     }
     if (this.gameGlobalConfig == null)
     {
         this.gameGlobalConfig = GameConfigs.instance.GlobalConfig;
     }
     if (this.gameData.UserInfo != null)
     {
         long[] resourceRecoveryTimes = this.gameData.UserInfo.resourceRecoveryTimes;
         long nowServerTime = ServerTimer.GetNowServerTime();
         int[] resourceRecoveryTime = this.gameGlobalConfig.resourceRecoveryTime;
         int[] resourceRecoveryNum = this.gameGlobalConfig.resourceRecoveryNum;
         int[] nums = new int[4];
         for (int i = 0; i < 4; i++)
         {
             if (((resourceRecoveryTimes.Length > i) && (resourceRecoveryTime.Length > i)) && ((resourceRecoveryNum.Length > i) && ((nowServerTime - resourceRecoveryTimes[i]) > resourceRecoveryTime[i])))
             {
                 nums[i] = resourceRecoveryNum[i];
                 resourceRecoveryTimes[i] = nowServerTime;
             }
         }
         this.gameData.UserInfo.AddAutoProducedResources(nums);
         this.OnResourceUpdateEvent(EventArgs.Empty);
     }
 }
Exemple #2
0
        /// <summary>
        /// 通过[编号]二分快速查表
        /// </summary>
        /// <param name="TableID">编号</param>
        /// <returns></returns>
        public static GameGlobalConfig Query(this List <GameGlobalConfig> sorted, uint TableID)
        {
            var key = new GameGlobalConfig()
            {
                TableID = TableID
            };
            var comparer = new Comparer1();
            var index    = sorted.BinarySearch(key, comparer);

            return(index >= 0 ? sorted[index] : default(GameGlobalConfig));
        }