Exemplo n.º 1
0
    public void DoGUI()
    {
        selectedGame = RGUI.Field(selectedGame, "Game");
        selectedAlgo = RGUI.Field(selectedAlgo, "Algo");

        if (selectedAlgo == Algo.MonteCarlo)
        {
            GUILayout.Label("Disable ES for more options.");
            mcES = RGUI.Field(mcES, "ES");
            if (!mcES)
            {
                mcOnPolicy   = RGUI.Field(mcOnPolicy, "On/Off Policy");
                mcFirstVisit = RGUI.Field(mcFirstVisit, "First/Every Visit");
            }
        }

        if (selectedGame == Game.Sokoban)
        {
            selectedSokobanLevel = RGUI.Field(selectedSokobanLevel, "Level");
        }

        if (elapsedMs != -1)
        {
            GUILayout.Label("In " + elapsedMs + " milliseconds");
        }
    }
Exemplo n.º 2
0
        protected bool DoGUIStrandard(GUIFunc func)
        {
            var customLabel = GetCustomLabel();

            if (customLabel != null)
            {
                RGUI.BeginCustomLabel(customLabel);
            }
            if (synced)
            {
                RGUI.BeginColor(syncedColor);
            }

            var changed = false;

            using (new GUILayout.HorizontalScope())
            {
                changed  = DoGUICheckChanged(key, func);
                changed |= DoGUIDefaultButton();
            }

            if (synced)
            {
                RGUI.EndColor();
            }
            if (customLabel != null)
            {
                RGUI.EndCustomLabel();
            }

            return(changed);
        }
Exemplo n.º 3
0
        public override void DoGUI()
        {
            using (new RGUI.IndentScope())
            {
                GUILayout.Label("IndentScope");
            }

            using (new RGUI.EnabledScope(false))
            {
                GUILayout.Label("EnabledScope");
            }

            using (new RGUI.ColorScope(Color.green))
            {
                GUILayout.Label("ColorScope");
            }

            using (new RGUI.BackgroundColorScope(Color.red))
            {
                GUILayout.Button("BackgroundColorScope");
            }

            using (new RGUI.CustomLabelScope(customLabelTable))
            {
                RGUI.Field(customClass, "CustomLabelScope - replace value1 to custom label");
            }

            using (new RGUI.IgnoreFieldScope("value1"))
            {
                RGUI.Field(customClass, "IgnoreFieldScope - ignore value1 field");
            }
        }
Exemplo n.º 4
0
 public bool DoGUISlider(T rangeMin, T rangeMax, string label = null)
 {
     return(DoGUIStrandard((v) =>
     {
         var minMax = ToOuter(v);
         RGUI.MinMaxSlider(ref minMax.min, ref minMax.max, rangeMin, rangeMax, label ?? key);
         return ToInner(minMax);
     }));
 }
Exemplo n.º 5
0
 public void OnGUI()
 {
     windowRect = RGUI.ResizableWindow(GetHashCode(), windowRect, (id) =>
     {
         DoGUI();
         GUI.DragWindow();
     },
                                       "PrefsGUI");
 }
Exemplo n.º 6
0
 private void OnGUI()
 {
     rect = RGUI.ResizableWindow(GetHashCode(), rect,
                                 (id) =>
     {
         GUILayout.Label("ResizableWindow");
         GUI.DragWindow();
     },
                                 "Title");
 }
Exemplo n.º 7
0
        public override void DoGUI()
        {
            customClass     = RGUI.Field(customClass, nameof(customClass));
            robustTestClass = RGUI.Field(robustTestClass, nameof(robustTestClass));

            GUILayout.Label("ClassWithIDoGUI - automatically call DoGUI within an Array/List and another class.");
            classWithIDoGUIList = RGUI.Field(classWithIDoGUIList, nameof(classWithIDoGUIList));

            GUILayout.Label("ClassWithICloneable - element will be duplicate when add new element.");
            classWithICloneableList = RGUI.Field(classWithICloneableList, nameof(classWithICloneableList));
        }
Exemplo n.º 8
0
 public bool DoGUIToolbar(string[] texts, string label = null)
 {
     return(DoGUIStrandard((v) =>
     {
         using (new GUILayout.HorizontalScope())
         {
             RGUI.PrefixLabel(label ?? key);
             return GUILayout.Toolbar(v, texts);
         }
     }));
 }
