Ejemplo n.º 1
0
        void DrawFirstSection(GridGraph graph)
        {
            DrawWidthDepthFields(graph);

            newNodeSize = EditorGUILayout.FloatField(new GUIContent("Node size", "The size of a single node. The size is the side of the node square in world units"), graph.nodeSize);

            newNodeSize = newNodeSize <= 0.01F ? 0.01F : newNodeSize;

            float prevRatio = graph.aspectRatio;

            graph.aspectRatio = EditorGUILayout.FloatField(new GUIContent("Aspect Ratio", "Scaling of the nodes width/depth ratio. Good for isometric games"), graph.aspectRatio);

            DrawIsometricField(graph);

            if (graph.nodeSize != newNodeSize || prevRatio != graph.aspectRatio)
            {
                if (!locked)
                {
                    graph.nodeSize = newNodeSize;
                    Matrix4x4 oldMatrix = graph.matrix;
                    graph.GenerateMatrix();
                    if (graph.matrix != oldMatrix)
                    {
                        //Rescan the graphs
                        //AstarPath.active.AutoScan ();
                        GUI.changed = true;
                    }
                }
                else
                {
                    int tmpWidth = graph.width;
                    int tmpDepth = graph.depth;

                    float delta = newNodeSize / graph.nodeSize;
                    graph.nodeSize      = newNodeSize;
                    graph.unclampedSize = RoundVector3(new Vector2(tmpWidth * graph.nodeSize, tmpDepth * graph.nodeSize));
                    Vector3 newCenter = graph.matrix.MultiplyPoint3x4(new Vector3((tmpWidth / 2F) * delta, 0, (tmpDepth / 2F) * delta));
                    graph.center = RoundVector3(newCenter);

                    graph.GenerateMatrix();

                    //Make sure the width & depths stay the same
                    graph.width = tmpWidth;
                    graph.depth = tmpDepth;
                    AutoScan();
                }
            }

            DrawPositionField(graph);

            graph.rotation = EditorGUILayout.Vector3Field("Rotation", graph.rotation);

            if (GUILayout.Button(new GUIContent("Snap Size", "Snap the size to exactly fit nodes"), GUILayout.MaxWidth(100), GUILayout.MaxHeight(16)))
            {
                SnapSizeToNodes(graph.width, graph.depth, graph);
            }
        }
    static bool RotationField(SerializedProperty property, SerializedProperty leftEyeBone, SerializedProperty rightEyeBone, string label = null, bool showButton = true, bool isActive = false, System.Action SetActive = null)
    {
        bool dirty = false;

        EditorGUI.BeginChangeCheck();
        GUILayout.BeginHorizontal();
        var leftRotation  = property.FindPropertyRelative("left");
        var rightRotation = property.FindPropertyRelative("right");
        var linked        = property.FindPropertyRelative("linked");

        GUILayout.BeginVertical();
        label = string.IsNullOrEmpty(label) ? property.displayName : label;
        if (GUILayout.Button(label, EditorStyles.label))
        {
            dirty = true;
        }
        if (linked.boolValue)
        {
            GUILayout.BeginHorizontal();
            {
                //Link button
                GUI.color = GUI.skin.label.normal.textColor;
                if (GUILayout.Button(new GUIContent(_linkIcon), GUI.skin.label, GUILayout.MaxWidth(16)))
                {
                    linked.boolValue = false;
                }
                GUI.color = Color.white;

                var testA1 = Quaternion.Euler(new Vector3(20, 0, 0)).eulerAngles;
                var testA2 = Quaternion.Euler(new Vector3(45, 0, 0)).eulerAngles;
                var testA3 = Quaternion.Euler(new Vector3(90, 0, 0)).eulerAngles;
                var testA4 = Quaternion.Euler(new Vector3(95, 0, 0)).eulerAngles;
                var testA5 = Quaternion.Euler(new Vector3(120, 0, 0)).eulerAngles;

                var testB1 = EditorQuaternionToVector3(Quaternion.Euler(new Vector3(20, 0, 0)));
                var testB2 = EditorQuaternionToVector3(Quaternion.Euler(new Vector3(45, 0, 0)));
                var testB3 = EditorQuaternionToVector3(Quaternion.Euler(new Vector3(90, 0, 0)));
                var testB4 = EditorQuaternionToVector3(Quaternion.Euler(new Vector3(95, 0, 0)));
                var testB5 = EditorQuaternionToVector3(Quaternion.Euler(new Vector3(120, 0, 0)));

                //Values
                //leftRotation.quaternionValue = EditorGUILayout.Vector3Field(GUIContent.none, QuaternionToVector3(leftRotation.quaternionValue), GUILayout.MinWidth(100)));
                leftRotation.quaternionValue  = Quaternion.Euler(EditorGUILayout.Vector3Field(GUIContent.none, EditorQuaternionToVector3(leftRotation.quaternionValue), GUILayout.MinWidth(100)));
                rightRotation.quaternionValue = leftRotation.quaternionValue;
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            GUIStyle style = new GUIStyle(EditorStyles.boldLabel);
            style.contentOffset = new Vector2(0, -4);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("L", style, GUILayout.MaxHeight(16)))
            {
                string message = string.Format(_linkEyelidsDialog, label, "L");
                if ((rightRotation.quaternionValue == leftRotation.quaternionValue) ||
                    EditorUtility.DisplayDialog("Collapse?", message, "Yes", "No"))
                {
                    linked.boolValue = true;
                    rightRotation.quaternionValue = leftRotation.quaternionValue;
                }
            }
            leftRotation.quaternionValue = Quaternion.Euler(EditorGUILayout.Vector3Field(GUIContent.none, EditorQuaternionToVector3(leftRotation.quaternionValue), GUILayout.MinWidth(100)));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("R", style, GUILayout.MaxHeight(16)))
            {
                string message = string.Format(_linkEyelidsDialog, label, "R");
                if ((leftRotation.quaternionValue == rightRotation.quaternionValue) ||
                    (EditorUtility.DisplayDialog("Collapse?", message, "Yes", "No")))
                {
                    linked.boolValue             = true;
                    leftRotation.quaternionValue = rightRotation.quaternionValue;
                }
            }
            rightRotation.quaternionValue = Quaternion.Euler(EditorGUILayout.Vector3Field(GUIContent.none, EditorQuaternionToVector3(rightRotation.quaternionValue), GUILayout.MinWidth(100)));
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical();
        bool changed = EditorGUI.EndChangeCheck();

        //Edit button
        if (showButton)
        {
            GUI.backgroundColor = (isActive ? _activeButtonColor : Color.white);
            GUILayout.BeginVertical();
            GUILayout.Space(linked.boolValue ? 4 : 20);
            if (GUILayout.Button(isActive ? "Return" : "Preview", EditorStyles.miniButton, GUILayout.Width(PreviewButtonWidth), GUILayout.Height(PreviewButtonHeight)))
            {
                if (isActive)
                {
                    SetActiveProperty(null);
                    isActive = false;
                }
                else
                {
                    SetActive();
                    isActive = true;
                }
                dirty = _repaint = true;
            }
            GUILayout.EndVertical();
            GUI.backgroundColor = Color.white;
        }

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

        //Mark active if changed
        if (changed)
        {
            //Set active if not already
            if (!isActive)
            {
                SetActive();
                isActive = true;
            }

            //Mark dirty
            dirty = _repaint = true;
        }

        //Update values, always update if active not only on change.
        //We do this because the user may change values with a control-z/undo operation
        if (isActive)
        {
            //Left
            var leftEyeTransform = (Transform)leftEyeBone.objectReferenceValue;
            if (leftEyeTransform != null)
            {
                leftEyeTransform.localRotation = leftRotation.quaternionValue;
            }

            //Right
            var rightEyeTransform = (Transform)rightEyeBone.objectReferenceValue;
            if (rightEyeTransform != null)
            {
                rightEyeTransform.localRotation = rightRotation.quaternionValue;
            }
        }

        //Return
        return(dirty);
    }
Ejemplo n.º 3
0
    public void DrawColaFrameworkUI()
    {
        GUILayout.BeginHorizontal("HelpBox");
        EditorGUILayout.LabelField("== UI相关辅助 ==");
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("创建NewUIView", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30)))
        {
            CreateColaUIEditor.CreateColaUIView();
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("创建C#版UIView脚本", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30)))
        {
            CreateScriptsEditor.CreateCSharpUIView();
        }
        if (GUILayout.Button("创建C#版Module脚本", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30)))
        {
            CreateScriptsEditor.CreateCSharpModule();
        }
        if (GUILayout.Button("创建C#版Templates(UIView和Module)", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30)))
        {
            CreateScriptsEditor.CreateCSharpModule();
        }
        GUILayout.EndHorizontal();
    }
Ejemplo n.º 4
0
            protected override void DrawCustomFooter()
            {
                ButtonIconProfileTexture iconProfile = (ButtonIconProfileTexture)target;

                UnityEditor.EditorGUILayout.LabelField("Custom Icons", UnityEditor.EditorStyles.boldLabel);

                for (int i = 0; i < iconProfile.CustomIcons.Length; i++)
                {
                    Texture2D icon = iconProfile.CustomIcons[i];
                    icon = (Texture2D)UnityEditor.EditorGUILayout.ObjectField(icon != null ? icon.name : "(Empty)", icon, typeof(Texture2D), false, GUILayout.MaxHeight(textureSize));
                    iconProfile.CustomIcons[i] = icon;
                }

                if (GUILayout.Button("Add custom icon"))
                {
                    System.Array.Resize <Texture2D>(ref iconProfile.CustomIcons, iconProfile.CustomIcons.Length + 1);
                }
            }
        public override void DrawSection()
        {
            repaint = false;

            using (new GUILayout.HorizontalScope())
            {
                showSection = GUILayout.Toggle(showSection, "", EUIResourceManager.Instance.Skin.button, GUILayout.Height(30), GUILayout.Width(30));
                GUILayout.Box(EUIResourceManager.Instance.GetContent("Scalable Header"), EUIResourceManager.Instance.Skin.GetStyle("Texture"), GUILayout.MaxWidth(256), GUILayout.MaxHeight(30));
            }

            if (!showSection)
            {
                return;
            }

            using (new HorizontalCenteredScope())
            {
                if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Scalable Wall"),
                                     GUILayout.Height(BlockoutEditorSettings.TwoLineHeight),
                                     GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth)))
                {
                    CreateTriPlanerAsset(m_scalableWallPrefab);
                }
                if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Scalable Floor"),
                                     GUILayout.Height(BlockoutEditorSettings.TwoLineHeight),
                                     GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth)))
                {
                    CreateTriPlanerAsset(m_scalableFloorPrefab);
                }
                if (GUILayout.Button(EUIResourceManager.Instance.GetContent("Scalable Trim"),
                                     GUILayout.Height(BlockoutEditorSettings.TwoLineHeight),
                                     GUILayout.Width(BlockoutEditorSettings.ThreeColumnWidth)))
                {
                    CreateTriPlanerAsset(m_scalableTrimPrefab);
                }
            }
        }
