示例#1
0
        /// <summary> Send 所有活动玩家 活动结束和活动退出 </summary>
        /// <param name="type">活动结果枚举类型</param>
        private void SendAllEndAndExit(SiegeResultType type)
        {
            foreach (var item in Variable.Activity.Siege.PlayerData)
            {
                var token = new CancellationTokenSource();
                Task.Factory.StartNew(m =>
                {
                    var temp = m as SiegePlayer;
                    if (temp == null)
                    {
                        return;
                    }

                    var reward = ConvertRewardVos(temp, type);          //计算玩家活动结束奖励所得

                    (new Share.Message()).BuildMessagesSend(temp.user_id, "美浓活动奖励", "美浓活动奖励", reward);

                    (new Share.DaMing()).CheckDaMing(temp.user_id, (int)DaMingType.美浓攻略);
                    if (!Variable.OnlinePlayer.ContainsKey(temp.user_id))
                    {
                        return;
                    }
                    var session = Variable.OnlinePlayer[temp.user_id] as TGGSession;

                    if (Common.GetInstance().IsActivities(temp.user_id))                                 //是否在活动中
                    {
                        var aso = EXIT.GetInstance().CommandStart(session);                              //退出活动(会推送其他玩家 该玩家离开美浓活动场景)
                        Common.GetInstance().TrainingSiegeEndSend(session, aso, (int)SiegeCommand.EXIT); //(SendData)退出活动
                    }
                    var asobj = new ASObject(BuildData((int)type, reward));
                    Common.GetInstance().TrainingSiegeEndSend(session, asobj, (int)SiegeCommand.PUSH_END);//Send活动结束
                    token.Cancel();
                }, item, token.Token);
            }

            Variable.Activity.Siege.PlayerData    = new List <SiegePlayer>();
            Variable.Activity.Siege.BossCondition = new List <CampCondition>();
        }
示例#2
0
文件: EXIT.cs 项目: Lantnr/MyTest
 /// <summary>EXIT单体模式</summary>
 public static EXIT GetInstance()
 {
     return(ObjInstance ?? (ObjInstance = new EXIT()));
 }