Exemplo n.º 9
0
 protected virtual void OnDrawWindow()
 {
     if (RGUI.Button("X"))
     {
         Close();
     }
     if (RGUI.Button("Refresh"))
     {
         OnOpen();
     }
 }
Exemplo n.º 10
0
 public bool DoGUISelectionGrid(string[] texts, int xCount, string label = null)
 {
     return(DoGUIStrandard((v) =>
     {
         using (new GUILayout.HorizontalScope())
         {
             RGUI.PrefixLabel(label ?? key);
             return GUILayout.SelectionGrid(v, texts, xCount);
         }
     }));
 }
Exemplo n.º 11
0
        public override void DoGUI()
        {
            RGUI.MinMaxSlider(floatVal, "float");                       // default range max=1.0f
            RGUI.MinMaxSlider(ref floatMin, ref floatMax, "ref float"); // You can also call it without using MinMax class

            RGUI.MinMaxSlider(intVal, 100, "int");
            RGUI.MinMaxSlider(vector2Val, Vector2.one, "vector2");
            RGUI.MinMaxSlider(vector3Val, Vector3.one, "vector3");
            RGUI.MinMaxSlider(vector4Val, Vector4.one, "vector4");
            RGUI.MinMaxSlider(vector2IntVal, Vector2Int.one * 100, "vector2Int");
            RGUI.MinMaxSlider(vector3IntVal, Vector3Int.one * 100, "vector3Int");
        }
Exemplo n.º 12
0
        public void DoGUI(string label = null)
        {
            using (new GUILayout.HorizontalScope())
            {
                RGUI.PrefixLabel(label ?? key);

                using (new GUILayout.VerticalScope())
                {
                    prefs0.DoGUI(paramNames[0]);
                    prefs1.DoGUI(paramNames[1]);
                }
            }
        }
Exemplo n.º 13
0
        protected override void Awake()
        {
            Ins = this;
            base.Awake();
            TypeOptions = typeof(Options);
            MemberInfos = TypeOptions.GetMembers(BindingFlags.Public | BindingFlags.Static);
            foreach (var item in MemberInfos)
            {
                CategoryAttribute     catyAttr = item.GetCustomAttribute(typeof(CategoryAttribute)) as CategoryAttribute;
                FoldoutGroupAttribute foldAttr = item.GetCustomAttribute(typeof(FoldoutGroupAttribute)) as FoldoutGroupAttribute;
                string typeName = "None";
                if (catyAttr != null)
                {
                    typeName = catyAttr.Category;
                }
                else if (foldAttr != null)
                {
                    typeName = foldAttr.GroupName;
                }
                if (!TypedMemberInfos.ContainsKey(typeName))
                {
                    TypedMemberInfos.Add(typeName, new List <MemberInfo>());
                    Folds.Add(typeName, new Fold(typeName));
                    ScrollVals.Add(typeName, new Vector2());
                }
                var list = TypedMemberInfos[typeName];
                list.Add(item);
            }

            foreach (var item in Folds)
            {
                item.Value.Add(() => {
                    ScrollVals[item.Key] = DoMember(TypedMemberInfos[item.Key], ScrollVals[item.Key]);
                });
            }

            FoldView.Add(() => {
                RGUI.BeginVertical();
                foreach (var item in AllIMUI)
                {
                    if (item.IsOptionView)
                    {
                        if (RGUI.Button(item.Title))
                        {
                            item.Toggle();
                        }
                    }
                }
                RGUI.EndVertical();
            });
        }
Exemplo n.º 14
0
        private Vector2 DoMember(List <MemberInfo> memberInfos, Vector2 scrollVal)
        {
            int scrollNum = 30;

            if (memberInfos.Count >= scrollNum)
            {
                scrollVal = RGUI.BeginScrollView(scrollVal, GUILayout.MaxHeight(500));
            }
            for (int i = 0; i < memberInfos.Count; ++i)
            {
                var item = memberInfos[i];
                if (item.MemberType == MemberTypes.Property)
                {
                    PropertyInfo property = item as PropertyInfo;
                    if (property.PropertyType == typeof(bool))
                    {
                        property.SetValue(Options.Ins, RGUI.Toggle((bool)property.GetValue(Options.Ins), item.Name));
                    }
                    else if (property.PropertyType == typeof(int))
                    {
                        property.SetValue(Options.Ins, RGUI.Field((int)property.GetValue(Options.Ins), item.Name));
                    }
                    else if (property.PropertyType == typeof(string))
                    {
                        property.SetValue(Options.Ins, RGUI.Field((string)property.GetValue(Options.Ins), item.Name));
                    }
                }
                else if (item.MemberType == MemberTypes.Method)
                {
                    MethodInfo method = item as MethodInfo;
                    if (method.IsSpecialName)
                    {
                        continue;
                    }
                    var para = method.GetParameters();
                    if (para != null && para.Length > 0)
                    {
                        continue;
                    }
                    if (RGUI.Button(item.Name))
                    {
                        method.Invoke(Options.Ins, null);
                    }
                }
            }
            if (memberInfos.Count >= scrollNum)
            {
                RGUI.EndScrollView();
            }
            return(scrollVal);
        }
