Exemple #1
0
    // Draw
    public override void Draw()
    {
        custom = InGameLobby.instance.displayedAccount.custom;
        if (custom == null)
        {
            return;
        }

        int     padding = 4;
        int     width   = (int)GUIArea.width / 4;
        Vector3 minRGB  = new Vector3(0.05f, 0.05f, 0.05f);

        GUILayout.BeginArea(new Rect(GUIArea.width - width + padding, padding, width - padding * 2, GUIArea.height - padding * 2));
        using (new GUIVertical("box")) {
            using (new GUIScrollView(ref scrollPosition)) {
                using (new GUIHorizontal()) {
                    GUI.enabled = false;
                    GUILayout.Button("Male", GUILayout.Width(70));
                    GUILayout.Button("Female", GUILayout.Width(70));
                    GUI.enabled = true;
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Coming soon!");
                }

                GUILayout.Label("Height:");
                custom.height = GUILayout.HorizontalSlider(custom.height, 0f, 1f);

                using (new GUIHorizontal()) {
                    GUILayout.Label("Voice:");
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(voicePlayButtonContent))
                    {
                        if (GameManager.inGame)
                        {
                            if (Player.main != null)
                            {
                                Player.main.audio.clip = Magic.instance.randomCastVoiceClip;
                                Player.main.audio.Play();
                            }
                        }
                        else
                        {
                            CharacterPreview.instance.audio.clip = Magic.instance.randomCastVoiceClip;
                            CharacterPreview.instance.audio.Play();
                        }
                    }
                }
                //using(new GUIHorizontal()) {
                //GUILayout.Label("Mature", GUILayout.Width(60f));
                //using(new GUIVertical()) {
                //GUILayout.Space(2);
                custom.voicePitch = GUILayout.HorizontalSlider(custom.voicePitch, 0f, 1f);
                if (GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
                {
                    GUI.tooltip = "Childish <-----> Mature";
                }
                //}
                //GUILayout.Label("Childish", GUILayout.Width(60f));
                //}

                GUILayout.Label("Hair color:");
                custom.hairColor = GUIHelper.ColorPicker(custom.hairColor, minRGB);

                GUILayout.Label("Eye color:");
                custom.eyeColor = GUIHelper.ColorPicker(custom.eyeColor, new Vector3(0.3f, 0.3f, 0.3f));

                GUILayout.Label("Eye background color:");
                custom.eyeBackgroundColor = GUIHelper.ColorPicker(custom.eyeBackgroundColor, minRGB);

                GUILayout.Label("Cloak color:");
                custom.cloakColor = GUIHelper.ColorPicker(custom.cloakColor, minRGB);

                GUILayout.Label("Topwear color:");
                custom.topWearColor = GUIHelper.ColorPicker(custom.topWearColor, minRGB);

                GUILayout.Label("Legwear color:");
                custom.legWearColor = GUIHelper.ColorPicker(custom.legWearColor, minRGB);

                GUILayout.Label("Boots color:");
                custom.bootsColor = GUIHelper.ColorPicker(custom.bootsColor, minRGB);
            }

            GUILayout.FlexibleSpace();

            if (Player.main == null)
            {
                if (GUIHelper.Button("Finish"))
                {
                    Sounds.instance.buttonClick.Play();
                    SendCustomization();
                }
            }
        }
        GUILayout.EndArea();

        // Visualize changes
        UpdateCustomization();
    }