SetSelectedGameObject() публичный Метод

public SetSelectedGameObject ( GameObject selected ) : void
selected GameObject
Результат void
Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("Pause"))
        {
            if (GameIsPaused)
            {
                Resume();
            }
            else
            {
                Pause();
            }
        }

        if (GameIsPaused || GameOverScreen.activeSelf)
        {
            if (Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown("Fire1"))
            {
                eventSystem.currentSelectedGameObject.GetComponent <Button>().onClick.Invoke();
            }

            if (eventSystem.currentSelectedGameObject != selectedGameObject)
            {
                if (eventSystem.currentSelectedGameObject == null)
                {
                    eventSystem.SetSelectedGameObject(selectedGameObject);
                }
                else
                {
                    selectedGameObject = eventSystem.currentSelectedGameObject;
                }
            }
        }
    }
Пример #2
0
        public void Update()
        {
            bool anyJoysticksConnected = InputWrapper.AnyJoysticksConnected();

            if (anyJoysticksConnected)
            {
                mInputModule.verticalAxis = InputWrapper.LeftYJoystickInputName;
                mInputModule.submitButton = InputWrapper.Xbox360SubmitAxis;
            }
            else
            {
                mInputModule.verticalAxis = InputWrapper.LeftYInputName;
                mInputModule.submitButton = InputWrapper.SubmitAxis;
            }

            if (!anyJoysticksConnected && (joystickWasConnected || mFirstFrame))
            {
                mUIEventSystem.SetSelectedGameObject(null);
                joystickWasConnected = false;
            }
            else if (anyJoysticksConnected && !joystickWasConnected)
            {
                mUIEventSystem.SetSelectedGameObject(mUIEventSystem.firstSelectedGameObject);
                joystickWasConnected = true;
            }
            mFirstFrame = false;
        }
 public void EndGame()
 {
     Time.timeScale = 0;
     dof.active     = true;
     inGameMenuGameObject.SetActive(false);
     gameHasEnded = true;
     endGamePopup.SetActive(true);
     eventSystem.SetSelectedGameObject(endGameFirstButton);
 }
Пример #4
0
    //--------------------------------------------------------------------------------------
    //  Set the current highlighted button
    //  Due to unity bug need to set higlighted at end of frame
    //
    // Param:
    //		team: whic team is the bullet on, enemy or player layer
    //--------------------------------------------------------------------------------------
    IEnumerator HighlightButton(GameObject button)
    {
        UnityEngine.EventSystems.EventSystem eventSystem = GameObject.Find("EventSystem").GetComponent <UnityEngine.EventSystems.EventSystem>();

        eventSystem.SetSelectedGameObject(null);

        yield return(new WaitForEndOfFrame());

        eventSystem.SetSelectedGameObject(button);
    }
Пример #5
0
    IEnumerator WaitTime(float wait, string anim)
    {
        //finding the event system and assigning it to this temp variable
        UnityEngine.EventSystems.EventSystem myEvent = GameObject.Find("Canvas/EventSystem").GetComponent <UnityEngine.EventSystems.EventSystem>();
        float start = Time.realtimeSinceStartup;

        while (Time.realtimeSinceStartup < start + wait)
        {
            yield return(null);
        }
        //playing the next animations by which the string is passed through the parameters of this function
        menusAnim.Play(anim);
        //finding the first button in the menu and setting that as the current selected button
        switch (curMenu)
        {
        default:
            myEvent.SetSelectedGameObject(GameObject.Find("Canvas/Pause/Menus/PauseMenus/Resume"));
            break;

        case CurMenu.Options:
            myEvent.SetSelectedGameObject(GameObject.Find("Canvas/Pause/Menus/OptionMenus/Difficulty"));
            break;

        case CurMenu.Audio:
            myEvent.SetSelectedGameObject(GameObject.Find("Canvas/Pause/Menus/AudioMenus/BGMVolume"));
            break;

        case CurMenu.Video:
            myEvent.SetSelectedGameObject(GameObject.Find("Canvas/Pause/Menus/VideoMenus/Brightness"));
            break;

        case CurMenu.Quit:
            myEvent.SetSelectedGameObject(GameObject.Find("Canvas/Pause/Menus/QuitGameMenus/Cancel"));
            if (curMenu == CurMenu.Quit)
            {    //just setting the text and changing it depending upon whether or not the player decided to quit or reset the level
                Text myText = GameObject.Find("Canvas/Pause/Menus/QuitGameMenus/Text").GetComponent <Text>();
                myText.text = "Quit Game?";
            }
            else
            {
                Text myText = GameObject.Find("Canvas/Pause/Menus/QuitGameMenus/Text").GetComponent <Text>();
                myText.text = "Reset Level?";
            }
            break;

        case CurMenu.Reset:
            goto case CurMenu.Quit;
        }
        start = Time.realtimeSinceStartup;
        while (Time.realtimeSinceStartup < start + menusAnim.GetCurrentAnimatorStateInfo(0).length)
        {
            yield return(null);
        }
        isPlaying = false;
    }
Пример #6
0
 // Update is called once per frame
 void Update()
 {
     if (event_sys.currentSelectedGameObject == null)
     {
         event_sys.SetSelectedGameObject(current_event_object);
     }
     else
     {
         current_event_object = event_sys.currentSelectedGameObject;
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (are_scores_shown)
     {
         transform.position = Vector3.Lerp(transform.position, new Vector3(0, 0, 0) + highscore_offset, 0.2f);
         event_sys.SetSelectedGameObject(back_button.gameObject);
     }
     else
     {
         transform.position = Vector3.Lerp(transform.position, new Vector3(0, 0, 0), 0.2f);
     }
 }
Пример #8
0
 public void OptionsMenu(bool clicked)
 {
     if (clicked == true)
     {
         optionsMenu.gameObject.SetActive(clicked);
         mainMenu.gameObject.SetActive(false);
         events.SetSelectedGameObject(optionsMenu.FindChild("Back").gameObject);
     }
     else
     {
         optionsMenu.gameObject.SetActive(clicked);
         mainMenu.gameObject.SetActive(true);
         events.SetSelectedGameObject(mainMenu.FindChild("StartGame").gameObject);
     }
 }
Пример #9
0
 static public int SetSelectedGameObject(IntPtr l)
 {
     try{
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 3)
         {
             UnityEngine.EventSystems.EventSystem self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
             UnityEngine.GameObject a1;
             checkType(l, 2, out a1);
             UnityEngine.EventSystems.BaseEventData a2;
             checkType(l, 3, out a2);
             self.SetSelectedGameObject(a1, a2);
             return(0);
         }
         else if (argc == 2)
         {
             UnityEngine.EventSystems.EventSystem self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
             UnityEngine.GameObject a1;
             checkType(l, 2, out a1);
             self.SetSelectedGameObject(a1);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
    public void DailyMenu()
    {
        dialogCanvas.SetActive(false);

        var choices     = inkManager.GetChoices();
        var choiceNames = new List <string> ();

        foreach (var choice in choices)
        {
            choiceNames.Add(choice.text);
            if (choice.text.ToLower().Equals("continue"))
            {
                inkManager.Continue(choice.index);
                dialogCanvas.SetActive(true);
                return;
            }
        }

        int childCount = dailyMenuCanvas.transform.childCount;

        for (int i = childCount; i > 0; i--)
        {
            var button = dailyMenuCanvas.transform.GetChild(i - 1).gameObject;
            button.SetActive(choiceNames.Contains(button.name));
            if (button.name.Equals("Note"))
            {
                eventSystem.firstSelectedGameObject = button.gameObject;
            }
        }

        dailyMenuCanvas.SetActive(true);
        eventSystem.SetSelectedGameObject(eventSystem.firstSelectedGameObject);
    }
    static int SetSelectedGameObject(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.EventSystems.EventSystem), typeof(UnityEngine.GameObject)))
            {
                UnityEngine.EventSystems.EventSystem obj = (UnityEngine.EventSystems.EventSystem)ToLua.ToObject(L, 1);
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 2);
                obj.SetSelectedGameObject(arg0);
                return(0);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.EventSystems.EventSystem), typeof(UnityEngine.GameObject), typeof(UnityEngine.EventSystems.BaseEventData)))
            {
                UnityEngine.EventSystems.EventSystem obj = (UnityEngine.EventSystems.EventSystem)ToLua.ToObject(L, 1);
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.ToObject(L, 2);
                UnityEngine.EventSystems.BaseEventData arg1 = (UnityEngine.EventSystems.BaseEventData)ToLua.ToObject(L, 3);
                obj.SetSelectedGameObject(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.EventSystems.EventSystem.SetSelectedGameObject"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #12
0
 void OnEnable()
 {
     currentSystem = EventSystem.current;
     currentSystem.SetSelectedGameObject (firstSelected);
     currentSystem.GetComponent<AudioSource>().PlayOneShot (entered);
     currentSystem.GetComponent<AudioSource>().volume = PlayerPrefs.GetFloat ("SFX Volume");
 }
Пример #13
0
    void Start()
    {
        EventSystem.SetSelectedGameObject(Selected.gameObject);

        RInputs    = new List <Rewired.Player>();
        _moveFlags = new List <bool>();
        foreach (Rewired.Player player in Rewired.ReInput.players.GetPlayers())
        {
            try
            {
                RInputs.Add(player);
                _moveFlags.Add(false);
            }
            catch (System.Exception) { }
        }
    }
Пример #14
0
 void Start()
 {
     m_NewGameMenuCanvas     = GameObject.Find("NewGameMenu");
     m_LoadGameMenuCanvas    = GameObject.Find("LoadGameMenu");
     m_LevelSelectMenuCanvas = GameObject.Find("LevelSelectMenu");
     m_OptionsMenuCanvas     = GameObject.Find("OptionsMenu");
     m_InputMenuCanvas       = GameObject.Find("InputMenu");
     m_VideoMenuCanvas       = GameObject.Find("VideoMenu");
     m_NewGameMenuCanvas.SetActive(false);
     m_LoadGameMenuCanvas.SetActive(false);
     m_LevelSelectMenuCanvas.SetActive(false);
     m_OptionsMenuCanvas.SetActive(false);
     m_InputMenuCanvas.SetActive(false);
     m_VideoMenuCanvas.SetActive(false);
     m_EventSystem.SetSelectedGameObject(GameObject.Find("Continue"));
 }
    static int SetSelectedGameObject(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.EventSystems.EventSystem.Register");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.EventSystems.EventSystem obj = (UnityEngine.EventSystems.EventSystem)ToLua.CheckObject <UnityEngine.EventSystems.EventSystem>(L, 1);
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject));
                obj.SetSelectedGameObject(arg0);
                return(0);
            }
            else if (count == 3)
            {
                UnityEngine.EventSystems.EventSystem obj = (UnityEngine.EventSystems.EventSystem)ToLua.CheckObject <UnityEngine.EventSystems.EventSystem>(L, 1);
                UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckObject(L, 2, typeof(UnityEngine.GameObject));
                UnityEngine.EventSystems.BaseEventData arg1 = (UnityEngine.EventSystems.BaseEventData)ToLua.CheckObject <UnityEngine.EventSystems.BaseEventData>(L, 3);
                obj.SetSelectedGameObject(arg0, arg1);
                return(0);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.EventSystems.EventSystem.SetSelectedGameObject"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Пример #16
0
    void Update()
    {
        RaycastHit hit;
        Button     button = null;

        // do a forward raycast to see if we hit a Button
        if (Physics.Raycast(transform.position, transform.forward, out hit, 50f))
        {
            button = hit.collider.GetComponent <Button>();
        }

        if (button != null)
        {
            if (m_currentButton != button)
            {
                m_currentButton = button;
                m_currentButton.Select();
            }
        }
        else if (m_currentButton != null)
        {
            m_currentButton = null;
            if (m_eventSystem != null)
            {
                m_eventSystem.SetSelectedGameObject(null);
            }
        }
    }
Пример #17
0
    static int SetSelectedGameObject(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            UnityEngine.EventSystems.EventSystem obj = (UnityEngine.EventSystems.EventSystem)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.EventSystems.EventSystem");
            GameObject arg0 = (GameObject)LuaScriptMgr.GetUnityObject(L, 2, typeof(GameObject));
            obj.SetSelectedGameObject(arg0);
            return(0);
        }
        else if (count == 3)
        {
            UnityEngine.EventSystems.EventSystem obj = (UnityEngine.EventSystems.EventSystem)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UnityEngine.EventSystems.EventSystem");
            GameObject arg0 = (GameObject)LuaScriptMgr.GetUnityObject(L, 2, typeof(GameObject));
            UnityEngine.EventSystems.BaseEventData arg1 = (UnityEngine.EventSystems.BaseEventData)LuaScriptMgr.GetNetObject(L, 3, typeof(UnityEngine.EventSystems.BaseEventData));
            obj.SetSelectedGameObject(arg0, arg1);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.EventSystems.EventSystem.SetSelectedGameObject");
        }

        return(0);
    }
 static public int SetSelectedGameObject(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             UnityEngine.EventSystems.EventSystem self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
             UnityEngine.GameObject a1;
             checkType(l, 2, out a1);
             self.SetSelectedGameObject(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             UnityEngine.EventSystems.EventSystem self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
             UnityEngine.GameObject a1;
             checkType(l, 2, out a1);
             UnityEngine.EventSystems.BaseEventData a2;
             checkType(l, 3, out a2);
             self.SetSelectedGameObject(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function SetSelectedGameObject to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #19
0
 public void Show()
 {
     m_panel.SetActive(true);
     if (FirstSelectedChosen)
     {
         eventSystem.SetSelectedGameObject(eventSystem.firstSelectedGameObject);
     }
 }
Пример #20
0
    private void Update()
    {
        timerToCheckInternet -= Time.deltaTime;
        if (timerToCheckInternet <= 0)
        {
            StartCoroutine(CheckInternetConnection());
            timerToCheckInternet = 2f;
        }


        if (runningPHPBool)
        {
            loadingImage.transform.Rotate(new Vector3(0, 0, -1) * Time.deltaTime * 50f);
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            Selectable next = system.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnDown();

            if (next != null)
            {
                InputField inputfield = next.GetComponent <InputField>();

                if (inputfield != null)
                {
                    inputfield.OnPointerClick(
                        new PointerEventData(system)); //if it's an input field, also set the text caret
                }
                system.SetSelectedGameObject(next.gameObject, new BaseEventData(system));
            }
            else if (next == null)
            {
                system.SetSelectedGameObject(emailInputField, new BaseEventData(system));
            }
        }

        if (emailInputField == system.currentSelectedGameObject ||
            passwordInputField == system.currentSelectedGameObject)
        {
            if (Input.GetKeyDown(KeyCode.Return))
            {
                loginButton.onClick.Invoke();
            }
        }
    }
Пример #21
0
    void Start()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;

        eventSystem = EventSystem.current;

        eventSystem.SetSelectedGameObject(firstSelectElement);
    }
Пример #22
0
    // Event System needs to force first selectable because Unity Derp.
    // GNTODO: This will trigger any audio attached to the button...
    //
    public void ForceNewButton(GameObject goButton)
    {
        UnityEngine.EventSystems.EventSystem es = GetComponent <UnityEngine.EventSystems.EventSystem>();
        if (es.currentSelectedGameObject != null)
        {
            var previous = es.currentSelectedGameObject.GetComponent <UnityEngine.UI.Selectable>();
            if (previous != null)
            {
                previous.OnDeselect(null);
                es.SetSelectedGameObject(null);
            }
        }
        // Select button and play its selection transition:
        es.SetSelectedGameObject(goButton);
        var current = es.currentSelectedGameObject.GetComponent <UnityEngine.UI.Selectable>();

        current.OnSelect(null);
    }
Пример #23
0
 public void ControlsMenu(bool clicked)
 {
     //switch controls for help or controls menu
     optionsMenu.FindChild("Help Text").gameObject.SetActive(!clicked);
     optionsMenu.FindChild("Help").gameObject.SetActive(clicked);
     optionsMenu.FindChild("Controls Text").gameObject.SetActive(clicked);
     optionsMenu.FindChild("Controls").gameObject.SetActive(!clicked);
     //change some other stuff
     if (clicked = true)
     {
         //set selected button for controller support
         events.SetSelectedGameObject(optionsMenu.FindChild("Back").gameObject);
     }
     else
     {
         events.SetSelectedGameObject(optionsMenu.FindChild("Back").gameObject);
     }
 }
Пример #24
0
        public void Start()
        {
            mFirstFrame    = true;
            mUIEventSystem = GetComponent <UnityEngine.EventSystems.EventSystem>();

            if (InputWrapper.AnyJoysticksConnected())
            {
                joystickWasConnected = true;
                mUIEventSystem.SetSelectedGameObject(mUIEventSystem.firstSelectedGameObject);
            }
            else
            {
                joystickWasConnected = false;
                mUIEventSystem.SetSelectedGameObject(null);
            }

            mInputModule = GetComponent <UnityEngine.EventSystems.StandaloneInputModule>();
            mInputModule.horizontalAxis = InputWrapper.LeftXInputName;
            mInputModule.verticalAxis   = InputWrapper.LeftYInputName;
        }
Пример #25
0
 void Pause()
 {
     eventSystem.SetSelectedGameObject(pauseMenuUI.transform.GetChild(0).gameObject);
     delay = Time.unscaledTime;
     gameUI.SetActive(false);
     pauseMenuUI.SetActive(true);
     Time.timeScale   = 0f; //freeze the game
     Paused           = true;
     Cursor.visible   = true;
     Cursor.lockState = CursorLockMode.None; //unlock cursorLock so they can click buttons
 }
Пример #26
0
 public void Update()
 {
     if (ev.currentSelectedGameObject == null)
     {
         if (continuebutton.active)
         {
             ev.SetSelectedGameObject(continuebutton);
         }
         if (backbutton.active)
         {
             ev.SetSelectedGameObject(backbutton);
         }
     }
 }
Пример #27
0
    void Start()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;
        singleplayerScript = GameObject.FindObjectOfType (typeof(Singleplayer)) as Singleplayer;

        eventSystem = EventSystem.current;

        eventSystem.SetSelectedGameObject(firstSelectElement);

        singleplayerScript.SetWinner (masterScript.GetCharacter(2));
        singleplayerScript.UpdateRound ();
    }
Пример #28
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (paused)
            {
                Time.timeScale = 1;

                paused = false;
                panel.SetActive(false);

                if (joinPrompts)
                {
                    joinPrompts.SetActive(true);
                }
                timer.SetActive(true);

                image.sprite = images[0].sprite;
            }
            else
            {
                Time.timeScale = 0;

                paused = true;
                panel.SetActive(true);

                if (joinPrompts)
                {
                    joinPrompts.SetActive(false);
                }
                timer.SetActive(false);

                image.sprite = images[1].sprite;

                eventSystem.SetSelectedGameObject(continueButton);
            }
        }
    }
 static public int SetSelectedGameObject__GameObject(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.EventSystem self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
         UnityEngine.GameObject a1;
         checkType(l, 2, out a1);
         self.SetSelectedGameObject(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
    // Use this for initialization
    public void pausegame()
    {
        if (Time.timeScale == 1 && !playermovement.dead)
        {
            Time.timeScale = 0;
            resumes.active = true;
            exits.active   = true;
            Cursor.visible = true;

            Cursor.lockState = CursorLockMode.None;
            ev.SetSelectedGameObject(null);
            ev.SetSelectedGameObject(resumes);
        }
        else
        {
            Time.timeScale = 1;
            Cursor.visible = false;

            //Cursor.lockState = CursorLockMode.Confined;
            resumes.active = false;
            exits.active   = false;
        }
    }
Пример #31
0
 static public int SetSelectedGameObject(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             UnityEngine.EventSystems.EventSystem self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
             UnityEngine.GameObject a1;
             checkType(l, 2, out a1);
             self.SetSelectedGameObject(a1);
             pushValue(l, true);
             return(1);
         }
         else if (argc == 3)
         {
             UnityEngine.EventSystems.EventSystem self = (UnityEngine.EventSystems.EventSystem)checkSelf(l);
             UnityEngine.GameObject a1;
             checkType(l, 2, out a1);
             UnityEngine.EventSystems.BaseEventData a2;
             checkType(l, 3, out a2);
             self.SetSelectedGameObject(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function SetSelectedGameObject to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #32
0
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            var next = eventSystem.currentSelectedGameObject.GetComponent <Selectable>().FindSelectableOnDown();

            if (next != null)
            {
                var inputField = next.GetComponent <InputField>();

                //if it's an input field, also set the text caret
                if (inputField != null)
                {
                    inputField.OnPointerClick(new PointerEventData(eventSystem));
                }

                eventSystem.SetSelectedGameObject(next.gameObject, new BaseEventData(eventSystem));
            }
            else if (next == null)
            {
                eventSystem.SetSelectedGameObject(studentIdInput.gameObject, new BaseEventData(eventSystem));
            }
        }
    }
Пример #33
0
    void Start()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;

        eventSystem = EventSystem.current;

        eventSystem.SetSelectedGameObject(firstSelectElement);

        startPos = credits.position;

        startTime = Time.time;

        StartCoroutine (ScrollNames ());
    }
Пример #34
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space) || Input.GetButtonDown("Fire1"))
        {
            eventSystem.currentSelectedGameObject.GetComponent <Button>().onClick.Invoke();
        }

        if (eventSystem.currentSelectedGameObject != selectedGameObject)
        {
            if (eventSystem.currentSelectedGameObject == null)
            {
                eventSystem.SetSelectedGameObject(selectedGameObject);
            }
            else
            {
                selectedGameObject = eventSystem.currentSelectedGameObject;
            }
        }
    }
