示例#1
0
        public BattleMapPlayer(BattleMapPlayer Clone)
        {
            if (Clone == null)
            {
                Team             = -1;
                OnlinePlayerType = PlayerTypeNA;
                return;
            }

            ConnectionID       = Clone.ConnectionID;
            Name               = Clone.Name;
            Guild              = Clone.Guild;
            License            = Clone.License;
            Ranking            = Clone.Ranking;
            IsOnline           = Clone.IsOnline;
            Team               = Clone.Team;
            Level              = Clone.Level;
            Money              = Clone.Money;
            IsPlayerControlled = Clone.IsPlayerControlled;
            Color              = Clone.Color;
            GameplayType       = Clone.GameplayType;
            InputManager       = Clone.InputManager;
            LocalPlayerIndex   = Clone.LocalPlayerIndex;

            OnlinePlayerType = Clone.OnlinePlayerType;
            OnlineClient     = Clone.OnlineClient;

            Inventory = Clone.Inventory;
        }
示例#2
0
        public IOnlineConnection OnlineClient;//Used by the server

        public Player(string ID, string Name, string PlayerType, bool IsOnline, int Team)
        {
            this.ConnectionID = ID;
            this.Name         = Name;
            this.PlayerType   = PlayerType;
            this.IsOnline     = IsOnline;
            this.Team         = Team;

            GameplayType = GameplayTypes.MouseAndKeyboard;

            Equipment = new PlayerEquipment();
        }
示例#3
0
        public IOnlineConnection OnlineClient;//Used by the server

        public Player(string ID, string Name, string PlayerType, int Team)
        {
            this.ConnectionID = ID;
            this.Name         = Name;
            this.PlayerType   = PlayerType;
            this.Team         = Team;

            Guild = string.Empty;

            GameplayType = GameplayTypes.MouseAndKeyboard;

            Equipment = new PlayerInventory();
        }
示例#4
0
        public BattleMapPlayer(string ID, string Name, string OnlinePlayerType, bool IsOnline, int Team, bool IsPlayerControlled, Color Color)
        {
            this.ConnectionID       = ID;
            this.Name               = Name;
            this.OnlinePlayerType   = OnlinePlayerType;
            this.IsOnline           = IsOnline;
            this.Team               = Team;
            this.IsPlayerControlled = IsPlayerControlled;
            this.Color              = Color;

            Guild     = string.Empty;
            Inventory = new PlayerInventory();

            GameplayType = GameplayTypes.MouseAndKeyboard;
            InputManager = new KeyboardInput();
        }
示例#5
0
        public BattleMapPlayer(string ID, string Name, PlayerTypes OnlinePlayerType, bool IsOnline, int Team, bool IsPlayerControlled, Color Color)
        {
            this.ConnectionID       = ID;
            this.Name               = Name;
            this.IsOnline           = IsOnline;
            this.Team               = Team;
            this.IsPlayerControlled = IsPlayerControlled;
            this.Color              = Color;

            Guild     = string.Empty;
            Inventory = new PlayerInventory();

            if (OnlinePlayerType == PlayerTypes.Offline)
            {
                this.OnlinePlayerType = PlayerTypeOffline;
            }
            else if (OnlinePlayerType == PlayerTypes.Online)
            {
                this.OnlinePlayerType = PlayerTypeOnline;
            }
            else if (OnlinePlayerType == PlayerTypes.Host)
            {
                this.OnlinePlayerType = PlayerTypeHost;
            }
            else if (OnlinePlayerType == PlayerTypes.Player)
            {
                this.OnlinePlayerType = PlayerTypePlayer;
            }
            else if (OnlinePlayerType == PlayerTypes.Ready)
            {
                this.OnlinePlayerType = PlayerTypeReady;
            }
            else
            {
                this.OnlinePlayerType = PlayerTypeSpectator;
            }

            GameplayType = GameplayTypes.MouseAndKeyboard;
            InputManager = new KeyboardInput();
        }
