Ejemplo n.º 1
0
    void OnGUI()
    {
        if (generator == null)
        {
            return;
        }
        GUI.enabled = usingLatestConfig && !character.GetComponent <Animation>().IsPlaying("walkin");

        GUILayout.BeginArea(new Rect(10, 10, typeWidth + 2 * buttonWidth + 8, 500));
        // 1. 添加切换角色按钮;
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("<", GUILayout.Width(buttonWidth)))
        {
            ChangeCharacter(false);
        }
        GUILayout.Box("角色", GUILayout.Width(typeWidth));
        if (GUILayout.Button(">", GUILayout.Width(buttonWidth)))
        {
            ChangeCharacter(true);
        }
        GUILayout.EndHorizontal();

        // 2. 添加切换角色身体部件按钮;
        AddCategory("face", "头", null);
        AddCategory("hair", "头发", null);
        AddCategory("eyes", "眼睛", null);
        AddCategory("top", "身体", "item_shirt");
        AddCategory("pants", "腿", "item_pants");
        AddCategory("shoes", "脚", "item_boots");

        // 3. 添加保存和删除设置按钮;
        if (GUILayout.Button("保存设置"))
        {
            PlayerPrefs.SetString(prefName, generator.GetConfig());
        }

        if (GUILayout.Button("删除设置"))
        {
            PlayerPrefs.DeleteKey(prefName);
        }

        GUI.enabled = true;
        if (!usingLatestConfig)
        {
            float  progress = generator.CurrentConfigProgress;
            string status   = "加载中";
            if (progress != 1)
            {
                status = "下载中" + (int)(progress * 100) + "%";
            }
            GUILayout.Box(status);
        }

        GUILayout.EndArea();
    }
Ejemplo n.º 2
0
    void OnGUI()
    {
        if (generator == null)
        {
            return;
        }
        GUI.enabled = usingLatestConfig && !character.animation.IsPlaying("walkin");
        GUILayout.BeginArea(new Rect(10, 10, typeWidth + 2 * buttonWidth + 8, 500));

        // Buttons for changing the active character.
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("<", GUILayout.Width(buttonWidth)))
        {
            ChangeCharacter(false);
        }

        GUILayout.Box("Character", GUILayout.Width(typeWidth));

        if (GUILayout.Button(">", GUILayout.Width(buttonWidth)))
        {
            ChangeCharacter(true);
        }

        GUILayout.EndHorizontal();

        // Buttons for changing character elements.
        AddCategory("face", "Head", null);
        AddCategory("eyes", "Eyes", null);
        AddCategory("hair", "Hair", null);
        AddCategory("top", "Body", "item_shirt");
        AddCategory("pants", "Legs", "item_pants");
        AddCategory("shoes", "Feet", "item_boots");

        // Buttons for saving and deleting configurations.
        // In a real world application you probably want store these
        // preferences on a server, but for this demo configurations
        // are saved locally using PlayerPrefs.
        if (GUILayout.Button("Save Configuration"))
        {
            PlayerPrefs.SetString(prefName, generator.GetConfig());
        }

        if (GUILayout.Button("Delete Configuration"))
        {
            PlayerPrefs.DeleteKey(prefName);
        }

        // Show download progress or indicate assets are being loaded.
        GUI.enabled = true;
        if (!usingLatestConfig)
        {
            float  progress = generator.CurrentConfigProgress;
            string status   = "Loading";
            if (progress != 1)
            {
                status = "Downloading " + (int)(progress * 100) + "%";
            }
            GUILayout.Box(status);
        }

        GUILayout.EndArea();
    }
