Exemple #1
0
 /// <summary>
 /// 移交队长
 /// </summary>
 /// <param name="note"></param>
 /// <param name="team"></param>
 private void ChangeManager(UserNote note, PlayerTeam team)
 {
     string teamID = team.TeamID;
     string newCaptainID = note.GetString(0);
     PlayerBusiness newCaptain = team.TransferCaptain(newCaptainID);
     if (newCaptain != null)
     {
         //通知
         var buffer = AmfCodec.Encode(TeamCommand.ChangeManagerR, new object[] { teamID, newCaptainID });
         team.Captain.CallAll(buffer);
         team.CallAway(buffer, note.Player.SceneID);
     }
 }
Exemple #2
0
        private void UserDisconnected(UserNote note, PlayerTeam team)
        {
            PlayerBusiness player = note.Player;
            if (player != team.Captain)
            {
                if (team.RemoveMember(player))
                {
                    //TODO:通知队员退出
                    var buffer = AmfCodec.Encode(TeamCommand.AwayTeamR,
                    new object[] { true, team.TeamID, player.ID, player.Name, null });
                    team.CallAway(buffer, player.SceneID);
                }
                return;
            }

            //队长退出
            if (team.Count > 1)
            {
                //转让队伍
                PlayerBusiness newCaptain = team.TransferCaptain(string.Empty, true);
                if (newCaptain != null)
                {
                    var buffer = AmfCodec.Encode(TeamCommand.ChangeManagerR, new object[] { team.TeamID, newCaptain.ID });
                    team.Captain.CallAll(buffer);
                    team.CallAway(buffer, newCaptain.SceneID);
                    return;
                }
            }
            FreeTeam(note, team);
        }