UnityEngine.GUILayout.EndHorizontal()

Here are the examples of the csharp api UnityEngine.GUILayout.EndHorizontal() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

906 Examples 7

19 View Source File : MoreGUILayout.cs
License : MIT License
Project Creator : PizzaLovers007

public static (float, float) NamedSliderPair(
            string name1,
            string name2,
            float value1,
            float value2,
            float leftValue,
            float rightValue,
            float sliderWidth,
            float roundNearest = 0,
            float labelWidth = 0,
            string valueFormat = "{0}") {
            GUILayout.BeginHorizontal();
            float newValue1 =
                NamedSliderContent(
                    name1,
                    value1,
                    leftValue,
                    rightValue,
                    sliderWidth,
                    roundNearest,
                    labelWidth,
                    valueFormat);
            float newValue2 =
                NamedSliderContent(
                    name2,
                    value2,
                    leftValue,
                    rightValue,
                    sliderWidth,
                    roundNearest,
                    labelWidth,
                    valueFormat);
            GUILayout.EndHorizontal();
            return (newValue1, newValue2);
        }

19 View Source File : MoreGUILayout.cs
License : MIT License
Project Creator : PizzaLovers007

public static string NamedTextField(
            string name,
            string value,
            float fieldWidth,
            float labelWidth = 0) {
            GUILayout.BeginHorizontal();
            string newValue = NamedTextFieldContent(name, value, fieldWidth, labelWidth);
            GUILayout.EndHorizontal();
            return newValue;
        }

19 View Source File : MoreGUILayout.cs
License : MIT License
Project Creator : PizzaLovers007

public static (string, string) NamedTextFieldPair(
            string name1,
            string name2,
            string value1,
            string value2,
            float fieldWidth,
            float labelWidth = 0) {
            GUILayout.BeginHorizontal();
            string newValue1 = NamedTextFieldContent(name1, value1, fieldWidth, labelWidth);
            string newValue2 = NamedTextFieldContent(name2, value2, fieldWidth, labelWidth);
            GUILayout.EndHorizontal();
            return (newValue1, newValue2);
        }

19 View Source File : MoreGUILayout.cs
License : MIT License
Project Creator : PizzaLovers007

public static bool ToggleList<T>(List<T> list, ref int selectedIndex, Func<T, string> nameFunc) {
            bool changed = false;
            int moveUp = -1, moveDown = -1;
            for (int i = 0; i < list.Count; i++) {
                T curr = list[i];
                string name = nameFunc.Invoke(curr);
                GUILayout.BeginHorizontal();

                // Move up/down
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("▲") && i > 0) {
                    moveUp = i;
                }
                if (GUILayout.Button("▼") && i < list.Count - 1) {
                    moveDown = i;
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(8f);

                if (GUILayout.Toggle(selectedIndex == i, name) && selectedIndex != i) {
                    selectedIndex = i;
                    changed = true;
                }
                GUILayout.FlexibleSpace();

                GUILayout.EndHorizontal();
            }
            if (moveUp != -1) {
                changed = true;
                T temp = list[moveUp];
                list[moveUp] = list[moveUp - 1];
                list[moveUp - 1] = temp;
                if (moveUp - 1 == selectedIndex) {
                    selectedIndex++;
                } else if (moveUp == selectedIndex) {
                    selectedIndex--;
                }
            } else if (moveDown != -1) {
                changed = true;
                T temp = list[moveDown];
                list[moveDown] = list[moveDown + 1];
                list[moveDown + 1] = temp;
                if (moveDown + 1 == selectedIndex) {
                    selectedIndex--;
                } else if (moveDown == selectedIndex) {
                    selectedIndex++;
                }
            }

            return changed;
        }

19 View Source File : TweakRunner.cs
License : MIT License
Project Creator : PizzaLovers007

internal void OnGUI() {
            // Draw header
            GUILayout.BeginHorizontal();
            bool newIsExpanded = GUILayout.Toggle(
                Settings.IsExpanded,
                Settings.IsEnabled ? (Settings.IsExpanded ? "◢" : "▶") : "",
                new GUIStyle() {
                    fixedWidth = 10,
                    normal = new GUIStyleState() { textColor = Color.white },
                    fontSize = 15,
                    margin = new RectOffset(4, 2, 6, 6),
                });
            bool newIsEnabled = GUILayout.Toggle(
                Settings.IsEnabled,
                Tweak.Name,
                new GUIStyle(GUI.skin.toggle) {
                    fontStyle = GlobalSettings.Language.IsSymbolLanguage()
                        ? FontStyle.Normal
                        : FontStyle.Bold,
                    font = GlobalSettings.Language.IsSymbolLanguage()
                        ? Tweakreplacedets.KoreanBoldFont
                        : null,
                    margin = new RectOffset(0, 4, 4, 4),
                });
            GUILayout.Label("-");
            GUILayout.Label(
                Tweak.Description,
                new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Italic });
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            // Handle enable/disable change
            if (newIsEnabled != Settings.IsEnabled) {
                Settings.IsEnabled = newIsEnabled;
                if (newIsEnabled) {
                    EnableTweak();
                    newIsExpanded = true;
                } else {
                    DisableTweak();
                }
            }

            // Handle expand/collapse change
            if (newIsExpanded != Settings.IsExpanded) {
                Settings.IsExpanded = newIsExpanded;
                if (!newIsExpanded) {
                    Tweak.OnHideGUI();
                }
            }

            // Draw custom options
            if (Settings.IsExpanded && Settings.IsEnabled) {
                GUILayout.BeginHorizontal();
                GUILayout.Space(24f);
                GUILayout.BeginVertical();
                Tweak.OnSettingsGUI();
#if DEBUG
                OnDebugGUI();
#endif
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                GUILayout.Space(12f);
            }
        }

19 View Source File : DisableEffectsTweak.cs
License : MIT License
Project Creator : PizzaLovers007

public override void OnSettingsGUI() {
            // Filter
            GUILayout.BeginHorizontal();
            if (Settings.DisableFilter =
                GUILayout.Toggle(
                    Settings.DisableFilter,
                    TweakStrings.Get(
                        TranslationKeys.DisableEffects.FILTER,
                        RDString.GetEnumValue(Filter.Grayscale),
                        RDString.GetEnumValue(Filter.Arcade))))
            {
                // Exclude specific filter from being disabled
                if (GUILayout.Button(TweakStrings.Get(TranslationKeys.DisableEffects.EXCLUDE_FILTER_LIST, Settings.FilterExcludeList.Count)))
                {
                    DisplayList = !DisplayList;
                }

                if (DisplayList)
                {
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10f);
                    GUILayout.Label(TweakStrings.Get(TranslationKeys.DisableEffects.EXCLUDE_FILTER_START_LIST));

                    GUILayout.BeginHorizontal();
                    GUILayout.Space(20f);

                    scrollPosition = GUILayout.BeginScrollView(
                        scrollPosition, GUILayout.Height(140f));
                    foreach (Filter f in Enum.GetValues(typeof(Filter)))
                    {
                        bool flag = GUILayout.Toggle(FilterExcludeDict[f], RDString.GetEnumValue(f));
                        if (FilterExcludeDict[f] != flag)
                        {
                            FilterExcludeDict[f] = flag;
                            UpdateExcludeList();
                        }
                    }
                    GUILayout.EndScrollView();
                }
            }

            GUILayout.EndHorizontal();

            // Bloom
            Settings.DisableBloom =
                GUILayout.Toggle(
                    Settings.DisableBloom,
                    TweakStrings.Get(TranslationKeys.DisableEffects.BLOOM));

            // Flash
            Settings.DisableFlash =
                GUILayout.Toggle(
                    Settings.DisableFlash,
                    TweakStrings.Get(TranslationKeys.DisableEffects.FLASH));

            // Hall of mirrors
            Settings.DisableHallOfMirrors =
                GUILayout.Toggle(
                    Settings.DisableHallOfMirrors,
                    TweakStrings.Get(
                        TranslationKeys.DisableEffects.HALL_OF_MIRRORS,
                        RDString.Get("editor." + LevelEventType.HallOfMirrors)));

            // Screen shake
            Settings.DisableScreenShake =
                GUILayout.Toggle(
                    Settings.DisableScreenShake,
                    TweakStrings.Get(TranslationKeys.DisableEffects.SCREEN_SHAKE));

            // Move track
            string trackMaxFormat =
                Settings.MoveTrackMax > DisableEffectsSettings.MOVE_TRACK_UPPER_BOUND
                    ? TweakStrings.Get(TranslationKeys.DisableEffects.TILE_MOVEMENT_UNLIMITED)
                    : "{0}";
            float newTrackMax =
                MoreGUILayout.NamedSlider(
                    TweakStrings.Get(TranslationKeys.DisableEffects.TILE_MOVEMENT_MAX),
                    Settings.MoveTrackMax,
                    5,
                    DisableEffectsSettings.MOVE_TRACK_UPPER_BOUND + 5,
                    300f,
                    roundNearest: 5,
                    valueFormat: trackMaxFormat);
            Settings.MoveTrackMax = Mathf.RoundToInt(newTrackMax);
        }

19 View Source File : KeyLimiterTweak.cs
License : MIT License
Project Creator : PizzaLovers007

