Ejemplo n.º 1
0
        public string PushLog(QueueResultBase _this)
        {
            var nt = "[";

            foreach (var newTeam in _this.newTeams)
            {
                nt = nt + newTeam.TeamList.Count + "";
            }
            nt = nt + "]";
            var tl = "[";

            foreach (var list in _this.mTeamList)
            {
                tl = tl + list.Count + "{";
                foreach (var character in list)
                {
                    tl = tl + character.mDatas.Count + "(" + character.GetLog() + ")";
                }
                tl = tl + "};";
            }
            tl = tl + "]";

            var cccc = string.Format("c={0},t1={1},t2={2}", _this.CharacterState.Count, tl, nt);

            return(cccc);
        }
Ejemplo n.º 2
0
 public void StopTrigger(QueueResultBase _this)
 {
     if (_this.mTrigger != null)
     {
         TeamServerControl.tm.DeleteTrigger(_this.mTrigger);
         _this.mTrigger = null;
     }
 }
Ejemplo n.º 3
0
 //排队结果,移除一堆人
 public void RemoveCharacterList(QueueResultBase _this, List <QueueCharacter> cs)
 {
     foreach (var character in cs)
     {
         RemoveCharacter(_this, character);
     }
     PushFront(_this, eLeaveMatchingType.OtherRefuse);
 }
Ejemplo n.º 4
0
 private void FaildList(QueueResultBase _this, List <ulong> guids)
 {
     PlayerLog.WriteLog((int)LogType.QueueMessage, "FaildList  character={0}, type={1}", guids.GetDataString(),
                        _this.GetType());
     foreach (var i in guids)
     {
         _this.CharacterState.Remove(i);
     }
     QueueManager.PopTimeOver(guids);
 }
Ejemplo n.º 5
0
        public void RemoveCharacterOne(FollowQueueResult _this, QueueCharacter character)
        {
            QueueResultBase.GetImpl().RemoveCharacterOne(_this, character);
            var scene = QueueSceneManager.GetCharacterScene(_this.Character.mDatas[0].Id);

            if (scene == null)
            {
                Logger.Error("In AllOK scene == null!!!");
                return;
            }
            scene.RemoveFollowCharacter(character);
        }
Ejemplo n.º 6
0
        public void TimeOver(QueueResultBase _this)
        {
            _this.mTrigger = null;
            var guids = new List <ulong>();

            foreach (var i in _this.CharacterState)
            {
                if (i.Value == 0)
                {
                    guids.Add(i.Key);
                }
            }
            FaildList(_this, guids);
        }
Ejemplo n.º 7
0
        public ErrorCodes MatchingBack(FollowQueueResult _this, ulong guid, bool agree = false)
        {
            var err = QueueResultBase.GetImpl().MatchingBack(_this, guid, agree);

            if (!agree)
            {
                var scene = QueueSceneManager.GetCharacterScene(guid);
                if (scene == null)
                {
                    return(err);
                }
                scene.FollowResult(_this.Character, 0);
                QueueManager.Pop(guid, eLeaveMatchingType.Refuse);
            }
            return(err);
        }
Ejemplo n.º 8
0
        public void OnAllOk(FightQueue _this, QueueResultBase result)
        {
            // 战场开始,所有人的战场计数+1
            var changes = new Dict_int_int_Data();

            changes.Data.Add((int)eExdataDefine.e530, 1);
            foreach (var list in result.mTeamList)
            {
                foreach (var character in list)
                {
                    foreach (var data in character.mDatas)
                    {
                        Utility.SSChangeExdata(data.Id, changes);
                    }
                }
            }
        }
Ejemplo n.º 9
0
        //压到队伍前列
        public void PushFront(QueueResultBase _this, eLeaveMatchingType type = eLeaveMatchingType.Unknow)
        {
            foreach (var team in _this.mTeamList)          //所有队伍 -》临时队伍
            {
                foreach (var character in team)            //临时队伍-》单独排队
                {
                    foreach (var data in character.mDatas) //单独排队 -》 一个玩家
                    {
                        if (type != eLeaveMatchingType.Unknow)
                        {
                            TeamServer.Instance.ServerControl.TeamServerMessage(data.Id, (int)type, string.Empty);
                        }
                    }

                    _this.mQueue.PushFront(character);
                }
            }
        }
Ejemplo n.º 10
0
        public void StartTrigger(QueueResultBase _this)
        {
            foreach (var i in _this.CharacterState)
            {
                TeamCharacterProxy toCharacterProxy;
                if (TeamServer.Instance.ServerControl.Proxys.TryGetValue(i.Key, out toCharacterProxy))
                {
                    toCharacterProxy.MatchingSuccess(_this.mQueue.mQueueId);
                }
            }

            _this.mTrigger =
                TeamServerControl.tm.CreateTrigger(DateTime.Now.AddSeconds(StaticParam.ConfirmDungeonWaitTime),
                                                   () => _this.TimeOver());

            var tcm = new TeamCharacterMessage();

            tcm.QueueId = _this.mQueue.mQueueId;
            foreach (var list in _this.mTeamList)
            {
                foreach (var character in list)
                {
                    foreach (var data in character.mDatas)
                    {
                        var one = new TeamCharacterOne
                        {
                            CharacterId   = data.Id,
                            CharacterName = data.Name,
                            RoleId        = data.TypeId,
                            Level         = data.Level,
                            Ladder        = data.Ladder,
                            FightPoint    = data.FightPoint
                        };
                        one.QueueResult = -1;
                        tcm.Characters.Add(one);
                    }
                }
            }
            foreach (var i in _this.CharacterState)
            {
                NotifyQueueMessage(i.Key, tcm);
            }
        }
Ejemplo n.º 11
0
 //排队结果,添加一组人
 public void PushCharacter(QueueResultBase _this, List <QueueCharacter> ListQueue)
 {
     foreach (var queue in ListQueue)
     {
         queue.result = _this;
         foreach (var i in queue.mDatas)
         {
             if (_this.CharacterState.ContainsKey(i.Id))
             {
                 Logger.Error("result  PushCharacter Same C={0}", i.Id);
                 _this.CharacterState[i.Id] = 0;
             }
             else
             {
                 _this.CharacterState.Add(i.Id, 0);
             }
         }
     }
     _this.mTeamList.Add(ListQueue);
 }
Ejemplo n.º 12
0
 //确认消息返回
 public ErrorCodes MatchingBack(QueueResultBase _this, ulong guid, bool Agree = false)
 {
     PlayerLog.WriteLog((int)LogType.QueueMessage, "MatchOver  character={0},Agree={1}", guid, Agree);
     if (_this.mTrigger == null)
     {
         return(ErrorCodes.Unknow);
     }
     if (Agree) //点了同意
     {
         int state;
         if (_this.CharacterState.TryGetValue(guid, out state))
         {
             if (state == 0)
             {
                 _this.CharacterState[guid] = 1;
                 _this.okCount++;
                 if (_this.okCount == _this.CharacterState.Count)
                 {
                     StopTrigger(_this);
                     _this.AllOK();
                 }
                 else
                 {
                     foreach (var i in _this.CharacterState)
                     {
                         NotifyQueueResult(i.Key, guid, 1);
                     }
                 }
             }
         }
     }
     else //点了失败
     {
         foreach (var i in _this.CharacterState)
         {
             NotifyQueueResult(i.Key, guid, 0);
         }
         FaildOne(_this, guid);
     }
     return(ErrorCodes.OK);
 }
Ejemplo n.º 13
0
        //排队结果,添加一个队伍的人,目前只有活动副本的预约要用这个函数
        public void PushOneCharacter(QueueResultBase _this, QueueCharacter queue)
        {
            queue.result = _this;
            foreach (var i in queue.mDatas)
            {
                if (_this.CharacterState.ContainsKey(i.Id))
                {
                    Logger.Error("result  PushCharacter Same C={0}", i.Id);
                    _this.CharacterState[i.Id] = 0;
                }
                else
                {
                    _this.CharacterState.Add(i.Id, 0);
                }
            }
            var teamList = new List <QueueCharacter>();

            teamList.Add(queue);
            _this.mTeamList.Add(teamList);
            _this.ServerId = queue.mDatas[0].ServerId;
        }
Ejemplo n.º 14
0
        private void RemoveCharacter(QueueResultBase _this, QueueCharacter character)
        {
#if DEBUG
            PlayerLog.WriteLog((int)LogType.QueueMessage, "RemoveCharacter c={0}, ids={1}", character.Guid,
                               character.mDatas.Select(c => c.Id).GetDataString());
#endif
            foreach (var data in character.mDatas)
            {
                _this.CharacterState.Remove(data.Id);
            }
            var isRemove = false;
            foreach (var team in _this.mTeamList) //所有队伍 -》临时队伍
            {
                foreach (var c in team)           //临时队伍-》单独排队
                {
                    if (character == c)
                    {
                        team.Remove(c);
                        c.result = null;
                        isRemove = true;
                        break;
                    }
                    if (c.mDatas[0].Id == character.mDatas[0].Id)
                    {
                        PlayerLog.WriteLog((int)LogType.QueueLog, "RemoveCharacter  Error not Same in={0},for={1}",
                                           character.Guid, c.Guid);
                    }
                }
                if (isRemove)
                {
                    break;
                }
            }
            if (!isRemove)
            {
                PlayerLog.WriteLog((int)LogType.QueueLog, "RemoveCharacter  Error c={0},n={1}",
                                   character.mDatas[0].Id, character.mDatas.Count);
            }
        }