Ejemplo n.º 6
0
        private static QuestCondition ShowConditionInfo(QuestCondition condition)
        {
            var oldtype = condition.ConditionType;

            condition.ConditionType = (ConditionType)RPGMakerGUI.EnumPopup("Condition Type:", condition.ConditionType);
            if (condition.ConditionType != oldtype)
            {
                //TODO: if no longer interact node tree than delete that node tree

                switch (condition.ConditionType)
                {
                case ConditionType.Kill:
                    condition = new KillCondition();
                    break;

                case ConditionType.Item:
                    condition = new ItemCondition();
                    break;

                case ConditionType.Interact:
                    condition = new InteractCondition();
                    break;

                case ConditionType.Deliver:
                    condition = new DeliverCondition();
                    break;

                case ConditionType.Custom:
                    condition = new CustomCondition();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            var killCondition     = condition as KillCondition;
            var itemCondition     = condition as ItemCondition;
            var interactCondition = condition as InteractCondition;
            var deliverCondition  = condition as DeliverCondition;
            var customCondition   = condition as CustomCondition;

            if (killCondition != null)
            {
                if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs)
                {
                    RPGMakerGUI.Toggle("Is NPC?", ref killCondition.IsNPC);
                }
                else
                {
                    killCondition.IsNPC = false;
                }

                if (killCondition.IsNPC)
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to Kill:", ref killCondition.CombatantID);
                }
                else
                {
                    RPGMakerGUI.PopupID <CombatCharacter>("Enemy to Kill:", ref killCondition.CombatantID);
                }

                killCondition.NumberToKill = RPGMakerGUI.IntField("Number To Kill:", killCondition.NumberToKill);
            }

            if (itemCondition != null)
            {
                itemCondition.ItemType = (ItemConditionType)RPGMakerGUI.EnumPopup("Required Item Type:", itemCondition.ItemType);

                if (itemCondition.ItemType == ItemConditionType.CraftItem)
                {
                    RPGMakerGUI.PopupID <Item>("CraftItem To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Craft");
                }
                else if (itemCondition.ItemType == ItemConditionType.QuestItem)
                {
                    RPGMakerGUI.PopupID <Item>("Quest Item To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Quest");

                    if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs)
                    {
                        RPGMakerGUI.Toggle("NPC Drops Items?", ref itemCondition.NPCDropsItem);
                    }
                    else
                    {
                        itemCondition.NPCDropsItem = false;
                    }

                    if (itemCondition.NPCDropsItem)
                    {
                        RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC that Drops Item:", ref itemCondition.CombatantIDThatDropsItem);
                    }
                    else
                    {
                        RPGMakerGUI.PopupID <CombatCharacter>("Enemy that Drops Item:", ref itemCondition.CombatantIDThatDropsItem);
                    }
                }
                else if (itemCondition.ItemType == ItemConditionType.Item)
                {
                    RPGMakerGUI.PopupID <Item>("Item To Collect:", ref itemCondition.ItemToCollectID);
                }

                itemCondition.NumberToObtain = RPGMakerGUI.IntField("Number To Obtain:", itemCondition.NumberToObtain);
            }

            if (interactCondition != null)
            {
                if (RPGMakerGUI.Toggle("Talk to NPC?", ref interactCondition.IsNpc))
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to talk to:", ref interactCondition.InteractableID);
                }
                else
                {
                    RPGMakerGUI.PopupID <Interactable>("Object to interact with:", ref interactCondition.InteractableID);
                }

                if (GUILayout.Button("Open Interaction Node Tree", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == interactCondition.InteractionNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        Debug.Log("ExistingTree null? " + existingTree == null);
                        existingTree.ID = interactCondition.ID;

                        Debug.Log(existingTree.ID + ":::" + existingTree.Name);

                        var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest;

                        //todo: need unique name
                        existingTree.Name = curSelectedQuest.Name + "Interact";
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(interactCondition.ID);
                    interactCondition.InteractionNodeTreeID = existingTree.ID;
                }
            }

            if (deliverCondition != null)
            {
                RPGMakerGUI.PopupID <Item>("Quest Item To Deliver:", ref deliverCondition.ItemToDeliverID, "ID", "Name", "Quest");
                if (RPGMakerGUI.Toggle("Deliver to NPC?", ref deliverCondition.DeliverToNPC))
                {
                    RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to deliver to:", ref deliverCondition.InteractableToDeliverToID);
                }
                else
                {
                    RPGMakerGUI.PopupID <Interactable>("Object to deliver with:", ref deliverCondition.InteractableToDeliverToID);
                }

                if (GUILayout.Button("Open Interaction On Deliver", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == deliverCondition.InteractionNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree    = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        existingTree.ID = deliverCondition.ID;
                        //todo: need unique name
                        var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest;

                        existingTree.Name = curSelectedQuest.Name + "Interact";
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(deliverCondition.ID);
                    deliverCondition.InteractionNodeTreeID = existingTree.ID;
                }
            }

            if (customCondition != null)
            {
                var customVar = customCondition.CustomVariableRequirement;
                RPGMakerGUI.PopupID <Rmh_CustomVariable>("Custom Variable:", ref customVar.VariableID);
                var foundCvar = Rm_RPGHandler.Instance.DefinedVariables.Vars.FirstOrDefault(v => v.ID == customCondition.CustomVariableRequirement.VariableID);
                if (foundCvar != null)
                {
                    switch (foundCvar.VariableType)
                    {
                    case Rmh_CustomVariableType.Float:
                        customVar.FloatValue = RPGMakerGUI.FloatField("Required Value:", customVar.FloatValue);
                        break;

                    case Rmh_CustomVariableType.Int:
                        customVar.IntValue = RPGMakerGUI.IntField("Required Value:", customVar.IntValue);
                        break;

                    case Rmh_CustomVariableType.String:
                        customVar.StringValue = RPGMakerGUI.TextField("Required Value:", customVar.StringValue);
                        break;

                    case Rmh_CustomVariableType.Bool:
                        selectedVarSetterBoolResult = customVar.BoolValue ? 0 : 1;
                        selectedVarSetterBoolResult = EditorGUILayout.Popup("Required Value:",
                                                                            selectedVarSetterBoolResult,
                                                                            new[] { "True", "False" });
                        customVar.BoolValue = selectedVarSetterBoolResult == 0;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
            }

            if (condition.ConditionType != ConditionType.Custom)
            {
                RPGMakerGUI.Toggle("Use Custom Tracking Text:", ref condition.UseCustomText);
            }
            else
            {
                condition.UseCustomText = true;
            }

            if (condition.UseCustomText)
            {
                condition.CustomText          = RPGMakerGUI.TextField("Custom Incomplete Text:", condition.CustomText);
                condition.CustomCompletedText = RPGMakerGUI.TextField("Custom Completed Text:", condition.CustomCompletedText);
            }
            GUILayout.Space(5);

            return(condition);
        }
    public override void OnInspectorGUI()
    {
        EditorGUILayout.BeginVertical();

        EditorGUILayout.Space(20);
        EditorGUILayout.BeginHorizontal();
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.MaxHeight(100));
        GUILayout.Label(scrollContent);
        EditorGUILayout.EndScrollView();

        //按钮
        EditorGUILayout.BeginVertical();
        ColorUtility.TryParseHtmlString("#12FFE9", out Color color);
        GUI.color = color;
        if (GUILayout.Button("点击详见更多内容", GUILayout.MinHeight(50)))
        {
            Application.OpenURL("https://aihailan.com/%e9%9d%a9%e5%91%bd%e6%80%a7unity-%e7%bc%96%e8%be%91%e5%99%a8%e6%89%a9%e5%b1%95%e5%b7%a5%e5%85%b7-odininspector%e7%b3%bb%e5%88%97%e6%95%99%e7%a8%8b/");
        }
        GUI.color = Color.white;

        EditorGUILayout.Space(20);

        if (GUILayout.Button("Github工程下载", GUILayout.MinHeight(50)))
        {
            Application.OpenURL("https://github.com/su9257/FamilyBucket/tree/main/UnityEditorFamilyBucket");
        }
        GUI.color = Color.white;
        EditorGUILayout.EndVertical();

        EditorGUILayout.EndHorizontal();

        //找到类中的私有字段
        serializedObject.Update();
        privateFieldContent = serializedObject.FindProperty("privateFieldContent");//私有字段只有添加SerializeField的才能找到
        EditorGUILayout.LabelField($"私有字段:{privateFieldContent.stringValue}");
        serializedObject.ApplyModifiedProperties();

        EditorGUILayout.IntField("ID", inspectorExample.id);
        EditorGUILayout.LabelField("描述内容");
        inspectorExample.description = EditorGUILayout.TextArea(inspectorExample.description, GUILayout.MinHeight(30));

        //警告
        EditorGUILayout.Space(20);
        inspectorExample.warningContent = EditorGUILayout.TextField("警告内容", inspectorExample.warningContent);
        EditorGUILayout.HelpBox(inspectorExample.warningContent, MessageType.Warning);

        //Slider滑动条
        EditorGUILayout.Space(20);
        inspectorExample.sliderIntValue   = EditorGUILayout.IntSlider("int滑动条", inspectorExample.sliderIntValue, 0, 100);
        inspectorExample.sliderFloatValue = EditorGUILayout.Slider("float滑动条", inspectorExample.sliderFloatValue, 0, 100);
        EditorGUILayout.MinMaxSlider("Min&Max滑动条", ref inspectorExample.minValue, ref inspectorExample.maxValue, -100, 200, GUILayout.MinHeight(20));
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.FloatField(nameof(inspectorExample.minValue), inspectorExample.minValue);
        EditorGUILayout.FloatField(nameof(inspectorExample.maxValue), inspectorExample.maxValue);
        EditorGUILayout.EndHorizontal();

        //progressBar进度条
        EditorGUILayout.Space(20);
        inspectorExample.progressBarValue = EditorGUILayout.Slider(inspectorExample.progressBarValue, 0, 1);
        if (inspectorExample.progressBarValue <= 0.2f)
        {
            GUI.color = Color.red;
        }
        else if (inspectorExample.progressBarValue >= 0.8f)
        {
            GUI.color = Color.green;
        }
        else
        {
            GUI.color = Color.white;
        }
        Rect progressRect = GUILayoutUtility.GetRect(50, 50);

        EditorGUI.ProgressBar(progressRect, inspectorExample.progressBarValue, "进度条");
        GUI.color = Color.white;//恢复

        //条目列表
        EditorGUILayout.Space(20);
        EditorGUILayout.BeginHorizontal();
        foldoutToggle = EditorGUILayout.ToggleLeft("显示条目", foldoutToggle);
        foldoutToggle = EditorGUILayout.Foldout(foldoutToggle, "折叠", true);
        EditorGUILayout.EndHorizontal();
        if (foldoutToggle)
        {
            EditorGUI.indentLevel  += 2;
            inspectorExample.item_0 = EditorGUILayout.TextField("item_0", inspectorExample.item_0);
            inspectorExample.item_1 = EditorGUILayout.TextField("item_1", inspectorExample.item_1);
            inspectorExample.item_2 = EditorGUILayout.TextField("item_2", inspectorExample.item_2);
            EditorGUI.indentLevel  -= 2;
        }
        EditorGUILayout.Space(20);
        foldoutAnimBool.target = EditorGUILayout.ToggleLeft("缓动显示条目", foldoutAnimBool.target);;
        if (EditorGUILayout.BeginFadeGroup(foldoutAnimBool.faded))
        {
            EditorGUI.indentLevel  += 2;
            inspectorExample.item_0 = EditorGUILayout.TextField("item_0", inspectorExample.item_0);
            inspectorExample.item_1 = EditorGUILayout.TextField("item_1", inspectorExample.item_1);
            inspectorExample.item_2 = EditorGUILayout.TextField("item_2", inspectorExample.item_2);
            EditorGUI.indentLevel  -= 2;
        }
        EditorGUILayout.EndFadeGroup();


        //只读条目
        EditorGUILayout.Space(20);
        allowModifyReadOnly = EditorGUILayout.BeginToggleGroup("允许修改只读参数", allowModifyReadOnly);
        EditorGUILayout.TextField(nameof(inspectorExample.readOnlyItem_0), inspectorExample.readOnlyItem_0);
        EditorGUILayout.TextField(nameof(inspectorExample.readOnlyItem_1), inspectorExample.readOnlyItem_1);
        EditorGUILayout.TextField(nameof(inspectorExample.readOnlyItem_2), inspectorExample.readOnlyItem_2);
        EditorGUILayout.EndToggleGroup();

        EditorGUILayout.EndVertical();
    }
    private void DrawMainPanel(MaterialEditor materialEditor, Material targetMaterial)
    {
        GUILayout.Space(7f);

        GUILayout.BeginHorizontal();
        GUILayout.Box(_bannerTop, EditorStyles.label, GUILayout.MaxWidth(224f), GUILayout.MaxHeight(32f));
        GUILayout.FlexibleSpace();
        ButtonOpenUrl(_btnHelp, _headerURL);
        GUILayout.EndHorizontal();
        DrawWideBox(1f);

        SpriteControl(materialEditor);

        if (_hasHueShift)
        {
            HueShiftControl(targetMaterial);
        }

        if (_hasMegaStack)
        {
            MegaStackControl(materialEditor);
        }

        if (_hasRenderTexture)
        {
            ToggleShader(targetMaterial, "Render Texture", ShaderFeature.RenderTexture.GetString());
            RenderTextureControl(materialEditor);
        }

        if (_hasCurvature)
        {
            ToggleShader(targetMaterial, "Curvature", ShaderFeature.Curvature.GetString());
            CurvatureControl(materialEditor);
        }

        if (_hasReflection)
        {
            var noToggle = ShaderNameCheck(targetMaterial.shader.name, "UI/Unlit");
            if (!noToggle)
            {
                ToggleShader(targetMaterial, "Reflection", ShaderFeature.Reflection.GetString());
            }
            ReflectionControl(materialEditor, noToggle);
        }

        if (_hasRefraction)
        {
            var noToggle = ShaderNameCheck(targetMaterial.shader.name, "/FX/");
            RefractionControl(materialEditor, noToggle);
        }

        if (_hasEmission && !targetMaterial.IsKeywordEnabled(ShaderFeature.RenderTexture.GetString()))
        {
            var noToggle = ShaderNameCheck(targetMaterial.shader.name, "/FX/");
            if (!noToggle)
            {
                ToggleShader(targetMaterial, "Emission", ShaderFeature.Emission.GetString());
            }
            EmissionControl(materialEditor, noToggle);
        }

        if (_hasDissolve)
        {
            ToggleShader(targetMaterial, "Dissolve", ShaderFeature.Dissolve.GetString());
            DissolveControl(materialEditor);
        }

        if (_hasFlow)
        {
            FlowControl(materialEditor);
        }


        //check Shader Keywords for Pixel Snapping
        ToggleShader(targetMaterial, "Pixel Snapping", "PIXELSNAP_ON", disableGroup: false);

        GUILayout.Space(15f);

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        EditorGUILayout.HelpBox("Version 1.3.9", MessageType.None);
        EditorGUILayout.HelpBox("Copyright 2016 Ruben de la Torre", MessageType.None);
        EditorGUILayout.EndHorizontal();
    }
        private void DrawConditionList(string aLabel, ref AntAIScenarioItem[] aConditions)
        {
            GUILayout.BeginVertical();
            {
                var c = GUI.color;
                GUILayout.BeginHorizontal();
                {
                    EditorGUILayout.LabelField(aLabel, EditorStyles.boldLabel);
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("", "OL Plus"))
                    {
                        var menu = new GenericMenu();
                        for (int i = 0, n = _scenario.conditions.list.Length; i < n; i++)
                        {
                            menu.AddItem(new GUIContent(_scenario.conditions.list[i].name), false, OnAddCondition, _scenario.conditions.list[i].name);
                        }
                        menu.ShowAsContext();
                    }
                }
                GUILayout.EndHorizontal();

                if (aConditions.Length == 0)
                {
                    GUILayout.Label("<Empty>", EditorStyles.centeredGreyMiniLabel);
                }
                else
                {
                    int delIndex = -1;
                    for (int i = 0, n = aConditions.Length; i < n; i++)
                    {
#if UNITY_2019_3_OR_NEWER
                        GUILayout.BeginHorizontal();
#else
                        GUILayout.BeginHorizontal("Icon.ClipSelected");
#endif
                        {
                            GUILayout.Space(4.0f);
                            GUI.color = c * ((aConditions[i].value)
                                                                ? new Color(0.5f, 1.0f, 0.5f) // green
                                                                : new Color(1.0f, 0.5f, 0.5f) // red
                                             );

                            if (GUILayout.Button(AntAIWorkbench.BoolToStr(aConditions[i].value), _badgeStyle, GUILayout.MaxWidth(20.0f), GUILayout.MaxHeight(20.0f)))
                            {
                                aConditions[i].value = !aConditions[i].value;
                            }

#if UNITY_2019_3_OR_NEWER
                            GUILayout.Label(_scenario.conditions.GetName(aConditions[i].id), _labelStyle);
#else
                            GUILayout.Label(_scenario.conditions.GetName(aConditions[i].id));
#endif

                            GUI.color = c;
                            if (GUILayout.Button("", "OL Minus", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(18.0f)))
                            {
                                delIndex = i;
                            }
                        }
                        GUILayout.EndHorizontal();
                    }

                    if (delIndex > -1)
                    {
                        AntArray.RemoveAt(ref aConditions, delIndex);
                    }
                }
            }
            GUILayout.EndVertical();
        }
        void displayResult(SketchfabModel model)
        {
            GUILayout.BeginVertical();
            {
                if (GUILayout.Button(new GUIContent(model._thumbnail as Texture2D), GUI.skin.label, GUILayout.MaxHeight(_thumbnailSize), GUILayout.MaxWidth(_thumbnailSize)))
                {
                    _currentUid = model.uid;
                    _browserManager.fetchModelInfo(_currentUid);
                    if (_skfbWin != null)
                    {
                        _skfbWin.Focus();
                    }
                }

                GUILayout.BeginVertical(GUILayout.Width(_thumbnailSize), GUILayout.Height(50));
                GUILayout.Label(model.name, _ui.getSketchfabMiniModelName());
                GUILayout.Label("by " + model.author, _ui.getSketchfabMiniAuthorName());
                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
        }
 private void OnGUI()
 {
     _scroll = EditorGUILayout.BeginScrollView(_scroll, GUILayout.MaxWidth(100000), GUILayout.MaxHeight(100000));
     GUILayout.TextArea(Content);
     EditorGUILayout.EndScrollView();
 }
Ejemplo n.º 12
0
        //Renders the RealChute editor GUI
        internal void RenderGUI()
        {
            if (!HighLogic.LoadedSceneIsEditor)
            {
                return;
            }

            GUI.skin = HighLogic.Skin;
            if (this.visible)
            {
                this.window = GUILayout.Window(this.mainId, this.window, Window, "RealChute Parachute Editor " + RCUtils.AssemblyVersion, GUILayout.MaxWidth(420), GUILayout.MaxHeight(Screen.height - 375));
            }
            foreach (ChuteTemplate chute in this.Chutes)
            {
                TemplateGUI gui = chute.templateGUI;
                if (gui.materialsVisible)
                {
                    gui.materialsWindow = GUILayout.Window(gui.matId, gui.materialsWindow, gui.MaterialsWindow, "Parachute material", GUILayout.MaxWidth(375), GUILayout.MaxHeight(275));
                }
            }
            if (this.failedVisible)
            {
                this.failedWindow = GUILayout.Window(this.failedId, this.failedWindow, ApplicationFailed, "Error", GUILayout.MaxWidth(300), GUILayout.MaxHeight(300));
            }
            if (this.successfulVisible)
            {
                this.successfulWindow = GUILayout.Window(this.successId, this.successfulWindow, ApplicationSucceeded, "Success", GUILayout.MaxWidth(300), GUILayout.MaxHeight(200), GUILayout.ExpandHeight(true));
            }
            if (this.presetVisible)
            {
                this.presetsWindow = GUILayout.Window(this.pChute.presetId, this.presetsWindow, Presets, "Presets", GUILayout.MaxWidth(400), GUILayout.MaxHeight(500));
            }
            if (this.presetSaveVisible)
            {
                this.presetsSaveWindow = GUILayout.Window(this.presetSaveId, this.presetsSaveWindow, SavePreset, "Save as preset", GUILayout.MaxWidth(350), GUILayout.MaxHeight(400));
            }
            if (this.presetWarningVisible)
            {
                this.presetsWarningWindow = GUILayout.Window(this.presetWarningId, this.presetsWarningWindow, PresetWarning, "Warning", GUILayout.Width(200), GUILayout.Height(100));
            }
        }
Ejemplo n.º 13
0
 //Failure notice
 private void ApplicationFailed(int id)
 {
     GUILayout.Label("Some parameters could not be applied\nInvalid parameters:");
     GUILayout.Space(10);
     this.failedScroll = GUILayout.BeginScrollView(this.failedScroll, false, false, GUI.skin.horizontalScrollbar, GUI.skin.verticalScrollbar, GUI.skin.box, GUILayout.MaxHeight(200));
     this.pChute.CreateErrors();
     GUILayout.EndScrollView();
     if (GUILayout.Button("Close"))
     {
         this.failedVisible = false;
     }
 }
Ejemplo n.º 14
0
        private void doHeader()
        {
            AH_WindowStyler.DrawGlobalHeader(m_window, AH_WindowStyler.clr_Pink, "ASSET HUNTER PRO", true);
            EditorGUILayout.BeginHorizontal();

            bool infoLoaded = (buildInfoManager != null && buildInfoManager.HasSelection);

            if (infoLoaded)
            {
                GUIContent RefreshGUIContent = new GUIContent(guiContentRefresh);
                Color      origColor         = GUI.color;
                if (buildInfoManager.ProjectDirty)
                {
                    GUI.color = AH_WindowStyler.clr_lBlue;
                    RefreshGUIContent.tooltip = String.Format("{0}{1}", RefreshGUIContent.tooltip, " (Project has changed which means that treeview is out of date)");
                }

                if (doSelectionButton(RefreshGUIContent))// GUILayout.Button(content, GUILayout.MaxWidth(32), GUILayout.Height(18)))
                {
                    RefreshBuildLog();
                }

                GUI.color = origColor;
            }


            if (doSelectionButton(guiContentLoadBuildInfo))
            {
                openBuildInfoSelector();
            }
            EditorGUI.BeginDisabledGroup(!EditorBuildSettings.scenes.Any(val => val.enabled == true)); //Disable the generate btn if there are no enabled scenes in buildsettings
            if (doSelectionButton(guiContentGenerateBuildInfo))
            {
                generateBuildInfo();
            }
            EditorGUI.EndDisabledGroup();
            if (doSelectionButton(guiContentSettings))
            {
                AH_SettingsWindow.Init(true);
            }

            /*if (doSelectionButton(guiContentSceneUsage))
             *  AH_SceneReferenceWindow.Init();*/
            //Only avaliable in 2018
#if UNITY_2018_1_OR_NEWER
            if (infoLoaded && doSelectionButton(guiContentBuildReport))
            {
                AH_BuildReportWindow.Init();
            }
#endif

#if AH_HAS_OLD_INSTALLED
            //Transfer settings to PRO
            GUIContent TransferSettingsContent = new GUIContent("Transfer Settings", "Transfer your settings from old Asset Hunter into PRO");
            if (AH_VersionUpgrader.VersionUpgraderReady && GUILayout.Button(TransferSettingsContent, GUILayout.MaxHeight(18)))
            {
                AH_VersionUpgrader.RunUpgrade();
            }
#endif

            if (infoLoaded && m_TreeView.GetCombinedUnusedSize() > 0)
            {
                string sizeAsString = AH_Utils.GetSizeAsString(m_TreeView.GetCombinedUnusedSize());

                GUIContent instancedGUIContent = new GUIContent(guiContentDeleteAll);
                instancedGUIContent.tooltip = string.Format(instancedGUIContent.tooltip, sizeAsString);
                if (AH_SettingsManager.Instance.HideButtonText)
                {
                    instancedGUIContent.text = null;
                }

                GUIStyle btnStyle = "button";
                GUIStyle newStyle = new GUIStyle(btnStyle);
                newStyle.normal.textColor = AH_WindowStyler.clr_Pink;

                m_TreeView.DrawDeleteAllButton(instancedGUIContent, newStyle, GUILayout.MaxHeight(AH_SettingsManager.Instance.HideButtonText ? btnMaxHeight * 2f : btnMaxHeight));
            }

            GUILayout.FlexibleSpace();
            GUILayout.Space(20);

            if (m_TreeView != null)
            {
                m_TreeView.AssetSelectionToolBarGUI();
            }

            if (doSelectionButton(guiContentReadme))
            {
                Heureka_PackageDataManagerEditor.SelectReadme();
                if (AH_EditorData.Instance.Documentation != null)
                {
                    AssetDatabase.OpenAsset(AH_EditorData.Instance.Documentation);
                }
            }

            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 15
0
    public override void OnInspectorGUI()
    {
        PathOptions myPathOption = (PathOptions)target;

        myPathOption.Type = (PathOptions.PathOptionsType)EditorGUILayout.Popup((int)myPathOption.Type, Enum.GetNames(typeof(PathOptions.PathOptionsType)), GUILayout.Width(100));

        switch (myPathOption.Type)
        {
        case PathOptions.PathOptionsType.Dialogue:
        {
            string name = "";
            GUILayout.BeginHorizontal();
            List <String> Names = Characters.Instance.GetNames();
            Names.Add("Custom Name");
            myPathOption.CharacterIndex = EditorGUILayout.Popup(myPathOption.CharacterIndex, Names.ToArray(), GUILayout.Width(100));
            if (myPathOption.CharacterIndex == Characters.Instance.CharacterList.Count)
            {
                //Custom Name
                name = myPathOption.CustomCharacterName = EditorGUILayout.TextField(myPathOption.CustomCharacterName, GUILayout.Width(100));
            }
            else
            {
                myPathOption.Character = Characters.Instance.CharacterList[myPathOption.CharacterIndex];
                name = myPathOption.Character.CharacterName;
            }
            GUILayout.EndHorizontal();

            EditorStyles.textField.wordWrap = true;
            float height = EditorStyles.textField.CalcHeight(new GUIContent(myPathOption.DialogueLine), EditorGUIUtility.currentViewWidth - 115);
            EditorGUIUtility.labelWidth     = 105;
            myPathOption.DialogueLine       = EditorGUILayout.TextField("Dialogue: ", myPathOption.DialogueLine, GUILayout.Height(height));
            myPathOption.name               = name + ": " + myPathOption.DialogueLine;
            EditorStyles.textField.wordWrap = false;

            myPathOption.DialogueAudio  = (AudioClip)EditorGUILayout.ObjectField("Clip: ", myPathOption.DialogueAudio, typeof(AudioClip), true);
            EditorGUIUtility.labelWidth = 0;
        }
        break;

        case PathOptions.PathOptionsType.CharacterMove:
        {
            GUILayout.BeginHorizontal();
            if (myPathOption.MultipleCharacters == null)
            {
                myPathOption.MultipleCharacters = new List <PathOptions.CharacterMovement>();
            }
            if (myPathOption.MultipleCharacters.Count == 0)
            {
                myPathOption.MultipleCharacters.Add(new PathOptions.CharacterMovement());
            }

            List <String> Names = Characters.Instance.GetNames();
            Names.Add("Multiple Characters");
            myPathOption.CharacterIndex = EditorGUILayout.Popup(myPathOption.CharacterIndex, Names.ToArray(), GUILayout.Width(100));
            if (myPathOption.CharacterIndex == Characters.Instance.CharacterList.Count)
            {
                myPathOption.MultipleMovementType = (PathOptions.CharacterMultipleMovementType)EditorGUILayout.Popup((int)myPathOption.MultipleMovementType, Enum.GetNames(typeof(PathOptions.CharacterMultipleMovementType)), GUILayout.Width(100));

                GUILayout.EndHorizontal();

                myPathOption.gameObject.name = "Multiple characters moving";

                for (int i = 0; i < myPathOption.MultipleCharacters.Count; i++)
                {
                    GUILayout.BeginHorizontal();
                    EditorGUI.indentLevel = 0;

                    myPathOption.MultipleCharacters[i].CharacterIndex = EditorGUILayout.Popup(myPathOption.MultipleCharacters[i].CharacterIndex, Characters.Instance.GetNames().ToArray(), GUILayout.Width(100));
                    myPathOption.MultipleCharacters[i].Character      = Characters.Instance.CharacterList[myPathOption.MultipleCharacters[i].CharacterIndex];

                    myPathOption.MultipleCharacters[i].Action = (PathOptions.CharacterAction)EditorGUILayout.Popup((int)myPathOption.MultipleCharacters[i].Action, Enum.GetNames(typeof(PathOptions.CharacterAction)), GUILayout.Width(70));

                    string label = "";
                    if (myPathOption.MultipleCharacters[0].Action == PathOptions.CharacterAction.Enter)
                    {
                        EditorGUIUtility.labelWidth = 40;
                        label = "from";
                        myPathOption.MultipleCharacters[0].Direction = (PathOptions.CharacterDirection)EditorGUILayout.Popup(label, (int)myPathOption.MultipleCharacters[0].Direction, Enum.GetNames(typeof(PathOptions.CharacterDirection)), GUILayout.Width(100));
                    }
                    else if (myPathOption.MultipleCharacters[0].Action == PathOptions.CharacterAction.Exit)
                    {
                        EditorGUIUtility.labelWidth = 20;
                        label = "to";
                        myPathOption.MultipleCharacters[0].Direction = (PathOptions.CharacterDirection)EditorGUILayout.Popup(label, (int)myPathOption.MultipleCharacters[0].Direction, Enum.GetNames(typeof(PathOptions.CharacterDirection)), GUILayout.Width(100));
                    }
                    else if (myPathOption.MultipleCharacters[0].Action == PathOptions.CharacterAction.Start)
                    {
                        EditorGUIUtility.labelWidth = 20;
                        label = "at";
                        myPathOption.MultipleCharacters[0].Position = (PathOptions.CharaterPosition)EditorGUILayout.Popup(label, (int)myPathOption.MultipleCharacters[0].Position, Enum.GetNames(typeof(PathOptions.CharaterPosition)), GUILayout.Width(100));
                    }

                    if (GUILayout.Button("Delete Movement", GUILayout.MinWidth(125)))
                    {
                        myPathOption.MultipleCharacters.Remove(myPathOption.MultipleCharacters[i]);
                        GUILayout.EndHorizontal();
                        break;
                    }

                    GUILayout.EndHorizontal();
                    if (myPathOption.MultipleCharacters[i].Action == PathOptions.CharacterAction.Enter)
                    {
                        EditorGUIUtility.labelWidth = 75;
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(100);
                        myPathOption.MultipleCharacters[i].Position = (PathOptions.CharaterPosition)EditorGUILayout.Popup("To position:", (int)myPathOption.MultipleCharacters[i].Position, Enum.GetNames(typeof(PathOptions.CharaterPosition)), GUILayout.Width(135));
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.Space(100);
                        myPathOption.MultipleCharacters[i].Orientation = (PathOptions.CharacterOrientation)EditorGUILayout.Popup("Orientation:", (int)myPathOption.MultipleCharacters[i].Orientation, Enum.GetNames(typeof(PathOptions.CharacterOrientation)), GUILayout.Width(135));
                        GUILayout.EndHorizontal();
                    }

                    if (myPathOption.MultipleCharacters[i].Action != PathOptions.CharacterAction.Start)
                    {
                        EditorGUIUtility.labelWidth = 75;
                        GUILayout.BeginHorizontal();
                        GUILayout.Space(100);
                        myPathOption.MultipleCharacters[i].MovementSpeed = EditorGUILayout.FloatField("Speed:", myPathOption.MultipleCharacters[i].MovementSpeed, GUILayout.Width(135));
                        GUILayout.EndHorizontal();
                    }
                }
                if (GUILayout.Button("Add Movement"))
                {
                    myPathOption.MultipleCharacters.Add(new PathOptions.CharacterMovement());
                }
            }
            else
            {
                myPathOption.MultipleCharacters[0].CharacterIndex = myPathOption.CharacterIndex;
                myPathOption.MultipleCharacters[0].Character      = Characters.Instance.CharacterList[myPathOption.MultipleCharacters[0].CharacterIndex];
                myPathOption.gameObject.name = myPathOption.MultipleCharacters[0].Character.CharacterName + " " + myPathOption.MultipleCharacters[0].Action.ToString() + "s";

                myPathOption.MultipleCharacters[0].Action = (PathOptions.CharacterAction)EditorGUILayout.Popup((int)myPathOption.MultipleCharacters[0].Action, Enum.GetNames(typeof(PathOptions.CharacterAction)), GUILayout.Width(70));

                string label = "";
                if (myPathOption.MultipleCharacters[0].Action == PathOptions.CharacterAction.Enter)
                {
                    EditorGUIUtility.labelWidth = 40;
                    label = "from";
                    myPathOption.MultipleCharacters[0].Direction = (PathOptions.CharacterDirection)EditorGUILayout.Popup(label, (int)myPathOption.MultipleCharacters[0].Direction, Enum.GetNames(typeof(PathOptions.CharacterDirection)), GUILayout.Width(100));
                }
                else if (myPathOption.MultipleCharacters[0].Action == PathOptions.CharacterAction.Exit)
                {
                    EditorGUIUtility.labelWidth = 20;
                    label = "to";
                    myPathOption.MultipleCharacters[0].Direction = (PathOptions.CharacterDirection)EditorGUILayout.Popup(label, (int)myPathOption.MultipleCharacters[0].Direction, Enum.GetNames(typeof(PathOptions.CharacterDirection)), GUILayout.Width(100));
                }
                else if (myPathOption.MultipleCharacters[0].Action == PathOptions.CharacterAction.Start)
                {
                    EditorGUIUtility.labelWidth = 20;
                    label = "at";
                    myPathOption.MultipleCharacters[0].Position = (PathOptions.CharaterPosition)EditorGUILayout.Popup(label, (int)myPathOption.MultipleCharacters[0].Position, Enum.GetNames(typeof(PathOptions.CharaterPosition)), GUILayout.Width(100));
                }

                if (myPathOption.MultipleCharacters[0].Action == PathOptions.CharacterAction.Enter)
                {
                    EditorGUIUtility.labelWidth = 55;
                    myPathOption.MultipleCharacters[0].Position = (PathOptions.CharaterPosition)EditorGUILayout.Popup("Position:", (int)myPathOption.MultipleCharacters[0].Position, Enum.GetNames(typeof(PathOptions.CharaterPosition)), GUILayout.Width(125));
                    EditorGUIUtility.labelWidth = 75;
                    myPathOption.MultipleCharacters[0].Orientation = (PathOptions.CharacterOrientation)EditorGUILayout.Popup("Orientation:", (int)myPathOption.MultipleCharacters[0].Orientation, Enum.GetNames(typeof(PathOptions.CharacterOrientation)), GUILayout.Width(135));
                }
                GUILayout.EndHorizontal();

                if (myPathOption.MultipleCharacters[0].Action != PathOptions.CharacterAction.Start)
                {
                    EditorGUIUtility.labelWidth = 75;
                    GUILayout.BeginHorizontal();
                    GUILayout.Space(100);
                    myPathOption.MultipleCharacters[0].MovementSpeed = EditorGUILayout.FloatField("Speed:", myPathOption.MultipleCharacters[0].MovementSpeed, GUILayout.Width(135));
                    GUILayout.EndHorizontal();
                }
            }
        }
        break;

        case PathOptions.PathOptionsType.FullScreenArt:
        {
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 90;
            myPathOption.FullscreenArt  = (Sprite)EditorGUILayout.ObjectField("Fullscreen Art: ", myPathOption.FullscreenArt, typeof(Sprite), true, GUILayout.MaxHeight(16));
            myPathOption.name           = "Fullscreen Art: ";
            if (myPathOption.FullscreenArt != null)
            {
                myPathOption.name += myPathOption.FullscreenArt.name;
            }
            GUILayout.EndHorizontal();
        }
        break;
        }

        EditorUtility.SetDirty(target);
        if (!EditorApplication.isPlaying)
        {
            EditorSceneManager.MarkAllScenesDirty();
        }
    }
        private void GUICriteriaComponentType()
        {
            Select.typeSelection = EditorGUILayout.BeginToggleGroup("Object has component of type:", Select.typeSelection);
            using (new EditorGUILayout.HorizontalScope(EditorStyles.inspectorFullWidthMargins, GUILayout.MaxHeight(10)))
            {
                if (Select.Types == null)
                {
                    Select.ReferenceAllTypesInProject();
                }

                Select.selectTypeIndex = EditorGUILayout.Popup(Select.selectTypeIndex, Select.TypesAsStrings);
                GUIButtonRefreshTypes();
            }
            EditorGUILayout.EndToggleGroup();
        }
Ejemplo n.º 17
0
        private static void QuestDetails(Quest quest, bool inQuestChain)
        {
            if (RPGMakerGUI.Foldout(ref showSelectedQuestDetails, "Selected Quest - Main Details"))
            {
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(GUILayout.MaxWidth(85));
                quest.Image.Image = RPGMakerGUI.ImageSelector("", quest.Image.Image, ref quest.Image.ImagePath);

                GUILayout.EndVertical();
                GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
                quest.Name          = RPGMakerGUI.TextField("Name: ", quest.Name);
                quest.Description   = RPGMakerGUI.TextArea("Description:", quest.Description);
                quest.ConditionMode = (QuestConditionMode)RPGMakerGUI.EnumPopup("Condition Mode:", quest.ConditionMode);
                if (GUILayout.Button("Open Dialog/Event On Accept", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == quest.DialogNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree      = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        existingTree.ID   = quest.ID;
                        existingTree.Name = quest.Name;
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(quest.ID);
                    quest.DialogNodeTreeID = existingTree.ID;
                }

                if (GUILayout.Button("Open Dialog/Event On Complete", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == quest.CompletedDialogNodeTreeID);
                    if (existingTree == null)
                    {
                        existingTree      = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        existingTree.ID   = "complete_" + quest.ID;
                        existingTree.Name = "Completed " + quest.Name;
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(existingTree.ID);
                    quest.CompletedDialogNodeTreeID = existingTree.ID;
                }

                GUILayout.Space(5);
                RPGMakerGUI.Toggle("Player Keeps Quest Items?", ref quest.PlayerKeepsQuestItems);
                RPGMakerGUI.Toggle("Is Repeatable?", ref quest.Repeatable);
                RPGMakerGUI.Toggle("Can Abandon?", ref quest.CanAbandon);
                if (RPGMakerGUI.Toggle("Has Time Limit?", ref quest.HasTimeLimit))
                {
                    quest.TimeLimit = RPGMakerGUI.FloatField("- Time Limit:", quest.TimeLimit);
                }
                if (RPGMakerGUI.Toggle("Run Event On Accept?", ref quest.RunEventOnAccept))
                {
                    RPGMakerGUI.PopupID <NodeChain>("- Event:", ref quest.EventOnAcceptID);
                }
                if (RPGMakerGUI.Toggle("Run Event On Completion?", ref quest.RunEventOnComplete))
                {
                    RPGMakerGUI.PopupID <NodeChain>("- Event:", ref quest.EventOnCompletionId);
                }
                if (RPGMakerGUI.Toggle("Run Event On Cancel?", ref quest.RunEventOnCancel))
                {
                    RPGMakerGUI.PopupID <NodeChain>("- Event:", ref quest.EventOnCancelId);
                }


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

                RPGMakerGUI.EndFoldout();
            }

            if (RPGMakerGUI.Foldout(ref showSelectedQuestReq, "Requirements"))
            {
                List <Quest> availableReqQuests = new List <Quest>();
                if (inQuestChain)
                {
                    availableReqQuests = Rm_RPGHandler.Instance.Repositories.Quests.AllQuests.Where(q => selectedQuestChain.QuestsInChain.FirstOrDefault(qu => qu.ID == q.ID) == null).ToList();
                }
                else
                {
                    availableReqQuests = Rm_RPGHandler.Instance.Repositories.Quests.AllQuests;
                }


                RPGMakerGUI.FoldoutList(ref showReqAcceptedQuests, "Required Completed Quests", quest.Requirements.QuestCompletedIDs, availableReqQuests, "+Quest",
                                        "", "Click +Quest to add a requirement for a completed quest.");

                RPGMakerGUI.FoldoutList(ref showCustomVarReqSetters, "Custom Var Requirements", quest.Requirements.CustomRequirements, Rm_RPGHandler.Instance.DefinedVariables.Vars, "+VariableReq",
                                        "", "Click +VariableReq to add a varaible requirement", "VariableID", "Name", "ID", "Name", false, "Value");

                RPGMakerGUI.SubTitle("More Requirements");

                if (RPGMakerGUI.Toggle("Require Player Level:", ref quest.Requirements.RequireLevel))
                {
                    quest.Requirements.LevelRequired = RPGMakerGUI.IntField("- Required Level:", quest.Requirements.LevelRequired);
                }

                if (RPGMakerGUI.Toggle("Require Player Class:", ref quest.Requirements.RequireClass))
                {
                    RPGMakerGUI.PopupID <Rm_ClassNameDefinition>("- Class ID:", ref quest.Requirements.RequiredClassID);
                }

                RPGMakerGUI.Toggle("Require Reputation Above Amount :", ref quest.Requirements.ReqRepAboveValue);
                if (quest.Requirements.ReqRepAboveValue)
                {
                    quest.Requirements.ReqRepBelowValue = false;
                }
                RPGMakerGUI.Toggle("Require Reputation Below Amount :", ref quest.Requirements.ReqRepBelowValue);
                if (quest.Requirements.ReqRepBelowValue)
                {
                    quest.Requirements.ReqRepAboveValue = false;
                }

                if (quest.Requirements.ReqRepAboveValue || quest.Requirements.ReqRepBelowValue)
                {
                    RPGMakerGUI.PopupID <ReputationDefinition>("- Reputation Faction:", ref quest.Requirements.ReputationFactionID);
                    var prefix = quest.Requirements.ReqRepAboveValue ? "Above " : "Below ";
                    quest.Requirements.ReputationValue = RPGMakerGUI.IntField("- " + prefix + "Amount:", quest.Requirements.ReputationValue);
                }

                if (RPGMakerGUI.Toggle("Require Trait Level?", ref quest.Requirements.RequireTraitLevel))
                {
                    RPGMakerGUI.PopupID <Rm_TraitDefintion>("- Trait:", ref quest.Requirements.RequiredTraitID);
                    quest.Requirements.TraitLevel = RPGMakerGUI.IntField("- Level:", quest.Requirements.TraitLevel);
                }
                if (RPGMakerGUI.Toggle("Require Learnt Skill?", ref quest.Requirements.RequireLearntSkill))
                {
                    RPGMakerGUI.PopupID <Skill>("- Skill:", ref quest.Requirements.LearntSkillID);
                }

                RPGMakerGUI.EndFoldout();
            }


            var result = RPGMakerGUI.FoldoutToolBar(ref showSelectedQuestMainConditions, "Quest Conditions", "+Condition", false, false);

            if (showSelectedQuestMainConditions)
            {
                if (quest.Conditions.Count == 0)
                {
                    EditorGUILayout.HelpBox("Click +Condition to add a new quest condition.", MessageType.Info);
                }

                for (int index = 0; index < quest.Conditions.Count; index++)
                {
                    GUILayout.BeginVertical("foldoutBox");

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

                    if (index > 0 && GUILayout.Button("Move Up", "genericButton"))
                    {
                        GUI.FocusControl("");
                        var curCondition  = quest.Conditions[index];
                        var prevCondition = quest.Conditions[index - 1];

                        quest.Conditions[index - 1] = curCondition;
                        quest.Conditions[index]     = prevCondition;

                        return;
                    }

                    if (index < quest.Conditions.Count - 1 && GUILayout.Button("Move Down", "genericButton"))
                    {
                        GUI.FocusControl("");
                        var curCondition  = quest.Conditions[index];
                        var nextCondition = quest.Conditions[index + 1];

                        quest.Conditions[index + 1] = curCondition;
                        quest.Conditions[index]     = nextCondition;

                        return;
                    }

                    GUILayout.EndHorizontal();

                    quest.Conditions[index] = ShowConditionInfo(quest.Conditions[index]);

                    GUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Delete", "genericButton", GUILayout.Height(25), GUILayout.Width(100)))
                    {
                        GUI.FocusControl("");
                        quest.Conditions.RemoveAt(index);
                        index--;
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.EndVertical();
                }


                if (result == 0)
                {
                    quest.Conditions.Add(new KillCondition());
                }

                RPGMakerGUI.EndFoldout();
            }

            if (RPGMakerGUI.Foldout(ref showFinalCondition, "Final Condition"))
            {
                if (RPGMakerGUI.Toggle("Enable Final Condition?", ref quest.HasFinalCondition))
                {
                    quest.FinalCondition = ShowConditionInfo(quest.FinalCondition);
                }
                RPGMakerGUI.EndFoldout();
            }

            if (RPGMakerGUI.Foldout(ref showBonusCondition, "Bonus Condition"))
            {
                if (RPGMakerGUI.Toggle("Enable Bonus Condition?", ref quest.HasBonusCondition))
                {
                    quest.BonusCondition = ShowConditionInfo(quest.BonusCondition);
                    if (RPGMakerGUI.Toggle("- Has Time Limit", ref quest.BonusHasTimeLimit))
                    {
                        quest.BonusTimeLimit = RPGMakerGUI.FloatField("  - Time Limit:", quest.BonusTimeLimit);
                    }
                }

                RPGMakerGUI.EndFoldout();
            }



            if (RPGMakerGUI.Foldout(ref showQuestRewards, "Rewards"))
            {
                ShowQuestRewardInfo(ref showQuestMainRewards, "Item Rewards", quest.Rewards);
                RPGMakerGUI.EndFoldout();
            }

            if (quest.HasBonusCondition)
            {
                if (RPGMakerGUI.Foldout(ref showBonusRewards, "Bonus Rewards"))
                {
                    ShowQuestRewardInfo(ref showQuestBonusRewards, "Bonus Condition Reward", quest.BonusRewards);
                    RPGMakerGUI.EndFoldout();
                }
            }

            RPGMakerGUI.FoldoutList(ref showCustomVarSetters, "Set Custom Vars on Completion", quest.SetCustomVariablesOnCompletion, Rm_RPGHandler.Instance.DefinedVariables.Vars, "+VariableSetter",
                                    "", "Click +VariableSetter to add a varaible setter", "VariableID", "Name", "ID", "Name");
        }
        private void GUIPropertyInComponent()
        {
            Select.propertyInComponent = EditorGUILayout.BeginToggleGroup("Property in Component", Select.propertyInComponent);
            using (new EditorGUI.IndentLevelScope())
            {
                using (new EditorGUILayout.HorizontalScope(EditorStyles.inspectorFullWidthMargins, GUILayout.MaxHeight(10)))
                {
                    EditorGUILayout.PrefixLabel("Property of type:");
                    propertyTypeIndex = EditorGUILayout.Popup(propertyTypeIndex, PropertyTypes);
                }

                EditorGUILayout.LabelField("Property name", EditorStyles.miniLabel);
                using (new EditorGUILayout.HorizontalScope(EditorStyles.inspectorFullWidthMargins, GUILayout.MaxHeight(10)))
                {
                    propertyName = EditorGUILayout.TextField(propertyName);
                    EditorGUIUtility.labelWidth = 180;

                    ChoosePropertyType();
                }
            }
            EditorGUILayout.EndToggleGroup();
        }
Ejemplo n.º 19
0
        private static void RenderEditMode()
        {
            BuildListVessel ship = KCTGameStates.EditedVessel;

            if (_finishedShipBP < 0 && ship.IsFinished)
            {
                // If ship is finished, then both build and integration times can be refreshed with newly calculated values
                _finishedShipBP        = Utilities.GetBuildTime(ship.ExtractedPartNodes);
                ship.BuildPoints       = _finishedShipBP;
                ship.IntegrationPoints = MathParser.ParseIntegrationTimeFormula(ship);
            }

            Utilities.GetShipEditProgress(ship, out double newProgressBP, out double originalCompletionPercent, out double newCompletionPercent);  //progress
            GUILayout.Label($"Original: {Math.Max(0, Math.Round(100 * originalCompletionPercent, 2))}%");
            GUILayout.Label($"Edited: {Math.Round(100 * newCompletionPercent, 2)}%");

            BuildListVessel.ListType type = EditorLogic.fetch.launchSiteName == "LaunchPad" ? BuildListVessel.ListType.VAB : BuildListVessel.ListType.SPH;
            GUILayout.BeginHorizontal();
            GUILayout.Label("Build Time at ");
            if (BuildRateForDisplay == null)
            {
                BuildRateForDisplay = Utilities.GetBuildRate(0, type, null).ToString();
            }
            BuildRateForDisplay = GUILayout.TextField(BuildRateForDisplay, GUILayout.Width(75));
            GUILayout.Label(" BP/s:");
            List <double> rates = new List <double>();

            if (ship.Type == BuildListVessel.ListType.VAB)
            {
                rates = Utilities.GetVABBuildRates(null);
            }
            else
            {
                rates = Utilities.GetSPHBuildRates(null);
            }
            if (double.TryParse(BuildRateForDisplay, out double bR))
            {
                if (GUILayout.Button("*", GUILayout.ExpandWidth(false)))
                {
                    _rateIndexHolder = (_rateIndexHolder + 1) % rates.Count;
                    bR = rates[_rateIndexHolder];
                    BuildRateForDisplay = bR.ToString();
                }
                GUILayout.EndHorizontal();
                GUILayout.Label(MagiCore.Utilities.GetFormattedTime(Math.Abs(KCTGameStates.EditorBuildTime + KCTGameStates.EditorIntegrationTime - newProgressBP) / bR));
            }
            else
            {
                GUILayout.EndHorizontal();
                GUILayout.Label("Invalid Build Rate");
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Save Edits"))
            {
                _finishedShipBP = -1;
                Utilities.SaveShipEdits(ship);
            }
            if (GUILayout.Button("Cancel Edits"))
            {
                KCTDebug.Log("Edits cancelled.");
                _finishedShipBP = -1;
                ScrapYardWrapper.ProcessVessel(KCTGameStates.EditedVessel.ExtractedPartNodes);
                KCTGameStates.mergedVessels = new List <BuildListVessel>();
                KCTGameStates.ClearVesselEditMode();

                HighLogic.LoadScene(GameScenes.SPACECENTER);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Simulate"))
            {
                _finishedShipBP = -1;
                _simulationConfigPosition.height = 1;
                EditorLogic.fetch.Lock(true, true, true, "KCTGUILock");
                GUIStates.ShowSimConfig = true;

                double effCost = Utilities.GetEffectiveCost(EditorLogic.fetch.ship.Parts);
                double bp      = Utilities.GetBuildTime(effCost);
                KCTGameStates.LaunchedVessel = new BuildListVessel(EditorLogic.fetch.ship, EditorLogic.fetch.launchSiteName, effCost, bp, EditorLogic.FlagURL);
            }
            GUILayout.EndHorizontal();

            if (KCTGameStates.LaunchedVessel != null && !KCTGameStates.LaunchedVessel.AreTanksFull() &&
                GUILayout.Button("Fill Tanks"))
            {
                foreach (Part p in EditorLogic.fetch.ship.parts)
                {
                    //fill as part prefab would be filled?
                    if (Utilities.PartIsProcedural(p))
                    {
                        foreach (PartResource rsc in p.Resources)
                        {
                            if (GuiDataAndWhitelistItemsDatabase.ValidFuelRes.Contains(rsc.resourceName) && rsc.flowState)
                            {
                                rsc.amount = rsc.maxAmount;
                            }
                        }
                    }
                    else
                    {
                        foreach (PartResource rsc in p.Resources)
                        {
                            if (GuiDataAndWhitelistItemsDatabase.ValidFuelRes.Contains(rsc.resourceName) && rsc.flowState)
                            {
                                PartResource templateRsc = p.partInfo.partPrefab.Resources.FirstOrDefault(r => r.resourceName == rsc.resourceName);
                                if (templateRsc != null)
                                {
                                    rsc.amount = templateRsc.amount;
                                }
                            }
                        }
                    }
                }
            }
            if (!_showMergeSelectionList && KCTGameStates.mergingAvailable)
            {
                if (GUILayout.Button("Merge Built Vessel"))
                {
                    _showMergeSelectionList = true;
                }
            }
            if (_showMergeSelectionList && KCTGameStates.mergingAvailable)
            {
                if (GUILayout.Button("Hide Merge Selection"))
                {
                    _showMergeSelectionList = false;
                }

                GUILayout.BeginVertical();
                GUILayout.Label("Choose a vessel");

                GUILayout.Label("VAB");
                VABMergeScroll = GUILayout.BeginScrollView(VABMergeScroll, GUILayout.Height(5 * 26 + 5), GUILayout.MaxHeight(1 * Screen.height / 4));

                foreach (BuildListVessel vessel in KCTGameStates.ActiveKSC.VABWarehouse)
                {
                    if (vessel.Id != ship.Id && !KCTGameStates.mergedVessels.Exists(x => x.Id == vessel.Id))
                    {
                        if (GUILayout.Button(vessel.ShipName))
                        {
                            ShipConstruct mergedShip = new ShipConstruct();
                            mergedShip.LoadShip(vessel.ShipNode);
                            EditorLogic.fetch.SpawnConstruct(mergedShip);

                            KCTGameStates.mergedVessels.Add(vessel);
                        }
                    }
                }
                GUILayout.EndScrollView();

                GUILayout.Label("SPH");
                SPHMergeScroll = GUILayout.BeginScrollView(SPHMergeScroll, GUILayout.Height(5 * 26 + 5), GUILayout.MaxHeight(1 * Screen.height / 4));

                foreach (BuildListVessel vessel in KCTGameStates.ActiveKSC.SPHWarehouse)
                {
                    if (vessel.Id != ship.Id && !KCTGameStates.mergedVessels.Exists(x => x.Id == vessel.Id))
                    {
                        if (GUILayout.Button(vessel.ShipName))
                        {
                            ShipConstruct mergedShip = new ShipConstruct();
                            mergedShip.LoadShip(vessel.ShipNode);
                            EditorLogic.fetch.SpawnConstruct(mergedShip);

                            KCTGameStates.mergedVessels.Add(vessel);
                        }
                    }
                }
                GUILayout.EndScrollView();
                GUILayout.EndVertical();
            }
        }
        void OnGUI()
        {
            EditorGUIUtility.labelWidth = 180;

            EditorGUILayout.Space();
            using (new EditorGUILayout.HorizontalScope(EditorStyles.inspectorFullWidthMargins))
            {
                GUILayout.FlexibleSpace();
                tab = GUILayout.Toolbar(tab, new string[] { "Scene", "Assets" }, GUILayout.MaxWidth(400), GUILayout.MaxHeight(25));
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.Space();

            switch (tab)
            {
            case 0:
                GUISceneFilter();
                break;

            case 1:
                GUIAssetFilter();
                break;
            }
        }
Ejemplo n.º 21
0
        private void OnGUI()
        {
            GUI.Label(new Rect(0f, 0f, base.position.width, 20f), "Heapshots are located here: " + Path.Combine(Application.dataPath, "Heapshots"));
            GUI.Label(new Rect(0f, 20f, base.position.width, 20f), "Currently opened: " + this.lastOpenedHeapshotFile);
            GUI.Label(new Rect(100f, 40f, base.position.width, 20f), "Profiling: " + this.lastOpenedProfiler);
            this.DoActiveProfilerButton(new Rect(0f, 40f, 100f, 30f));
            if (GUI.Button(new Rect(0f, 70f, 200f, 20f), "CaptureHeapShot", EditorStyles.toolbarDropDown))
            {
                ProfilerDriver.CaptureHeapshot();
            }
            GUI.changed           = false;
            this.selectedHeapshot = EditorGUI.Popup(new Rect(250f, 70f, 500f, 30f), "Click to open -->", this.selectedHeapshot, this.heapshotFiles.ToArray());
            if (GUI.changed && this.heapshotFiles[this.selectedHeapshot].Length > 0)
            {
                this.OpenHeapshot(this.heapshotFiles[this.selectedHeapshot] + ".heapshot");
            }
            GUILayout.BeginArea(new Rect(0f, 90f, base.position.width, 60f));
            SplitterGUILayout.BeginHorizontalSplit(this.viewSplit, new GUILayoutOption[0]);
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            string[] array = new string[]
            {
                "Roots",
                "All Objects"
            };
            for (int i = 0; i < array.Length; i++)
            {
                bool flag = GUILayout.Toggle(this.currentTab == i, array[i], EditorStyles.toolbarButton, new GUILayoutOption[]
                {
                    GUILayout.MaxHeight(16f)
                });
                if (flag)
                {
                    this.currentTab = i;
                }
            }
            GUILayout.EndHorizontal();
            this.DoTitles(this.titleSplit1);
            GUILayout.EndVertical();
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.Label("Back trace references", EditorStyles.toolbarButton, new GUILayoutOption[]
            {
                GUILayout.MaxHeight(16f)
            });
            this.DoTitles(this.titleSplit2);
            GUILayout.EndVertical();
            SplitterGUILayout.EndHorizontalSplit();
            GUILayout.EndArea();
            this.guiRect = new Rect(0f, 130f, (float)this.viewSplit.realSizes[0], 16f);
            float height   = (float)this.GetItemCount(this.hsAllObjects) * 16f;
            Rect  position = new Rect(this.guiRect.x, this.guiRect.y, this.guiRect.width, base.position.height - this.guiRect.y);

            this.leftViewScrollPosition = GUI.BeginScrollView(position, this.leftViewScrollPosition, new Rect(0f, 0f, position.width - 20f, height));
            this.itemIndex = 0;
            this.guiRect.y = 0f;
            int num = this.currentTab;

            if (num != 0)
            {
                if (num == 1)
                {
                    this.DoHeapshotObjects(this.hsAllObjects, this.titleSplit1, 0, new HeapshotWindow.OnSelect(this.OnSelectObject));
                }
            }
            else
            {
                this.DoHeapshotObjects(this.hsRoots, this.titleSplit1, 0, new HeapshotWindow.OnSelect(this.OnSelectObject));
            }
            GUI.EndScrollView();
            this.guiRect = new Rect((float)this.viewSplit.realSizes[0], 130f, (float)this.viewSplit.realSizes[1], 16f);
            float height2 = (float)this.GetItemCount(this.hsBackTraceObjects) * 16f;

            position = new Rect(this.guiRect.x, this.guiRect.y, this.guiRect.width, base.position.height - this.guiRect.y);
            this.rightViewScrollPosition = GUI.BeginScrollView(position, this.rightViewScrollPosition, new Rect(0f, 0f, position.width - 20f, height2));
            if (this.hsBackTraceObjects.Count > 0)
            {
                this.guiRect.y = 0f;
                this.itemIndex = 0;
                this.DoHeapshotObjects(this.hsBackTraceObjects, this.titleSplit2, 0, null);
            }
            GUI.EndScrollView();
        }
        private void DrawGoalList()
        {
            Color c        = GUI.color;
            int   delIndex = -1;

            EditorGUILayout.Separator();
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("目标列表", EditorStyles.boldLabel);

            AIScenarioGoal goal;

            if (_self.goals.Length == 0)
            {
                GUILayout.BeginVertical("box");
                EditorGUILayout.LabelField("The Goal List is Empty.");
                GUILayout.EndVertical();
            }

            for (int i = 0, n = _self.goals.Length; i < n; i++)
            {
                GUILayout.BeginVertical("box");

                goal = _self.goals[i];
                GUILayout.BeginVertical(_rowStyleA);
                GUILayout.BeginHorizontal();
                GUI.color = c * new Color(1.0f, 1.0f, 0.5f);
                EditorGUILayout.LabelField(goal.name, EditorStyles.boldLabel);
                GUI.color = c;

                if (GUILayout.Button((goal.isOpened) ? "-" : "+", GUILayout.MaxWidth(18.0f),
                                     GUILayout.MaxHeight(16.0f)))
                {
                    goal.isOpened = !goal.isOpened;
                }

                if (GUILayout.Button("↑", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                {
                    if (i - 1 >= 0)
                    {
                        var temp = _self.goals[i - 1];
                        _self.goals[i - 1] = goal;
                        _self.goals[i]     = temp;
                    }
                }

                if (GUILayout.Button("↓", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                {
                    if (i + 1 < _self.goals.Length)
                    {
                        var temp = _self.goals[i + 1];
                        _self.goals[i + 1] = goal;
                        _self.goals[i]     = temp;
                    }
                }

                GUI.color = c * new Color(1.0f, 1.0f, 0.5f);
                if (GUILayout.Button("x", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                {
                    delIndex = i;
                }

                GUI.color = c;
                GUILayout.EndHorizontal();
                GUILayout.Space(2.0f);
                GUILayout.EndVertical();

                if (goal.isOpened)
                {
                    GUILayout.Space(2.0f);
                    goal.name = EditorGUILayout.TextField("Goal", goal.name);
                    GUILayout.Space(10.0f);
                    DrawConditionsList("达成目标所需条件", ref goal.conditions);
                    GUILayout.Space(2.0f);
                }

                GUILayout.EndVertical();
            }

            if (GUILayout.Button("Add Goal"))
            {
                AddToArray <AIScenarioGoal> (ref _self.goals, new AIScenarioGoal());
            }

            if (delIndex > -1)
            {
                RemoveFromArrayAt <AIScenarioGoal> (ref _self.goals, delIndex);
            }

            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 23
0
        private void drawTagTextureList()
        {
            bool changed = false;

            List <QTagTexture> tagTextureList = QHierarchySettings.getSetting <List <QTagTexture> >(QHierarchySetting.CustomTagIcon);

            for (int i = 0; i < UnityEditorInternal.InternalEditorUtility.tags.Length; i++)
            {
                string      tag        = UnityEditorInternal.InternalEditorUtility.tags[i];
                QTagTexture tagTexture = tagTextureList.Find(t => t.tag == tag);
                Texture2D   newTexture = (Texture2D)EditorGUILayout.ObjectField(tag, tagTexture == null ? null : tagTexture.texture, typeof(Texture2D), false, GUILayout.MaxHeight(16));
                if (newTexture != null && tagTexture == null)
                {
                    QTagTexture newTagTexture = new QTagTexture(tag, newTexture);
                    tagTextureList.Add(newTagTexture);

                    changed = true;
                }
                else if (newTexture == null && tagTexture != null)
                {
                    tagTextureList.Remove(tagTexture);

                    changed = true;
                }
                else if (tagTexture != null && tagTexture.texture != newTexture)
                {
                    tagTexture.texture = newTexture;
                    changed            = true;
                }
            }

            if (changed)
            {
                QHierarchySettings.setSetting(QHierarchySetting.CustomTagIcon, tagTextureList);
                EditorApplication.RepaintHierarchyWindow();
            }
        }
        private void DrawActionList()
        {
            Color c        = GUI.color;
            int   delIndex = -1;

            GUILayout.BeginVertical();
            EditorGUILayout.LabelField("行动列表", EditorStyles.boldLabel);

            AIScenarioAction action;

            if (_self.actions.Length == 0)
            {
                GUILayout.BeginVertical("box");
                EditorGUILayout.LabelField("The Action List is Empty.");
                GUILayout.EndVertical();
            }

            string actionName = "";

            for (int i = 0, n = _self.actions.Length; i < n; i++)
            {
                GUILayout.BeginVertical("box");

                action = _self.actions[i];
                GUILayout.BeginVertical(_rowStyleA);
                GUILayout.BeginHorizontal();
                GUI.color = c * new Color(1.0f, 1.0f, 0.5f);
                if (action.cost > 0)
                {
                    EditorGUILayout.LabelField(string.Format("{0} [{1}]", action.name, action.cost),
                                               EditorStyles.boldLabel);
                }
                else
                {
                    EditorGUILayout.LabelField(action.name, EditorStyles.boldLabel);
                }

                GUI.color = c;

                action.isActived = GUILayout.Toggle(action.isActived, string.Empty, GUILayout.MaxWidth(18.0f),
                                                    GUILayout.MaxHeight(16.0f));

                if (GUILayout.Button((action.isOpened) ? "-" : "+", GUILayout.MaxWidth(18.0f),
                                     GUILayout.MaxHeight(16.0f)))
                {
                    action.isOpened = !action.isOpened;
                }

                if (GUILayout.Button("↑", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                {
                    if (i - 1 >= 0)
                    {
                        var temp = _self.actions[i - 1];
                        _self.actions[i - 1] = action;
                        _self.actions[i]     = temp;
                    }
                }

                if (GUILayout.Button("↓", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                {
                    if (i + 1 < _self.actions.Length)
                    {
                        var temp = _self.actions[i + 1];
                        _self.actions[i + 1] = action;
                        _self.actions[i]     = temp;
                    }
                }

                GUI.color = c * new Color(1.0f, 1.0f, 0.5f);
                if (GUILayout.Button("x", GUILayout.MaxWidth(18.0f), GUILayout.MaxHeight(16.0f)))
                {
                    delIndex = i;
                }

                GUI.color = c;
                GUILayout.EndHorizontal();
                GUILayout.Space(2.0f);
                GUILayout.EndVertical();

                if (action.isOpened)
                {
                    GUILayout.Space(2.0f);

                    actionName = EditorGUILayout.TextField("Action", action.name);
                    if (!string.Equals(actionName, action.name))
                    {
//						if ( string.Equals ( action.name, action.state ) ) {
//							action.state = actionName;
//						}

                        action.name = actionName;
                    }

//					action.state = EditorGUILayout.TextField ( "State", action.state );
                    action.cost = EditorGUILayout.IntField("Cost", action.cost);

                    GUILayout.Space(10.0f);
                    DrawConditionsList("前提条件", ref action.pre);
                    GUILayout.Space(10.0f);
                    DrawConditionsList("执行结果", ref action.post);

                    GUILayout.Space(2.0f);
                }

                GUILayout.EndVertical();
            }

            if (GUILayout.Button("Add Action"))
            {
                AddToArray <AIScenarioAction> (ref _self.actions, new AIScenarioAction());
            }

            if (delIndex > -1)
            {
                RemoveFromArrayAt <AIScenarioAction> (ref _self.actions, delIndex);
            }

            GUILayout.EndVertical();
        }
        void OnGUI()
        {
            if (!skin)
            {
                skin = Resources.Load("vSkin") as GUISkin;
            }
            GUI.skin = skin;

            this.minSize      = rect;
            this.titleContent = new GUIContent("Character", null, "Third Person Character Creator");

            GUILayout.BeginVertical("Character Creator Window", "window");
            GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
            GUILayout.Space(5);

            GUILayout.BeginVertical("box");

            if (!charObj)
            {
                EditorGUILayout.HelpBox("Make sure your FBX model is set as Humanoid!", MessageType.Info);
            }
            else if (!charExist)
            {
                EditorGUILayout.HelpBox("Missing a Animator Component", MessageType.Error);
            }
            else if (!isHuman)
            {
                EditorGUILayout.HelpBox("This is not a Humanoid", MessageType.Error);
            }
            else if (!isValidAvatar)
            {
                EditorGUILayout.HelpBox(charObj.name + " is a invalid Humanoid", MessageType.Info);
            }

            charObj = EditorGUILayout.ObjectField("FBX Model", charObj, typeof(GameObject), true, GUILayout.ExpandWidth(true)) as GameObject;

            if (GUI.changed && charObj != null && charObj.GetComponent <vThirdPersonController>() == null)
            {
                humanoidpreview = Editor.CreateEditor(charObj);
            }
            if (charObj != null && charObj.GetComponent <vThirdPersonController>() != null)
            {
                EditorGUILayout.HelpBox("This gameObject already contains the component vThirdPersonController", MessageType.Warning);
            }
            controller     = EditorGUILayout.ObjectField("Animator Controller: ", controller, typeof(RuntimeAnimatorController), false) as RuntimeAnimatorController;
            cameraListData = EditorGUILayout.ObjectField("Camera List Data: ", cameraListData, typeof(vThirdPersonCameraListData), false) as vThirdPersonCameraListData;
            hud            = EditorGUILayout.ObjectField("Hud Controller: ", hud, typeof(GameObject), false) as GameObject;
            if (hud != null && hud.GetComponent <vHUDController>() == null)
            {
                EditorGUILayout.HelpBox("This object does not contain a vHUDController", MessageType.Warning);
            }
            GUILayout.EndVertical();

            GUILayout.BeginHorizontal("box");
            EditorGUILayout.LabelField("Need to know how it works?");
            if (GUILayout.Button("Video Tutorial"))
            {
                Application.OpenURL("https://www.youtube.com/watch?v=KQ5xha36tfE");
            }
            GUILayout.EndHorizontal();

            if (charObj)
            {
                charAnimator = charObj.GetComponent <Animator>();
            }
            charExist     = charAnimator != null;
            isHuman       = charExist ? charAnimator.isHuman : false;
            isValidAvatar = charExist ? charAnimator.avatar.isValid : false;

            if (CanCreate())
            {
                DrawHumanoidPreview();
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (controller != null)
                {
                    if (GUILayout.Button("Create"))
                    {
                        Create();
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();
        }
        /// <summary>
        /// Draw a menu button.  Returns true if the button is active and settings are enabled, false if settings are not enabled.
        /// </summary>
        /// <param name="isHorizontal"></param>
        /// <param name="showOptions"></param>
        /// <param name="optionsRect"></param>
        /// <param name="layoutOptions"></param>
        /// <returns></returns>
        internal override bool DoButton(bool isHorizontal, bool showOptions, ref Rect optionsRect, params GUILayoutOption[] layoutOptions)
        {
            bool wasEnabled    = GUI.enabled;
            bool buttonEnabled = (menuActionState & MenuActionState.Enabled) == MenuActionState.Enabled;

            bool isActiveTool = m_Tool != null && ToolManager.IsActiveTool(m_Tool);

            GUI.enabled = buttonEnabled;

            GUI.backgroundColor = Color.white;

            if (iconMode)
            {
                GUIStyle style = ToolbarGroupUtility.GetStyle(group, isHorizontal);

                Texture2D normalTex = style.normal.background;
                Texture2D hoverTex  = style.hover.background;
                if (isActiveTool)
                {
                    style.normal.background = hoverTex;
                    style.hover.background  = normalTex;
                }

                bool isToggled = GUILayout.Toggle(isActiveTool, buttonEnabled || !disabledIcon ? icon : disabledIcon, style, layoutOptions);
                if (isToggled != isActiveTool)
                {
                    if (showOptions && (optionsMenuState & MenuActionState.VisibleAndEnabled) == MenuActionState.VisibleAndEnabled)
                    {
                        DoAlternateAction();
                    }
                    else
                    {
                        var result = isActiveTool ? EndActivation() : StartActivation();
                        EditorUtility.ShowNotification(result.notification);
                    }
                }

                style.normal.background = normalTex;
                style.hover.background  = hoverTex;

                if ((optionsMenuState & MenuActionState.VisibleAndEnabled) == MenuActionState.VisibleAndEnabled)
                {
                    Rect r = GUILayoutUtility.GetLastRect();
                    r.x      = r.x + r.width - 16;
                    r.y     += 0;
                    r.width  = 14;
                    r.height = 14;
                    GUI.Label(r, IconUtility.GetIcon("Toolbar/Options", IconSkin.Pro), GUIStyle.none);
                    optionsRect = r;
                    GUI.enabled = wasEnabled;
                    return(buttonEnabled);
                }
                else
                {
                    GUI.enabled = wasEnabled;
                    return(false);
                }
            }
            else
            {
                // in text mode always use the vertical layout.
                isHorizontal = false;
                GUILayout.BeginHorizontal(MenuActionStyles.rowStyleVertical, layoutOptions);
                GUI.backgroundColor = ToolbarGroupUtility.GetColor(group);

                GUIStyle   style  = MenuActionStyles.buttonStyleVertical;
                RectOffset border = new RectOffset(style.border.left, style.border.right, style.border.top, style.border.bottom);
                if (isActiveTool)
                {
                    style.border = new RectOffset(0, 4, 0, 0);
                }

                bool isToggled = GUILayout.Toggle(isActiveTool, menuTitle, style);
                if (isToggled != isActiveTool)
                {
                    var result = isActiveTool ? EndActivation() : StartActivation();
                    EditorUtility.ShowNotification(result.notification);
                }

                MenuActionState altState = optionsMenuState;

                if ((altState & MenuActionState.Visible) == MenuActionState.Visible)
                {
                    GUI.enabled = GUI.enabled && (altState & MenuActionState.Enabled) == MenuActionState.Enabled;

                    if (DoAltButton(GUILayout.MaxWidth(21), GUILayout.MaxHeight(16)))
                    {
                        DoAlternateAction();
                    }
                }

                style.border = border;
                GUILayout.EndHorizontal();

                GUI.backgroundColor = Color.white;

                GUI.enabled = wasEnabled;

                return(false);
            }
        }
Ejemplo n.º 27
0
 private void DrawAssetUI()
 {
     GUILayout.BeginHorizontal("HelpBox");
     EditorGUILayout.LabelField("== 快捷功能 ==");
     GUILayout.EndHorizontal();
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Build Lua To StreamingAsset", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30)))
     {
         ColaEditHelper.BuildLuaToStreamingAsset();
     }
     GUILayout.EndHorizontal();
 }
Ejemplo n.º 28
0
    public override void OnInspectorGUI()
    {
        if (!skin)
        {
            skin = Resources.Load("skin") as GUISkin;
        }
        GUI.skin = skin;

        tpCamera = (MainCamera)target;

        EditorGUILayout.Space();
        GUILayout.BeginVertical("CAMERA CONFIFURATIONS", "window");
        GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
        GUILayout.Space(5);

        if (tpCamera.cullingLayer == 0)
        {
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("Please assign the Culling Layer to 'Default' ", MessageType.Warning);
            EditorGUILayout.Space();
        }

        EditorGUILayout.HelpBox("The target will be assign automatically to the current Character when start, check the InitialSetup method on the Motor.", MessageType.Info);

        base.OnInspectorGUI();
        GUILayout.EndVertical();

        GUILayout.BeginVertical("CAMERA STATES", "window");

        GUILayout.Label(m_Logo, GUILayout.MaxHeight(25));
        GUILayout.Space(5);

        EditorGUILayout.HelpBox("This settings will always load in this List, you can create more List's with different settings for another characters or scenes", MessageType.Info);

        tpCamera.CameraStateList = (CameraListData)EditorGUILayout.ObjectField("CameraState List", tpCamera.CameraStateList, typeof(CameraListData), false);
        if (tpCamera.CameraStateList == null)
        {
            GUILayout.EndVertical();
            return;
        }
        GUILayout.BeginHorizontal();
        if (GUILayout.Button(new GUIContent("NEW CAMERA STATE")))
        {
            if (tpCamera.CameraStateList.tpCameraStates == null)
            {
                tpCamera.CameraStateList.tpCameraStates = new List <CameraState>();
            }

            tpCamera.CameraStateList.tpCameraStates.Add(new CameraState("New State" + tpCamera.CameraStateList.tpCameraStates.Count));
            tpCamera.indexList = tpCamera.CameraStateList.tpCameraStates.Count - 1;
        }

        if (GUILayout.Button(new GUIContent("DELETE STATE")) && tpCamera.CameraStateList.tpCameraStates.Count > 1 && tpCamera.indexList != 0)
        {
            tpCamera.CameraStateList.tpCameraStates.RemoveAt(tpCamera.indexList);
            if (tpCamera.indexList - 1 >= 0)
            {
                tpCamera.indexList--;
            }
        }

        GUILayout.EndHorizontal();

        if (tpCamera.CameraStateList.tpCameraStates.Count > 0)
        {
            if (tpCamera.indexList > tpCamera.CameraStateList.tpCameraStates.Count - 1)
            {
                tpCamera.indexList = 0;
            }
            tpCamera.indexList = EditorGUILayout.Popup("State", tpCamera.indexList, getListName(tpCamera.CameraStateList.tpCameraStates));
            StateData(tpCamera.CameraStateList.tpCameraStates[tpCamera.indexList]);
        }

        GUILayout.EndVertical();
        EditorGUILayout.Space();

        if (GUI.changed)
        {
            EditorUtility.SetDirty(tpCamera);
            EditorUtility.SetDirty(tpCamera.CameraStateList);
        }
    }
Ejemplo n.º 29
0
        void OnGUI()
        {
            if (skin)
            {
                GUI.skin = skin;
            }
            this.minSize = new Vector2(460, 600);
            GUILayout.BeginVertical("box");
            GUILayout.Box("vItemEnums");
            GUILayout.BeginHorizontal();
            #region Item Type current
            GUILayout.BeginVertical("box", GUILayout.Width(215));
            GUILayout.Box("Item Types", GUILayout.ExpandWidth(true));

            for (int i = 0; i < _itemTypeNames.Count; i++)
            {
                GUILayout.Label(_itemTypeNames[i], EditorStyles.miniBoldLabel);
            }

            GUILayout.EndVertical();
            #endregion
            #region Item Attribute current
            GUILayout.BeginVertical("box", GUILayout.Width(215));
            GUILayout.Box("Item Attributes", GUILayout.ExpandWidth(true));

            for (int i = 0; i < _itemAttributeNames.Count; i++)
            {
                GUILayout.Label(_itemAttributeNames[i], EditorStyles.miniBoldLabel);
            }

            GUILayout.EndVertical();
            #endregion

            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            GUILayout.BeginVertical("box");
            GUILayout.Box("Edit Enums", GUILayout.ExpandHeight(false));
            scrollView = GUILayout.BeginScrollView(scrollView, GUILayout.MinHeight(100), GUILayout.MaxHeight(600));
            for (int i = 0; i < datas.Length; i++)
            {
                DrawItemEnumListData(datas[i]);
            }
            GUILayout.EndScrollView();
            EditorGUILayout.HelpBox("If the field has is gray, the vItemEnums contains same value", MessageType.Info);
            if (GUILayout.Button(new GUIContent("Refresh ItemEnums", "Save and refesh changes to vItemEnums")))
            {
                vItemEnumsBuilder.RefreshItemEnums();
            }
            GUILayout.EndVertical();
        }
Ejemplo n.º 30
0
        public static void WorldMap(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            leftAreaB   = new Rect(leftArea.xMax + 5, leftArea.y, leftArea.width, leftArea.height);
            mainAreaAlt = new Rect(leftAreaB.xMax + 5, leftArea.y, mainArea.width - (leftAreaB.width + 5),
                                   leftArea.height);

            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(leftAreaB, "", "backgroundBox");
            GUI.Box(mainAreaAlt, "", "backgroundBox");



            GUILayout.BeginArea(PadRect(leftArea, 0, 0));
            RPGMakerGUI.ListArea(worldAreaList, ref selectedWorldArea, Rm_ListAreaType.WorldAreas, false, false);
            GUILayout.EndArea();

            GUILayout.BeginArea(leftAreaB);
            if (selectedWorldArea != null)
            {
                var rect = RPGMakerGUI.ListArea(selectedWorldArea.Locations, ref selectedWorldAreaLocation, Rm_ListAreaType.Location, false, false, Rme_ListButtonsToShow.AllExceptHelp, true, selectedWorldArea.ID);
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(mainAreaAlt);
            worldAreaScrollPos = GUILayout.BeginScrollView(worldAreaScrollPos);
            RPGMakerGUI.Title("World Areas (Not Finished)");
            if (selectedWorldArea != null)
            {
                selectedWorldArea.Name = RPGMakerGUI.TextField("Name: ", selectedWorldArea.Name);
                selectedWorldArea.ImageContainer.Image = RPGMakerGUI.ImageSelector("Image:", selectedWorldArea.ImageContainer.Image, ref selectedWorldArea.ImageContainer.ImagePath);
                if (GUILayout.Button("Open Interaction Node Tree", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.WorldMapNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == selectedWorldArea.ID);
                    if (existingTree == null)
                    {
                        existingTree    = NodeWindow.GetNewTree(NodeTreeType.WorldMap);
                        existingTree.ID = selectedWorldArea.ID;

                        Debug.Log(existingTree.ID + ":::" + existingTree.Name);
                        existingTree.Name = selectedWorldArea.Name;
                        trees.Add(existingTree);
                    }

                    WorldMapNodeWindow.ShowWindow(selectedWorldArea.ID);
                }
            }

            if (selectedWorldArea != null)
            {
                RPGMakerGUI.SubTitle("Location Info:");
                if (selectedWorldAreaLocation != null)
                {
                    var loc = selectedWorldAreaLocation;
                    loc.Name = RPGMakerGUI.TextField("Name:", loc.Name);
                    loc.ImageContainer.Image = RPGMakerGUI.ImageSelector("Name:", loc.ImageContainer.Image, ref loc.ImageContainer.ImagePath);
                    loc.Description          = RPGMakerGUI.TextField("Description:", loc.Description);
                    RPGMakerGUI.SceneSelector("Scene:", ref loc.SceneName);
                    if (RPGMakerGUI.Toggle("Use Custom Spawn Location?", ref loc.UseCustomLocation))
                    {
                        loc.CustomSpawnLocation = EditorGUILayout.Vector3Field("Location:", loc.CustomSpawnLocation);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Select a location in the world area to begin editing it.", MessageType.Info);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise world areas.", MessageType.Info);
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }