Пример #1
0
    public void ToggleVisiblity()
    {
        if (m_MenuState == EMenuState.eHidden || m_MenuState == EMenuState.eHiding)
        {
            m_StartTime = Time.time;

            Vector3    wandLocalPosition = m_SystemCenterNode.transform.InverseTransformPoint(m_Wand.transform.position);
            Quaternion wandLocalRotation = Quaternion.Inverse(m_SystemCenterNode.transform.rotation) * m_Wand.transform.rotation;
            Vector3    wandLocalForward  = m_SystemCenterNode.transform.InverseTransformDirection(m_Wand.transform.forward);

            if (m_MenuState == EMenuState.eHiding)
            {
                m_StartRotation = this.transform.localRotation;
                m_StartPosition = this.transform.localPosition;
                m_StartScale    = this.transform.localScale;
            }
            else
            {
                m_StartRotation = wandLocalRotation;
                m_StartPosition = wandLocalPosition;
                m_StartScale    = Vector3.zero;
            }

            m_TargetPosition = wandLocalPosition + 0.5f * wandLocalForward;
            m_MenuState      = EMenuState.eShowing;
        }
        else if (m_MenuState == EMenuState.eVisible || m_MenuState == EMenuState.eShowing)
        {
            m_StartTime     = Time.time;
            m_StartPosition = this.transform.localPosition;
            m_StartRotation = this.transform.localRotation;
            m_StartScale    = this.transform.localScale;
            m_MenuState     = EMenuState.eHiding;
        }
    }
Пример #2
0
    public void ActiveState(EMenuState eMenuState)
    {
        currentMenuState = eMenuState;

        for (int i = 0; i < menus.Count; i++)
        {
            if (menus[i].menuState == eMenuState)
            {
                if (menus[i].mIsPopup)
                {
                    currentPopup = menus[i];
                    currentPopup.ActiveAlpha(true);
                    break;
                }

                if (currentMenu != null)
                {
                    currentMenu.ActiveAlpha(false);
                }
                if (currentPopup != null)
                {
                    currentPopup.ActiveAlpha(false);
                }

                currentMenu = menus[i];
                currentMenu.ActiveAlpha(true);
                break;
            }
        }
    }
Пример #3
0
 void Awake()
 {
     this.currentState = EMenuState.MAINMENU;
     OnMenuChangeState();
     RestoreDefaults1();
     RestoreDefaults2();
 }
Пример #4
0
 public void GoToMainMenu()
 {
     GoToMenu(m_GoToMainMenuData);
     if (m_MenuState == EMenuState.Options)
     {
         m_OptionsButton?.Select();
     }
     m_MenuState = EMenuState.MainMenu;
 }
Пример #5
0
 public void OnControls2ButtonPressed()
 {
     if (this.currentState == EMenuState.CONTROLSMENU2)
     {
         this.currentState = EMenuState.PLAYMENU;
     }
     else
     {
         this.currentState = EMenuState.CONTROLSMENU2;
     }
     OnMenuChangeState();
 }
        void createAccountGUI()
        {
            if (Network.isClient == false)
            {
                m_MainState = EMenuState.MAIN_MENU;
                return;
            }
            int elements = 5;
            float height = m_MenuHeight * elements;
            Rect rect = new Rect(Screen.width * 0.5f - m_MenuWidth * 0.5f, Screen.height * 0.5f - height * 0.5f, m_MenuWidth, height);

            GUILayout.BeginArea(rect);
            {
                GUILayout.Label("Enter Account Info");
                //Email or Username
                m_UserID = Utils.editorTextfield("Username", m_UserID);
                m_Password = Utils.editorTextfield("Password", m_Password);
                m_Email = Utils.editorTextfield("Email", m_Email);

                if (GUILayout.Button("Create"))
                {
                    int loginSuccess = -1;
                    //Try Login
                    loginSuccess = AuthenticationServer.instance.newUser(m_UserID, m_Password, m_Email);

                    if (loginSuccess == AuthenticationServer.ERROR_NONE)
                    {
                        m_MainState = EMenuState.LOGIN;
                        m_Password = string.Empty;
                    }
                    else if (loginSuccess == AuthenticationServer.STATUS_PENDING)
                    {
                        Debug.Log("Status Pending");
                    }
                    else
                    {
                        //HANDLE ERROR
                        Debug.Log("Error Creating Account");
                    }
                }
            }
            GUILayout.EndArea();
        }
