Exemplo n.º 1
0
        public void OpenMenu(string menu)
        {
            DisableButtons();
            if (m_Menustack.Peek() != menu)
            {
                m_Menustack.Push(menu);
            }
            int BtIndex = 0;

            if (m_ButtonNavigation == null)
            {
                return;
            }
            ButtonNavigation SubMenu = m_ButtonNavigation.FilterByMenu(menu);

            while (BtIndex < 10)
            {
                if (BtIndex >= SubMenu.Count)
                {
                    ConfigureButton(BtIndex, new ButtonConfig());   //preload disable
                }
                else
                {
                    ConfigureButton(BtIndex, SubMenu[BtIndex]);
                }
                BtIndex++;
            }
        }
Exemplo n.º 2
0
        protected virtual void OnButtonClick(ButtonClickEventArgs e)
        {
            //Menuumschaltung nicht durchreichen
            ButtonNavigation SubMenu = m_ButtonNavigation.FilterByMenu(m_Menustack.Peek());

            switch (SubMenu[e.Button].GetBtFunction())
            {
            case ButtonFunction.Call:
                if (ButtonClick != null)
                {
                    ButtonClickEventArgs Event = new ButtonClickEventArgs(e.Button, SubMenu[e.Button].GetValue());
                    ButtonClick(this, Event);
                }
                break;

            case ButtonFunction.OpenSubMenu:
                OpenMenu(SubMenu[e.Button].GetValue());
                break;

            case ButtonFunction.OpenTopMenu:
                OpenMenu("");
                break;

            case ButtonFunction.ReturnSubMenu:
                m_Menustack.Pop();
                OpenMenu(m_Menustack.Peek());
                break;

            default:
                break;
            }
        }
Exemplo n.º 3
0
        public void SetButtonNavigation(ButtonNavigation buttonConfig)
        {
            //verify Config??
            Boolean _init = (m_ButtonNavigation == null);

            m_ButtonNavigation = buttonConfig;
            if (_init)
            {
                Translator.getTranslator.EventRetranslate += new Translator.OnRetranslateEventHandler(OnRetranslateEvent);
                UserManagement.UserManager.getUserManager.EventUserChanged += new UserManagement.UserManager.OnUserChangedEventHandler(OnRetranslateEvent);
                Retranslate();
            }
            OpenMenu("");
        }
Exemplo n.º 4
0
            public ButtonNavigation FilterByMenu(string menu)
            {
                ButtonNavigation SubMenu = new ButtonNavigation();
                int ConfigIndex          = 0;

                while (ConfigIndex < this.Count)
                {
                    if (this[ConfigIndex].GetMenu() == menu)
                    {
                        SubMenu.Add(this[ConfigIndex]);
                    }
                    ConfigIndex++;
                }
                return(SubMenu);
            }
    public override void OnExit()
    {
        if (GameManager.singleton.acm.menuActionPlayer1.activeSelf == true)
        {
            GameManager.singleton.acm.isAbilityTank    = false;
            GameManager.singleton.acm.isAbilityHealer  = false;
            GameManager.singleton.acm.isAbilityUtility = false;
            GameManager.singleton.acm.isAbilityDealer  = false;
            ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
            buttonNavigation.index = 2;
            buttonNavigation.ChangeImageButton();
            if (buttonNavigation.activeab == true)
            {
                // slide back ability button
                RectTransform movedback         = buttonNavigation.ability.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[2].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("ability" + destination2Dback);
                    buttonNavigation.activeab = false;
                });
            }
        }

        if (GameManager.singleton.acm.menuActionPlayer2.activeSelf == true)
        {
            GameManager.singleton.acm.isAbilityTank2    = false;
            GameManager.singleton.acm.isAbilityHealer2  = false;
            GameManager.singleton.acm.isAbilityUtility2 = false;
            GameManager.singleton.acm.isAbilityDealer2  = false;
            ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
            buttonNavigation.index = 2;
            buttonNavigation.ChangeImageButton();
            if (buttonNavigation.activeab == true)
            {
                // slide back ability button
                RectTransform movedback         = buttonNavigation.ability.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[2].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("ability" + destination2Dback);
                    buttonNavigation.activeab = false;
                });
            }
        }
    }
Exemplo n.º 6
0
 public override void OnExit()
 {
     GameManager.singleton.acm.isActionMenu = false;
     if (ctx.currentPlayer.IdPlayer == 1)
     {
         ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
         buttonNavigation.KeyboardKey1.enabled = false;
         buttonNavigation.KeyboardKey2.enabled = false;
     }
     if (ctx.currentPlayer.IdPlayer == 2)
     {
         ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
         buttonNavigation.KeyboardKey1.enabled = false;
         buttonNavigation.KeyboardKey2.enabled = false;
     }
 }
