Exemplo n.º 1
0
 private void OnCursorCollision(int playerIndex, object targetData, CursorModel cursor)
 {
     if (cursor.TargetCategory == Category.Cat6)
     {
         UpdateEntry(targetData, true);
     }
 }
Exemplo n.º 2
0
 private void OnCursorSeparation(int playerIndex, object targetData, CursorModel cursor)
 {
     if (cursor.TargetCategory == Category.Cat6)
     {
         UpdateEntry(targetData, false);
     }
 }
Exemplo n.º 3
0
        private void OnCursorClick(int playerIndex, object targetData, CursorModel cursor, bool selectKey)
        {
            if (cursor.TargetCategory == Category.Cat6)
            {
                MenuEntry m = (MenuEntry)targetData;
                m.action.Invoke(m.entryIndex);

                menuView.Entries.ForEach(a => a.selected = false);
            }
        }
Exemplo n.º 4
0
        private void OnCursorSeparation(int playerIndex, object targetData, CursorModel cursor)
        {
            if (cursor.TargetCategory == Category.Cat5)
            {
                if (targetData.GetType() == typeof(int))
                {
                    switch (CurrentState)
                    {
                        case GameState.CharacterMenu:
                            hoverOutCharacter(playerIndex, (int)targetData);
                            break;
                        case GameState.MapsMenu:
                            int mapIndex = (int)targetData;

                            //If no other players hovers this map thumb then animate back
                            if (!playerHoversMap.Any(a => a.Value == mapIndex && a.Key != playerIndex))
                            {
                                var map = mapThumbs[(int)targetData];
                                map.GetAt(0).CurrentRotation = 0f;
                                map.AnimateScale(1f, 300, false);
                            }
                            playerHoversMap.Remove(playerIndex);
                            break;
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void OnCursorCollision(int playerIndex, object targetData, CursorModel cursor)
        {
            if (cursor.TargetCategory == Category.Cat5)
            {
                if (targetData == null) return;
                //If data is character then show the character pose at the playersIndex pos
                if (targetData.GetType() == typeof(int))
                {
                    switch (CurrentState)
                    {
                        case GameState.CharacterMenu:
                            hoverCharacter(playerIndex, (int)targetData);
                            break;
                        case GameState.MapsMenu:
                            var map = mapThumbs[(int)targetData];
                            map.GetAt(0).CurrentRotation = 0.01f;
                            map.AnimateScale(1.1f, 300, false);

                            if(!playerHoversMap.ContainsKey(playerIndex))
                                playerHoversMap.Add(playerIndex, (int)targetData);
                            else
                                playerHoversMap[playerIndex] = (int)targetData;
                            break;
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void OnCursorClick(int playerIndex, object targetData, CursorModel cursor, bool selectKey)
        {
            if (cursor.TargetCategory == Category.Cat5)
            {
                if (targetData.GetType() == typeof(string))
                {
                    string s = targetData.ToString();
                    if (s == "options")
                    {
                        Screen.popupMenuController.State = PopupState.Options;
                    }
                    else if (s == "help")
                    {
                        Screen.popupMenuController.State = PopupState.Help;
                    }
                }
                else
                {
                    switch (CurrentState)
                    {
                        case GameState.CharacterMenu:
                            if (selectKey && cursor.Enabled)
                            {
                                GamePadControllers[playerIndex].PlayerModel.SelectedCharacter = characterModels[(int)targetData];
                                GamePadControllers[playerIndex].PlayerModel.CharacterIndex = (int)targetData;
                                Screen.cursorsController.DisableCursor(playerIndex);

                                Screen.soundController.PlaySound(characterModels[(int)targetData].sound_selected);
                            }
                            else if (!selectKey)
                            {
                                if(GamePadControllers[playerIndex].PlayerModel.SelectedCharacter != null)
                                    hoverCharacter(playerIndex, characterModels.IndexOf(GamePadControllers[playerIndex].PlayerModel.SelectedCharacter));

                                GamePadControllers[playerIndex].PlayerModel.SelectedCharacter = null;
                                Screen.cursorsController.EnableCursor(playerIndex);
                            }
                            break;
                        case GameState.MapsMenu:
                            if (selectKey)
                            {
                                selectedMap = mapModels[(int)targetData];
                                Screen.cursorsController.EnableCursors = false;
                                AddView(continueText);
                            }
                            else
                            {
                                RemoveView(continueText);
                                Screen.cursorsController.EnableCursors = true;
                            }

                            break;
                    }
                }
            }
        }
Exemplo n.º 7
0
        public override void Load(ContentManager content)
        {
            this.playerCursors = new List<CursorModel>();
            foreach (GamepadController pad in GamePadControllers)
            {
                var c = new CursorModel(content, World, pad, OnCursorNavigate, OnCollision, OnSeparation, false);
                c.SetMinMaxPos(10, Constants.WindowWidth - 25, 10, Constants.WindowHeight - 30);
                pad.OnHitKeyPressed += CheckForCursorPress;
                pad.OnSuperKeyPressed += CheckForCursorDeslect;

                playerCursors.Add(c);
            }

            ResetCursors();
            SubscribeToGameState = true;
        }