Пример #7
0
 public void OnPlayModeButtonPressed()
 {
     this.currentState = EMenuState.PLAYMENU;
     OnMenuChangeState();
 }
Пример #8
0
 public void OnReturnToMainMenuButtonPressed()
 {
     this.currentState = EMenuState.MAINMENU;
     OnMenuChangeState();
 }
Пример #9
0
    private void _VisibilityAnimation()
    {
        switch (m_MenuState)
        {
            case EMenuState.eHidden:
                {
                    break;
                }
            case EMenuState.eHiding:
                {
                    float state = (Time.time - m_StartTime) / m_TransitionDuration;

                    if (state >= 1.0f)
                    {
                        this.transform.localScale = Vector3.zero;
                        this.transform.position = m_Wand.transform.position;
                        this.transform.rotation = m_Wand.transform.rotation;
                        m_MenuState = EMenuState.eHidden;
                    }
                    else
                    {
                        this.transform.localScale = Vector3.Slerp(m_StartScale, Vector3.zero, state);
                        Vector3 wandLocalPosition = m_SystemCenterNode.transform.InverseTransformPoint(m_Wand.transform.position);
                        this.transform.localPosition = Vector3.Slerp(m_StartPosition, wandLocalPosition, state);
                        Quaternion wandLocalRotation = Quaternion.Inverse(m_SystemCenterNode.transform.rotation) * m_Wand.transform.rotation;
                        this.transform.localRotation = Quaternion.Slerp(m_StartRotation, wandLocalRotation, state);
                    }

                    break;
                }
            case EMenuState.eShowing:
                {
                    float state = (Time.time - m_StartTime) / m_TransitionDuration;

                    Vector3 forward = m_SystemCenterNode.transform.InverseTransformDirection((this.transform.position - m_HeadNode.transform.position).normalized);
                    Quaternion targetRotation = Quaternion.LookRotation(forward);

                    if (state >= 1.0f)
                    {
                        this.transform.parent = m_SystemCenterNode.transform;
                        this.transform.localScale = m_NormalScale;
                        this.transform.localPosition = m_TargetPosition;
                        this.transform.localRotation = targetRotation;
                        m_MenuState = EMenuState.eVisible;
                    }
                    else
                    {
                        this.transform.localScale = Vector3.Slerp(m_StartScale, m_NormalScale, state);
                        this.transform.localPosition = Vector3.Slerp(m_StartPosition, m_TargetPosition, state);
                        this.transform.localRotation = Quaternion.Slerp(m_StartRotation, targetRotation, state);
                    }

                    break;
                }
            case EMenuState.eVisible:
                {
                    break;
                }
        }
    }
Пример #10
0
    public void ToggleVisiblity()
    {
        if (m_MenuState == EMenuState.eHidden || m_MenuState == EMenuState.eHiding)
        {
            m_StartTime = Time.time;

            Vector3 wandLocalPosition = m_SystemCenterNode.transform.InverseTransformPoint(m_Wand.transform.position);
            Quaternion wandLocalRotation = Quaternion.Inverse(m_SystemCenterNode.transform.rotation) * m_Wand.transform.rotation;
            Vector3 wandLocalForward = m_SystemCenterNode.transform.InverseTransformDirection(m_Wand.transform.forward);

            if (m_MenuState == EMenuState.eHiding)
            {
                m_StartRotation = this.transform.localRotation;
                m_StartPosition = this.transform.localPosition;
                m_StartScale = this.transform.localScale;
            }
            else
            {
                m_StartRotation = wandLocalRotation;
                m_StartPosition = wandLocalPosition;
                m_StartScale = Vector3.zero;
            }

            m_TargetPosition = wandLocalPosition + 0.5f * wandLocalForward;
            m_MenuState = EMenuState.eShowing;
        }
        else if (m_MenuState == EMenuState.eVisible || m_MenuState == EMenuState.eShowing)
        {
            m_StartTime = Time.time;
            m_StartPosition = this.transform.localPosition;
            m_StartRotation = this.transform.localRotation;
            m_StartScale = this.transform.localScale;
            m_MenuState = EMenuState.eHiding;
        }
    }
        void mainMenuGUI()
        {
            int elements = 4;
            float height = m_MenuHeight * elements;
            Rect rect = new Rect(Screen.width * 0.5f - m_MenuWidth * 0.5f, Screen.height * 0.5f - height * 0.5f, m_MenuWidth, height);

            GUILayout.BeginArea(rect);
            {
                GUILayout.Label("Main Menu");
                if (Network.isClient == false)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Login"))
                {
                    m_MainState = EMenuState.LOGIN;
                }

                GUI.enabled = true;
                if (GUILayout.Button("Offline Mode"))
                {
                    //m_MainState = EMenuState.OFFLINE;
                }
                if(GUILayout.Button("Options"))
                {
                    //m_MainState = EMenuState.OPTIONS;
                }
            }
            GUILayout.EndArea();
        }
