Exemplo n.º 1
0
        private void BeginSimulater(BattlePlayer user)
        {
            _battlePlayers.Remove(user.User.UserID);
            var si = MonitorPool.Singleton.GetMointor <SimulaterManager>().BeginSimulater(user);

            foreach (var i in worksThread.ToList())
            {
                if (i.Count >= i.MaxUpdaterPerThread)
                {
                    continue;
                }
                i.AddThread(si);
            }
        }
Exemplo n.º 2
0
        public ServerWorldSimluater BeginSimulater(BattlePlayer player)
        {
            if (isStoped)
            {
                return(null);
            }

            var worldSimulater = new ServerWorldSimluater(player.MapID,
                                                          Index++,
                                                          new List <BattlePlayer> {
                player
            });
            var client = Appliaction.Current.GetClientByID(player.ClientID);

            worldSimulater.AddClient(client);
            simluater.Add(worldSimulater.Index, worldSimulater);
            player.SimulaterIndex = worldSimulater.Index;
            return(worldSimulater);
        }
Exemplo n.º 3
0
        public void AddUser(PlayerServerInfo user, int mapID)
        {
            var userInfo = new BattlePlayer
            {
                ClientID       = -1,
                User           = user,
                MapID          = mapID,
                StartTime      = DateTime.UtcNow,
                SimulaterIndex = -1
            };

            if (_battlePlayers.Add(user.UserID, userInfo))
            {
                if (!UserSimulaterMapping.Add(user.UserID, userInfo))
                {
                    DeleteUser(user.UserID, false);
                    Debuger.LogError("user " + user.UserID + " is in battle!");
                }
            }
            else
            {
                Debuger.LogError("user " + user.UserID + " is in battle!");
            }
        }