Exemple #1
0
        /// <summary>
        /// 成功进入场景
        /// </summary>
        /// <param name="note"></param>
        protected virtual void IntoSceneSuccess(PlayerBusiness player, Variant sceneinfo)
        {
            // 发送用户列表并通知其它用户
            const int maxCount = 100;
            PlayerBusiness[] players;
            if (m_showAll)
            {
                players = m_players.Values.ToArray();
            }
            else
            {
                long showID = player.ShowID;
                players = m_players.Values.Where(x => { return x.ShowID == showID; }).ToArray();
            }

            if (players.Length <= maxCount)
            {
                player.CallBig(ClientCommand.IntoSceneR, true, sceneinfo, players);
            }
            else
            {
                PlayerBusiness[] first = new PlayerBusiness[maxCount];
                Array.Copy(players, first, maxCount);
                player.CallBig(ClientCommand.IntoSceneR, true, sceneinfo, first);
                //分割玩家列表
                for (int offset = maxCount; offset < players.Length; offset += maxCount)
                {
                    int count = Math.Min(players.Length - offset, maxCount);
                    PlayerBusiness[] other = new PlayerBusiness[count];
                    Array.Copy(players, offset, other, 0, count);
                    player.CallBig(ClientCommand.MorePlayer, this.ID, other);
                }
            }
            CallAllExcludeOne(player, ClientCommand.OtherIntoSceneR, new object[] { player });
            player.FightTime = DateTime.UtcNow.AddSeconds(15);
            player.Online = true;
            player.Save();

            if (this.HaveApc)
            {
                IList apcs = SceneApcProxy.GetSceneApc(this.ID);
                player.Call(ClientCommand.RefreshApcR, this.ID, apcs);
            }
            if (this.HaveBox)
            {
                IList boxs = BoxProxy.GetSceneBox(this.ID);
                player.Call(ClientCommand.RefreshBoxR, this.ID, boxs);
            }
        }
Exemple #2
0
        /// <summary>
        /// 成功进入场景
        /// </summary>
        /// <param name="note"></param>
        protected override void IntoSceneSuccess(PlayerBusiness player, Variant sceneinfo)
        {
            player.Call(ClientCommand.IntoSceneR, true, sceneinfo, EmptyPlayerList);
            player.FightTime = DateTime.UtcNow.AddSeconds(10);
            player.Online = true;
            player.Save();

            if (this.HaveApc)
            {
                IList apcs = SceneApcProxy.GetSceneApc(this.ID);
                player.Call(ClientCommand.RefreshApcR, this.ID, apcs);
            }
            if (this.HaveBox)
            {
                IList boxs = BoxProxy.GetSceneBox(this.ID);
                player.Call(ClientCommand.RefreshBoxR, this.ID, boxs);
            }
        }
Exemple #3
0
 /// <summary>
 /// 玩家断线
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public virtual bool Disconnected(PlayerBusiness player)
 {
     if (player == null)
     {
         return false;
     }
     string playerID = player.ID;
     if (m_players.TryRemove(playerID, out player) && player != null)
     {
         player.Online = false;
         player.Save();
         return true;
     }
     return false;
 }