Example #1
0
        /// <summary> 美浓活动结束时间到了才调用 </summary>
        public void SiegeEnd()
        {
            var eastBase = Variable.Activity.Siege.BossCondition.FirstOrDefault(m => m.player_camp == (int)CampType.East);
            var westBase = Variable.Activity.Siege.BossCondition.FirstOrDefault(m => m.player_camp == (int)CampType.West);

            if (eastBase == null || westBase == null)
            {
                return;
            }
            if (eastBase.BaseLife == westBase.BaseLife)
            {
                PUSH_END.GetInstance().CommandStart(SiegeResultType.DOGFALL); return;
            }
            if (eastBase.BaseLife > westBase.BaseLife)
            {
                PUSH_END.GetInstance().CommandStart(SiegeResultType.EAST_WIN);
            }
            PUSH_END.GetInstance().CommandStart(SiegeResultType.EAST_LOSE);
        }
Example #2
0
        /// <summary> 推送我方攻城hp数据 </summary>
        /// <param name="camp">己方阵营</param>
        /// <param name="rivalcamp">对方阵营</param>
        /// <param name="type">NPC 类型</param>
        /// <param name="life">剩余血量</param>
        /// <param name="fame">声望</param>
        public void CommandStart(int camp, int rivalcamp, int type, int life, int fame)
        {
            if (life < 0)
            {
                life = 0;
            }
            if (type == (int)SiegeNpcType.BOSS && life <= 0)  //验证是否大将死亡
            {
                SendBossRewardAndHp(camp, rivalcamp, type, life);
                return;
            }

            foreach (var item in Variable.Activity.Siege.PlayerData.Where(item => Common.GetInstance().IsActivities(item.user_id)))
            {
                var token = new CancellationTokenSource();
                Task.Factory.StartNew(m =>
                {
                    var sp = m as SiegePlayer;
                    if (sp == null)
                    {
                        return;
                    }
                    SendBossHp(sp.user_id, rivalcamp, type, life, sp.fame);
                    token.Cancel();
                }, item, token.Token);
            }

            if (type != (int)SiegeNpcType.BASE)
            {
                return;
            }
            if (life <= 0)
            {
                PUSH_END.GetInstance().CommandStart(rivalcamp == (int)CampType.East ? SiegeResultType.EAST_LOSE : SiegeResultType.EAST_WIN);
            }
        }