Пример #35
0
    public static void handleEnter(EventSystem system)
    {
        if (Input.GetKeyDown(KeyCode.Return))
        {
            Selectable next = system.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown();

            if( next != null)
            {
                Button button = next.GetComponent<Button>();
                if (button != null)
                    button.OnPointerClick( new PointerEventData( system ));

                system.SetSelectedGameObject(next.gameObject, new BaseEventData(system));
            }
        }
    }
    void Start()
    {
        masterScript = GameObject.FindObjectOfType (typeof(MasterScript)) as MasterScript;
        sceneHandlerScript = GameObject.FindObjectOfType (typeof(SceneHandler)) as SceneHandler;

        eventSystem = EventSystem.current;

        eventSystem.SetSelectedGameObject(firstSelectElement);

        player1 = characterSelectionMenu.transform.FindChild ("Player1");
        player2 = characterSelectionMenu.transform.FindChild ("Player2");

        StartCoroutine (EnableStart ());
    }
Пример #37
0
    // UI functions
    public static void handleTab(EventSystem system)
    {
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            Selectable next = system.currentSelectedGameObject.GetComponent<Selectable>().FindSelectableOnDown();

            if (next!= null) {

                InputField inputfield = next.GetComponent<InputField>();
                if (inputfield !=null) inputfield.OnPointerClick(new PointerEventData(system));  //if it's an input field, also set the text caret

                system.SetSelectedGameObject(next.gameObject, new BaseEventData(system));
            }
        }
    }