Ejemplo n.º 15
0
        //因为时间结束,而要移除一堆人
        public void PopTimeOver(List <ulong> guids)
        {
            var             cs     = new List <QueueCharacter>();
            QueueResultBase result = null;

            foreach (var guid in guids)
            {
                var character = GetMatchingCharacter(guid);
                if (character == null)
                {
                    continue;
                }
                if (character.result != null)
                {
                    if (result != null && result != character.result)
                    {
                        Logger.Error("PopTimeOver result not same!");
                    }
                    result = character.result;
                    cs.Add(character);
                }
                foreach (var matchingCharacter in character.mDatas)
                {
                    if (guids.Contains(matchingCharacter.Id))
                    {
                        Remove(matchingCharacter.Id, eLeaveMatchingType.TimeOut);
                    }
                    else
                    {
                        Remove(matchingCharacter.Id, eLeaveMatchingType.TeamOther);
                    }
                }
            }
            if (result != null)
            {
                result.RemoveCharacterList(cs);
            }
        }
Ejemplo n.º 16
0
 public void PushOneCharacter(FollowQueueResult _this, QueueCharacter queue)
 {
     QueueResultBase.GetImpl().PushOneCharacter(_this, queue);
     _this.Character = queue;
 }
Ejemplo n.º 17
0
 public void OnAllOk(QueueLogic _this, QueueResultBase result)
 {
 }
Ejemplo n.º 18
0
 public override void OnAllOk(QueueResultBase result)
 {
     mImpl.OnAllOk(this, result);
 }
Ejemplo n.º 19
0
        //通知玩家修改PvP的Camp
        private IEnumerator NotifyCharacterSceneCamp(Coroutine co, QueueResultBase _this, ulong character, int camp)
        {
            var msgChgScene = TeamServer.Instance.SceneAgent.SSPvPSceneCampSet(character, camp);

            yield return(msgChgScene.SendAndWaitUntilDone(co));
        }
Ejemplo n.º 20
0
 //进入战场时响应
 public virtual void OnAllOk(QueueResultBase result)
 {
     mImpl.OnAllOk(this, result);
 }
Ejemplo n.º 21
0
        //重新组织新队长
        private void ResetNewLeader(QueueResultBase _this)
        {
            foreach (var list in _this.mTeamList)
            {
                //筛选队长
                CharacterSimpleData LeaderCharacter = null;
                var maxCount   = 0;
                var FightPoint = 0;
                foreach (var qCharacters in list)
                {
                    foreach (var matchingCharacter in qCharacters.mDatas)
                    {
                        var character = TeamManager.GetCharacterTeam(matchingCharacter.Id);
                        if (character != null)
                        {
                            if (character.TeamState == TeamState.Leader)
                            {
                                if (character.team.GetTeamCount() > maxCount)
                                {
                                    maxCount        = character.team.GetTeamCount();
                                    LeaderCharacter = matchingCharacter;
                                    FightPoint      = matchingCharacter.FightPoint;
                                }
                                else if (character.team.GetTeamCount() == maxCount)
                                {
                                    if (matchingCharacter.FightPoint > FightPoint)
                                    {
                                        FightPoint      = matchingCharacter.FightPoint;
                                        LeaderCharacter = matchingCharacter;
                                    }
                                }
                                //character.team.Disband();
                            }
                        }
                        else
                        {
                            if (matchingCharacter.FightPoint > FightPoint && LeaderCharacter == null)
                            {
                                FightPoint      = matchingCharacter.FightPoint;
                                LeaderCharacter = matchingCharacter;
                            }
                        }
                    }
                }
                if (LeaderCharacter == null)
                {
                    return;
                }
                //组队
                var tempTeam = QueueTeamManager.CreateTeam(_this.mQueue.mQueueId);
                _this.newTeams.Add(tempTeam);
                tempTeam.PushCharacter(LeaderCharacter.Id);

                foreach (var qCharacters in list)
                {
                    qCharacters.team = tempTeam;
                    foreach (var matchingCharacter in qCharacters.mDatas)
                    {
                        if (LeaderCharacter != matchingCharacter)
                        {
                            tempTeam.PushCharacter(matchingCharacter.Id);
                        }
                    }
                }
            }
        }
Ejemplo n.º 22
0
 private void FaildOne(QueueResultBase _this, ulong guid)
 {
     StopTrigger(_this);
     QueueManager.Pop(guid, eLeaveMatchingType.Refuse);
 }
Ejemplo n.º 23
0
        public void EnterFuben(QueueResultBase _this)
        {
            var tbQueue = _this.mQueue.tbQueue;
            var fubenId = tbQueue.Param;
            var tbFuben = Table.GetFuben(fubenId);

            if (tbFuben == null)
            {
                Logger.Error("Not Find FubenID! QueueId = {0} ", tbQueue.Id);
                return;
            }
            if (_this.CharacterState.Count < 1)
            {
                return;
            }
            var tbScene = Table.GetScene(tbFuben.SceneId);

            switch ((eQueueType)tbQueue.AppType)
            {
            case eQueueType.Dungeon:
            {
                var characters = new List <ulong>();
                foreach (var character in _this.CharacterState)
                {
                    characters.Add(character.Key);
                }
                var serverId = tbScene.CanCrossServer == 1 ? -1 : _this.mTeamList[0][0].mDatas[0].ServerId;
                CoroutineFactory.NewCoroutine(Utility.AskEnterDungeonByTeamCoroutine, characters, serverId, tbFuben,
                                              (ulong)0).MoveNext();
                foreach (var matchingCharacter in _this.CharacterState)
                {
                    QueueManager.Pop(matchingCharacter.Key, eLeaveMatchingType.Success);
                }
            }
            break;

            case eQueueType.BattleField:
            {
                if (_this.mTeamList.Count % 2 != 0)
                {
                    Logger.Error("fightQueue mTeamList Count ={0}", _this.mTeamList.Count);
                }
                var index      = 0;
                var characters = new List <ulong>();
                var tempScene  = QueueSceneManager.CreateScene(tbQueue.Id);
                foreach (var list in _this.mTeamList)
                {
                    foreach (var character in list)
                    {
                        foreach (var data in character.mDatas)
                        {
                            characters.Add(data.Id);
                            CoroutineFactory.NewCoroutine(NotifyCharacterSceneCamp, _this, data.Id, index)
                            .MoveNext();
                            tempScene.InitCharacter(data.Id, index);
                        }
                    }
                    if (index == 0)
                    {
                        index = 1;
                    }
                    else
                    {
                        index = 0;
                    }
                }
                var serverId = tbScene.CanCrossServer == 1 ? -1 : _this.mTeamList[0][0].mDatas[0].ServerId;
                CoroutineFactory.NewCoroutine(Utility.AskEnterDungeonByTeamCoroutine, characters, serverId, tbFuben,
                                              (ulong)0).MoveNext();
                foreach (var matchingCharacter in _this.CharacterState)
                {
                    QueueManager.Pop(matchingCharacter.Key, eLeaveMatchingType.Success);
                }
            }
            break;

            case eQueueType.ActivityDungeon:
            {
                var characters = new List <ulong>();
                foreach (var character in _this.CharacterState)
                {
                    characters.Add(character.Key);
                    if (tbFuben.FubenCountNode == (int)eDungeonSettlementNode.Start)
                    {
                        Utility.NotifyEnterFuben(character.Key, fubenId);
                    }
                }
                var serverId = tbScene.CanCrossServer == 1 ? -1 : _this.ServerId;
                CoroutineFactory.NewCoroutine(Utility.AskEnterDungeonByTeamCoroutine, characters, serverId,
                                              tbFuben, (ulong)0).MoveNext();
                foreach (var matchingCharacter in _this.CharacterState)
                {
                    QueueManager.Pop(matchingCharacter.Key, eLeaveMatchingType.Success);
                }
            }
            break;
            }
        }
Ejemplo n.º 24
0
 public void PushOneCharacter(QueueResult _this, QueueCharacter queue)
 {
     QueueResultBase.GetImpl().PushOneCharacter(_this, queue);
 }
Ejemplo n.º 25
0
 public void RemoveCharacterOne(QueueResult _this, QueueCharacter character)
 {
     QueueResultBase.GetImpl().RemoveCharacterOne(_this, character);
     _this.PushFront(eLeaveMatchingType.OtherRefuse);
 }
Ejemplo n.º 26
0
 public void Construct(QueueResultBase _this, QueueLogic q)
 {
     _this.mQueue = q;
 }
Ejemplo n.º 27
0
 //排队结果,移除一个人
 public void RemoveCharacterOne(QueueResultBase _this, QueueCharacter character)
 {
     RemoveCharacter(_this, character);
 }