Exemplo n.º 15
0
 public void DoGUI()
 {
     using (new GUILayout.HorizontalScope())
     {
         GUILayout.Label("In DoGUI");
         using (new GUILayout.HorizontalScope())
         {
             myParam = RGUI.Field(myParam);
             if (GUILayout.Button("Add10"))
             {
                 myParam += 10;
             }
         }
     }
 }
Exemplo n.º 16
0
        public override void DoGUI()
        {
            using (new GUILayout.HorizontalScope(GUILayout.MinWidth(1500f)))
            {
                using (new GUILayout.VerticalScope())
                {
                    intVal   = RGUI.Slider(intVal, 100, "int");
                    floatVal = RGUI.Slider(floatVal, "float");

                    vector2Val = RGUI.Slider(vector2Val, Vector2.one, "vector2");
                    vector3Val = RGUI.Slider(vector3Val, Vector3.one, "vector3");
                    vector4Val = RGUI.Slider(vector4Val, Vector4.one, "vector4");

                    vector2IntVal = RGUI.Slider(vector2IntVal, Vector2Int.one * 100, "vector2Int");
                    vector3IntVal = RGUI.Slider(vector3IntVal, Vector3Int.one * 100, "vector3Int");

                    rectVal       = RGUI.Slider(rectVal, new Rect(Vector2.one, Vector2.one), "rect");
                    rectIntVal    = RGUI.Slider(rectIntVal, new RectInt(Vector2Int.one * 100, Vector2Int.one * 100), "rectInt");
                    rectOffsetVal = RGUI.Slider(rectOffsetVal, new RectOffset(100, 100, 100, 100), "rectOffset");
                }

                using (new GUILayout.VerticalScope())
                {
                    boundsVal    = RGUI.Slider(boundsVal, new Bounds(Vector3.one, Vector3.one), "bounds");
                    boundsIntVal = RGUI.Slider(boundsIntVal, new BoundsInt(Vector3Int.one * 100, Vector3Int.one * 100), "boundsInt");
                }


                using (new GUILayout.VerticalScope())
                {
                    GUILayout.Label("<b>with isOpen</b>");

                    vector2Val = RGUI.Slider(vector2Val, Vector2.one, "vector2", ref isOpenVector2);
                    vector3Val = RGUI.Slider(vector3Val, Vector3.one, "vector3", ref isOpenVector3);
                    vector4Val = RGUI.Slider(vector4Val, Vector4.one, "vector4", ref isOpenVector4);

                    vector2IntVal = RGUI.Slider(vector2IntVal, Vector2Int.one * 100, "vector2Int", ref isOpenVector2Int);
                    vector3IntVal = RGUI.Slider(vector3IntVal, Vector3Int.one * 100, "vector3Int", ref isOpenVector3Int);

                    rectVal       = RGUI.Slider(rectVal, new Rect(Vector2.one, Vector2.one), "rect", ref isOpenRect);
                    rectIntVal    = RGUI.Slider(rectIntVal, new RectInt(Vector2Int.one * 100, Vector2Int.one * 100), "rectInt", ref isOpenRectInt);
                    rectOffsetVal = RGUI.Slider(rectOffsetVal, new RectOffset(100, 100, 100, 100), "rectOffset", ref isOpenRectOffset);

                    boundsVal    = RGUI.Slider(boundsVal, new Bounds(Vector3.one, Vector3.one), "bounds", ref isOpenBounds);
                    boundsIntVal = RGUI.Slider(boundsIntVal, new BoundsInt(Vector3Int.one * 100, Vector3Int.one * 100), "boundsInt", ref isOpenBoundsInt);
                }
            }
        }