private void DrawKeyRegisterSettingsGUI() {
            // List of registered keys
            GUILayout.Label(TweakStrings.Get(TranslationKeys.KeyLimiter.REGISTERED_KEYS));
            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            GUILayout.BeginVertical();
            GUILayout.Space(8f);
            GUILayout.EndVertical();
            foreach (KeyCode code in Settings.ActiveKeys) {
                GUILayout.Label(code.ToString());
                GUILayout.Space(8f);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(12f);

            // Record keys toggle
            GUILayout.BeginHorizontal();
            if (Settings.IsListening) {
                if (GUILayout.Button(TweakStrings.Get(TranslationKeys.KeyLimiter.DONE))) {
                    Settings.IsListening = false;
                }
                GUILayout.Label(TweakStrings.Get(TranslationKeys.KeyLimiter.PRESS_KEY_REGISTER));
            } else {
                if (GUILayout.Button(TweakStrings.Get(TranslationKeys.KeyLimiter.CHANGE_KEYS))) {
                    Settings.IsListening = true;
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            // Limit CLS toggle
            Settings.LimitKeyOnCLS =
                GUILayout.Toggle(
                    Settings.LimitKeyOnCLS, TweakStrings.Get(TranslationKeys.KeyLimiter.LIMIT_CLS));

            // Limit main menu toggle
            Settings.LimitKeyOnMainScreen =
                GUILayout.Toggle(
                    Settings.LimitKeyOnMainScreen,
                    TweakStrings.Get(TranslationKeys.KeyLimiter.LIMIT_MAIN_MENU));
        }

19 View Source File : KeyViewerTweak.cs
License : MIT License
Project Creator : PizzaLovers007

private void DrawProfileSettingsGUI() {
            GUILayout.Space(4f);

            // New, Duplicate, Delete buttons
            GUILayout.BeginHorizontal();
            if (GUILayout.Button(
                TweakStrings.Get(TranslationKeys.KeyViewer.NEW))) {
                Settings.Profiles.Add(new KeyViewerProfile());
                Settings.ProfileIndex = Settings.Profiles.Count - 1;
                Settings.CurrentProfile.Name += "Profile " + Settings.Profiles.Count;
                keyViewer.Profile = Settings.CurrentProfile;
            }
            if (GUILayout.Button(
                TweakStrings.Get(TranslationKeys.KeyViewer.DUPLICATE))) {
                Settings.Profiles.Add(Settings.CurrentProfile.Copy());
                Settings.ProfileIndex = Settings.Profiles.Count - 1;
                Settings.CurrentProfile.Name += " Copy";
                keyViewer.Profile = Settings.CurrentProfile;
            }
            if (Settings.Profiles.Count > 1
                && GUILayout.Button(
                    TweakStrings.Get(TranslationKeys.KeyViewer.DELETE))) {
                Settings.Profiles.RemoveAt(Settings.ProfileIndex);
                Settings.ProfileIndex =
                    Math.Min(Settings.ProfileIndex, Settings.Profiles.Count - 1);
                keyViewer.Profile = Settings.CurrentProfile;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.Space(4f);

            // Profile name
            Settings.CurrentProfile.Name =
                MoreGUILayout.NamedTextField(
                    TweakStrings.Get(TranslationKeys.KeyViewer.PROFILE_NAME),
                    Settings.CurrentProfile.Name,
                    400f);

            // Profile list
            GUILayout.Label(TweakStrings.Get(TranslationKeys.KeyViewer.PROFILES));
            int selected = Settings.ProfileIndex;
            if (MoreGUILayout.ToggleList(Settings.Profiles, ref selected, p => p.Name)) {
                Settings.ProfileIndex = selected;
                keyViewer.Profile = Settings.CurrentProfile;
            }
        }

19 View Source File : KeyViewerTweak.cs
License : MIT License
Project Creator : PizzaLovers007

private void DrawKeyRegisterSettingsGUI() {
            // List of registered keys
            GUILayout.Label(TweakStrings.Get(TranslationKeys.KeyViewer.REGISTERED_KEYS));
            GUILayout.BeginHorizontal();
            GUILayout.Space(20f);
            GUILayout.BeginVertical();
            GUILayout.Space(8f);
            GUILayout.EndVertical();
            foreach (KeyCode code in CurrentProfile.ActiveKeys) {
                GUILayout.Label(code.ToString());
                GUILayout.Space(8f);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(12f);

            // Record keys toggle
            GUILayout.BeginHorizontal();
            if (Settings.IsListening) {
                if (GUILayout.Button(TweakStrings.Get(TranslationKeys.KeyViewer.DONE))) {
                    Settings.IsListening = false;
                }
                GUILayout.Label(TweakStrings.Get(TranslationKeys.KeyViewer.PRESS_KEY_REGISTER));
            } else {
                if (GUILayout.Button(TweakStrings.Get(TranslationKeys.KeyViewer.CHANGE_KEYS))) {
                    Settings.IsListening = true;
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

19 View Source File : PlanetColorTweak.cs
License : MIT License
Project Creator : PizzaLovers007

public override void OnSettingsGUI() {
            Color newBody, newTail;
            string newHex, newTailHex;

            GUILayout.Label(TweakStrings.Get(TranslationKeys.PlanetColor.PLANET_ONE));
            MoreGUILayout.BeginIndent();

            GUILayout.BeginHorizontal();
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.PlanetColor.BODY), GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(8f);
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.PlanetColor.TAIL), GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(20f);
            GUILayout.EndHorizontal();
            MoreGUILayout.BeginIndent();

            // Planet 1 RGB sliders
            (newBody, newTail) =
                MoreGUILayout.ColorRgbSlidersPair(Settings.Color1, Settings.TailColor1);
            if (Settings.Color1 != newBody) {
                Settings.Color1 = newBody;
                UpdatePlanetColors();
            }
            if (Settings.TailColor1 != newTail) {
                Settings.TailColor1 = newTail;
                UpdatePlanetColors();
            }

            // Planet 1 Hex
            (newHex, newTailHex) =
                MoreGUILayout.NamedTextFieldPair(
                    "Hex:", "Hex:", Settings.Color1Hex, Settings.TailColor1Hex, 100f, 40f);
            if (newHex != Settings.Color1Hex
                && ColorUtility.TryParseHtmlString($"#{newHex}", out newBody)) {
                Settings.Color1 = newBody;
                UpdatePlanetColors();
            }
            if (newTailHex != Settings.TailColor1Hex
                && ColorUtility.TryParseHtmlString($"#{newTailHex}", out newTail)) {
                Settings.TailColor1 = newTail;
                UpdatePlanetColors();
            }
            Settings.Color1Hex = newHex;
            Settings.TailColor1Hex = newTailHex;

            MoreGUILayout.EndIndent();

            MoreGUILayout.EndIndent();

            GUILayout.Space(8f);

            GUILayout.Label(TweakStrings.Get(TranslationKeys.PlanetColor.PLANET_TWO));
            MoreGUILayout.BeginIndent();

            GUILayout.BeginHorizontal();
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.PlanetColor.BODY), GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(8f);
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.PlanetColor.TAIL), GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(20f);
            GUILayout.EndHorizontal();
            MoreGUILayout.BeginIndent();

            // Planet 2 RGB sliders
            (newBody, newTail) =
                MoreGUILayout.ColorRgbSlidersPair(Settings.Color2, Settings.TailColor2);
            if (Settings.Color2 != newBody) {
                Settings.Color2 = newBody;
                UpdatePlanetColors();
            }
            if (Settings.TailColor2 != newTail) {
                Settings.TailColor2 = newTail;
                UpdatePlanetColors();
            }

            // Planet 2 Hex
            (newHex, newTailHex) =
                MoreGUILayout.NamedTextFieldPair(
                    "Hex:", "Hex:", Settings.Color2Hex, Settings.TailColor2Hex, 100f, 40f);
            if (newHex != Settings.Color2Hex
                && ColorUtility.TryParseHtmlString($"#{newHex}", out newBody)) {
                Settings.Color2 = newBody;
                UpdatePlanetColors();
            }
            if (newTailHex != Settings.TailColor2Hex
                && ColorUtility.TryParseHtmlString($"#{newTailHex}", out newTail)) {
                Settings.TailColor2 = newTail;
                UpdatePlanetColors();
            }
            Settings.Color2Hex = newHex;
            Settings.TailColor2Hex = newTailHex;

            MoreGUILayout.EndIndent();

            MoreGUILayout.EndIndent();
        }

19 View Source File : JudgmentVisualsTweak.cs
License : MIT License
Project Creator : PizzaLovers007

public override void OnSettingsGUI() {
            Settings.ShowHitErrorMeter =
                GUILayout.Toggle(
                    Settings.ShowHitErrorMeter,
                    TweakStrings.Get(TranslationKeys.JudgmentVisuals.SHOW_HIT_ERROR_METER));

            if (Settings.ShowHitErrorMeter) {
                MoreGUILayout.BeginIndent();

                // Scale slider
                float newScale =
                    MoreGUILayout.NamedSlider(
                        TweakStrings.Get(TranslationKeys.JudgmentVisuals.ERROR_METER_SCALE),
                        Settings.ErrorMeterScale,
                        0.25f,
                        4f,
                        200f,
                        roundNearest: 0.125f,
                        valueFormat: "{0}x");
                if (newScale != Settings.ErrorMeterScale) {
                    Settings.ErrorMeterScale = newScale;
                    HitErrorMeter.Instance.UpdateLayout();
                }

                // X position slider
                float newX =
                    MoreGUILayout.NamedSlider(
                        TweakStrings.Get(TranslationKeys.JudgmentVisuals.ERROR_METER_X_POS),
                        Settings.ErrorMeterXPos,
                        0f,
                        1f,
                        300f,
                        roundNearest: 0.01f,
                        valueFormat: "{0:0.##}");
                if (newX != Settings.ErrorMeterXPos) {
                    Settings.ErrorMeterXPos = newX;
                    HitErrorMeter.Instance.UpdateLayout();
                }

                // Y position slider
                float newY =
                    MoreGUILayout.NamedSlider(
                        TweakStrings.Get(TranslationKeys.JudgmentVisuals.ERROR_METER_Y_POS),
                        Settings.ErrorMeterYPos,
                        0f,
                        1f,
                        300f,
                        roundNearest: 0.01f,
                        valueFormat: "{0:0.##}");
                if (newY != Settings.ErrorMeterYPos) {
                    Settings.ErrorMeterYPos = newY;
                    HitErrorMeter.Instance.UpdateLayout();
                }

                // Tick life slider
                Settings.ErrorMeterTickLife =
                    MoreGUILayout.NamedSlider(
                        TweakStrings.Get(TranslationKeys.JudgmentVisuals.ERROR_METER_TICK_LIFE),
                        Settings.ErrorMeterTickLife,
                        1f,
                        10f,
                        200f,
                        roundNearest: 1f,
                        valueFormat: TweakStrings.Get(
                            TranslationKeys.JudgmentVisuals.ERROR_METER_TICK_SECONDS));

                // Sensitivity slider
                GUILayout.BeginHorizontal();
                GUILayout.Label(
                    TweakStrings.Get(TranslationKeys.JudgmentVisuals.ERROR_METER_SENSITIVITY));
                GUILayout.Space(16f);
                GUILayout.Label(
                    TweakStrings.Get(TranslationKeys.JudgmentVisuals.ERROR_METER_MORE_STABLE));
                GUILayout.Space(8f);
                float newSens =
                    GUILayout.HorizontalSlider(
                        Settings.ErrorMeterSensitivity, 0.05f, 0.5f, GUILayout.Width(200f));
                newSens *= 20;
                newSens = Mathf.Round(newSens);
                newSens /= 20;
                if (Settings.ErrorMeterSensitivity != newSens) {
                    Settings.ErrorMeterSensitivity = newSens;
                }
                GUILayout.Space(8f);
                GUILayout.Label(
                    TweakStrings.Get(TranslationKeys.JudgmentVisuals.ERROR_METER_LESS_STABLE));
                GUILayout.Space(8f);
                GUILayout.Label($"({Settings.ErrorMeterSensitivity})");
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                MoreGUILayout.EndIndent();
            }

            // Hide perfects
            Settings.HidePerfects =
                GUILayout.Toggle(
                    Settings.HidePerfects,
                    TweakStrings.Get(
                        TranslationKeys.JudgmentVisuals.HIDE_PERFECTS,
                        RDString.Get("HitMargin." + HitMargin.Perfect)));
        }

19 View Source File : KeyViewerTweak.cs
License : MIT License
Project Creator : PizzaLovers007

private void DrawKeyViewerSettingsGUI() {
            MoreGUILayout.BeginIndent();

            // Show only in gameplay toggle
            CurrentProfile.ViewerOnlyGameplay =
                GUILayout.Toggle(
                    CurrentProfile.ViewerOnlyGameplay,
                    TweakStrings.Get(TranslationKeys.KeyViewer.VIEWER_ONLY_GAMEPLAY));

            // Animate keys toggle
            CurrentProfile.AnimateKeys =
                GUILayout.Toggle(
                    CurrentProfile.AnimateKeys,
                    TweakStrings.Get(TranslationKeys.KeyViewer.ANIMATE_KEYS));

            // Key press total toggle
            bool newShowTotal =
                GUILayout.Toggle(
                    CurrentProfile.ShowKeyPressTotal,
                    TweakStrings.Get(TranslationKeys.KeyViewer.SHOW_KEY_PRESS_TOTAL));
            if (newShowTotal != CurrentProfile.ShowKeyPressTotal) {
                CurrentProfile.ShowKeyPressTotal = newShowTotal;
                keyViewer.UpdateLayout();
            }

            // Size slider
            float newSize =
                MoreGUILayout.NamedSlider(
                    TweakStrings.Get(TranslationKeys.KeyViewer.KEY_VIEWER_SIZE),
                    CurrentProfile.KeyViewerSize,
                    10f,
                    200f,
                    300f,
                    roundNearest: 1f);
            if (newSize != CurrentProfile.KeyViewerSize) {
                CurrentProfile.KeyViewerSize = newSize;
                keyViewer.UpdateLayout();
            }

            // X position slider
            float newX =
                MoreGUILayout.NamedSlider(
                    TweakStrings.Get(TranslationKeys.KeyViewer.KEY_VIEWER_X_POS),
                    CurrentProfile.KeyViewerXPos,
                    0f,
                    1f,
                    300f,
                    roundNearest: 0.01f,
                    valueFormat: "{0:0.##}");
            if (newX != CurrentProfile.KeyViewerXPos) {
                CurrentProfile.KeyViewerXPos = newX;
                keyViewer.UpdateLayout();
            }

            // Y position slider
            float newY =
                MoreGUILayout.NamedSlider(
                    TweakStrings.Get(TranslationKeys.KeyViewer.KEY_VIEWER_Y_POS),
                    CurrentProfile.KeyViewerYPos,
                    0f,
                    1f,
                    300f,
                    roundNearest: 0.01f,
                    valueFormat: "{0:0.##}");
            if (newY != CurrentProfile.KeyViewerYPos) {
                CurrentProfile.KeyViewerYPos = newY;
                keyViewer.UpdateLayout();
            }

            GUILayout.Space(8f);

            Color newPressed, newReleased;
            string newPressedHex, newReleasedHex;

            // Outline color header
            GUILayout.BeginHorizontal();
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.KeyViewer.PRESSED_OUTLINE_COLOR),
                GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(8f);
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.KeyViewer.RELEASED_OUTLINE_COLOR),
                GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(20f);
            GUILayout.EndHorizontal();
            MoreGUILayout.BeginIndent();

            // Outline color RGBA sliders
            (newPressed, newReleased) =
                MoreGUILayout.ColorRgbaSlidersPair(
                    CurrentProfile.PressedOutlineColor, CurrentProfile.ReleasedOutlineColor);
            if (newPressed != CurrentProfile.PressedOutlineColor) {
                CurrentProfile.PressedOutlineColor = newPressed;
                keyViewer.UpdateLayout();
            }
            if (newReleased != CurrentProfile.ReleasedOutlineColor) {
                CurrentProfile.ReleasedOutlineColor = newReleased;
                keyViewer.UpdateLayout();
            }

            // Outline color hex
            (newPressedHex, newReleasedHex) =
                MoreGUILayout.NamedTextFieldPair(
                    "Hex:",
                    "Hex:",
                    CurrentProfile.PressedOutlineColorHex,
                    CurrentProfile.ReleasedOutlineColorHex,
                    100f,
                    40f);
            if (newPressedHex != CurrentProfile.PressedOutlineColorHex
                && ColorUtility.TryParseHtmlString($"#{newPressedHex}", out newPressed)) {
                CurrentProfile.PressedOutlineColor = newPressed;
                keyViewer.UpdateLayout();
            }
            if (newReleasedHex != CurrentProfile.ReleasedOutlineColorHex
                && ColorUtility.TryParseHtmlString($"#{newReleasedHex}", out newReleased)) {
                CurrentProfile.ReleasedOutlineColor = newReleased;
                keyViewer.UpdateLayout();
            }
            CurrentProfile.PressedOutlineColorHex = newPressedHex;
            CurrentProfile.ReleasedOutlineColorHex = newReleasedHex;

            MoreGUILayout.EndIndent();

            GUILayout.Space(8f);

            // Background color header
            GUILayout.BeginHorizontal();
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.KeyViewer.PRESSED_BACKGROUND_COLOR),
                GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(8f);
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.KeyViewer.RELEASED_BACKGROUND_COLOR),
                GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(20f);
            GUILayout.EndHorizontal();
            MoreGUILayout.BeginIndent();

            // Background color RGBA sliders
            (newPressed, newReleased) =
                MoreGUILayout.ColorRgbaSlidersPair(
                    CurrentProfile.PressedBackgroundColor, CurrentProfile.ReleasedBackgroundColor);
            if (newPressed != CurrentProfile.PressedBackgroundColor) {
                CurrentProfile.PressedBackgroundColor = newPressed;
                keyViewer.UpdateLayout();
            }
            if (newReleased != CurrentProfile.ReleasedBackgroundColor) {
                CurrentProfile.ReleasedBackgroundColor = newReleased;
                keyViewer.UpdateLayout();
            }

            // Background color hex
            (newPressedHex, newReleasedHex) =
                MoreGUILayout.NamedTextFieldPair(
                    "Hex:",
                    "Hex:",
                    CurrentProfile.PressedBackgroundColorHex,
                    CurrentProfile.ReleasedBackgroundColorHex,
                    100f,
                    40f);
            if (newPressedHex != CurrentProfile.PressedBackgroundColorHex
                && ColorUtility.TryParseHtmlString($"#{newPressedHex}", out newPressed)) {
                CurrentProfile.PressedBackgroundColor = newPressed;
                keyViewer.UpdateLayout();
            }
            if (newReleasedHex != CurrentProfile.ReleasedBackgroundColorHex
                && ColorUtility.TryParseHtmlString($"#{newReleasedHex}", out newReleased)) {
                CurrentProfile.ReleasedBackgroundColor = newReleased;
                keyViewer.UpdateLayout();
            }
            CurrentProfile.PressedBackgroundColorHex = newPressedHex;
            CurrentProfile.ReleasedBackgroundColorHex = newReleasedHex;

            MoreGUILayout.EndIndent();

            GUILayout.Space(8f);

            // Text color header
            GUILayout.BeginHorizontal();
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.KeyViewer.PRESSED_TEXT_COLOR),
                GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(8f);
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.KeyViewer.RELEASED_TEXT_COLOR),
                GUILayout.Width(200f));
            GUILayout.FlexibleSpace();
            GUILayout.Space(20f);
            GUILayout.EndHorizontal();
            MoreGUILayout.BeginIndent();

            // Text color RGBA sliders
            (newPressed, newReleased) =
                MoreGUILayout.ColorRgbaSlidersPair(
                    CurrentProfile.PressedTextColor, CurrentProfile.ReleasedTextColor);
            if (newPressed != CurrentProfile.PressedTextColor) {
                CurrentProfile.PressedTextColor = newPressed;
                keyViewer.UpdateLayout();
            }
            if (newReleased != CurrentProfile.ReleasedTextColor) {
                CurrentProfile.ReleasedTextColor = newReleased;
                keyViewer.UpdateLayout();
            }

            // Text color hex
            (newPressedHex, newReleasedHex) =
                MoreGUILayout.NamedTextFieldPair(
                    "Hex:",
                    "Hex:",
                    CurrentProfile.PressedTextColorHex,
                    CurrentProfile.ReleasedTextColorHex,
                    100f,
                    40f);
            if (newPressedHex != CurrentProfile.PressedTextColorHex
                && ColorUtility.TryParseHtmlString($"#{newPressedHex}", out newPressed)) {
                CurrentProfile.PressedTextColor = newPressed;
                keyViewer.UpdateLayout();
            }
            if (newReleasedHex != CurrentProfile.ReleasedTextColorHex
                && ColorUtility.TryParseHtmlString($"#{newReleasedHex}", out newReleased)) {
                CurrentProfile.ReleasedTextColor = newReleased;
                keyViewer.UpdateLayout();
            }
            CurrentProfile.PressedTextColorHex = newPressedHex;
            CurrentProfile.ReleasedTextColorHex = newReleasedHex;

            MoreGUILayout.EndIndent();

            MoreGUILayout.EndIndent();
        }