Ejemplo n.º 3
0
    void OnGUI()
    {
        //TestGUI();

        if (stage == 0)         //Stage 0 is the login screen
        {
            LoginScreen();
        }         //end of stage 0


        if (stage == 1)        //stage 1 is the character selection screen
        {
            if (generator == null)
            {
                return;
            }
            GUI.enabled = usingLatestConfig && !character.animation.IsPlaying("walkin");
            GUILayout.BeginArea(new Rect(10, 10, typeWidth + 2 * buttonWidth + 8, 500));

            // Buttons for changing the active character.
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("<", GUILayout.Width(buttonWidth)))
            {
                ChangeCharacter(false);
            }

            GUILayout.Box("Character", GUILayout.Width(typeWidth));

            if (GUILayout.Button(">", GUILayout.Width(buttonWidth)))
            {
                ChangeCharacter(true);
            }

            GUILayout.EndHorizontal();

            // Buttons for changing character elements.
            AddCategory("face", "Head", null);
            AddCategory("eyes", "Eyes", null);
            AddCategory("hair", "Hair", null);
            AddCategory("top", "Body", "item_shirt");
            AddCategory("pants", "Legs", "item_pants");
            AddCategory("shoes", "Feet", "item_boots");


            // Buttons for saving and deleting configurations.
            // In a real world application you probably want store these
            // preferences on a server, but for this demo configurations
            // are saved locally using PlayerPrefs.
            if (GUILayout.Button("Save Configuration"))
            {
                PlayerPrefs.SetString(prefName, generator.GetConfig());
            }

            if (GUILayout.Button("Delete Configuration"))
            {
                PlayerPrefs.DeleteKey(prefName);
            }

            // Show download progress or indicate assets are being loaded.
            GUI.enabled = true;
            if (!usingLatestConfig)
            {
                float  progress = generator.CurrentConfigProgress;
                string status   = "Loading";
                if (progress != 1)
                {
                    status = "Downloading " + (int)(progress * 100) + "%";
                }
                GUILayout.Box(status);
            }

            GUILayout.EndArea();

            /*
             *      if(GUI.Button(new Rect(Screen.width-190,Screen.height-140,180,60), "Unlock Customizations"))
             *
             *      {
             *              Unlock uk = GameObject.Find("Unlock").GetComponent<Unlock>();
             *              uk.UnlockEnabled = true;
             *              stage = 2;
             *      }
             */

            if (GUI.Button(new Rect(Screen.width - 190, Screen.height - 70, 180, 60), "Purchase Current Selections"))

            {
                StoreFront sf = GameObject.Find("StoreFront").GetComponent <StoreFront>();
                sf.SetStoreFrontProductPrice();
                sf.StoreFrontEnabled = true;
                stage = 2;
            }
        }    //end of stage 1

        if (stage == 5)
        {
            int confirmButtonX = Screen.width / 2 - 65;
            int confirmButtonY = Screen.height / 2;
            GUI.Box(new Rect(confirmButtonX - 25, confirmButtonY - 20, 280, 100), "Your purchase has been proccessed. \n Thank you for shopping with Co-Op and Co!");

            if (GUI.Button(new Rect(confirmButtonX + 75, confirmButtonY + 20, 80, 40), "Contiune"))
            {
                stage = 1;
            }
        }
    }