Exemplo n.º 17
0
        protected override void OnDrawWindow()
        {
            base.OnDrawWindow();
            RGUI.BeginVertical();
            if (isPopShow)
            {
                RGUI.Label(Util.GetStr("Desc_Feedback_Error"), RGUIStyle.warningLabel);
            }
            RGUI.BeginHorizontal();
            RGUI.Label(Util.GetStr("Desc_Feedback_Title"), RGUI.Width(200));
            submitTitle = RGUI.TextField(submitTitle, RGUIStyle.warningLabel);
            RGUI.EndHorizontal();

            RGUI.BeginHorizontal();
            RGUI.Label(Util.GetStr("Desc_Feedback_Contact"), RGUI.Width(200));
            submitContact = GUILayout.TextField(submitContact, RGUIStyle.warningLabel);
            RGUI.EndHorizontal();

            RGUI.Label(Util.GetStr("Desc_Feedback_Desc"));
            submitDesc = GUILayout.TextArea(submitDesc, RGUIStyle.warningLabel, RGUI.Height(350));

            RGUI.BeginHorizontal();
            if (RGUI.Button(Util.GetStr("Bnt_取消")))
            {
                Close();
            }
            if (RGUI.Button(Util.GetStr("Bnt_发送")))
            {
                if (
                    submitDesc.IsInv() ||
                    submitDesc == sourceDesc
                    )
                {
                    isPopShow = true;
                    return;
                }
                Feedback.SendMail(submitTitle, submitDesc, submitContact);
                Close();

                BaseTipView.Default?.Show("Text_发送成功");
            }
            RGUI.EndHorizontal();
            RGUI.EndVertical();
        }
Exemplo n.º 18
0
        public override void DoGUI()
        {
            stringVal     = RGUI.Field(stringVal, "string");
            boolVal       = RGUI.Field(boolVal, "bool");
            intVal        = RGUI.Field(intVal, "int");
            floatVal      = RGUI.Field(floatVal, "float");
            colorVal      = RGUI.Field(colorVal, "color");
            enumVal       = RGUI.Field(enumVal, "enum");
            enumFlagsVal  = RGUI.Field(enumFlagsVal, "enumFlags");
            vector2Val    = RGUI.Field(vector2Val, "vector2");
            vector3Val    = RGUI.Field(vector3Val, "vector3");
            vector4Val    = RGUI.Field(vector4Val, "vector4");
            vector2IntVal = RGUI.Field(vector2IntVal, "vector2Int");
            vector3IntVal = RGUI.Field(vector3IntVal, "vector3Int");
            rectVal       = RGUI.Field(rectVal, "rect");
            rectIntVal    = RGUI.Field(rectIntVal, "rectInt");
            rectOffsetVal = RGUI.Field(rectOffsetVal, "rectOffset");
            boundsVal     = RGUI.Field(boundsVal, "bounds");
            boundsIntVal  = RGUI.Field(boundsIntVal, "boundsInt");
            arrayVal      = RGUI.Field(arrayVal, "array");
            listVal       = RGUI.Field(listVal, "list");

            listVal = RGUI.ListField(listVal, "list with custom element GUI", (list, idx, label) =>
            {
                using (new GUILayout.HorizontalScope())
                {
                    var v = list[idx];
                    v     = RGUI.Slider(v, 100, label);
                    if (GUILayout.Button("+"))
                    {
                        v++;
                    }
                    if (GUILayout.Button("-"))
                    {
                        v--;
                    }

                    return(v);
                }
            });
        }
Exemplo n.º 19
0
 private void OnGUI()
 {
     if (IsShow)
     {
         if (IsWindow)
         {
             if (IsResizable)
             {
                 mainRect = RGUI.ResizableWindow(GetHashCode(), mainRect,
                                                 (id) =>
                 {
                     OnDrawWindow();
                     if (IsDragble)
                     {
                         GUI.DragWindow();
                     }
                 },
                                                 Title,
                                                 RGUIStyle.darkWindow);
             }
             else
             {
                 mainRect = RGUI.Window(GetHashCode(), mainRect,
                                        (id) =>
                 {
                     OnDrawWindow();
                     if (IsDragble)
                     {
                         GUI.DragWindow();
                     }
                 },
                                        Title,
                                        RGUIStyle.darkWindow);
             }
         }
         else
         {
             OnDrawWindow();
         }
     }
 }