Пример #12
0
    public void ChangeMenu(EMenuState menuState)
    {
        // turn off old items
        switch (m_MenuState)
        {
        case EMenuState.MainMenu:
            foreach (GameObject obj in m_MainMenuObjects)
            {
                obj.SetActive(false);
            }
            break;

        case EMenuState.Options:
            foreach (GameObject obj in m_OptionsObjects)
            {
                obj.SetActive(false);
            }
            break;

        case EMenuState.Credits:
            foreach (GameObject obj in m_CreditsObjects)
            {
                obj.SetActive(false);
            }
            break;

        default:
            break;
        }

        // update state
        m_MenuState = menuState;

        // turn on new items
        switch (m_MenuState)
        {
        case EMenuState.MainMenu:
            foreach (GameObject obj in m_MainMenuObjects)
            {
                obj.SetActive(true);
            }
            break;

        case EMenuState.Options:
            foreach (GameObject obj in m_OptionsObjects)
            {
                obj.SetActive(true);
            }
            break;

        case EMenuState.Credits:
            foreach (GameObject obj in m_CreditsObjects)
            {
                obj.SetActive(true);
            }
            break;

        default:
            break;
        }
    }
        void loginGUI()
        {
            if (Network.isClient == false)
            {
                m_MainState = EMenuState.MAIN_MENU;
                return;
            }
            int elements = 4;
            float height = m_MenuHeight * elements;
            Rect rect = new Rect(Screen.width * 0.5f - m_MenuWidth * 0.5f, Screen.height * 0.5f - height * 0.5f, m_MenuWidth, height);
            GUILayout.BeginArea(rect);
            {
                GUILayout.Label("Enter Login");
                //Email or Username
                m_UserID = Utils.editorTextfield("User ID", m_UserID);
                m_Password = Utils.editorTextfield("Password", m_Password);

                if (GUILayout.Button("Login"))
                {
                    int loginSuccess = -1;
                    //Try Login
                    if (m_UserID.Contains(".com") || m_UserID.Contains(".ca"))
                    {
                        loginSuccess = AuthenticationServer.instance.loginEmail(m_UserID, m_Password);
                    }
                    else
                    {
                        if (m_UserID.Contains("@") == false)
                        {
                            loginSuccess = AuthenticationServer.instance.login(m_UserID, m_Password);
                        }
                    }
                    if (loginSuccess == AuthenticationServer.ERROR_NONE)
                    {

                    }
                    else if (loginSuccess == AuthenticationServer.STATUS_PENDING)
                    {
                        Debug.Log("Status Pending");

                    }
                    else
                    {
                        //HANDLE ERROR
                        Debug.Log("Error Loging in");
                    }
                }
                if (GUILayout.Button("Register Account"))
                {
                    m_MainState = EMenuState.CREATE_ACCOUNT;
                    m_UserID = string.Empty;
                    m_Password = string.Empty;
                    m_Email = string.Empty;
                }
            }
            GUILayout.EndArea();
        }
        // Update is called once per frame
        void Update()
        {
            if (Network.isClient)
            {
                if (m_MainState == EMenuState.LOGIN)
                {
                    //Check for Login Status every frame
                    int status = AuthenticationServer.instance.getStatus(AuthenticationServerUnity.STATUS_TYPE_LOGIN);

                    if(status == AuthenticationServer.ERROR_NONE)
                    {
                        if (m_LoggedIn == false)
                        {
                            m_LoggedIn = true;
                            Debug.Log("Successfully Logged In");
                        }

                    }
                    else if( status > AuthenticationServer.ERROR_NONE)
                    {
                        //Error Check
                        Debug.Log("Error Logging In");
                    }
                }
                else if (m_MainState == EMenuState.CREATE_ACCOUNT)
                {
                    int status = AuthenticationServer.instance.getStatus(AuthenticationServerUnity.STATUS_TYPE_REGISTER_SERVER);
                    if(status ==  AuthenticationServer.ERROR_NONE)
                    {
                        m_MainState = EMenuState.LOGIN;
                        Debug.Log("Created an account");
                    }
                    else if(status > AuthenticationServer.ERROR_NONE)
                    {
                        Debug.Log("Error creating account");
                    }
                }

                if (Input.GetKeyDown(KeyCode.A))
                {
                    AuthenticationServer.instance.requestCall();
                    //AuthenticationServer.instance.requestCall(new string[] {"A Key Pressed"});
                }
                if (Input.GetKeyDown(KeyCode.B))
                {
                    //AuthenticationServer.instance.requestCall(new string[] { "B Key Pressed" });
                }
            }
        }
 void OnGUI()
 {
     if (m_MainState != EMenuState.MAIN_MENU)
     {
         if (GUI.Button(new Rect(0.0f, 0.0f, 50.0f, 32.0f), "Back"))
         {
             if (m_MainState == EMenuState.CREATE_ACCOUNT)
             {
                 m_MainState = EMenuState.LOGIN;
             }
             else
             {
                 m_MainState = EMenuState.MAIN_MENU;
             }
         }
     }
     switch (m_MainState)
     {
         case EMenuState.MAIN_MENU:
             mainMenuGUI();
             break;
         case EMenuState.OPTIONS:
             optionsGUI();
             break;
         case EMenuState.OFFLINE:
             offlineGUI();
             break;
         case EMenuState.LOGIN:
             loginGUI();
             break;
         case EMenuState.CREATE_ACCOUNT:
             createAccountGUI();
             break;
     }
 }
