Exemple #1
0
        /// <summary> 验证筑城耐久度是否达到上限 </summary>
        private bool CheckGameOver(int camp)
        {
            var blood = camp == (int)CampType.East
                ? Variable.Activity.BuildActivity.EastCityBlood
                : Variable.Activity.BuildActivity.WestCityBlood;

            if (blood < Variable.Activity.BuildActivity.CityBloodFull)
            {
                return(false);
            }
            if (camp == (int)CampType.East)
            {
                Variable.Activity.BuildActivity.EastCityBlood = Variable.Activity.BuildActivity.CityBloodFull;
            }
            else
            {
                Variable.Activity.BuildActivity.WestCityBlood = Variable.Activity.BuildActivity.CityBloodFull;
            }
            END.GetInstance().CommandStart(Variable.Activity.BuildActivity.EastCityBlood == Variable.Activity.BuildActivity.CityBloodFull ? 1 : 2);
            return(true);
        }
Exemple #2
0
        /// <summary> 活动开始 </summary>
        public void ActivityStart()
        {
            #region 开启活动倒计时
            try
            {
                Variable.Activity.BuildActivity.isover = false;
                new Share.Activity().PushActivity(1, 15);
                var token = new CancellationTokenSource();
                var time  = Variable.Activity.BuildActivity.PlayTime * 60 * 1000;
#if DEBUG
                time = 1000 * 60 * 2;
#endif
                Task.Factory.StartNew(m =>
                                      SpinWait.SpinUntil(() =>
                {
                    if (Variable.Activity.BuildActivity.isover)
                    {
                        token.Cancel();
                        return(true);
                    }
                    return(false);
                }, Convert.ToInt32(m)
                                                         ), time, token.Token)
                .ContinueWith(m =>
                {
                    if (!Variable.Activity.BuildActivity.isover)
                    {
                        END.GetInstance().CommandStart();
                    }
                    token.Cancel();
                }, token.Token);
            }
            catch (Exception ex)
            {
                XTrace.WriteException(ex);
            }
            #endregion
        }
Exemple #3
0
 /// <summary>END 单体模式</summary>
 public static END GetInstance()
 {
     return(_objInstance ?? (_objInstance = new END()));
 }