Exemplo n.º 7
0
 public override void OnExit()
 {
     if (GameManager.singleton.acm.menuActionPlayer1.activeSelf == true)
     {
         GameManager.singleton.acm.isMovement = false;
         ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
         buttonNavigation.index = 0;
         buttonNavigation.ChangeImageButton();
     }
     if (GameManager.singleton.acm.menuActionPlayer2.activeSelf == true)
     {
         GameManager.singleton.acm.isMovement = false;
         ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
         buttonNavigation.index = 0;
         buttonNavigation.ChangeImageButton();
     }
 }
    /*public void GoToMainMenu()
     * {
     *  SMController.SetTrigger("GoToMainMenu");
     * }
     * public void GoToInit()
     * {
     *  SMController.SetTrigger("GoToInit");
     * }*/



    /// <summary>
    /// funzione che mi iscrive a tutti gli eventi
    /// </summary>
    public void SetupManager()
    {
        vfx          = FindObjectOfType <VfxManager>();
        lm           = GetComponent <LifeManager>();
        lm           = FindObjectOfType <LifeManager>();
        tm           = FindObjectOfType <TurnManager>();
        hud          = FindObjectOfType <HudManagerTest>();
        mc           = FindObjectOfType <MainMenùController>();
        acm          = FindObjectOfType <ActionMenuController>();
        sc           = FindObjectOfType <SelectionController>();
        stateMachine = FindObjectOfType <FlowSM>();
        _player      = FindObjectOfType <Player>();
        sc2          = FindObjectOfType <SelectControllerP2>();
        buttNav      = FindObjectOfType <ButtonNavigation>();

        musicGame  = GameObject.FindGameObjectWithTag("MusicBattle");
        musicMenu  = GameObject.FindGameObjectWithTag("MusicGame");
        animDragon = GameObject.FindGameObjectWithTag("Dragon");
        hudUnit    = GameObject.FindGameObjectWithTag("HUDUnit1");
        hudUnit2   = GameObject.FindGameObjectWithTag("HUDUnit2");
    }
Exemplo n.º 9
0
        public void OpenMenu(string menu)
        {
            DisableButtons();
            m_PrevMenu = m_CurrMenu;
            m_CurrMenu = menu;
            int BtIndex = 0;
            ButtonNavigation SubMenu = m_ButtonNavigation.FilterByMenu(menu);

            while (BtIndex < 10)
            {
                if (BtIndex >= SubMenu.Count)
                {
                    ConfigureButton(BtIndex, new ButtonConfig());   //preload disable
                }
                else
                {
                    ConfigureButton(BtIndex, SubMenu[BtIndex]);
                }
                BtIndex++;
            }
        }
 public override void OnUpdate()
 {
     if (GameManager.singleton.acm.menuActionPlayer1.activeSelf == true)
     {
         ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
         buttonNavigation.index = 2;
         buttonNavigation.SwitchSprite();
         buttonNavigation.text[3].SetActive(false);
         buttonNavigation.text[2].SetActive(true);
         buttonNavigation.text[1].SetActive(false);
         buttonNavigation.text[0].SetActive(false);
     }
     if (GameManager.singleton.acm.menuActionPlayer2.activeSelf == true)
     {
         ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
         buttonNavigation.index = 2;
         buttonNavigation.SwitchSprite();
         buttonNavigation.text[3].SetActive(false);
         buttonNavigation.text[2].SetActive(true);
         buttonNavigation.text[1].SetActive(false);
         buttonNavigation.text[0].SetActive(false);
     }
 }
Exemplo n.º 11
0
    public override void OnUpdate()
    {
        if (ctx.currentPlayer.IdPlayer == 1)
        {
            GameManager.singleton.acm.menuActionPlayer1.SetActive(true);

            ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
            if (buttonNavigation.activemov == true)
            {
                //slide back movement button
                RectTransform movedback         = buttonNavigation.movement.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[0].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("Movimento " + destination2Dback);
                    buttonNavigation.activemov = false;
                });
            }
            if (buttonNavigation.activeatk == true)
            {
                //slide back attack button
                RectTransform movedback         = buttonNavigation.attack.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[1].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("attack" + destination2Dback);
                    buttonNavigation.activeatk = false;
                });
            }
            if (buttonNavigation.activeab == true)
            {
                // slide back ability button
                RectTransform movedback         = buttonNavigation.ability.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[2].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("ability" + destination2Dback);
                    buttonNavigation.activeab = false;
                });
            }
            buttonNavigation.KeyboardKey1.enabled = true;
            buttonNavigation.KeyboardKey2.enabled = true;
        }
        if (ctx.currentPlayer.IdPlayer == 2)
        {
            GameManager.singleton.acm.menuActionPlayer2.SetActive(true);

            ButtonNavigation buttonNavigation = FindObjectOfType <ButtonNavigation>();
            if (buttonNavigation.activemov == true)
            {
                //slide back movement button
                RectTransform movedback         = buttonNavigation.movement.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[0].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("Movimento " + destination2Dback);
                    buttonNavigation.activemov = false;
                });
            }
            if (buttonNavigation.activeatk == true)
            {
                //slide back attack button
                RectTransform movedback         = buttonNavigation.attack.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[1].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("attack" + destination2Dback);
                    buttonNavigation.activeatk = false;
                });
            }
            if (buttonNavigation.activeab == true)
            {
                // slide back ability button
                RectTransform movedback         = buttonNavigation.ability.GetComponent <RectTransform>();
                RectTransform destback          = buttonNavigation.slidebacktransform[2].GetComponent <RectTransform>();
                Vector2       destination2Dback = new Vector2(movedback.anchoredPosition.x, destback.anchoredPosition.y);
                movedback.DOLocalMoveY(destination2Dback.y, 0.4f).OnComplete(() =>
                {
                    Debug.Log("ability" + destination2Dback);
                    buttonNavigation.activeab = false;
                });
            }
            buttonNavigation.KeyboardKey1.enabled = true;
            buttonNavigation.KeyboardKey2.enabled = true;
        }
    }
Exemplo n.º 12
0
 public void SetButtonNavigation(ButtonNavigation buttonConfig)
 {
     //verify Config??
     m_ButtonNavigation = buttonConfig;
     OpenMenu("");
 }