19 View Source File : AdofaiTweaks.cs
License : MIT License
Project Creator : PizzaLovers007

private static void OnGUI(UnityModManager.ModEntry modEntry) {
            // Set some default GUI settings for better layouts
            if (GlobalSettings.Language.IsSymbolLanguage()) {
                GUI.skin.button.font = Tweakreplacedets.SymbolLangNormalFont;
                GUI.skin.label.font = Tweakreplacedets.SymbolLangNormalFont;
                GUI.skin.textArea.font = Tweakreplacedets.SymbolLangNormalFont;
                GUI.skin.textField.font = Tweakreplacedets.SymbolLangNormalFont;
                GUI.skin.toggle.font = Tweakreplacedets.SymbolLangNormalFont;
                GUI.skin.button.fontSize = 15;
                GUI.skin.label.fontSize = 15;
                GUI.skin.textArea.fontSize = 15;
                GUI.skin.textField.fontSize = 15;
                GUI.skin.toggle.fontSize = 15;
            }
            GUI.skin.toggle = new GUIStyle(GUI.skin.toggle) {
                margin = new RectOffset(0, 4, 6, 6),
            };
            GUI.skin.label.wordWrap = false;

            GUILayout.Space(4);

            // Language chooser
            GUILayout.BeginHorizontal();
            GUILayout.Space(4);
            GUILayout.Label(
                TweakStrings.Get(TranslationKeys.Global.GLOBAL_LANGUAGE),
                new GUIStyle(GUI.skin.label) {
                    fontStyle = GlobalSettings.Language.IsSymbolLanguage()
                        ? FontStyle.Normal
                        : FontStyle.Bold,
                    font = GlobalSettings.Language.IsSymbolLanguage()
                        ? Tweakreplacedets.KoreanBoldFont
                        : null,
                });
            foreach (LanguageEnum language in Enum.GetValues(typeof(LanguageEnum))) {
                string langString =
                    TweakStrings.GetForLanguage(TranslationKeys.Global.LANGUAGE_NAME, language);

                // Set special styles for selected and Korean language
                GUIStyle style = new GUIStyle(GUI.skin.button);
                if (language == GlobalSettings.Language) {
                    if (language.IsSymbolLanguage()) {
                        style.font = Tweakreplacedets.KoreanBoldFont;
                        style.fontSize = 15;
                    } else {
                        style.fontStyle = FontStyle.Bold;
                    }
                } else if (language.IsSymbolLanguage()) {
                    style.font = Tweakreplacedets.SymbolLangNormalFont;
                    style.fontSize = 15;
                }

                bool click = GUILayout.Button(langString, style);
                if (click) {
                    GlobalSettings.Language = language;
                    foreach (TweakRunner runner in tweakRunners) {
                        runner.OnLanguageChange();
                    }
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            // Show each tweak's GUI
            GUILayout.Space(4);
            foreach (TweakRunner runner in tweakRunners) {
                runner.OnGUI();
            }

            // Reset GUI settings to defaults
            GUI.skin.button.font = null;
            GUI.skin.label.font = null;
            GUI.skin.textArea.font = null;
            GUI.skin.textField.font = null;
            GUI.skin.toggle.font = null;
            GUI.skin.button.fontSize = 0;
            GUI.skin.label.fontSize = 0;
            GUI.skin.textArea.fontSize = 0;
            GUI.skin.textField.fontSize = 0;
            GUI.skin.toggle.fontSize = 0;

#if DEBUG
            GUILayout.Label($"<color=#a7a7a7><i>This build is a debug build.\nGame Version: r{ReleaseNumber}\nBuild Date: {GCNS.buildDate}\nCurrent Scene: {ADOBase.sceneName}</i></color>");
#endif
        }

19 View Source File : Test.cs
License : MIT License
Project Creator : psygames

private void OnGUI()
    {
        scroll = GUILayout.BeginScrollView(scroll,GUILayout.Width(300));

        // BASE
        GUILayout.BeginVertical("box");
        GUILayout.Label("Base:");
        if (GUILayout.Button("console.log"))
        {
            WebGLKit.Log("test log");
        }

        if (GUILayout.Button("alert"))
        {
            WebGLKit.Alert("test alert");
        }
        GUILayout.EndVertical();

        // OPEN FILE
        GUILayout.BeginVertical("box");
        if (string.IsNullOrEmpty(uploadFileName))
            GUILayout.Label("Try to open a image file:");
        else
            GUILayout.Label("File: " + uploadFileName);
        if (GUILayout.Button("Open File"))
        {
            uploadFileName = "";
            uploadBytes = null;
            uploadTexture = null;
            WebGLKit.OpenFile((filename, bytes) =>
            {
                WebGLKit.Log("file name: " + filename);
                WebGLKit.Log("file size: " + bytes.Length);

                uploadFileName = filename;
                uploadBytes = bytes;
                // Do something else
            });
        }
        if (uploadFileName.EndsWith(".png")
            || uploadFileName.EndsWith(".jpg")
            || uploadFileName.EndsWith(".jpeg"))
        {
            if (uploadTexture == null)
            {
                uploadTexture = new Texture2D(0, 0);
                uploadTexture.LoadImage(uploadBytes);
                uploadBytes = null;
            }
            GUILayout.Box(uploadTexture, GUILayout.Width(266), GUILayout.Height(150));
        };
        GUILayout.EndVertical();

        // RESOLUTION
        GUILayout.BeginVertical("box");
        GUILayout.Label("Resolution: ");
        GUILayout.BeginHorizontal();
        width = int.Parse(GUILayout.TextField(width.ToString()));
        GUILayout.Label(" x ");
        height = int.Parse(GUILayout.TextField(height.ToString()));
        GUILayout.EndHorizontal();
        if (GUILayout.Button("Set Resolution"))
        {
            WebGLKit.SetResolution(width, height);
        }
        GUILayout.EndVertical();


        // EVAL JS CODE
        GUILayout.BeginVertical("box");
        GUILayout.Label("JS Code: ");
        jsCode = GUILayout.TextArea(jsCode);
        if (GUILayout.Button("Eval JS"))
        {
            var result = WebGLKit.EvalJs(jsCode);
            WebGLKit.Log(result);
        }
        GUILayout.EndVertical();


        GUILayout.EndScrollView();
    }

19 View Source File : AddScriptWindow.cs
License : MIT License
Project Creator : psygames

void SearchGUI()
        {
            GUI.Label(new Rect(0.0f, 0.0f, this.position.width, this.position.height), GUIContent.none, _styles.background);
            GUILayout.Space(7);
            GUILayout.BeginHorizontal();
            _searchString = GUILayout.TextField(_searchString, GUI.skin.FindStyle("SearchTextField"));
            var buttonStyle = _searchString == string.Empty ? GUI.skin.FindStyle("SearchCancelButtonEmpty") : GUI.skin.FindStyle("SearchCancelButton");
            if (GUILayout.Button(string.Empty, buttonStyle))
            {
                _searchString = string.Empty;
                GUI.FocusControl(null);
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : GUIMain.cs
License : MIT License
Project Creator : PULSAR-Modders

void WindowFunction(int WindowID)
        {
            
            BeginHorizontal(); // TAB Start
            {
                if (Button("Mod Info"))
                    Tab = 0;
                if (Button("Mod Settings"))
                    Tab = 1;
                if (Button("About"))
                    Tab = 2;
            }
            EndHorizontal(); // TAB End
            switch (Tab)
            {
                #region ModList and ModInfo
                case 0:
                    GUI.skin.label.alignment = PMLConfig.instance.ModInfoTextAnchor;
                    BeginArea(ModListArea);
                    {
                        ModListScroll = BeginScrollView(ModListScroll);
                        {
                            for (ushort p = 0; p < mods.Count; p++)
                                if (Button(mods[p].Name))
                                    selectedMod = p;
                        }
                        EndScrollView();
                    }
                    EndArea();
                    BeginArea(ModInfoArea);
                    {
                        if (selectedMod != ushort.MaxValue)
                        {
                            ModInfoScroll = BeginScrollView(ModInfoScroll);
                            {
                                PulsarMod mod = mods[selectedMod];
                                BeginHorizontal();
                                {
                                    if (Button("Unload"))
                                        mod.Unload();
                                }
                                EndHorizontal();
                                Label($"Author: {mod.Author}");
                                Label($"Name: {mod.Name}");
                                Label($"Version: {mod.Version}");
                                if (mod.ShortDescription != string.Empty)
                                    Label($"Short Description: {mod.ShortDescription}");
                                if (mod.LongDescription != string.Empty)
                                    Label($"Long Description: {mod.LongDescription}");
                                Label($"MPFunctionality: {((MPFunction)mod.MPFunctionality).ToString()}");
                            }
                            EndScrollView();
                        }
                    }
                    EndArea();
                    break;
                #endregion
                #region ModSettings
                case 1:
                    GUI.skin.label.alignment = TextAnchor.UpperLeft;
                    BeginArea(ModSettingsArea);
                    {
                        ModSettingsScroll = BeginScrollView(ModSettingsScroll);
                        {
                            if (selectedSettings == ushort.MaxValue)
                            {
                                var length = settings.Count;
                                for (ushort msm = 0; msm < length; msm++)
                                {
                                    var FSettings = settings[msm];
                                    if (Button(FSettings.Name()))
                                    {
                                        selectedSettings = msm;
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                if (Button("Back"))
                                    selectedSettings = ushort.MaxValue;

                                settings[selectedSettings].Draw();
                            }
                        }
                        EndScrollView();
                    }
                    EndArea();
                    break;
                #endregion
                #region About
                case 2:
                    GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                    Label($"PulsarModLoader - Unofficial mod loader for PULSAR: Lost Colony.");
                    Label($"Version: {ModManager.Instance.PMLVersionInfo.FileVersion}");
                    Label($"\n\nDeveloped by Tom Richter");
                    Label($"Contributors:\nDragonFire47\n18107\nBadRyuner");
                    BeginHorizontal();
                    if (Button("Github"))
                        Process.Start("https://github.com/PULSAR-Modders/pulsar-mod-loader");
                    if (Button("Discord"))
                        Process.Start("https://discord.gg/j3Pydn6");
                    EndHorizontal();
                    break;
                    #endregion
            }
            GUI.DragWindow();
        }

19 View Source File : PMLSettings.cs
License : MIT License
Project Creator : PULSAR-Modders

public override void Draw()
        {
            GUI.skin.label.alignment = TextAnchor.UpperLeft;
            BeginHorizontal();
            {
                Label($"ModInfoTextAnchor: {PMLConfig.instance.ModInfoTextAnchor.ToString()}");

                if (Button("<"))
                    PMLConfig.instance.ModInfoTextAnchor = Enum.GetValues(typeof(TextAnchor)).Cast<TextAnchor>().SkipWhile(e => (int)e != (int)PMLConfig.instance.ModInfoTextAnchor - 1).First();
                if (Button(">"))
                    PMLConfig.instance.ModInfoTextAnchor = Enum.GetValues(typeof(TextAnchor)).Cast<TextAnchor>().SkipWhile(e => (int)e != (int)PMLConfig.instance.ModInfoTextAnchor).Skip(1).First();
            }
            EndHorizontal();
            BeginHorizontal();
            {
                if (Button("Save")) PMLConfig.SaveConfig(Path.GetDirectoryName(replacedembly.GetExecutingreplacedembly().Location) + "/PulsarModLoaderConfig.json");
                if (Button("Reset to default")) PMLConfig.CreateDefaultConfig(string.Empty, false);
            }
            EndHorizontal();
        }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

private void RenderHeader()
  {
    GUILayout.BeginVertical();
    GUILayout.Space(15);
    GUILayout.EndVertical();

    Color defaultColor = GUI.color;
    GUI.color = new Color(208f / 255f, 208f / 255f, 208f / 255f);
    // GUI.color = Color.red;

    GUIStyle headerStyle = new GUIStyle();
    headerStyle.margin = new RectOffset(10, 10, 0, 0);

    GUILayout.BeginHorizontal(headerStyle);
    GUILayout.Label(logoTexture, GUILayout.Width(50), GUILayout.Height(50));
    GUILayout.Space(10);

    GUIStyle replacedleStyle = new GUIStyle();
    replacedleStyle.fontSize = 20;
    replacedleStyle.fontStyle = FontStyle.Bold;
    replacedleStyle.alignment = TextAnchor.MiddleCenter;
    GUILayout.Label("RunwayML", replacedleStyle, GUILayout.Height(50));
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();

    GUI.color = defaultColor;

    GUILayout.BeginVertical();
    GUILayout.Space(15);
    GUILayout.EndVertical();
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

private void RenderModelInfo(Model m)
  {
    GUILayout.BeginHorizontal("box");
    GUILayout.FlexibleSpace();
    GUILayout.BeginVertical();
    GUILayout.Label("MODEL INFORMATION", boldTextStyle);
    GUILayout.Space(5);
    GUILayout.Label(m.description, justifyCenterTextStyle);
    GUILayout.Space(5);
    GUILayout.EndVertical();
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

private void RenderRunwayNotFound()
  {
    GUILayout.BeginHorizontal("box");
    GUILayout.FlexibleSpace();
    GUILayout.BeginVertical();
    GUILayout.Space(5);
    GUILayout.Label("RUNWAY NOT FOUND", boldTextStyle);
    GUILayout.Space(5);
    GUILayout.Label("Make sure that the Runway app is running\n and that you are signed in.", justifyCenterTextStyle);
    GUILayout.Space(5);
    if (GUILayout.Button("Download Runway"))
    {
      Application.OpenURL("https://runwayml.com");
    }
    GUILayout.Space(5);
    GUILayout.EndVertical();
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

private void RenderModelSelection()
  {
    GUILayout.Space(10);
    GUILayout.Label("MODEL SELECTION", sectionreplacedleStyle);
    GUILayout.Space(5);

    GUILayout.BeginHorizontal("box");
    GUILayout.BeginVertical();
    GUILayout.Space(5);

    GUILayout.BeginHorizontal(horizontalStyle);
    GUILayout.Label("Model");
    GUILayout.FlexibleSpace();
    string[] modelNames = new string[getFilteredModels().Length];
    for (var i = 0; i < modelNames.Length; i++) { modelNames[i] = getFilteredModels()[i].name; }
    if (selectedModelIndex >= modelNames.Length) { selectedModelIndex = 0; }
    selectedModelIndex = EditorGUILayout.Popup(selectedModelIndex, modelNames);
    GUILayout.EndHorizontal();

    GUILayout.EndVertical();
    GUILayout.EndHorizontal();
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

void RenderImageInput(Field input, int index)
  {
    GUILayout.BeginHorizontal(horizontalStyle);
    GUILayout.FlexibleSpace();

    Texture tex = textureForInputKey(input.name, false);

    if (tex != null)
    {
      RenderTextureInfo(tex);
    }
    else
    {
      RenderNotAvailable();
    }
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();

    GUILayout.Space(5);

    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();

    if (GUILayout.Button("Select"))
    {
      EditorGUIUtility.ShowObjectPicker<UnityEngine.Object>(inputData[input.name] as UnityEngine.Object, true, "t:Texture t:Camera", index);
    }

    if (userPickedObjectForIndex == index)
    {
      inputData[input.name] = EditorGUIUtility.GetObjectPickerObject();
      userPickedObjectForIndex = -1;
    }

    if (Event.current.commandName == "ObjectSelectorUpdated" && EditorGUIUtility.GetObjectPickerControlID() == index)
    {
      userPickedObjectForIndex = index;
    }

    GUILayout.Space(5);

    if (GUILayout.Button("Preview"))
    {
      if (index == 0)
      {
        inputWindows[index] = GetWindow<RunwayInput1Window>(false, "Runway - Model Input 1", true);
      }
      else
      {
        inputWindows[index] = GetWindow<RunwayInput2Window>(false, "Runway - Model Input 2", true);
      }
    }

    GUILayout.Space(5);

    if (GUILayout.Button("Save"))
    {
      string path = EditorUtility.SaveFilePanel("Save as PNG", "", "ModelInput.png", "png");
      byte[] data = RunwayUtils.TextureToPNG(tex as Texture2D);
      File.WriteAllBytes(path, data);
    }
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();


    if (inputData[input.name] != null)
    {
      if (inputWindows.ContainsKey(index))
      {
        inputWindows[index].texture = tex;
        inputWindows[index].Repaint();
      }
    }
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

void RenderObjectTagger(Field input, int index)
  {
    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();
    GUILayout.BeginVertical();

    GUILayout.BeginHorizontal("GroupBox", GUILayout.MaxWidth(300));
    GUILayout.BeginVertical();
    
    foreach(string label in input.labels) {
      GameObject[] objs = RunwayUtils.GetObjectsWithLabelTag(label);
      if (objs.Length > 0) {
        GUILayout.Label(System.String.Format("{0} objects labeled as {1}", objs.Length, label));
      }
    }

    GUILayout.Space(10);

    GUILayout.BeginHorizontal();
    GUILayout.Label("Select Label:");
    selectedLabel = RunwayUtils.Dropdown(selectedLabel, input.labels);
    GUILayout.EndHorizontal();

    using (new EditorGUI.DisabledScope(Selection.gameObjects.Length == 0))
    {
      if (GUILayout.Button(System.String.Format("Label selected objects with {0} ({1})", selectedLabel, Selection.gameObjects.Length)))
      {
        RunwayUtils.AddTag(selectedLabel);
        foreach (GameObject go in Selection.gameObjects)
        {
          go.tag = selectedLabel;
        }
      }
      if (GUILayout.Button(System.String.Format("Unlabel selected objects ({0})", Selection.gameObjects.Length)))
      {
        RunwayUtils.AddTag(selectedLabel);
        foreach (GameObject go in Selection.gameObjects)
        {
          go.tag = "Untagged";
        }
      }
    }
    GUILayout.EndVertical();
    GUILayout.EndHorizontal();

    GUILayout.EndHorizontal();
    GUILayout.FlexibleSpace();
    GUILayout.EndVertical();
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

void RenderInputsAndOutputs()
  {
    Field[] inputs = getFilteredModels()[selectedModelIndex].commands[0].inputs;
    Field[] outputs = getFilteredModels()[selectedModelIndex].commands[0].outputs;

    GUILayout.Space(10);
    GUILayout.Label("INPUT", sectionreplacedleStyle);
    GUILayout.Space(5);

    GUILayout.BeginHorizontal("box");
    GUILayout.BeginVertical();

    for (int i = 0; i < inputs.Length; i++)
    {
      GUILayout.Space(5);

      Field input = inputs[i];

      GUILayout.BeginVertical();
      if (input.type.Equals("image") || input.type.Equals("segmentation"))
      {
        GUILayout.BeginHorizontal(horizontalStyle);
        GUILayout.FlexibleSpace();
        GUILayout.Label(RunwayUtils.FormatFieldName(input.name), boldTextStyle);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
        GUILayout.Space(5);
      }
      if (input.type.Equals("image"))
      {
        RenderImageInput(input, i);
      }
      else if (input.type.Equals("segmentation"))
      {
        RenderSegmentationInput(input, i);
      }
      else if (input.type.Equals("text"))
      {
        GUILayout.BeginHorizontal(horizontalStyle);
        GUILayout.Label(System.String.Format("{0}:", RunwayUtils.FormatFieldName(input.name)));
        GUILayout.FlexibleSpace();
        inputData[input.name] = EditorGUILayout.TextField(inputData[input.name] as string, GUILayout.MaxWidth(250));
        GUILayout.EndHorizontal();
      }
      else if (input.type.Equals("category"))
      {
        GUILayout.BeginHorizontal(horizontalStyle);
        GUILayout.Label(System.String.Format("{0}:", RunwayUtils.FormatFieldName(input.name)));
        GUILayout.FlexibleSpace();
        inputData[input.name] = RunwayUtils.Dropdown(inputData[input.name] as string, input.oneOf);
        GUILayout.EndHorizontal();
      }
      else if (input.type.Equals("number"))
      {
        GUILayout.BeginHorizontal(horizontalStyle);
        GUILayout.Label(System.String.Format("{0}:", RunwayUtils.FormatFieldName(input.name)));
        GUILayout.FlexibleSpace();
        if (RunwayUtils.IsAnInteger(input.step))
        {
          if (input.hasMin && input.hasMax && input.hreplacedtep)
          {
            int value = inputData[input.name] is int ? (int)inputData[input.name] : (int)Convert.ToSingle(input.defaultValue);
            inputData[input.name] = EditorGUILayout.IntSlider(value, (int)input.min, (int)input.max);
          }
          else
          {
            int value = inputData[input.name] is int ? (int)inputData[input.name] : (int)Convert.ToSingle(input.defaultValue);
            inputData[input.name] = EditorGUILayout.IntField(value);
          }
        }
        else
        {
          if (input.hasMin && input.hasMax && input.hreplacedtep)
          {
            float value = inputData[input.name] is float ? (float)inputData[input.name] : (float)Convert.ToSingle(input.defaultValue);
            inputData[input.name] = EditorGUILayout.Slider(value, input.min, input.max);
          }
          else
          {
            float value = inputData[input.name] is float ? (float)inputData[input.name] : Convert.ToSingle(input.defaultValue);
            inputData[input.name] = EditorGUILayout.FloatField(value);
          }
        }
        GUILayout.EndHorizontal();
      }
      else if (input.type.Equals("boolean"))
      {
        GUILayout.BeginHorizontal(horizontalStyle);
        GUILayout.Label(System.String.Format("{0}:", RunwayUtils.FormatFieldName(input.name)));
        bool value = inputData[input.name] is bool ? (bool)inputData[input.name] : false;
        GUILayout.FlexibleSpace();
        inputData[input.name] = EditorGUILayout.Toggle(value, GUILayout.Width(20));
        GUILayout.EndHorizontal();
      }
      GUILayout.Space(5);

      GUILayout.EndVertical();
    }
    GUILayout.EndVertical();
    GUILayout.EndHorizontal();

    GUILayout.Space(10);
    GUILayout.Label("OUTPUT", sectionreplacedleStyle);
    GUILayout.Space(5);

    GUILayout.BeginHorizontal("box");
    GUILayout.BeginVertical();

    GUILayout.Space(5);

    GUILayout.BeginHorizontal(horizontalStyle);
    GUILayout.FlexibleSpace();
    if (this.lastOutput)
    {
      RenderTextureInfo(this.lastOutput);
    }
    else
    {
      RenderNotAvailable();
    }
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();

    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();

    if (GUILayout.Button("Preview"))
    {
      outputWindow = GetWindow<RunwayOutputWindow>(false, "Runway - Model Output", true);
    }

    GUILayout.Space(5);

    if (this.lastOutput && GUILayout.Button("Save"))
    {
      string path = EditorUtility.SaveFilePanel("Save as PNG", "", "ModelOutput.png", "png");
      byte[] data = RunwayUtils.TextureToPNG(this.lastOutput);
      File.WriteAllBytes(path, data);
    }
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();

    GUILayout.Space(5);

    GUILayout.EndVertical();
    GUILayout.EndHorizontal();

    if (lastOutput != null && outputWindow != null)
    {
      outputWindow.texture = lastOutput;
      outputWindow.Repaint();
    }
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

void RenderModelOptions()
  {
    GUILayout.Space(10);
    GUILayout.Label("SETUP OPTIONS", sectionreplacedleStyle);
    GUILayout.Space(5);

    GUILayout.BeginHorizontal("box");
    GUILayout.BeginVertical();

    Field[] options = getSelectedModel().options == null ? new Field[0] : getSelectedModel().options;

    for (var i = 0; i < options.Length; i++)
    {
      GUILayout.Space(5);
      Field option = options[i];
      if (option.type == "category" || option.type == "file")
      {
        GUILayout.BeginHorizontal(horizontalStyle);
        GUILayout.Label(RunwayUtils.FormatFieldName(option.name));
        GUILayout.FlexibleSpace();
        optionSelectionIndices[i] = EditorGUILayout.Popup(optionSelectionIndices[i], option.oneOf);
        GUILayout.EndHorizontal();
      }
    }

    GUILayout.Space(5);
    GUILayout.EndVertical();
    GUILayout.EndHorizontal();
  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

void RenderRunModel()
  {
    GUILayout.Space(10);
    GUILayout.Label("RUN OPTIONS", sectionreplacedleStyle);
    GUILayout.Space(5);

    GUILayout.BeginHorizontal("box");

    GUILayout.BeginVertical();

    GUILayout.Space(5);

    GUILayout.BeginHorizontal(horizontalStyle);
    GUILayout.Label("Run Location");
    GUILayout.FlexibleSpace();
    runLocationIndex = EditorGUILayout.Popup(runLocationIndex, runLocations);
    GUILayout.EndHorizontal();

    GUILayout.Space(5);
    GUILayout.BeginHorizontal(horizontalStyle);
    GUILayout.Label("Run Continuously");
    GUILayout.FlexibleSpace();
    this.continuousInference = EditorGUILayout.Toggle(this.continuousInference, GUILayout.Width(20));
    GUILayout.EndHorizontal();


    GUILayout.Space(5);
    GUILayout.BeginHorizontal(horizontalStyle);
    GUILayout.FlexibleSpace();

    if (modelIsRunning())
    {
      if (this.continuousInference && !this.isProcessingInput)
      {
        this.isProcessingInput = true;
        try
        {
          this.RunInference();
        }
        catch
        {
          this.isProcessingInput = false;
        }
      }
      using (new EditorGUI.DisabledScope(this.isProcessingInput))
      {
        if (GUILayout.Button("Process"))
        {
          this.isProcessingInput = true;
          try
          {
            this.RunInference();
          }
          catch
          {
            this.isProcessingInput = false;
          }
        }
      }
    }

    string buttonText;
    bool buttonDisabled;
    if (modelIsRunning())
    {
      buttonText = "Stop Model";
      buttonDisabled = false;
    }
    else if (modelIsStarting())
    {
      buttonText = "Starting Model...";
      buttonDisabled = true;
    }
    else
    {
      buttonText = "Start Model";
      buttonDisabled = false;
    }
    buttonDisabled = buttonDisabled || this.isMakingRequest;

    using (new EditorGUI.DisabledScope(buttonDisabled))
    {
      if (GUILayout.Button(buttonText))
      {
        if (modelIsRunning())
        {
          this.isMakingRequest = true;
          this.StartCoroutine(RunwayHub.stopModel(runningSession.id, (response) =>
          {
            this.runningSession = null;
            this.isMakingRequest = false;
            this.isProcessingInput = false;
            Repaint();
          }));
        }
        else
        {
          ProviderOptions providerOptions = new ProviderOptions();
          providerOptions.runLocation = runLocations[runLocationIndex];
          this.isMakingRequest = true;
          int versionId = getFilteredModels()[selectedModelIndex].defaultVersionId;
          this.StartCoroutine(RunwayHub.runModel(versionId, getOptions(), providerOptions, (error, session) =>
          {
            this.isMakingRequest = false;
            if (error != null)
            {
              EditorUtility.DisplayDialog("Error starting model", error, "OK");
              return;
            }
            this.runningSession = session;
            Repaint();
          }));
        }
      }
    }
    GUILayout.EndHorizontal();

    GUILayout.EndVertical();
    GUILayout.EndHorizontal();

    GUILayout.Space(15);

  }

19 View Source File : RunwayWindow.cs
License : MIT License
Project Creator : runwayml

void RenderSegmentationInput(Field input, int index)
  {
    GUILayout.BeginHorizontal(horizontalStyle);
    GUILayout.FlexibleSpace();

    Texture tex = textureForInputKey(input.name, true);

    if (inputData[input.name] != null)
    {
      RenderTextureInfo(tex);
    }
    else
    {
      RenderNotAvailable();
    }
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();

    GUILayout.Space(5);

    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();

    if (userPickedObjectForIndex == index)
    {
      GameObject go = EditorGUIUtility.GetObjectPickerObject() as GameObject;
      inputData[input.name] = go;
      if (go != null)
      {
        ImageSynthesis synthesis = go.GetComponent<ImageSynthesis>();
        synthesis.labels = input.labels;
        synthesis.colors = input.colors;
        synthesis.defaultColor = input.defaultColor;
        inputWidths[index] = maxWidths[index] = (int)go.GetComponent<Camera>().pixelWidth;
        inputHeights[index] = maxHeights[index] = (int)go.GetComponent<Camera>().pixelHeight;
      }
      userPickedObjectForIndex = -1;
    }

    if (Event.current.commandName == "ObjectSelectorUpdated" && EditorGUIUtility.GetObjectPickerControlID() == index)
    {
      userPickedObjectForIndex = index;
    }


    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();

    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();

    if (GUILayout.Button("Select"))
    {
      EditorGUIUtility.ShowObjectPicker<UnityEngine.Object>(inputData[input.name] as UnityEngine.Object, true, "t:Camera", index);
    }

    GUILayout.Space(5);

    if (GUILayout.Button("Preview"))
    {
      if (index == 0)
      {
        inputWindows[index] = GetWindow<RunwayInput1Window>(false, "Runway - Model Input 1", true);
      }
      else
      {
        inputWindows[index] = GetWindow<RunwayInput2Window>(false, "Runway - Model Input 2", true);
      }
    }

    GUILayout.Space(5);

    if (GUILayout.Button("Save"))
    {
      string path = EditorUtility.SaveFilePanel("Save as PNG", "", "ModelInput.png", "png");
      byte[] data = RunwayUtils.TextureToPNG(tex as Texture2D);
      File.WriteAllBytes(path, data);
    }

    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();

    RenderObjectTagger(input, index);

    if (inputData[input.name] != null)
    {
      if (inputWindows.ContainsKey(index))
      {
        inputWindows[index].texture = tex;
        inputWindows[index].Repaint();
      }
    }
  }

19 View Source File : PluginInitializer.cs
License : GNU General Public License v3.0
Project Creator : Sauceke

private void DeviceListDrawer(ConfigEntryBase entry)
        {
            var serverController = Chainloader.ManagerObject.GetComponent<replacedWsClient>();
            GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
            {
                GUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Connect", GUILayout.Width(150)))
                    {
                        serverController.Connect();
                    }
                    if (serverController.IsConnected)
                    {
                        if (GUILayout.Button("Scan", GUILayout.Width(150)))
                        {
                            serverController.StartScan();
                        }
                    }
                    GUILayout.FlexibleSpace();
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(12);

                // table header
                float totalWidth = GUILayoutUtility.GetWindowsBounds().width * .9f;
                int columns = 6;
                float columnWidth = totalWidth / columns;
                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                {
                    GUILayout.Label("Device Name", GUILayout.Width(columnWidth));
                    GUILayout.Label("Stroker", GUILayout.Width(columnWidth));
                    GUILayout.Label("Vibrators", GUILayout.Width(columnWidth));
                    if (girlMappingHeader != null)
                    {
                        GUILayout.Label(girlMappingHeader, GUILayout.Width(columnWidth));
                    }
                    if (actionMappingHeader != null)
                    {
                        GUILayout.Label(actionMappingHeader, GUILayout.Width(columnWidth));
                    }
                    GUILayout.Label("Test Device", GUILayout.Width(columnWidth));
                }
                GUILayout.EndHorizontal();

                // imgui doesn't expect the layout to change outside of layout events
                if (Event.current.type == EventType.Layout)
                {
                    cachedDeviceList = serverController.Devices;
                }

                foreach (var device in cachedDeviceList)
                {
                    GUILayout.Space(10);
                    GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                    {
                        GUILayout.Label(device.DeviceName, GUILayout.Width(columnWidth));
                        GUILayout.Toggle(device.IsStroker, "", GUILayout.Width(columnWidth));
                        GUILayout.Toggle(device.IsVibrator, "", GUILayout.Width(columnWidth));
                        if (girlMappingOptions != null)
                        {
                            device.GirlIndex = GUILayout.SelectionGrid(
                                selected: device.GirlIndex,
                                girlMappingOptions,
                                xCount: 1,
                                GUILayout.Width(columnWidth));
                        }
                        if (actionMappingOptions != null)
                        {
                            device.BoneIndex = GUILayout.SelectionGrid(
                                selected: device.BoneIndex,
                                actionMappingOptions,
                                xCount: 1,
                                GUILayout.Width(columnWidth));
                        }
                        GUILayout.BeginVertical(GUILayout.ExpandHeight(true));
                        {
                            if (device.IsStroker)
                            {
                                if (GUILayout.Button("Test Slow"))
                                {
                                    TestStrokerAsync(device, fast: false, hard: false);
                                }
                                if (GUILayout.Button("Test Fast"))
                                {
                                    TestStrokerAsync(device, fast: true, hard: false);
                                }
                                if (GUILayout.Button("Test Hard"))
                                {
                                    TestStrokerAsync(device, fast: false, hard: true);
                                }
                            }
                        }
                        GUILayout.EndVertical();
                    }
                    GUILayout.EndHorizontal();
                }
            }
            GUILayout.EndVertical();
        }

19 View Source File : PluginInitializer.cs
License : GNU General Public License v3.0
Project Creator : Sauceke

private void DrawRangeSlider(ConfigEntry<int> min, ConfigEntry<int> max)
        {
            float labelWidth = GUI.skin.label.CalcSize(new GUIContent("100%")).x;
            GUILayout.BeginHorizontal();
            {
                float lower = min.Value;
                float upper = max.Value;
                GUILayout.Label(lower + "%", GUILayout.Width(labelWidth));
                RangeSlider.Create(ref lower, ref upper, 0, 100);
                GUILayout.Label(upper + "%", GUILayout.Width(labelWidth));
                if (GUILayout.Button("Reset", GUILayout.ExpandWidth(false)))
                {
                    lower = (int)min.DefaultValue;
                    upper = (int)max.DefaultValue;
                }
                min.Value = (int)lower;
                max.Value = (int)upper;
            }
            GUILayout.EndHorizontal();
        }

19 View Source File : GUIDisplay.cs
License : MIT License
Project Creator : Scrawk

void OnGUI() 
		{

			if(Ocean.Instance == null) return;

			ShipCamera shipCam = m_camera.GetComponent<ShipCamera>();
			UnderWaterPostEffect postEffect = m_camera.GetComponent< UnderWaterPostEffect>();

			WaveSpectrum spectrum = Ocean.Instance.GetComponent<WaveSpectrum>();
			PlanarReflection reflection = Ocean.Instance.GetComponent<PlanarReflection>();
			UnderWater underWater = Ocean.Instance.GetComponent<UnderWater>();
            ProjectedGrid grid = Ocean.Instance.GetComponent<ProjectedGrid>();

			if(true)
			{
				GUILayout.BeginArea(m_hideToggle);
				GUILayout.BeginHorizontal("Box");
				m_hide = GUILayout.Toggle(m_hide, " Hide GUI");
				GUILayout.EndHorizontal();
				GUILayout.EndArea();
			}

			shipCam.disableInput = false;
			if (m_hide) return;
			shipCam.disableInput = true;

			if (reflection != null)
			{
				bool on = reflection.enabled;
				
				GUILayout.BeginArea(m_reflectionsToggle);
				GUILayout.BeginHorizontal("Box");
				on = GUILayout.Toggle(on, " Reflection");
				GUILayout.EndHorizontal();
				GUILayout.EndArea();
				
				reflection.enabled = on;
			}

			if(underWater != null)
			{
				bool on = underWater.enabled;
				
				GUILayout.BeginArea(m_refractionToggle);
				GUILayout.BeginHorizontal("Box");
				on = GUILayout.Toggle(on, " Refraction");
				GUILayout.EndHorizontal();
				GUILayout.EndArea();
				
				underWater.enabled = on;
			}

            if (spectrum != null && grid != null)
            {
     
                GUILayout.BeginArea(m_detailToggle);
                GUILayout.BeginHorizontal("Box");
                m_ultraDetailOn = GUILayout.Toggle(m_ultraDetailOn, " Ultra Detail");
                GUILayout.EndHorizontal();
                GUILayout.EndArea();

                if (m_ultraDetailOn)
                {
                    grid.resolution = MESH_RESOLUTION.ULTRA;
                    spectrum.fourierSize = FOURIER_SIZE.ULTRA_256_GPU;
                    spectrum.disableReadBack = !m_supportsDX11;
                }
                else
                {
                    grid.resolution = MESH_RESOLUTION.HIGH;
                    spectrum.fourierSize = FOURIER_SIZE.MEDIUM_64_CPU;
                    spectrum.disableReadBack = true;
                }
            }

            GUILayout.BeginArea(m_settings);
			GUILayout.BeginVertical("Box");

			if(true)
			{
				float windDir = Ocean.Instance.windDir;

				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Wind Direction", GUILayout.MaxWidth(m_textWidth));
				windDir = GUILayout.HorizontalSlider(windDir, 0.0f, 360.0f);
				GUILayout.EndHorizontal();
				Ocean.Instance.windDir = windDir;
			}

            /*
            if (m_uSky != null)
            {
                float timeLine = m_uSky.GetComponent<uSkyManager>().Timeline;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Sun Dir", GUILayout.MaxWidth(m_textWidth));
                timeLine = GUILayout.HorizontalSlider(timeLine, 0.0f, 23.0f);
                GUILayout.EndHorizontal();

                m_uSky.GetComponent<uSkyManager>().Timeline = timeLine;
            }
            */

            if (spectrum != null)
			{
				float windSpeed = spectrum.windSpeed;

				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Wind Speed", GUILayout.MaxWidth(m_textWidth));
				windSpeed = GUILayout.HorizontalSlider(windSpeed, 0.0f, WaveSpectrum.MAX_WIND_SPEED);
				GUILayout.EndHorizontal();

				spectrum.windSpeed = windSpeed;
			}

			if(spectrum != null)
			{
				float waveAge = spectrum.waveAge;

				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Wave Age", GUILayout.MaxWidth(m_textWidth));
				waveAge = GUILayout.HorizontalSlider(waveAge, WaveSpectrum.MIN_WAVE_AGE, WaveSpectrum.MAX_WAVE_AGE);
				GUILayout.EndHorizontal();

				spectrum.waveAge = waveAge;
			}

			if(spectrum != null)
			{
				float waveSpeed = spectrum.waveSpeed;
				
				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Wave Speed", GUILayout.MaxWidth(m_textWidth));
				waveSpeed = GUILayout.HorizontalSlider(waveSpeed, 0.0f, WaveSpectrum.MAX_WAVE_SPEED);
				GUILayout.EndHorizontal();
				
				spectrum.waveSpeed = waveSpeed;
			}

			if(spectrum != null)
			{
				float choppyness = spectrum.choppyness;
				
				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Choppyness", GUILayout.MaxWidth(m_textWidth));
				choppyness = GUILayout.HorizontalSlider(choppyness, 0.0f, WaveSpectrum.MAX_CHOPPYNESS);
				GUILayout.EndHorizontal();
				
				spectrum.choppyness = choppyness;
			}

			if(spectrum != null)
			{
				float foamAmount = spectrum.foamAmount;

				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Foam Amount", GUILayout.MaxWidth(m_textWidth));
				foamAmount = GUILayout.HorizontalSlider(foamAmount, 0.0f, WaveSpectrum.MAX_FOAM_AMOUNT);
				GUILayout.EndHorizontal();

				spectrum.foamAmount = foamAmount;
			}

			if(spectrum != null)
			{
				float foamCoverage = spectrum.foamCoverage;
				
				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Foam Coverage", GUILayout.MaxWidth(m_textWidth));
				foamCoverage = GUILayout.HorizontalSlider(foamCoverage, 0.0f, WaveSpectrum.MAX_FOAM_COVERAGE);
				GUILayout.EndHorizontal();
				
				spectrum.foamCoverage = foamCoverage;
			}

			if(reflection != null)
			{
				int iterations = reflection.blurIterations;

				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Reflection blur", GUILayout.MaxWidth(m_textWidth));
				iterations = (int)GUILayout.HorizontalSlider(iterations, 0, 4);
				GUILayout.EndHorizontal();
	
				reflection.blurIterations = iterations;
			}

			if(reflection != null)
			{
				float intensity = reflection.reflectionIntensity;

				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Reflection Intensity", GUILayout.MaxWidth(m_textWidth));
				intensity = GUILayout.HorizontalSlider(intensity, 0.0f, PlanarReflection.MAX_REFLECTION_INTENSITY);
				GUILayout.EndHorizontal();
				
				reflection.reflectionIntensity = intensity;
			}

            if (underWater != null)
            {
                float intensity = underWater.aboveRefractionIntensity;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Refraction Intensity", GUILayout.MaxWidth(m_textWidth));
                intensity = GUILayout.HorizontalSlider(intensity, 0.0f, UnderWater.MAX_REFRACTION_INTENSITY);
                GUILayout.EndHorizontal();

                underWater.aboveRefractionIntensity = intensity;
            }

            if (spectrum != null)
            {
                int numGrids = spectrum.numberOfGrids;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Num Grids", GUILayout.MaxWidth(m_textWidth));
                numGrids = (int)GUILayout.HorizontalSlider(numGrids, 1, 4);
                GUILayout.EndHorizontal();

                spectrum.numberOfGrids = numGrids;
            }

            if (spectrum != null)
			{
				float scale = spectrum.gridScale;

				GUILayout.BeginHorizontal("Box");
				GUILayout.Label("Grid Scale", GUILayout.MaxWidth(m_textWidth));
				scale = GUILayout.HorizontalSlider(scale, WaveSpectrum.MIN_GRID_SCALE, WaveSpectrum.MAX_GRID_SCALE);
				GUILayout.EndHorizontal();

				spectrum.gridScale = scale;
			}


            if (underWater != null)
            {
                float intensity = underWater.subSurfaceScatterModifier.intensity;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("SSS Intensity", GUILayout.MaxWidth(m_textWidth));
                intensity = GUILayout.HorizontalSlider(intensity, 0.0f, 10.0f);
                GUILayout.EndHorizontal();

                underWater.subSurfaceScatterModifier.intensity = intensity;
            }

            if (postEffect != null)
            {
                int blur = postEffect.blurIterations;

                GUILayout.BeginHorizontal("Box");
                GUILayout.Label("Underwater Blur", GUILayout.MaxWidth(m_textWidth));
                blur = (int)GUILayout.HorizontalSlider(blur, 0, 4);
                GUILayout.EndHorizontal();

                postEffect.blurIterations = blur;
            }

            if (true)
			{

				string info = 
@"W to move ship forward. A/D to turn.
Left click and drag to rotate camera.
Keypad +/- to move sun.
Ceto Version " + Ocean.VERSION;

				if(m_fps != null)
				{
					info += "\nCurrent FPS = " + m_fps.FrameRate.ToString("F2");
				}

				GUILayout.BeginHorizontal("Box");
				GUILayout.TextArea(info);
				GUILayout.EndHorizontal();

			}

			GUILayout.EndVertical();
			GUILayout.EndArea();
		}

19 View Source File : SceneHierarchyBackend.cs
License : MIT License
Project Creator : seldomU

public Rect OnGUI()
		{
			GUILayout.BeginHorizontal( EditorStyles.toolbar );
			{
				if ( GUILayout.Button( "Show active scene", EditorStyles.toolbarButton, GUILayout.ExpandWidth( false ) ) )
				{
					api.ResetTargets( new object[] { sceneObj } );
				}

				EditorGUI.BeginChangeCheck();
				includeComponents = GUILayout.Toggle( includeComponents, "Include components" );
				if ( EditorGUI.EndChangeCheck() )
				{
					api.Rebuild();
				}

				GUILayout.FlexibleSpace();
			}
			GUILayout.EndHorizontal();
			return BackendUtil.GetMaxRect();
		}

19 View Source File : TagBackend.cs
License : MIT License
Project Creator : seldomU

public override Rect OnGUI()
		{
			GUILayout.BeginHorizontal( EditorStyles.toolbar );
			{
				// option: use all gameobjects of the active scene as targets
				if ( GUILayout.Button( "Show active scene", EditorStyles.toolbarButton ) )
					api.ResetTargets( Object.FindObjectsOfType<GameObject>().Cast<object>().ToArray() );

				// option: remove untagged objects
				if ( ContainsUntaggedTargets() &&
					GUILayout.Button( "Hide untagged", EditorStyles.toolbarButton ) )
					api.ResetTargets( api.GetTargets().Where( IsUntagged ).ToArray() );

				GUILayout.FlexibleSpace();

				searchstring = BackendUtil.DrawEnreplacedySelectSearchField( searchstring, api );
			}
			GUILayout.EndHorizontal();
			return base.OnGUI();
		}

19 View Source File : SettingsInspector.cs
License : MIT License
Project Creator : seldomU

void ShowGraphLayoutParams( GraphLayoutParameters parameters )
		{
			EditorGUILayout.Space();
			foldLayoutSettings = EditorGUILayout.Foldout( foldLayoutSettings, "Graph layout settings" );
			if ( foldLayoutSettings )
			{
				GUILayout.BeginHorizontal();
				GUILayout.Space( 10 );
				GUILayout.BeginVertical();

				parameters.posInitRange = EditorGUILayout.FloatField( "Init positioning range", parameters.posInitRange );
				parameters.idealDistance = EditorGUILayout.FloatField( "Ideal vertex spacing", parameters.idealDistance );
				parameters.initalMaxMove = EditorGUILayout.FloatField( "Inital max move", parameters.initalMaxMove );
				parameters.numIterations = EditorGUILayout.IntField( "Number of iterations", parameters.numIterations );
				parameters.gravityStrength = EditorGUILayout.FloatField( "Gravity strength", parameters.gravityStrength );

				GUILayout.EndVertical();
				GUILayout.EndHorizontal();
			}
		}

19 View Source File : BackendSelectWindow.cs
License : MIT License
Project Creator : seldomU

void OnGUI()
		{
			if ( backendTypes == null || OnSelectBackend == null )
			{
				Log.Message( "BackendSelectWindow missing argument" );
				Close();
			}

			if ( backendIcons == null )
			{
				backendIcons = backendTypes
					.Select( t => new { type = t, icon = LoadIcon( t ) } )
					//.Where( tuple => tuple.icon != null )
					.ToDictionary( tuple => tuple.type, tuple => tuple.icon );
			}

			GUILayout.BeginHorizontal( scrollBoxStyle );
			GUILayout.Label("Select graph type", headerStyle);
			GUILayout.EndHorizontal();

			// a scrollview with one row for each backend type
			scrollPos = GUILayout.BeginScrollView( scrollPos, scrollBoxStyle );
			{
				foreach ( var t in backendTypes )
				{
					GUILayout.BeginHorizontal();
					{
						DrawTypeRow( t );
					}
					GUILayout.EndHorizontal();
				}
			}
			GUILayout.EndScrollView();
		}

19 View Source File : GUIUtil.cs
License : MIT License
Project Creator : seldomU

public static Enum EnumToolbar( string prefixLabel, Enum selected, Func<Enum, GUIContent> getContent, GUIStyle style, params GUILayoutOption[] options )
		{
			var values = Enum.GetValues( selected.GetType() );
			var contents = values.OfType<Enum>().Select( val => getContent( val ) ).ToArray();

			int selected_index = 0;
			while ( selected_index < values.Length )
			{
				if ( selected.ToString() == values.GetValue( selected_index ).ToString() )
					break;
				selected_index++;
			}

			GUILayout.BeginHorizontal();
			if ( !string.IsNullOrEmpty( prefixLabel ) )
			{
				GUILayout.Label( prefixLabel );
				GUILayout.Space( 10 );
			}

			selected_index = GUILayout.Toolbar( selected_index, contents, style, options );
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();

			return (Enum) values.GetValue( selected_index );
		}

19 View Source File : Util.cs
License : MIT License
Project Creator : seldomU

internal static void DrawCenteredInspector( Editor editor, int width = 350 )
		{
			// vertical space on top
			GUILayout.FlexibleSpace();

			GUILayout.BeginHorizontal();
			// horizontal space left
			GUILayout.FlexibleSpace();

			// content
			GUILayout.BeginVertical( GUI.skin.box, GUILayout.Width( width ) );

			GUILayout.Label( editor.name, EditorStyles.boldLabel );
			editor.OnInspectorGUI();

			GUILayout.EndVertical();

			// horizontal space right
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();

			// vertical space bottom
			GUILayout.FlexibleSpace();
		}

19 View Source File : WelcomeWindow.cs
License : MIT License
Project Creator : seldomU

void OnGUI()
		{
			if ( !resourcesLoaded )
			{
				if ( !LoadAllTextures() )
				{
					GUILayout.Label( "Window resources are missing" );
					return;
				}
				resourcesLoaded = true;
			}

			if ( !stylesInitialized )
			{
				InitStyles();
				stylesInitialized = true;
			}

			GUILayout.Space( toolbarToHeaderSpace );

			// draw replacedle
			GUILayout.BeginHorizontal();
			var replacedleTexture = EditorGUIUtility.isProSkin ? textureByName[ TNamereplacedleWhite ] : textureByName[ TNamereplacedleBlack ];
			GUILayout.Space( ( position.width - replacedleTexture.width ) / 2 );
			GUI.DrawTexture( ReserveRect( replacedleTexture.width, replacedleTexture.height ), replacedleTexture );
			GUILayout.EndHorizontal();

			string version = GetType().replacedembly.GetName().Version.ToString();
#if RIDEMO
			version += " Demo";
#endif
			GUILayout.Label( version, versionLabelStyle );

			GUILayout.Space( headerToListSpace );

			// draw integrations header
			GUILayout.BeginHorizontal();
			GUILayout.Space( integrationIconHorSpacing );
			var iconRect = ReserveRect( new Vector2( listIconSize, listIconSize ) );
			GUILayout.Space( integrationIconHorSpacing );
			GUI.DrawTexture( iconRect, textureByName[TNameIntegration] );

			GUILayout.Label( "Installable Add-ons", listHeaderStyle );
			GUILayout.EndHorizontal();

			scrollPosition = GUILayout.BeginScrollView( scrollPosition );
			{
				// integrations
				foreach ( var pInfo in packageMetadata )
					DrawPackageContent( pInfo );
			}
			GUILayout.EndScrollView();

			GUILayout.FlexibleSpace();

			// link bar
			GUILayout.Space( toolbarTopSpace );
			GUILayout.BeginHorizontal();
			float linkBarSpacing = ( position.width - ( headlineContent.Length * toolbarIconSize ) ) / ( headlineContent.Length + 1 );
			foreach ( var item in headlineContent )
			{
				GUILayout.Space( linkBarSpacing );
				var rect = ReserveRect( new Vector2( toolbarIconSize, toolbarIconSize ) );
				if ( GUI.Button( rect, new GUIContent( "", null, item.replacedle ), buttonStyles[item.bStTexName] ) )
					item.onClick.Invoke();
			}
			GUILayout.EndHorizontal();

			// tooltip
			GUILayout.Label( GUI.tooltip, tooltipStyle );

			GUILayout.Space( toolbarTopSpace );
		}

19 View Source File : WelcomeWindow.cs
License : MIT License
Project Creator : seldomU

void DrawPackageContent( RIBackendPackageMetaData pInfo )
		{
			GUILayout.Space( packageRowVerticalSpace );
			// replacedle and install/uninstall control
			GUILayout.BeginHorizontal();
			{
				EditorGUI.BeginChangeCheck();
				EditorGUIUtility.labelWidth = packageCheckBoxWidth;
				bool install = GUILayout.Toggle( PackageIsInstalled( pInfo ), GUIContent.none, packageInstallToggleStyle );
				if ( EditorGUI.EndChangeCheck() )
				{
					if ( install )
						replacedetDatabase.ImportPackage( GetFullPackagePath( pInfo.packageName ), true );
					else
					{
						string installPath = GetPackageInstallPath( pInfo );
						string msg = string.Format( "Delete the folder {0} and its contents?", installPath );
						if ( EditorUtility.DisplayDialog( "Delete folder", msg, "Yes", "No" ) )
							replacedetDatabase.Deletereplacedet( installPath );
					}
				}
				GUILayout.Label( pInfo.replacedle, packagereplacedleStyle );
				GUILayout.FlexibleSpace();
			}
			GUILayout.EndHorizontal();

			// description
			GUILayout.Label( pInfo.description, packageDescriptionStyle );
		}

19 View Source File : SettingsInspector.cs
License : MIT License
Project Creator : seldomU

void ShowLayoutTweenParams( LayoutTweenParameters lParams )
		{
			EditorGUILayout.Space();
			foldLayoutTweenSettings = EditorGUILayout.Foldout( foldLayoutTweenSettings, "Layout tween settings" );
			if ( foldLayoutTweenSettings )
			{
				GUILayout.BeginHorizontal();
				GUILayout.Space( 10 );
				GUILayout.BeginVertical();

				lParams.maxFrameDuration = EditorGUILayout.FloatField( "Frame duration", lParams.maxFrameDuration );

				EditorGUILayout.Space();
				GUILayout.Label( "Position tweens", EditorStyles.boldLabel );
				lParams.vertexPosTweenDuration = EditorGUILayout.FloatField( "Duration", lParams.vertexPosTweenDuration );
				lParams.vertexPosTweenUpdateInterval = EditorGUILayout.FloatField( "Update interval", lParams.vertexPosTweenUpdateInterval );

				GUILayout.EndVertical();
				GUILayout.EndHorizontal();
			}
		}

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void DisplayGameObject(GameObject gameObj, Int32 level)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            {
                GUILayout.Space(level * 20);
                var color = GUI.color;
                if (SelectedGameObject == gameObj.transform)
                    GUI.color = Color.green;
                if (!gameObj.activeSelf && gameObj.transform.childCount == 0)
                    GUI.color = Color.magenta;
                else if (gameObj.transform.childCount == 0)
                    GUI.color = Color.yellow;
                else if (!gameObj.activeSelf)
                    GUI.color = Color.red;
                if (GUILayout.Toggle(ExpandedObjs.Contains(gameObj.name), gameObj.name, new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
                {
                    if (!ExpandedObjs.Contains(gameObj.name))
                    {
                        ExpandedObjs.Add(gameObj.name);
                        SelectedGameObject = gameObj.transform;
                    }
                }
                else
                {
                    if (ExpandedObjs.Contains(gameObj.name))
                    {
                        ExpandedObjs.Remove(gameObj.name);
                        SelectedGameObject = gameObj.transform;
                    }
                }
                GUI.color = color;
            }
            GUILayout.EndHorizontal();
            if (ExpandedObjs.Contains(gameObj.name))
                for (var i = 0; i < gameObj.transform.childCount; ++i)
                    DisplayGameObject(gameObj.transform.GetChild(i).gameObject, level + 1);
        }

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void HierarchyWindowMethod(Int32 id)
        {
            GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);// { GUI.skin.box });
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                {
                    SearchText = GUILayout.TextField(SearchText, 100, new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
                    if (GUILayout.Button("Search", new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
                    { }
                }
                GUILayout.EndHorizontal();
                if (RootObjects.Count == 0)
                {
                    foreach (Transform xform in GameObject.FindObjectsOfType<Transform>())
                        if (xform.parent == null && !xform.name.Contains("(Clone)"))
                            RootObjects.Add(xform.gameObject);
                }
                //var rootObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
                if (SelectedGameObject == null)
                    SelectedGameObject = RootObjects.First().transform;
                HierarchyScrollPos = GUILayout.BeginScrollView(HierarchyScrollPos, new GUILayoutOption[2] { GUILayout.Height(HierarchyWindow.height / 3), GUILayout.ExpandWidth(true) });
                {
                    foreach (var rootObject in RootObjects)
                        DisplayGameObject(rootObject, 0);
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);//GUI.skin.box);
            {
                PropertiesScrollPos = GUILayout.BeginScrollView(PropertiesScrollPos, new GUILayoutOption[0]);// GUI.skin.box);
                {
                    var fullName = SelectedGameObject.name;
                    var parentTransform = SelectedGameObject.parent;
                    while (parentTransform != null)
                    {
                        fullName = parentTransform.name + "/" + fullName;
                        parentTransform = parentTransform.parent;
                    }
                    GUILayout.Label(fullName, new GUILayoutOption[0]);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    {
                        GUILayout.Label(SelectedGameObject.gameObject.layer + " : " + LayerMask.LayerToName(SelectedGameObject.gameObject.layer), new GUILayoutOption[0]);
                        GUILayout.FlexibleSpace();
                        SelectedGameObject.gameObject.SetActive(GUILayout.Toggle(SelectedGameObject.gameObject.activeSelf, "Active", new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }));
                        if (GUILayout.Button("?", new GUILayoutOption[0]))
                            Console.WriteLine("?");
                        if (GUILayout.Button("X", new GUILayoutOption[0]))
                            GameObject.Destroy(SelectedGameObject.gameObject);
                    }
                    GUILayout.EndHorizontal();
                    foreach (var component in SelectedGameObject.GetComponents<Component>())
                    {
                        GUILayout.BeginHorizontal(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);// GUI.skin.box);
                        {

                            if (component is Behaviour)
                                (component as Behaviour).enabled = GUILayout.Toggle((component as Behaviour).enabled, "", new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });

                            GUILayout.Label(component.GetIl2CppType().Name + " : " + component.GetIl2CppType().Namespace, new GUILayoutOption[0]);
                            GUILayout.FlexibleSpace();
                            if (GUILayout.Button("?", new GUILayoutOption[0]))
                                Console.WriteLine("?");
                            if (!(component is Transform))
                                if (GUILayout.Button("X", new GUILayoutOption[0]))
                                    GameObject.Destroy(component);
                        }
                        GUILayout.EndHorizontal();
                    }
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            //GUI.DragWindow();
        }

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void ProjectWindowMethod(Int32 id)
        {
            GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);// GUI.skin.box);
            {
                ProjectScrollPos = GUILayout.BeginScrollView(ProjectScrollPos, new GUILayoutOption[2] { GUILayout.Height(ProjectWindow.height / 3), GUILayout.ExpandWidth(true) });
                {
                    var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
                    foreach (var replacedembly in replacedemblies)
                    {
                        ExpandedObjects[replacedembly] = GUILayout.Toggle(ExpandedObjects.ContainsKey(replacedembly) ? ExpandedObjects[replacedembly] : false, replacedembly.GetName().Name, new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
                        if (ExpandedObjects[replacedembly])
                        {
                            var types = replacedembly.GetTypes().Where(t => t.IsClreplaced && !t.IsAbstract && !t.ContainsGenericParameters).ToList();
                            foreach (var type in types)
                            {
                                var staticfields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy).Count(f => f.Name != "OffsetOfInstanceIDInCPlusPlusObject");
                                if (staticfields == 0)
                                    continue;
                                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                                {
                                    var color = GUI.color;
                                    GUILayout.Space(20);
                                    ExpandedObjects[type] = GUILayout.Toggle(ExpandedObjects.ContainsKey(type) ? ExpandedObjects[type] : false, type.Name, new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
                                    GUI.color = color;
                                }
                                GUILayout.EndHorizontal();
                                if (ExpandedObjects[type])
                                {
                                    var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
                                    foreach (var field in fields)
                                    {
                                        if (field.Name == "OffsetOfInstanceIDInCPlusPlusObject") continue;
                                        //var val = field.GetValue(null);
                                        GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                                        {
                                            GUILayout.Space(40);
                                            ExpandedObjects[field] = GUILayout.Toggle(ExpandedObjects.ContainsKey(field) ? ExpandedObjects[field] : false, field.Name + " : " + field.FieldType, new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
                                        }
                                        GUILayout.EndHorizontal();
                                    }
                                }
                            }
                        }
                    }
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            //GUI.DragWindow();
        }

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void DisplayGameObject(GameObject gameObj, Int32 level)
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.Space(level * 20);
                var color = GUI.color;
                if (SelectedGameObject == gameObj.transform)
                    GUI.color = Color.green;
                if (!gameObj.activeSelf && gameObj.transform.childCount == 0)
                    GUI.color = Color.magenta;
                else if (gameObj.transform.childCount == 0)
                    GUI.color = Color.yellow;
                else if (!gameObj.activeSelf)
                    GUI.color = Color.red;
                if (GUILayout.Toggle(ExpandedObjs.Contains(gameObj), gameObj.name, GUILayout.ExpandWidth(false)))
                {
                    if (!ExpandedObjs.Contains(gameObj))
                    {
                        ExpandedObjs.Add(gameObj);
                        SelectedGameObject = gameObj.transform;
                    }
                }
                else
                {
                    if (ExpandedObjs.Contains(gameObj))
                    {
                        ExpandedObjs.Remove(gameObj);
                        SelectedGameObject = gameObj.transform;
                    }
                }
                GUI.color = color;
            }
            GUILayout.EndHorizontal();
            if (ExpandedObjs.Contains(gameObj))
                for (var i = 0; i < gameObj.transform.childCount; ++i)
                    DisplayGameObject(gameObj.transform.GetChild(i).gameObject, level + 1);
        }

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void HierarchyWindowMethod(Int32 id)
        {
            GUILayout.BeginVertical(GUI.skin.box);
            {
                GUILayout.BeginHorizontal();
                {
                    SearchText = GUILayout.TextField(SearchText, GUILayout.ExpandWidth(true));
                    if (GUILayout.Button("Search", GUILayout.ExpandWidth(false)))
                    { }
                }
                GUILayout.EndHorizontal();
                var rootObjects = new List<GameObject>();
                foreach (Transform xform in GameObject.FindObjectsOfType<Transform>())
                    if (xform.parent == null)
                        rootObjects.Add(xform.gameObject);
                //var rootObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
                if (SelectedGameObject == null)
                    SelectedGameObject = rootObjects.First().transform;
                HierarchyScrollPos = GUILayout.BeginScrollView(HierarchyScrollPos, GUILayout.Height(HierarchyWindow.height / 3), GUILayout.ExpandWidth(true));
                {
                    foreach (var rootObject in rootObjects)
                        DisplayGameObject(rootObject, 0);
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical(GUI.skin.box);
            {
                PropertiesScrollPos = GUILayout.BeginScrollView(PropertiesScrollPos, GUI.skin.box);
                {
                    var fullName = SelectedGameObject.name;
                    var parentTransform = SelectedGameObject.parent;
                    while (parentTransform != null)
                    {
                        fullName = parentTransform.name + "/" + fullName;
                        parentTransform = parentTransform.parent;
                    }
                    GUILayout.Label(fullName);
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label(SelectedGameObject.gameObject.layer + " : " + LayerMask.LayerToName(SelectedGameObject.gameObject.layer));
                        GUILayout.FlexibleSpace();
                        SelectedGameObject.gameObject.SetActive(GUILayout.Toggle(SelectedGameObject.gameObject.activeSelf, "Active", GUILayout.ExpandWidth(false)));
                        if (GUILayout.Button("?"))
                            Console.WriteLine("?");
                        if (GUILayout.Button("X"))
                            Destroy(SelectedGameObject.gameObject);
                    }
                    GUILayout.EndHorizontal();
                    foreach (var component in SelectedGameObject.GetComponents<Component>())
                    {
                        GUILayout.BeginHorizontal(GUI.skin.box);
                        {

                            if (component is Behaviour)
                                (component as Behaviour).enabled = GUILayout.Toggle((component as Behaviour).enabled, "", GUILayout.ExpandWidth(false));

                            GUILayout.Label(component.GetType().Name + " : " + component.GetType().Namespace);
                            GUILayout.FlexibleSpace();
                            if (GUILayout.Button("?"))
                                Console.WriteLine("?");
                            if (!(component is Transform))
                                if (GUILayout.Button("X"))
                                    Destroy(component);
                        }
                        GUILayout.EndHorizontal();
                    }
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void ProjectWindowMethod(Int32 id)
        {
            GUILayout.BeginVertical(GUI.skin.box);
            {
                ProjectScrollPos = GUILayout.BeginScrollView(ProjectScrollPos, GUILayout.Height(ProjectWindow.height / 3), GUILayout.ExpandWidth(true));
                {
                    var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
                    foreach (var replacedembly in replacedemblies)
                    {
                        ExpandedObjects[replacedembly] = GUILayout.Toggle(ExpandedObjects.ContainsKey(replacedembly) ? ExpandedObjects[replacedembly] : false, replacedembly.GetName().Name, GUILayout.ExpandWidth(false));
                        if (ExpandedObjects[replacedembly])
                        {
                            var types = replacedembly.GetTypes().Where(t => t.IsClreplaced && !t.IsAbstract && !t.ContainsGenericParameters).ToList();
                            foreach (var type in types)
                            {
                                var staticfields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy).Count(f => f.Name != "OffsetOfInstanceIDInCPlusPlusObject");
                                if (staticfields == 0)
                                    continue;
                                GUILayout.BeginHorizontal();
                                {
                                    var color = GUI.color;
                                    GUILayout.Space(20);
                                    ExpandedObjects[type] = GUILayout.Toggle(ExpandedObjects.ContainsKey(type) ? ExpandedObjects[type] : false, type.Name, GUILayout.ExpandWidth(false));
                                    GUI.color = color;
                                }
                                GUILayout.EndHorizontal();
                                if (ExpandedObjects[type])
                                {
                                    var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
                                    foreach (var field in fields)
                                    {
                                        if (field.Name == "OffsetOfInstanceIDInCPlusPlusObject") continue;
                                        //var val = field.GetValue(null);
                                        GUILayout.BeginHorizontal();
                                        {
                                            GUILayout.Space(40);
                                            ExpandedObjects[field] = GUILayout.Toggle(ExpandedObjects.ContainsKey(field) ? ExpandedObjects[field] : false, field.Name + " : " + field.FieldType, GUI.skin.label, GUILayout.ExpandWidth(false));
                                        }
                                        GUILayout.EndHorizontal();
                                    }
                                }
                            }
                        }
                    }
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void ProjectWindowMethod(Int32 id)
        {
            GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);// GUI.skin.box);
            {
                ProjectScrollPos = GUILayout.BeginScrollView(ProjectScrollPos, new GUILayoutOption[2] { GUILayout.Height(ProjectWindow.height / 3), GUILayout.ExpandWidth(true) });
                {
                    var replacedemblies = AppDomain.CurrentDomain.Getreplacedemblies();
                    foreach (var replacedembly in replacedemblies)
                    {
                        ExpandedObjects[replacedembly] = GUILayout.Toggle(ExpandedObjects.ContainsKey(replacedembly) ? ExpandedObjects[replacedembly] : false, replacedembly.GetName().Name, new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
                        if (ExpandedObjects[replacedembly])
                        {
                            var types = replacedembly.GetTypes().Where(t => t.IsClreplaced && !t.IsAbstract && !t.ContainsGenericParameters).ToList();
                            foreach (var type in types)
                            {
                                var staticfields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy).Count(f => f.Name != "OffsetOfInstanceIDInCPlusPlusObject");
                                if (staticfields == 0)
                                    continue;
                                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                                {
                                    var color = GUI.color;
                                    GUILayout.Space(20);
                                    ExpandedObjects[type] = GUILayout.Toggle(ExpandedObjects.ContainsKey(type) ? ExpandedObjects[type] : false, type.Name, new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
                                    GUI.color = color;
                                }
                                GUILayout.EndHorizontal();
                                if (ExpandedObjects[type])
                                {
                                    var fields = type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
                                    foreach (var field in fields)
                                    {
                                        if (field.Name == "OffsetOfInstanceIDInCPlusPlusObject") continue;
                                        //var val = field.GetValue(null);
                                        GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                                        {
                                            GUILayout.Space(40);
                                            ExpandedObjects[field] = GUILayout.Toggle(ExpandedObjects.ContainsKey(field) ? ExpandedObjects[field] : false, field.Name + " : " + field.FieldType, GUI.skin.label, new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
                                        }
                                        GUILayout.EndHorizontal();
                                    }
                                }
                            }
                        }
                    }
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }

19 View Source File : SceneDebugger.cs
License : MIT License
Project Creator : shalzuth

void HierarchyWindowMethod(Int32 id)
        {
            GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);// { GUI.skin.box });
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                {
                    SearchText = GUILayout.TextField(SearchText, new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
                    if (GUILayout.Button("Search", new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }))
                    { }
                }
                GUILayout.EndHorizontal();
                var rootObjects = new List<GameObject>();
                foreach (Transform xform in GameObject.FindObjectsOfType<Transform>())
                    if (xform.parent == null)
                        rootObjects.Add(xform.gameObject);
                //var rootObjects = UnityEngine.SceneManagement.SceneManager.GetActiveScene().GetRootGameObjects();
                if (SelectedGameObject == null)
                    SelectedGameObject = rootObjects.First().transform;
                HierarchyScrollPos = GUILayout.BeginScrollView(HierarchyScrollPos, new GUILayoutOption[2] { GUILayout.Height(HierarchyWindow.height / 3), GUILayout.ExpandWidth(true) });
                {
                    foreach (var rootObject in rootObjects)
                        DisplayGameObject(rootObject, 0);
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);//GUI.skin.box);
            {
                PropertiesScrollPos = GUILayout.BeginScrollView(PropertiesScrollPos, new GUILayoutOption[0]);// GUI.skin.box);
                {
                    var fullName = SelectedGameObject.name;
                    var parentTransform = SelectedGameObject.parent;
                    while (parentTransform != null)
                    {
                        fullName = parentTransform.name + "/" + fullName;
                        parentTransform = parentTransform.parent;
                    }
                    GUILayout.Label(fullName, new GUILayoutOption[0]);
                    GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                    {
                        GUILayout.Label(SelectedGameObject.gameObject.layer + " : " + LayerMask.LayerToName(SelectedGameObject.gameObject.layer), new GUILayoutOption[0]);
                        GUILayout.FlexibleSpace();
                        SelectedGameObject.gameObject.SetActive(GUILayout.Toggle(SelectedGameObject.gameObject.activeSelf, "Active", new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }));
                        if (GUILayout.Button("?", new GUILayoutOption[0]))
                            Console.WriteLine("?");
                        if (GUILayout.Button("X", new GUILayoutOption[0]))
                            GameObject.Destroy(SelectedGameObject.gameObject);
                    }
                    GUILayout.EndHorizontal();
                    foreach (var component in SelectedGameObject.GetComponents<Component>())
                    {
                        GUILayout.BeginHorizontal(GUIContent.none, GUI.skin.box, new GUILayoutOption[0]);// GUI.skin.box);
                        {

                            if (component is Behaviour)
                                (component as Behaviour).enabled = GUILayout.Toggle((component as Behaviour).enabled, "", new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });

                            GUILayout.Label(component.GetType().Name + " : " + component.GetType().Namespace, new GUILayoutOption[0]);
                            GUILayout.FlexibleSpace();
                            if (GUILayout.Button("?", new GUILayoutOption[0]))
                                Console.WriteLine("?");
                            if (!(component is Transform))
                                if (GUILayout.Button("X", new GUILayoutOption[0]))
                                    GameObject.Destroy(component);
                        }
                        GUILayout.EndHorizontal();
                    }
                }
                GUILayout.EndScrollView();
            }
            GUILayout.EndVertical();
            GUI.DragWindow();
        }

19 View Source File : ReadMeEditor.cs
License : Apache License 2.0
Project Creator : sintefneodroid

protected override void OnHeaderGUI() {
      var readme = (ReadMe)this.target;
      this.Init();

      var icon_width = Mathf.Min(EditorGUIUtility.currentViewWidth / 3f - 20f, 128f);

      GUILayout.BeginHorizontal("In Bigreplacedle");
      {
        GUILayout.Label(readme.icon, GUILayout.Width(icon_width), GUILayout.Height(icon_width));
        GUILayout.Label(readme.replacedle, this.replacedleStyle);
      }
      GUILayout.EndHorizontal();
    }

19 View Source File : ReadmeEditor.cs
License : MIT License
Project Creator : SmallPlanet

protected override void OnHeaderGUI()
	{
		var readme = (Readme)target;
		Init();
		
		var iconWidth = Mathf.Min(EditorGUIUtility.currentViewWidth/3f - 20f, 128f);
		
		GUILayout.BeginHorizontal("In Bigreplacedle");
		{
			GUILayout.Label(readme.icon, GUILayout.Width(iconWidth), GUILayout.Height(iconWidth));
			GUILayout.Label(readme.replacedle, replacedleStyle);
		}
		GUILayout.EndHorizontal();
	}

19 View Source File : GUILayoutHelper.cs
License : MIT License
Project Creator : TeodorVecerdi

public static void EndCenterVertically() {
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
        }

See More Examples