Пример #1
0
 public CharacterSelector(int startIndex, Dictionary <int, GameObject> components,
                          TransitionHandlerInterface[] transitionHandlers,
                          ElementPressedHandler[] pressedHandler,
                          CharacterSelectionHelper selectionHelper, CharacterMenuManager menuManager, bool initialFocus)
     : base(startIndex, components, transitionHandlers, pressedHandler, initialFocus)
 {
     this.selectionHelper = selectionHelper;
     this.menuManager     = menuManager;
 }
Пример #2
0
 public static void LeftScroll()
 {
     if (All_Characters.IndexOf(currentCharacter) == 0)
     {
         CharacterMenuManager.LoadCharacter(All_Characters.Count - 1, character_position.previous);
     }
     else
     {
         CharacterMenuManager.LoadCharacter(All_Characters.IndexOf(currentCharacter) - 1, character_position.previous);
     }
 }
Пример #3
0
 public static void RightScroll()
 {
     if (All_Characters.IndexOf(currentCharacter) == All_Characters.Count - 1)
     {
         CharacterMenuManager.LoadCharacter(0, character_position.next);
     }
     else
     {
         CharacterMenuManager.LoadCharacter(All_Characters.IndexOf(currentCharacter) + 1, character_position.next);
     }
 }
    public override void PerformAction <T>(T triggerInstance)
    {
        CharacterMenuManager menu     = GetComponent <CharacterMenuManager>();
        CharacterSelector    selector = menu.Selector as CharacterSelector;

        bool wasSelected = selector.Deselect();

        if (wasSelected)
        {
            menu.Deselect();
            OnActionPerformed();
        }
        else
        {
            base.PerformAction <T>(triggerInstance);
        }
    }
Пример #5
0
    private void Initialize()
    {
        menuManager = (CharacterMenuManager)GetComponent <AbstractMenuManager>();
        menuManager.NavigationNext     += HandleNextChange;
        menuManager.NavigationPrevious += HandlePreviousChange;

        characters = new ImageData[menuManager.MenuComponents.Count];
        for (int i = 0; i < characters.Length; i++)
        {
            GameObject tmp;
            menuManager.MenuComponents.TryGetValue(i, out tmp);
            characters[i] = new ImageData(tmp.GetComponent <RectTransform>());
        }

        if (selectionHelper == null)
        {
            Debug.LogError("Selection helper is not assigned!");
        }

        selectionHelper.OnCharacterSelected   += HandleCharacterSelected;
        selectionHelper.OnCharacterDeselected += HandleCharacterDeselected;
        menuManager.PlayerRegistered          += HandlePlayerRegistered;
    }
Пример #6
0
    void OnMouseUp()
    {
        if (SceneManager.GetActiveScene().name == "StartMenu")
        {
            Animator transition = Camera.main.GetComponent <Animator> ();
            transition.Play("StartMenu_Camera_RotateAway");
        }
        else if (SceneManager.GetActiveScene().name == "Characters" && gameObject.tag == "PlayButton")
        {
            Change_Scene();
        }

        switch (gameObject.tag)
        {
        case "RetryButton":
            MainGameManager.Start_New();
            break;

        case "HomeButton":
            Scene_To_Load = "StartMenu";
            Change_Scene();
            break;

        case "CharactersButton":
            Scene_To_Load = "Characters";
            Change_Scene();
            break;

        case "AchievementsButton":
            if (Social.localUser.authenticated == true)
            {
                PlayGamesPlatform.Instance.ShowAchievementsUI();
            }
            else
            {
                Social.localUser.Authenticate((bool success) => {
                    if (success)
                    {
                        Debug.Log("Login Succesful");
                        MainGameManager.GPGS_Logged_In = true;
                    }
                    else
                    {
                        Debug.Log("Login Failed");
                    }
                });
            }
            break;

        case "LeaderboardsButton":
            if (Social.localUser.authenticated == true)
            {
                Social.ShowLeaderboardUI();
            }
            else
            {
                Social.localUser.Authenticate((bool success) => {
                    if (success)
                    {
                        Debug.Log("Login Succesful");
                        MainGameManager.GPGS_Logged_In = true;
                    }
                    else
                    {
                        Debug.Log("Login Failed");
                    }
                });
            }
            break;

        case "RightScroll":
            gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Scroll_Up");
            CharacterMenuManager.RightScroll();
            break;

        case "LeftScroll":
            gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Scroll_Up");
            CharacterMenuManager.LeftScroll();
            break;

        case "ChooseCharacterButton":
            gameObject.GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite> ("Sprites/Ui/Characters_Chosen");
            SaveManager.SetCharacter(CharacterMenuManager.currentCharacter);
            CharacterMenuManager.chosenCharacter = CharacterMenuManager.currentCharacter;
            break;
        }
    }
 public SlotContainer(CharacterMenuManager menuManager, InputDevice inputDevice)
 {
     this.menuManager = menuManager;
     this.inputDevice = inputDevice;
 }