Exemplo n.º 20
0
 public override void DoGUI()
 {
     stringVal     = RGUI.Field(stringVal, "string");
     boolVal       = RGUI.Field(boolVal, "bool");
     intVal        = RGUI.Field(intVal, "int");
     floatVal      = RGUI.Field(floatVal, "float");
     colorVal      = RGUI.Field(colorVal, "color");
     enumVal       = RGUI.Field(enumVal, "enum");
     enumFlagsVal  = RGUI.Field(enumFlagsVal, "enumFlags");
     vector2Val    = RGUI.Field(vector2Val, "vector2");
     vector3Val    = RGUI.Field(vector3Val, "vector3");
     vector4Val    = RGUI.Field(vector4Val, "vector4");
     vector2IntVal = RGUI.Field(vector2IntVal, "vector2Int");
     vector3IntVal = RGUI.Field(vector3IntVal, "vector3Int");
     rectVal       = RGUI.Field(rectVal, "rect");
     rectIntVal    = RGUI.Field(rectIntVal, "rectInt");
     rectOffsetVal = RGUI.Field(rectOffsetVal, "rectOffset");
     boundsVal     = RGUI.Field(boundsVal, "bounds");
     boundsIntVal  = RGUI.Field(boundsIntVal, "boundsInt");
     arrayVal      = RGUI.Field(arrayVal, "array");
     listVal       = RGUI.Field(listVal, "list");
 }
Exemplo n.º 21
0
        protected override void OnDrawWindow()
        {
            base.OnDrawWindow();
            if (Objectiver != null)
            {
                RGUI.BeginHorizontal();
                Enum <TEnum> .For(x =>
                {
                    RGUI.BeginVertical();
                    RGUI.Label(x.ToString(), RGUIStyle.warningLabel, RGUI.Width(200));
                    foreach (var objective in Objectiver.GetTasks(x))
                    {
                        GUILayout.Label(objective.Target.GetName());
                        var units = Objectiver.GetExcuteUnits(objective);
                        if (units != null)
                        {
                            foreach (var legion in units)
                            {
                                RGUI.Label("-" + legion.GetName());
                            }
                        }
                    }
                    RGUI.EndVertical();
                });

                RGUI.BeginVertical();
                RGUI.Label("Idle", RGUIStyle.warningLabel, RGUI.Width(200));
                foreach (var legion in Objectiver.AllUnits)
                {
                    if (!Objectiver.IsHaveTask(legion))
                    {
                        GUILayout.Label(legion.GetName());
                    }
                }
                RGUI.EndVertical();
                RGUI.EndHorizontal();
            }
        }
Exemplo n.º 22
0
 protected override void OnDrawWindow()
 {
     base.OnDrawWindow();
     if (RGUI.Button("游戏存档"))
     {
         FileUtil.OpenExplorer(Application.persistentDataPath);
     }
     if (RGUI.Button("游戏资源"))
     {
         FileUtil.OpenExplorer(Const.Path_StreamingAssets);
     }
     if (RGUI.Button("游戏文档"))
     {
         FileUtil.OpenExplorer(GameConfig.Ins.URLWiki);
     }
     if (RGUI.Button("游戏论坛"))
     {
         FileUtil.OpenExplorer(GameConfig.Ins.URLCommunity);
     }
     if (RGUI.Button("游戏官网"))
     {
         FileUtil.OpenExplorer(GameConfig.Ins.URLWebsite);
     }
 }