Пример #16
0
 public void OnCreditsButtonPressed()
 {
     this.currentState = EMenuState.CREDITSMENU;
     OnMenuChangeState();
 }
Пример #17
0
    private void _VisibilityAnimation()
    {
        switch (m_MenuState)
        {
        case EMenuState.eHidden:
        {
            break;
        }

        case EMenuState.eHiding:
        {
            float state = (Time.time - m_StartTime) / m_TransitionDuration;

            if (state >= 1.0f)
            {
                this.transform.localScale = Vector3.zero;
                this.transform.position   = m_Wand.transform.position;
                this.transform.rotation   = m_Wand.transform.rotation;
                m_MenuState = EMenuState.eHidden;
            }
            else
            {
                this.transform.localScale = Vector3.Slerp(m_StartScale, Vector3.zero, state);
                Vector3 wandLocalPosition = m_SystemCenterNode.transform.InverseTransformPoint(m_Wand.transform.position);
                this.transform.localPosition = Vector3.Slerp(m_StartPosition, wandLocalPosition, state);
                Quaternion wandLocalRotation = Quaternion.Inverse(m_SystemCenterNode.transform.rotation) * m_Wand.transform.rotation;
                this.transform.localRotation = Quaternion.Slerp(m_StartRotation, wandLocalRotation, state);
            }

            break;
        }

        case EMenuState.eShowing:
        {
            float state = (Time.time - m_StartTime) / m_TransitionDuration;

            Vector3    forward        = m_SystemCenterNode.transform.InverseTransformDirection((this.transform.position - m_HeadNode.transform.position).normalized);
            Quaternion targetRotation = Quaternion.LookRotation(forward);

            if (state >= 1.0f)
            {
                this.transform.parent        = m_SystemCenterNode.transform;
                this.transform.localScale    = m_NormalScale;
                this.transform.localPosition = m_TargetPosition;
                this.transform.localRotation = targetRotation;
                m_MenuState = EMenuState.eVisible;
            }
            else
            {
                this.transform.localScale    = Vector3.Slerp(m_StartScale, m_NormalScale, state);
                this.transform.localPosition = Vector3.Slerp(m_StartPosition, m_TargetPosition, state);
                this.transform.localRotation = Quaternion.Slerp(m_StartRotation, targetRotation, state);
            }

            break;
        }

        case EMenuState.eVisible:
        {
            break;
        }
        }
    }
Пример #18
0
 public void OnExitButtonPressed()
 {
     this.currentState = EMenuState.EXITMENU;
     OnMenuChangeState();
 }
Пример #19
0
 public void GoToOptionsMenu()
 {
     GoToMenu(m_GoToOptionsData);
     m_MenuState = EMenuState.Options;
 }