Ejemplo n.º 4
0
    void OnGUI()
    {
        if (generator == null)
        {
            return;
        }
        GUI.enabled = usingLatestConfig && !character.animation.IsPlaying("walkin") &&
                      speechResult == null && !displayHelp && !displayChangeCharacterPrompt &&   //A popup is displayed
                      propertiesToChange == null && !isRecording && !showProcess;

        if (!skinSetup)
        {
            generateSkinStyling();
            skinSetup = true;
        }

        GUILayout.BeginArea(new Rect(10, 10, typeWidth + buttonWidth + 4, 600));

        // Buttons for changing the active character.
        GUILayout.BeginHorizontal();

        GUILayout.Box("Character", GUILayout.Width(typeWidth));

        if (GUILayout.Button(">", GUILayout.Width(buttonWidth)))
        {
            ChangeCharacter(true);
        }

        GUILayout.EndHorizontal();

        AddCategory("face", null);
        AddCategory("eyes", null);
        AddCategory("hair", null);
        AddCategory("top", "item_shirt");
        AddCategory("pants", "item_pants");
        AddCategory("shoes", "item_boots");

        // Buttons for saving and deleting configurations.
        // In a real world application you probably want store these
        // preferences on a server, but for this demo configurations
        // are saved locally using PlayerPrefs.
        if (GUILayout.Button("Save Configuration"))
        {
            PlayerPrefs.SetString(prefName, generator.GetConfig());
        }

        if (GUILayout.Button("Delete Configuration"))
        {
            PlayerPrefs.DeleteKey(prefName);
        }

        if (!isRecording && !showProcess)
        {
            if (GUILayout.Button("Speech"))
            {
                ClearPopups();
                StartCoroutine(DoRecording());
            }
        }
        else
        {
            GUI.enabled = true;

            if (isRecording)
            {
                TimeSpan ts = endTime.Subtract(DateTime.Now);
                GUILayout.Box("Recording... " + ts.Seconds);
            }
            else
            {
                GUILayout.Box("Processing...");
            }
        }

        if (!string.IsNullOrEmpty(speechOutput))
        {
            OnSpeechReady(speechOutput);
            speechOutput = string.Empty;
        }

        GUI.enabled = true;

        //Show windows
        Rect windowRec = new Rect((Screen.width - windowWidth) / 2, 10, windowWidth, windowHeight);

        if (speechResult != null)
        {
            GUI.Window(0, windowRec, DidNotUnderstandWindow, "Did Not Understand");
        }
        else if (displayHelp)
        {
            GUI.Window(1, windowRec, HelpWindow, "Speech Help");
        }
        else if (displayChangeCharacterPrompt)
        {
            GUI.Window(2, windowRec, CharacterChangeConfirmationWindow, "Change Character?");
        }
        else if (propertiesToChange != null)
        {
            GUI.Window(3, windowRec, TraitConfirmationWindow, "Trait Changes");
        }

        // Show download progress or indicate assets are being loaded.
        if (!usingLatestConfig)
        {
            float  progress = generator.CurrentConfigProgress;
            string status   = "Loading";
            if (progress != 1)
            {
                status = "Downloading " + (int)(progress * 100) + "%";
            }
            GUILayout.Box(status);
        }

        GUILayout.EndArea();
    }
Ejemplo n.º 5
0
    void OnGUI()
    {
        if (generator == null)
        {
            return;
        }
        GUI.enabled = usingLatestConfig;// && !character.animation.IsPlaying("walkin");
        GUILayout.BeginArea(new Rect(10, 10, typeWidth + 2 * buttonWidth + 8, 500));

        // Buttons for changing character elements.
        AddCategory("head", "Head", null);
        AddCategory("torso", "Torso", null);
        AddCategory("pants", "Pants", null);
        AddCategory("boots", "Boots", null);

        // Buttons for saving and deleting configurations.
        // In a real world application you probably want store these
        // preferences on a server, but for this demo configurations
        // are saved locally using PlayerPrefs.
        if (GUILayout.Button("Save Configuration"))
        {
            PlayerPrefs.SetString(prefName, generator.GetConfig());
        }

        if (GUILayout.Button("Delete Configuration"))
        {
            PlayerPrefs.DeleteKey(prefName);
        }

        // Show download progress or indicate assets are being loaded.
        GUI.enabled = true;
        if (!usingLatestConfig)
        {
            float  progress = generator.CurrentConfigProgress;
            string status   = "Loading";
            if (progress != 1)
            {
                status = "Downloading " + (int)(progress * 100) + "%";
            }
            GUILayout.Box(status);
        }

        defaultRotate = GUILayout.Toggle(defaultRotate, "Default Rotation");

        GUILayout.Box("Max. Players (4)");

        maxPlayers = GUILayout.TextField(maxPlayers, GUILayout.Width(30));

        if (GUILayout.Button(buttonString, GUILayout.Width(100)))
        {
            if (!searchingRoom)
            {
                buttonString  = "Cancel";
                searchingRoom = true;

                PlayerStats.config = generator.GetConfig();

                if (SmartFoxConnection.hasConnection)
                {
                    SearchForRooms();
                }
                else
                {
                    StartCoroutine(SceneChanger.ChangeScene("Baskin-Arena"));
                }
            }
            else
            {
                buttonString  = "Play";
                searchingRoom = false;

                if (SmartFoxConnection.hasConnection)
                {
                    CancelRoomSearch();
                }
            }
        }

        GUILayout.EndArea();
    }