Пример #1
0
    /// <summary>
    /// Will act for each btn set actiion .. this method is implemented in all child classes too
    /// </summary>
    /// <param name="setOfBtns"></param>
    internal void ActionableBtnClick(Button[] setOfBtns)//actionable buttons
    {
        //make sure there is not two obj in the array with the same name or contains partial part of the same name
        currentBtn = USearch.FindBtnInColl(setOfBtns, Program.MOUSEOVERTHIS.name);

        if (currentBtn == null)
        {
            return;
        }
        else if (currentBtn.btnAction == Btn.SelectMale1)
        {
            SelectPlayerRoutine(setOfBtns, Root.boardMale1);
        }
        else if (currentBtn.btnAction == Btn.SelectMale2)
        {
            SelectPlayerRoutine(setOfBtns, Root.boardMale2);
        }
        else if (currentBtn.btnAction == Btn.PlayNewGame)
        {
            //needed here other wise would only create menu in next Scene after first left click
            MenuHandler.CREATEMENU = true;
            Application.LoadLevel("Test3");
        }
        else if (currentBtn.btnAction == Btn.ExitGame)
        {
            Application.Quit();
        }
    }
Пример #2
0
    void LeftClick()
    {
        currentBtn = USearch.FindBtnInColl(menusArrayOne, Program.MOUSEOVERTHIS);

        if (Input.GetMouseButtonUp(0))
        {
            //if MOUSEOVERTHIS not null
            if (Program.MOUSEOVERTHIS != null)
            {
                LobbyHandleMenu(Program.MOUSEOVERTHIS.name);
                //audioPlayer.PlayAudio(RootSound.clickMenuSound, H.Sound);

                //will pop up new menus
                //will pop up new Raws and Elements
                if (Program.MOUSEOVERTHIS.name.Contains("Select_") && Application.loadedLevelName != "Lobby")
                {
                    UponLeftClickOnMenu(Program.MOUSEOVERTHIS.name);
                }
                else if (Application.loadedLevelName != "Lobby")
                {
                    CloseCurrentMenu();
                }
            }
            //click outside the buttons bascially MOUSEOVERTHIS == null...
            else if (Application.loadedLevelName != "Lobby")
            {
                CloseCurrentMenu();
            }
        }
    }
Пример #3
0
    /// <summary>
    /// It finds the single board obj and replace it with the one for the selected character
    /// </summary>
    /// <param name="setOfBtns">The set of buttons passed</param>
    /// <param name="rootP">The obj root will be spawn</param>
    private void SelectPlayerRoutine(Button[] setOfBtns, string rootP)
    {
        int    indexOfSingleB = -1;
        Btn3D  singleBoard    = (Btn3D)USearch.FindBtnInColl(setOfBtns, "SingleBoard", out indexOfSingleB);
        string storeTemp      = singleBoard.gameObject.name;

        moveToPosTemp = singleBoard.MovingToPosition;

        Destroy(singleBoard.gameObject);
        MenuHandler.CREATEMENU = true;
        //Single Board object handlgins
        singleBoard = (Btn3D)CreateBtn(singleBoard, rootP, moveToPosTemp);
        singleBoard.gameObject.name  = storeTemp;
        singleBoard.MovingToPosition = moveToPosTemp;
        //needs to be assign otherwise after being hovered lose movetoPos
        singleBoard.InitialPosition = moveToPosTemp;

        MenuHandler.CREATEMENU = false;
        //asign this back to the array so as is reference the array will hold this new obj now
        setOfBtns[indexOfSingleB] = singleBoard;
    }