Exemplo n.º 23
0
        public static void DisplayGUI()
        {
            GUILayout.BeginHorizontal();
            {
                GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_general_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
                {
                    GUILayout.Space(EntryPoint.s_boxSpacing);

                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_god_mode : " + (Player.m_localPlayer.VTInGodMode() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        Player.m_localPlayer.VTSetGodMode(!Player.m_localPlayer.VTInGodMode());
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_inf_stamina_me : " + (s_isInfiniteStaminaMe ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        s_isInfiniteStaminaMe = !s_isInfiniteStaminaMe;
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_inf_stamina_others : " + (s_isInfiniteStaminaOthers ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        s_isInfiniteStaminaOthers = !s_isInfiniteStaminaOthers;
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_no_stamina : " + (s_isNoStaminaOthers ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        s_isNoStaminaOthers = !s_isNoStaminaOthers;
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_fly_mode : " + (Player.m_localPlayer.VTInFlyMode() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        Player.m_localPlayer.VTSetFlyMode(!Player.m_localPlayer.VTInFlyMode());
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_ghost_mode : " + (Player.m_localPlayer.VTInGhostMode() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        Player.m_localPlayer.VTSetGhostMode(!Player.m_localPlayer.VTInGhostMode());
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_nop_lacement_cost : " + (Player.m_localPlayer.VTIsNoPlacementCost() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        Player.m_localPlayer.VTSetNoPlacementCost(!Player.m_localPlayer.VTIsNoPlacementCost());
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_explore_minimap")))
                    {
                        Minimap.instance.VTExploreAll();
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_reset_minimap")))
                    {
                        Minimap.instance.VTReset();
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_tame_creatures")))
                    {
                        Player.m_localPlayer.VTTameNearbyCreatures();
                    }
                    if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_infinite_weight : " + (Player.m_localPlayer.VTIsInventoryInfiniteWeight() ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                    {
                        Player.m_localPlayer.VTInventoryInfiniteWeight(!Player.m_localPlayer.VTIsInventoryInfiniteWeight());
                    }
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical();
                {
                    GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_teleport_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
                    {
                        GUILayout.Space(EntryPoint.s_boxSpacing);
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(VTLocalization.instance.Localize("$vt_player_teleport_player :"), GUILayout.ExpandWidth(false));

                            s_teleportTargetIdx = RGUI.SelectionPopup(s_teleportTargetIdx, s_netPlayerNames.ToArray());
                        }
                        GUILayout.EndHorizontal();

                        if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_teleport_button")))
                        {
                            if (s_netPlayers != null && s_teleportTargetIdx < s_netPlayers.Count && s_teleportTargetIdx >= 0)
                            {
                                Player.m_localPlayer.VTTeleportTo(s_netPlayers[s_teleportTargetIdx]);
                            }
                        }
                    }
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_heal_manager_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
                    {
                        GUILayout.Space(EntryPoint.s_boxSpacing);
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(VTLocalization.instance.Localize("$vt_player_heal_player :"), GUILayout.ExpandWidth(false));

                            s_healTargetIdx = RGUI.SelectionPopup(s_healTargetIdx, s_playerNames.ToArray());
                        }
                        GUILayout.EndHorizontal();

                        if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_heal_selected_player")))
                        {
                            if (s_healTargetIdx < s_players.Count && s_healTargetIdx >= 0)
                            {
                                s_players[s_healTargetIdx].VTHeal();
                            }
                        }
                        if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_heal_all_players")))
                        {
                            foreach (Player player in s_players)
                            {
                                player.VTHeal();
                            }
                        }
                    }
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_power_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
                    {
                        GUILayout.Space(EntryPoint.s_boxSpacing);
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(VTLocalization.instance.Localize("$vt_player_power_name :"), GUILayout.ExpandWidth(false));
                            s_guardianPowerIdx = RGUI.SelectionPopup(s_guardianPowerIdx, s_guardianPowers.Keys.Select(p => VTLocalization.instance.Localize(p)).ToArray());
                        }
                        GUILayout.EndHorizontal();


                        if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_power_active_me")))
                        {
                            if (Player.m_localPlayer != null)
                            {
                                Player.m_localPlayer.VTActiveGuardianPower(s_guardianPowers[s_guardianPowerIdx]);
                            }
                        }
                        if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_power_active_all")))
                        {
                            if (s_guardianPowers.ContainsKey(s_guardianPowerIdx))
                            {
                                AllPlayersActiveGuardianPower(s_guardianPowers[s_guardianPowerIdx]);
                            }
                        }
                    }
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_player_skill_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
                    {
                        GUILayout.Space(EntryPoint.s_boxSpacing);
                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(VTLocalization.instance.Localize("$vt_player_skill_name :"), GUILayout.ExpandWidth(false));
                            s_skillNameIdx = RGUI.SelectionPopup(s_skillNameIdx, s_skills.ToArray());
                        }
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        {
                            GUILayout.Label(VTLocalization.instance.Localize("$vt_player_skill_level :"), GUILayout.ExpandWidth(false));
                            s_skillLevelIdx = RGUI.SelectionPopup(s_skillLevelIdx, s_levels.ToArray());
                        }
                        GUILayout.EndHorizontal();

                        if (GUILayout.Button(VTLocalization.instance.Localize("$vt_player_skill_button")))
                        {
                            if (s_skillNameIdx < s_skills.Count && s_skillNameIdx >= 0)
                            {
                                if (int.TryParse(s_levels[s_skillLevelIdx], out int levelInt))
                                {
                                    Player.m_localPlayer.VTUpdateSkillLevel(s_skills[s_skillNameIdx], levelInt);
                                }
                            }
                        }
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }
Exemplo n.º 24
0
        public override void DoGUI()
        {
            using (new RGUI.IndentScope())
            {
                GUILayout.Label("IndentScope");
            }

            using (new RGUI.ColorScope(Color.green))
            {
                GUILayout.Label("ColorScope");
            }

            using (new RGUI.BackgroundColorScope(Color.red))
            {
                GUILayout.Button("BackgroundColorScope");
            }

            using (new RGUI.EnabledScope(false))
            {
                GUILayout.Label("EnabledScope");
            }

            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Label("Popup");

                GUILayout.Box("Popup");
                var resultIdx = RGUI.PopupOnLastRect(new[] { "Button One", "Button Two", "Button Three" });
                if (resultIdx >= 0)
                {
                    Debug.Log($"Popup: Button{resultIdx + 1}");
                }
            }

            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Label("Popup with so many elements");

                GUILayout.Box("A scrollbar appears when the pop-up protrudes from the screen");
                RGUI.PopupOnLastRect(Enumerable.Range(0, 100).Select(i => "Element " + i.ToString()).ToArray());
            }

            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Label("SelectionPopup");
                selectionPopupIdx = RGUI.SelectionPopup(selectionPopupIdx, new[] { "One", "Two", "Three" });
            }

            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Label("SelectionPopupStr");
                selectionPopupStr = RGUI.SelectionPopup(selectionPopupStr, new[] { "One", "Two", "Three" });
            }



            GUILayout.Space(8f);


            GUILayout.Label("FastScrollView (doesn't slow down even if there are many items.)");
            using (new GUILayout.HorizontalScope())
            {
                GUILayout.Label("ItemNum");
                if (int.TryParse(GUILayout.TextField(scrollViewItemCount.ToString()), out var count))
                {
                    if (scrollViewItemCount != count)
                    {
                        scrollViewItemCount = count;
                        fastScrollView.SetNeedUpdateLayout();
                    }
                }
            }

            using (new RGUI.IndentScope())
            {
                useFastScrollView = GUILayout.Toggle(useFastScrollView, nameof(useFastScrollView));
                var items = Enumerable.Range(0, scrollViewItemCount);

                using (new GUILayout.VerticalScope(GUILayout.Height(500)))
                {
                    if (useFastScrollView)
                    {
                        fastScrollView.DoGUI(items, (item) => GUILayout.Label($"FastScrollView item: {item}"));
                    }
                    else
                    {
                        using (var sv = new GUILayout.ScrollViewScope(scPos))
                        {
                            scPos = sv.scrollPosition;
                            items.ToList().ForEach(i => GUILayout.Label($"ScrollView item: {i}"));
                        }
                    }
                }
            }
        }
