Exemplo n.º 1
0
        public LobbyScreen(ContentManager Content)
        {
            content = new ContentManager(Content.ServiceProvider, "Content"); // TODO has to be disposed
            pixel   = content.Load <Texture2D>("pixel");
            players = new Dictionary <string, LobbyPlayer>();

            int i = 0;

            guis = new List <MenuGuiManager>();
            foreach (KeyValuePair <PlayerControllerIndex, InputController> kvp in Input.Controllers)
            {
                PlayerControllerIndex index = kvp.Key;
                MenuGuiManager        gui   = new MenuGuiManager(index);
                guis.Add(gui);

                string inputButtonText = (index == PlayerControllerIndex.Keyboard) ? "[Enter]" : "(A)";
                int    y      = 200 + i * 75;
                Button button = new Button(100, y, 150, 60, $"Press {inputButtonText} to join");
                gui.AddButton(button);
                button.Click += (source, args) =>
                {
                    gui.RemoveButton(button);
                    client.RequestNewPlayer((int)index);
                };

                i++;
            }
        }
Exemplo n.º 2
0
 public LocalPj(string ID, PlayerControllerIndex playerControllerIndex, float x, float y, int palette) : base(ID, x, y, palette)
 {
     PlayerControllerIndex = playerControllerIndex;
     PendingInputs         = new List <InputPacket>();
     InputSequenceNumber   = 0;
     LastSnapshotReceived  = 0;
 }
Exemplo n.º 3
0
 public GamepadInputController(PlayerControllerIndex index) : base(index)
 {
     buttons = new Dictionary <InputKeys, InputControllerButton>()
     {
         { InputKeys.Up, new GamepadInputButtonController(this.Index, InputKeys.Up) },
         { InputKeys.Left, new GamepadInputButtonController(this.Index, InputKeys.Left) },
         { InputKeys.Down, new GamepadInputButtonController(this.Index, InputKeys.Down) },
         { InputKeys.Right, new GamepadInputButtonController(this.Index, InputKeys.Right) },
         { InputKeys.Action, new GamepadInputButtonController(this.Index, InputKeys.Action) },
         { InputKeys.Back, new GamepadInputButtonController(this.Index, InputKeys.Back) },
     };
 }
Exemplo n.º 4
0
        public static void Initialize()
        {
            Controllers = new Dictionary <PlayerControllerIndex, InputController>()
            {
                { PlayerControllerIndex.Keyboard, new KeyboardInputController() },
            };

            for (int i = 0; i < 4; i++)
            {
                if (GamePad.GetState(i).IsConnected)
                {
                    PlayerControllerIndex index = (PlayerControllerIndex)i;
                    Controllers.Add(index, new GamepadInputController(index));
                }
            }
        }
Exemplo n.º 5
0
 public MenuGuiManager(PlayerControllerIndex index) => PlayerControllerIndex = index;
Exemplo n.º 6
0
 public InputStateEventArgs(PlayerControllerIndex PlayerIndex, InputKeys Button)
 {
     this.PlayerIndex = PlayerIndex;
     this.Button      = Button;
 }
Exemplo n.º 7
0
 public LobbyPlayer(string characterID, PlayerControllerIndex playerControllerIndex)
 {
     CharacterID           = characterID;
     PlayerControllerIndex = playerControllerIndex;
 }
Exemplo n.º 8
0
 protected InputController(PlayerControllerIndex Index)
 {
     this.Index      = Index;
     directionVector = new Vector2();
 }
 public GamepadInputButtonController(PlayerControllerIndex PlayerIndex, InputKeys id) : base(PlayerIndex, id)
 {
     _buttons = keyBindings[id];
 }
 protected InputControllerButton(PlayerControllerIndex PlayerIndex, InputKeys id)
 {
     this.PlayerIndex = PlayerIndex;
     Button           = id;
 }