示例#6
0
        public RobotInput GetRobotInput(GameplayTypes GameplayType, RobotAnimation Owner, Rectangle CameraBounds)
        {
            switch (GameplayType)
            {
            case GameplayTypes.MouseAndKeyboard:
                return(new KeyboardAndMouseRobotInput(Owner, CameraBounds));

            case GameplayTypes.Controller1:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.One));

            case GameplayTypes.Controller2:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Two));

            case GameplayTypes.Controller3:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Three));

            case GameplayTypes.Controller4:
                return(new ControllerRobotInput(Owner, CameraBounds, PlayerIndex.Four));
            }

            return(new NullRobotInput());
        }
示例#7
0
        public Player(string ID, string Name, PlayerTypes PlayerType, int Team)
        {
            this.ConnectionID = ID;
            this.Name         = Name;
            this.Team         = Team;

            Guild = string.Empty;

            if (PlayerType == PlayerTypes.Offline)
            {
                this.PlayerType = PlayerTypeOffline;
            }
            else if (PlayerType == PlayerTypes.Online)
            {
                this.PlayerType = PlayerTypeOnline;
            }
            else if (PlayerType == PlayerTypes.Host)
            {
                this.PlayerType = PlayerTypeHost;
            }
            else if (PlayerType == PlayerTypes.Player)
            {
                this.PlayerType = PlayerTypePlayer;
            }
            else if (PlayerType == PlayerTypes.Ready)
            {
                this.PlayerType = PlayerTypeReady;
            }
            else
            {
                this.PlayerType = PlayerTypeSpectator;
            }

            GameplayType = GameplayTypes.MouseAndKeyboard;

            Equipment = new PlayerInventory();
        }
示例#8
0
    public void ReloadData()
    {
        if (_AsyncReadThread != null)
        {
            if (_AsyncReadThread.IsAlive)
            {
                return; // Already fetching data
            }
        }
        _AsyncReadThread = new Thread(() =>
        {
            if (isStopping)
            {
                return;
            }

            try
            {
                // Consume a message
                semaphore.WaitOne((int)receiveTimeout.TotalMilliseconds, true);
                if (message == null)
                {
                    //selfReference.UpdateText("No message received!" + "\n");
                }
                else
                {
                    if (lastMessage != null)
                    {
                        if (lastMessage.NMSMessageId == message.NMSMessageId)
                        {
                            return; //sameMessage
                        }
                        else
                        {
                            this.lastMessage = message;
                        }
                    }
                    else
                    {
                        this.lastMessage = message;
                    }
                    message.Acknowledge();

                    if (debug)
                    {
                        selfReference.UpdateText("Received message with text: " + message.Text);
                    }

                    GameplayTypes gameTypes = GameplayTypes.NONE;

                    if (message.Properties.Contains("GameType"))
                    {
                        gameTypes = (GameplayTypes)Enum.Parse(typeof(GameplayTypes), message.Properties.GetString("GameType"));
                    }
                    switch (gameTypes)
                    {
                    case GameplayTypes.Connect:
                        HandleConnectionMessage();
                        break;

                    case GameplayTypes.Disconnect:
                        HandleDisconnectMessage();
                        break;

                    case GameplayTypes.Initialised:
                        HandleInitialisedMessage();
                        break;

                    case GameplayTypes.Movement:
                        break;

                    case GameplayTypes.Turn:
                        break;

                    case GameplayTypes.Surrender:
                        break;

                    default:
                        //No Default Handler
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                //selfReference.UpdateText(e.Message + " -" + e.GetBaseException().ToString() + "\n");
            }
        });

        _AsyncReadThread.Start();
    }
示例#9
0
 public RobotInput GetRobotInput(GameplayTypes GameplayType, RobotAnimation Owner, Rectangle CameraBounds)
 {
     return(new KeyboardSpaceshipVehicleInput(Owner, CameraBounds));
 }
示例#10
0
 public void UpdateControls(GameplayTypes GameplayType, Rectangle CameraBounds)
 {
     InputManager = InputManagerHelper.GetRobotInput(GameplayType, this, CameraBounds);
 }
示例#11
0
 public RobotInput GetRobotInput(GameplayTypes GameplayType, RobotAnimation Owner, Rectangle CameraBounds)
 {
     return(new NullRobotInput());
 }