コード例 #1
0
    /// <summary>
    /// Will find which obj in onScreen List is hovered at the moment
    /// </summary>
    /// <param name="hovering">The transform the mouse is hovering at the moment</param>
    private void Hovering(Transform hovering)
    {
        int counter = 0;

        for (int i = 0; i < onScreen.Count; i++)
        {
            if (onScreen[i] != null)
            {
                if (hovering == onScreen[i].MyTransform.transform)
                {
                    onScreen[i].IsNowHovered = true;

                    Vector3 tipsSpawn = USearch.FindTransfInArray(camChild, "Tips_Spawner").transform.position;
                    SpawnText(Camera.main.WorldToViewportPoint(tipsSpawn));
                }
                else
                {
                    onScreen[i].IsNowHovered = false;
                    counter++;
                }
            }
        }
        //if the counter is being added as many times as the onScreen.Count means tht is nothing hovered at the
        //moment
        if (counter == onScreen.Count)
        {
            DestroyTipMenu();
        }
    }
コード例 #2
0
    private new void ActionableBtnClick(Button[] setOfBtns)//actionable buttons
    {
        base.ActionableBtnClick(setOfBtns);

        //when we click in the back to menu main btn in the pause screen
        if (currentBtn.btnAction == Btn.BackToMain)
        {
            int[] slots = { 6, 8 }; //the slots we want to render this obj in the camChild slots
            CloseCurrentMenu(true); //we force to close current menu
            SpawnSetMenu(S.Confirm_Menu_Spawner.ToString(), 150f, slotsP: slots);
            Vector3 msgSpawn = USearch.FindTransfInArray(camChild, "Message_Spawner").transform.position;
            SpawnText(Camera.main.WorldToViewportPoint(msgSpawn), "If you exit will lose all the progress.\n"
                      + "Are you sure you want to exit the game now?");
        }
        //when we click in the ok btn in the pause screen
        else if (currentBtn.btnAction == Btn.OkPause)
        {
            ActionOnPauseBtn();
            Application.LoadLevel("Lobby");
        }
        //when we click in the cancel btn in the pause screen
        else if (currentBtn.btnAction == Btn.CancelPause)
        {
            ActionOnPauseBtn();
            Destroy(textMessage.gameObject);
            textMessage = null;
        }
        //when we click in the SETTINGS btn in the pause screen
        else if (currentBtn.btnAction == Btn.SettingsPause)
        {
            CloseCurrentMenu(true);
            SpawnSetMenu(S.Settings_Pause_Menu_Spawner.ToString());
        }
        //when we click in the MUSIC btn in the settings pause screen
        else if (currentBtn.btnAction == Btn.SwitchMusic)
        {
            ChangeAudioSettings(H.Music.ToString());
        }
        //when we click in the SOUND btn in the settings pause screen
        else if (currentBtn.btnAction == Btn.SwitchSound)
        {
            ChangeAudioSettings(H.Sound.ToString());
        }
        //when we click in the BACK TO PAUSE MENU btn in the settings pause screen
        else if (currentBtn.btnAction == Btn.BackToPauseMenu)
        {
            CloseCurrentMenu(true);
            SpawnSetMenu("Pause_Menu_Spawner", 150f);
        }
        currentBtn = null;
    }