Ejemplo n.º 1
0
    private void Update()
    {
        if (m_awake
            &&
            EventSystem.current.currentSelectedGameObject != null
            &&
            EventSystem.current.currentSelectedGameObject != m_SelectedLast) // spam prevention
        {
            m_SelectedLast = EventSystem.current.currentSelectedGameObject;  // spam prevention

            // executes functions when a button is pressed
            switch (EventSystem.current.currentSelectedGameObject.name)
            {
            // general buttons -----------------------------------------------------------------------------------------------------------------------------
            case "Delete Button":
                DeleteSelectedCharacter();
                break;

            case "Reload Back Button":
                ReloadTheScene();
                break;

            case "Quit Button":
                QuitTheGame();
                break;

            // character creation buttons ------------------------------------------------------------------------------------------------------------------
            case "Male Button":
                ClearCurrentSlots();
                DefaultTheCharacter();    // character is now male
                break;

            case "Female Button":
                ClearCurrentSlots();
                DefaultTheCharacter();
                m_cd.m_DummyModel[0] = 1;    // character is now female
                break;

            case "Skin Color Button":
                ClearCurrentSlots();
                CreateSlotsOfType(m_SkinIdsAsSlots);
                break;

            case "Face Button":
                ClearCurrentSlots();
                CreateSlotsOfType(m_FaceIdsAsSlots);
                break;

            case "Ears Button":
                ClearCurrentSlots();
                CreateSlotsOfType(m_EarsIdsAsSlots);
                break;

            case "Eyes Button":
                ClearCurrentSlots();
                CreateSlotsOfType(m_EyesIdsAsSlots);
                break;

            case "Accessories Button":
                ClearCurrentSlots();
                CreateSlotsOfType(m_AccessoriesIdsAsSlots);
                break;

            case "Hair Button":
                ClearCurrentSlots();
                CreateSlotsOfType(m_HairIdsAsSlots);
                break;

            case "Create Button":
                CreateCharacter();
                break;

            // game mode buttons ---------------------------------------------------------------------------------------------------------------------------
            case "Solo Button":
                m_cnm.SoloOnClick();
                break;

            case "Host Button":
                m_cnm.HostOnClick();
                break;

            case "Join Button":
                m_cnm.JoinOnClick();
                break;

            default:

                break;
            }

            // changes the dummy model id on the proper index
            if (m_SlotsAlive.Contains(EventSystem.current.currentSelectedGameObject))
            {
                int slotIndex = System.Array.IndexOf(m_SlotsAlive, EventSystem.current.currentSelectedGameObject);

                int selectedId = 0;
                int.TryParse(m_SlotsAlive[slotIndex].name, out selectedId);

                int bodyPartIndex;
                int.TryParse(selectedId.ToString().Substring(0, 1), out bodyPartIndex);

                if (bodyPartIndex >= 1
                    &&
                    bodyPartIndex <= 7)
                {
                    m_cd.m_DummyModel[bodyPartIndex] = selectedId;

                    // BUILD DUMMY HERE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                }
                else
                {
                    Debug.LogError("LobbyButtonManagement Error:\nSlot Error");
                }
            }
        }
    }