Exemplo n.º 25
0
 public bool DoGUISlider(int min, int max, string label = null)
 {
     return(DoGUIStrandard((v) => RGUI.Slider(v, min, max, label ?? key)));
 }
Exemplo n.º 26
0
 public virtual bool DoGUISlider(T min, T max, string label = null)
 {
     return(DoGUIStrandard((T v) => RGUI.Slider(v, min, max, label ?? key, ref isOpen)));
 }
Exemplo n.º 27
0
        public static void DisplayGUI()
        {
            GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_entities_spawn_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
            {
                GUILayout.Space(EntryPoint.s_boxSpacing);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_entities_spawn_entity_name :"), GUILayout.ExpandWidth(false));
                    s_entityPrefabIdx = RGUI.SearchableSelectionPopup(s_entityPrefabIdx, s_entityPrefabsFiltered.ToArray(), ref s_entitySearchTerms);

                    SearchItem(s_entitySearchTerms);
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_entities_spawn_quantity :"), GUILayout.ExpandWidth(false));
                    s_entityQuantityText = GUILayout.TextField(s_entityQuantityText, GUILayout.ExpandWidth(true));
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_entities_spawn_level :"), GUILayout.ExpandWidth(false));
                    s_entityLevelIdx = RGUI.SelectionPopup(s_entityLevelIdx, s_entityLevels.ToArray());
                }
                GUILayout.EndHorizontal();

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_entities_spawn_button")))
                {
                    if (int.TryParse(s_entityQuantityText, out int entityQuantity) && int.TryParse(s_entityLevels[s_entityLevelIdx], out int entityLevel))
                    {
                        if (entityQuantity <= 100 && s_entityPrefabIdx < s_entityPrefabsFiltered.Count && s_entityPrefabIdx >= 0)
                        {
                            SpawnEntities(s_entityPrefabsFiltered[s_entityPrefabIdx], entityLevel, entityQuantity);
                        }
                    }
                }
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_entities_drops_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
            {
                GUILayout.Space(EntryPoint.s_boxSpacing);
                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_entities_drops_button")))
                {
                    RemoveAllDrops();
                }
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_entities_item_giver_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
            {
                GUILayout.Space(EntryPoint.s_boxSpacing);
                if (GUILayout.Button(EntryPoint.s_showItemGiver ? VTLocalization.instance.Localize("$vt_entities_item_giver_button_hide") : VTLocalization.instance.Localize("$vt_entities_item_giver_button_show")))
                {
                    EntryPoint.s_showItemGiver = !EntryPoint.s_showItemGiver;
                }
            }
            GUILayout.EndVertical();
        }
Exemplo n.º 28
0
        public static void DisplayGUI()
        {
            GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_damage_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
            {
                GUILayout.Space(EntryPoint.s_boxSpacing);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_damage_player :"), GUILayout.ExpandWidth(false));
                    s_playerDamageIdx = RGUI.SelectionPopup(s_playerDamageIdx, s_playerNames.ToArray());
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_damage_value :"), GUILayout.ExpandWidth(false));
                    s_damageToDeal = GUILayout.TextField(s_damageToDeal, GUILayout.ExpandWidth(true));
                }
                GUILayout.EndHorizontal();

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_player")))
                {
                    if (int.TryParse(s_damageToDeal, out int damage))
                    {
                        s_players[s_playerDamageIdx].VTDamage(damage);
                    }
                }
                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_entities")))
                {
                    DamageAllCharacters();
                }
                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_players")))
                {
                    DamageAllOtherPlayers();
                }
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_event_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
            {
                GUILayout.Space(EntryPoint.s_boxSpacing);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_event_message :"), GUILayout.ExpandWidth(false));
                    s_worldMessageText = GUILayout.TextField(s_worldMessageText, GUILayout.ExpandWidth(true));
                }
                GUILayout.EndHorizontal();

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_event_button")))
                {
                    MessageAllInRange(MessageHud.MessageType.Center, s_worldMessageText);
                }
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_chat_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
            {
                GUILayout.Space(EntryPoint.s_boxSpacing);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_chat_username :"******"$vt_misc_chat_message :"), GUILayout.ExpandWidth(false));
                    s_chatMessageText = GUILayout.TextField(s_chatMessageText, GUILayout.ExpandWidth(true));
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                {
                    s_isShoutMessage = GUILayout.Toggle(s_isShoutMessage, "");
                    GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_chat_shout"));
                }
                GUILayout.EndHorizontal();

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_chat_button")))
                {
                    ChatMessage(s_isShoutMessage ? Talker.Type.Shout : Talker.Type.Normal, s_chatUsernameText, s_chatMessageText);
                }
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_esp_title"), GUI.skin.box, GUILayout.ExpandWidth(false));
            {
                GUILayout.Space(EntryPoint.s_boxSpacing);

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_player_esp_button : " + (EntryPoint.s_showPlayerESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                {
                    EntryPoint.s_showPlayerESP = !EntryPoint.s_showPlayerESP;
                }

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_monster_esp_button : " + (EntryPoint.s_showMonsterESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                {
                    EntryPoint.s_showMonsterESP = !EntryPoint.s_showMonsterESP;
                }

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_dropped_esp_button : " + (EntryPoint.s_showDroppedESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                {
                    EntryPoint.s_showDroppedESP = !EntryPoint.s_showDroppedESP;
                }

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_deposit_esp_button : " + (EntryPoint.s_showDepositESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                {
                    EntryPoint.s_showDepositESP = !EntryPoint.s_showDepositESP;
                }

                if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_pickable_esp_button : " + (EntryPoint.s_showPickableESP ? VTLocalization.s_cheatOn : VTLocalization.s_cheatOff))))
                {
                    EntryPoint.s_showPickableESP = !EntryPoint.s_showPickableESP;
                }
            }
            GUILayout.EndVertical();
        }
Exemplo n.º 29
0
 public override bool DoGUI(string label = null)
 {
     return(DoGUIStrandard((v) => RGUI.Field(v, label ?? key)));
 }