Esempio n. 1
0
    void OnEnable()
    {
        list = new ReorderableList(serializedObject,
                                   serializedObject.FindProperty("bursts"),
                                   true, true, true, true);

        list.drawHeaderCallback = (Rect rect) =>
        {
            EditorGUI.LabelField(rect, "Bursts");
        };

        list.drawElementCallback =
            (Rect rect, int index, bool isActive, bool isFocused) =>
        {
            var element = list.serializedProperty.GetArrayElementAtIndex(index);
            rect.y += 2;

            EditorGUI.LabelField(new Rect(rect.x, rect.y, 60, EditorGUIUtility.singleLineHeight), "Direction");
            element.FindPropertyRelative("angle").floatValue = CustomGUI.Knob(new Rect(rect.x + 5, rect.y + EditorGUIUtility.singleLineHeight, 40, 40), element.FindPropertyRelative("angle").floatValue, element.FindPropertyRelative("spread").floatValue);
            EditorGUI.LabelField(new Rect(rect.x + 65, rect.y, 60, EditorGUIUtility.singleLineHeight), "Spread");
            element.FindPropertyRelative("spread").floatValue = EditorGUI.Slider(new Rect(rect.x + 65, rect.y + EditorGUIUtility.singleLineHeight, rect.width - 65 - 80, EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("spread").floatValue, 0, 360);
            EditorGUI.PropertyField(
                new Rect(rect.x + 65, rect.y + EditorGUIUtility.singleLineHeight * 2 + 4, rect.width - 65 - 80, EditorGUIUtility.singleLineHeight),
                element.FindPropertyRelative("prefab"), GUIContent.none);
            EditorGUI.LabelField(new Rect(rect.x + rect.width - 80, rect.y, 60, EditorGUIUtility.singleLineHeight), "Amount");
            EditorGUI.PropertyField(
                new Rect(rect.x + rect.width - 30, rect.y, 30, EditorGUIUtility.singleLineHeight),
                element.FindPropertyRelative("amount"), GUIContent.none);
        };

        list.elementHeight = EditorGUIUtility.singleLineHeight + 40 + 6;
    }
Esempio n. 2
0
    private bool GuiFold(T obj, string name)
    {
        bool folded = IsFolded(obj);

        // Handle Clicks on the Foldout title, and design stuff...

        //CustomGUI.Splitter ();

        EditorGUI.BeginChangeCheck();
        EditorGUILayout.GetControlRect(true, 16f, EditorStyles.foldout);
        Rect foldRect = GUILayoutUtility.GetLastRect();

        if (Event.current.type == EventType.MouseUp && foldRect.Contains(Event.current.mousePosition))
        {
            folded      = !folded;
            GUI.changed = true;
            Event.current.Use();
        }

        folded = EditorGUI.Foldout(foldRect, folded, name);
        EditorGUI.EndChangeCheck();

        if (folded)
        {
            CustomGUI.Splitter();
        }

        FoldObject(
            obj,
            folded
            );

        return(folded);
    }
Esempio n. 3
0
    public static void Window <T>(Rect windowRect, string title, Action <T> contentFunction, T argument)
    {
        int   controlId    = GUIUtility.GetControlID(FocusType.Passive);
        Event currentEvent = Event.current;

        if (currentEvent.type == EventType.MouseDown && windowRect.Contains(currentEvent.mousePosition))
        {
            GUIUtility.hotControl = controlId;
        }

        Color guiColor = GUI.color;

        Handles.BeginGUI();
        GUILayout.BeginArea(windowRect);
        GUI.backgroundColor = Palette.GuiBackground;
        EditorGUILayout.BeginVertical("Window");
        CustomGUI.SetLabelColors();

        EditorGUILayout.BeginVertical(EditorStyles.inspectorFullWidthMargins);

        CustomGUI.DrawTitle(title, CustomGUI.HeaderStyle);
        CustomGUI.DrawSplitter(10, 15, 1.0f);
        contentFunction(argument);

        EditorGUILayout.EndVertical();

        CustomGUI.UnsetLabelColors();
        EditorGUILayout.EndVertical();
        GUILayout.EndArea();
        Handles.EndGUI();

        GUI.color = guiColor;
    }
        public void DrawPart1()
        {
            this.DrawHeader(this.partTitles[this.partIndex]);

            GUILayout.FlexibleSpace();

                        #if UNITY_WEBPLAYER
            EditorGUILayout.HelpBox("Due to the Unity3D WebPlayer limitations File System using is not allowed. Use other platform.", MessageType.Error);
                        #else
            GUILayout.Label("Namespace:");
            this.compileNamespace = GUILayout.TextField(this.compileNamespace);

            CustomGUI.Splitter();

            this.forceRecompile = GUILayout.Toggle(this.forceRecompile, "Force to recompile all");
            EditorGUILayout.HelpBox("By default all not compiled windows will be compiled. If you want to recompile all ScreenBase* windows - turn on this flag. Your Screen* code will not be changed in any case.", MessageType.Info);

            CustomGUI.Splitter();

            this.minimalScriptsSize = GUILayout.Toggle(this.minimalScriptsSize, "Minimal scripts size");

            this.DrawSaveToDefaultToggle();
                        #endif

            this.DrawBottom();

                        #if UNITY_WEBPLAYER
            this.readyToNext = false;
                        #else
            this.readyToNext = true;
                        #endif
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            CustomGUI.DoHorizontalLine();
            EditorGUILayout.Space();

            GUILayout.Label("Debugging", EditorStyles.boldLabel);

            if (!Application.isPlaying)
            {
                EditorGUILayout.HelpBox("Debug info will be shown at play-time!", MessageType.Info);
                return;
            }

            GUILayout.Label("Has Target: " + m_AISettings.Detection.HasTarget());
            GUILayout.Label("Has Target: " + m_AISettings.Detection.HasVisibleTarget());

            if (m_AISettings.Detection.HasTarget())
            {
                Rect rect = EditorGUILayout.GetControlRect();
                rect.x += 16f;

                GUI.Label(rect, "Target: " + m_AISettings.Detection.StillInRangeTargets[0].name);
            }
        }
Esempio n. 6
0
        public static void OnDrawSettingsGUI()
        {
            var flowAddons = WindowUtilities.GetAddons <FlowAddon>((name, item) => item.name = name);

            if (flowAddons.Count == 0)
            {
                GUILayout.Label("No Modules Have Been Installed.");
            }
            else
            {
                foreach (var addon in flowAddons)
                {
                    Flow.DrawModuleSettingsGUI(addon.name, () => { addon.OnFlowSettingsGUI(); });
                }
            }

            CustomGUI.Splitter();

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

                var content = new GUIContent("Install Modules...");
                if (GUILayout.Button(content, FlowSystemEditorWindow.defaultSkin.button, GUILayout.Height(40f), GUILayout.MaxWidth(200f)) == true)
                {
                    Application.OpenURL(VersionInfo.downloadLink);
                }

                GUILayout.FlexibleSpace();
            }
            GUILayout.EndHorizontal();
        }
Esempio n. 7
0
        public static void OnDrawSettingsGUI()
        {
            var flowAddons = WindowUtilities.GetAddons <IWindowFlowAddon>();

            if (flowAddons.Count == 0)
            {
                GUILayout.Label("No Modules Have Been Installed.");
            }
            else
            {
                foreach (var addon in flowAddons)
                {
                    addon.OnFlowSettingsGUI();
                }
            }

            CustomGUI.Splitter();

            var content = new GUIContent("Install Modules...");

            if (GUILayout.Button(content, FlowSystemEditorWindow.defaultSkin.button, GUILayout.Height(40f)) == true)
            {
                Application.OpenURL(VersionInfo.downloadLink);
            }
        }
        public override void OnInspectorGUI()
        {
            this.DrawServices <LocalizationServiceItem>();

            CustomGUI.Splitter();

            GUILayout.Label("Languages", EditorStyles.boldLabel);

            EditorGUI.BeginDisabledGroup(true);

            var currentLangs = LocalizationSystem.GetLanguagesList();
            var langs        = System.Enum.GetValues(typeof(UnityEngine.SystemLanguage));

            foreach (var lang in langs)
            {
                var lng = (UnityEngine.SystemLanguage)lang;
                if (currentLangs.Contains(lng) == true)
                {
                    GUILayout.Toggle(true, lng.ToString());
                }
                else
                {
                    GUILayout.Toggle(false, lng.ToString());
                }
            }

            EditorGUI.EndDisabledGroup();
        }
Esempio n. 9
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            CustomGUI.DoHorizontalLine();
            EditorGUILayout.Space();
            EditorGUILayout.Space();

            var rect = EditorGUILayout.GetControlRect();

            rect.width *= 0.5f;

            serializedObject.Update();

            if (GUI.Button(rect, "Apply Presets"))
            {
                if (EditorUtility.DisplayDialog("Apply Presets", "Applying a preset will overwrite the current values, are you sure?", "Yes", "Cancel"))
                {
                    ApplyPresets();
                }
            }

            serializedObject.ApplyModifiedProperties();

            rect.x           = rect.xMax;
            m_SelectedPreset = (Preset)EditorGUI.EnumPopup(rect, m_SelectedPreset);
        }
        private void AgentEditing()
        {
            EditorExtensionSettings.StandardMargin();
            speciesSelector = SelectionPosition(speciesOptions, SpeciesName.stringValue);
            if (CustomGUI.ChangeCheckingPopup(ref speciesSelector, speciesOptions, ""))
            {
                if (speciesSelector > 0)
                {
                    SpeciesName.stringValue = speciesOptions[speciesSelector];
                }
                else
                {
                    SpeciesName.stringValue = "";
                }
            }

            selectedPlan.enumValueIndex = (int)(NEEDSIMNode.ExamplePlans)EditorGUILayout.EnumPopup((NEEDSIMNode.ExamplePlans)selectedPlan.enumValueIndex, EditorExtensionSettings.MediumEditorFieldWidth);

            EditorExtensionSettings.StandardMargin();
            ShowDebugInGame.boolValue = EditorGUILayout.ToggleLeft(Simulation.Strings.DebugIngameLabel, ShowDebugInGame.boolValue, EditorExtensionSettings.MediumEditorFieldWidth);
            EditorExtensionSettings.StandardMargin();
            //ShowDebugInSpector.boolValue = EditorGUILayout.ToggleLeft(Simulation.Strings.DebugInSpectorLabel, ShowDebugInSpector.boolValue, EditorExtensionSettings.MediumEditorFieldWidth);
            //CustomGUI.StandardMargin();
            SpecificSatisfactionLevelsAtStart.boolValue = EditorGUILayout.ToggleLeft(Simulation.Strings.RandomStartLevelsLabel, SpecificSatisfactionLevelsAtStart.boolValue, EditorExtensionSettings.MediumEditorFieldWidth);

            if (SpecificSatisfactionLevelsAtStart.boolValue)
            {
                StartNeedSatisfactionEditing();
            }

            EditorExtensionSettings.StandardMargin();
        }
        private void InteractionEditing(int loop)
        {
            int indexer = 0;

            for (int i = 1; i < interactionOptions.Length; i++)
            {
                if (serializedObject.FindProperty(string.Format(InteractionDataAccess, loop)).stringValue == interactionOptions[i])
                {
                    indexer = i;
                    break;
                }
            }

            if (CustomGUI.ChangeCheckingPopup(ref indexer, interactionOptions, Simulation.Strings.InteractionLabelToExtend(loop + 1)))
            {
                serializedObject.FindProperty(string.Format(InteractionDataAccess, loop)).stringValue = interactionOptions[indexer];
            }

            EditorGUILayout.BeginHorizontal();
            {
                EditorExtensionSettings.LargeMargin();
                EditorExtensionSettings.LargeMargin();
                EditorExtensionSettings.LargeMargin();
                EditorExtensionSettings.LargeMargin();
                EditorExtensionSettings.LargeMargin();
                EditorExtensionSettings.LargeMargin();
                EditorExtensionSettings.MediumMargin();

                if (GUILayout.Button("Edit interactions"))
                {
                    NEEDSIMEditor.CustomMainWindow.MainWindowInit(CustomMainWindow.Screens.Interactions);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
    void ShowPath()
    {
        for (int i = 0; i < script.pathList.Count; i++)
        {
            Action delAction = () => { script.pathList.RemoveAt(i); };
            if (script.pathList[i] == null || string.IsNullOrEmpty(script.pathList[i].pathName))
            {
                continue;
            }
            if (CustomGUI.HeaderButton(script.pathList[i].pathName, null, delAction))
            {
                script.selected           = script.pathList[i];
                script.selected.pointSize = EditorGUILayout.Slider("Point Size", script.selected.pointSize, 0.1f, 3f);
                script.selected.lineColor = EditorGUILayout.ColorField("Path Color", script.selected.lineColor);
                script.selected.lineType  = (PathLineType)EditorGUILayout.EnumPopup("Path Type", script.selected.lineType);

                List <Vector3> wayPointList = script.selected.points;

                if (wayPointList.Count > 0)
                {
                    GUILayout.BeginHorizontal();
                    {
                        float fDepth = EditorGUILayout.FloatField("Path Depth", wayPointList[0].z);
                        if (wayPointList[0].z != fDepth)
                        {
                            SetWaypointDepth(fDepth);
                        }

                        if (GUILayout.Button("Depth +"))
                        {
                            SetWaypointDepth(fDepth + 1);
                        }
                        if (GUILayout.Button("Depth -"))
                        {
                            SetWaypointDepth(fDepth - 1);
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                int count = 0;
                for (int j = 0; j < wayPointList.Count; j++)
                {
                    GUILayout.BeginHorizontal();
                    {
                        wayPointList[j] = EditorGUILayout.Vector3Field("Point " + count++, wayPointList[j]);
                        if (GUILayout.Button("+", GUILayout.Width(25f)))
                        {
                            AddWaypoint(wayPointList[j] + Vector3.right + Vector3.up, j + 1);
                        }
                        if (GUILayout.Button("-", GUILayout.Width(25f)))
                        {
                            DeleteWaypoint(j);
                        }
                    }
                    GUILayout.EndHorizontal();
                }
            }
        }
    }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var random     = property.FindPropertyRelative("m_Random");
            var customName = property.FindPropertyRelative("m_CustomName");
            var stackSize  = property.FindPropertyRelative("m_StackSize");

            //position.y += 4f;
            position.height = 16f;
            EditorGUI.PropertyField(position, random);

            position.y = position.yMax;

            GUI.enabled = !random.boolValue;

            if (!random.boolValue)
            {
                EditorGUI.PropertyField(position, customName);

                position.y = position.yMax;
                EditorGUI.PropertyField(position, stackSize);
            }
            else
            {
                EditorGUI.LabelField(position, "Custom Name: ???");

                position.y = position.yMax;
                EditorGUI.LabelField(position, "Stack Size: ???");
            }

            GUI.enabled = true;

            position.y      = position.yMax + 4f;
            position.height = 1f;
            CustomGUI.DoHorizontalLine(position);
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.PropertyField(position, property, label, includeChildren: true);

            var attribute = PropertyExtensions.GetAttribute <BeginGroupAttribute>(this);
            var otherProp = PropertyExtensions.GetRelativeProperty(property, property.propertyPath, attribute.otherFieldName);

            var isNull = false;

            if (property.propertyType == SerializedPropertyType.ObjectReference)
            {
                isNull = (property.objectReferenceValue == null);
            }

            if (isNull == true && otherProp != null)
            {
                if (otherProp.propertyType == SerializedPropertyType.ObjectReference)
                {
                    isNull = (otherProp.objectReferenceValue == null);
                }
            }

            ++EditorGUI.indentLevel;
            EditorGUI.BeginDisabledGroup(isNull);

            CustomGUI.Splitter();
        }
Esempio n. 15
0
    void OnEnable()
    {
        list = new ReorderableList(serializedObject,
                                   serializedObject.FindProperty("charges"),
                                   true, true, true, true);

        list.drawHeaderCallback = (Rect rect) =>
        {
            EditorGUI.LabelField(rect, "Charges");
        };

        list.drawElementCallback =
            (Rect rect, int index, bool isActive, bool isFocused) =>
        {
            var element = list.serializedProperty.GetArrayElementAtIndex(index);
            rect.y += 2;

            EditorGUI.LabelField(new Rect(rect.x, rect.y, 60, EditorGUIUtility.singleLineHeight), "Direction");
            element.FindPropertyRelative("angle").floatValue = CustomGUI.Knob(new Rect(rect.x + 5, rect.y + EditorGUIUtility.singleLineHeight, 40, 40), element.FindPropertyRelative("angle").floatValue, false);
            EditorGUI.LabelField(new Rect(rect.x + 65, rect.y, 60, EditorGUIUtility.singleLineHeight), "Distance");
            element.FindPropertyRelative("distance").floatValue = EditorGUI.Slider(new Rect(rect.x + 65, rect.y + EditorGUIUtility.singleLineHeight, rect.width - 65 - 80, EditorGUIUtility.singleLineHeight), element.FindPropertyRelative("distance").floatValue, 0, 10);
        };

        list.elementHeight = EditorGUIUtility.singleLineHeight + 40 + 6;
    }
    void Start()
    {
        inputMapping     = new InputMapping();
        levelsAttributes = new LevelsAttributes();

        sceneID = LevelsAttributes.currentLevelId;

                #if UNITY_ANDROID
        inputMapping.idController = "Android";

        instantiatePlayer(sceneID, PlayerCharacter.GHOST, levelsAttributes.getInitialPositionFromID(sceneID),
                          inputMapping.idController, getKeysBasedOnController(inputMapping.idController));

        CustomGUI gui = GameObject.Find("CustomGUI").GetComponent <CustomGUI>();
        gui.initializeButtonsAndroid();
                #endif

                #if UNITY_STANDALONE_WIN || UNITY_WEBPLAYER
        string idController = inputMapping.idController;
        instantiatePlayer(sceneID, PlayerCharacter.GHOST, levelsAttributes.getInitialPositionFromID(sceneID),
                          idController, getKeysBasedOnController(idController));
                #endif

        SizeFixer sizeFixer = new SizeFixer();
        namePlayer = sizeFixer.getRectFixResolution(1900, 20, 300, 200);
        coinsRect  = sizeFixer.getRectFixResolution(1600, 20, 100, 50);

        nameStyle          = new GUIStyle();
        nameStyle.fontSize = 17;
    }
Esempio n. 17
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.PropertyField(position, property, label, includeChildren: true);

            CustomGUI.Splitter();

            EditorGUI.EndDisabledGroup();
            --EditorGUI.indentLevel;
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            base.OnGUI(position, property, label);

            CustomGUI.Splitter();

            EditorGUI.EndDisabledGroup();
            --EditorGUI.indentLevel;
        }
Esempio n. 19
0
    /// -------- DRONE GUI -------- ///


    public static void DrawDroneGUI(Crazyflie drone)
    {
        showTimestamps = EditorPrefs.GetBool(TIMESTAMPS_PREF_KEY, false);
        showEndpoints  = EditorPrefs.GetBool(ENDPOINTS_PREF_KEY, false);

        Rect toolsRect = new Rect(20, 20, 300, 250);

        CustomGUI.Window(toolsRect, "Drone Tools", DrawDroneTools, drone);
    }
        public override void OnInspectorGUI()
        {
            var offset = 2f;

            //this.DrawDefaultInspector();
            base.OnInspectorGUI();

            var newComponent = this.prefab.objectReferenceValue as WindowComponent;

            if (this.oldComponent != newComponent)
            {
                this.prefabParameters.objectReferenceValue = Layout.AddParametersFor((this.target as Component).gameObject, newComponent);
                this.prefabParameters.serializedObject.ApplyModifiedPropertiesWithoutUndo();
                this.editor = null;
            }

            this.serializedObject.Update();

            if (this.prefab.objectReferenceValue != null)
            {
                if (this.editor == null)
                {
                    this.editor = Editor.CreateEditor(this.prefabParameters.objectReferenceValue) as IParametersEditor;
                }

                if (this.editor != null)
                {
                    CustomGUI.Splitter();

                    var title = "Parameters";
                    ++EditorGUI.indentLevel;
                    this.foldout = EditorGUILayout.Foldout(this.foldout, new GUIContent(title));
                    var rect = GUILayoutUtility.GetLastRect();
                    --EditorGUI.indentLevel;

                    if (this.foldout == true)
                    {
                        rect.y     += rect.height;
                        rect.height = this.editor.GetHeight();
                        GUILayout.Space(rect.height);

                        var height = 16f;
                        rect.height = height - offset;
                        ++EditorGUI.indentLevel;
                        this.editor.OnParametersGUI(rect);
                        --EditorGUI.indentLevel;
                    }
                }
            }

            this.serializedObject.ApplyModifiedProperties();

            this.oldComponent = newComponent;
        }
Esempio n. 21
0
        private void Start()
        {
            robustTestClass.selfReference = robustTestClass; // circular reference

            CustomGUI.Label <CustomGUIClass>("value0", "label changed");
            CustomGUI.IgnoreMember <CustomGUIClass>("value1");
            CustomGUI.AddRange <CustomGUIClass>("value2", new MinMaxFloat()
            {
                max = 100f
            });
        }
    public override void OnInspectorGUI()
    {
        //base.DrawDefaultInspector();

        ShowButtons();

        CustomGUI.DrawSeparator(Color.gray);

        ShowPath();
        CheckGUIChanged();
    }
Esempio n. 23
0
            public override void OnInspectorGUI()
            {
                EditorGUILayout.Space();

                EditorGUI.BeginChangeCheck();
                {
                    CustomGUI.Draw();
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();

                    target.UpdateText();
                }
            }
Esempio n. 24
0
 /// <summary>
 /// Constructor for Create Lobby
 /// Creates Buttons to other GameStates
 /// </summary>
 ///
 /// Entire file created by Matthew Baldock
 /// <param name="game"></param>
 public CreateLobby(Game1 game)
 {
     this.game       = game;
     nextlayerButton = new BaseButton(Game1.Assets.gamelobby)
     {
         height = 100, width = 300
     };
     banner          = new CustomGUI(game, "Create Lobby");
     lastlayerButton = new BaseButton(Game1.Assets.lobbyoptions)
     {
         height = 100, width = 300
     };
     lastlayerButton.setPosition(new Vector2(0, game.getScreenHeight() - 300));
     nextlayerButton.setPosition(new Vector2(0, game.getScreenHeight() - 100));
 }
Esempio n. 25
0
        /// <summary>
        /// Constructor for Game Room
        /// Creates Buttons to other GameStates
        /// </summary>
        ///
        /// Entire file created by Matthew Baldock
        /// <param name="game"></param>
        public GameRoom(Game1 game)
        {
            this.game       = game;
            nextlayerButton = new BaseButton(Game1.Assets.gamelobby)
            {
                height = 100, width = 300
            };

            banner          = new CustomGUI(game, "Space Union Multiplayer Game Room");
            lastlayerButton = new BaseButton(Game1.Assets.playButton)
            {
                height = 100, width = 300
            };
            lastlayerButton.setPosition(new Vector2(0, game.getScreenHeight() - 300));
            nextlayerButton.setPosition(new Vector2(0, game.getScreenHeight() - 100));
        }
Esempio n. 26
0
        public void OnPlayerPrefsGUI()
        {
            for (int i = 0; i < this.prefsInt.Count; ++i)
            {
                this.prefsInt[i].item = this;
            }
            for (int i = 0; i < this.prefsFloat.Count; ++i)
            {
                this.prefsFloat[i].item = this;
            }

            this.Draw("Int Values", this.prefsInt, () => this.prefsInt.Add(new IntPrefs(string.Empty)));

            CustomGUI.Splitter();

            this.Draw("Float Values", this.prefsFloat, () => this.prefsFloat.Add(new FloatPrefs(string.Empty)));
        }
Esempio n. 27
0
        public override void OnInspectorGUI()
        {
            //base.OnInspectorGUI();

            serializedObject.Update();

            if (Application.isPlaying)
            {
                GUILayout.Label("Occupied Spaces: ", EditorStyles.boldLabel);
                EditorGUILayout.Space();

                for (int i = 0; i < m_Socket.OccupiedSpaces.Count; i++)
                {
                    GUILayout.Label(m_Socket.OccupiedSpaces[i].ToString());
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_Radius);
            CustomGUI.DoHorizontalLine();
            EditorGUILayout.Space();

            GUI.color = m_EditOffset ? Color.grey : Color.white;

            if (GUILayout.Button("Edit Piece Offset"))
            {
                m_EditOffset = !m_EditOffset;

                if (!m_EditOffset)
                {
                    Tools.current = Tool.Move;
                }
            }

            GUI.color = Color.white;

            if (!serializedObject.isEditingMultipleObjects)
            {
                m_PieceOffsets.DoLayoutList();
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 28
0
        public override void OnGUI(float width)
        {
            base.OnGUI(width);

            for (var i = 0; i < 16; i++)
            {
                //ref var meshData = ref target.Editor_Get(i);
                using (new EditorGUILayout.HorizontalScope())
                {
                    using (new EditorGUILayout.VerticalScope())
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            using (new BackgroundColorScope((i & 8) == 8? Color.white : Color.black))
                                GUILayout.Box(GUIContent.none, CustomStyles.Gray, GUILayout.Width(20f));
                            using (new BackgroundColorScope((i & 4) == 4? Color.white : Color.black))
                                GUILayout.Box(GUIContent.none, CustomStyles.Gray, GUILayout.Width(20f));
                        }
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            using (new BackgroundColorScope((i & 1) == 1? Color.white : Color.black))
                                GUILayout.Box(GUIContent.none, CustomStyles.Gray, GUILayout.Width(20f));
                            using (new BackgroundColorScope((i & 2) == 2? Color.white : Color.black))
                                GUILayout.Box(GUIContent.none, CustomStyles.Gray, GUILayout.Width(20f));
                        }
                    }

                    using (new EditorGUILayout.VerticalScope())
                    {
                        var prop = SerializedObject.FindProperty(TileMeshConfig.Editor_ConfigDataPropName)
                                   .GetArrayElementAtIndex(i).FindPropertyRelative(nameof(TileMeshConfig.MeshSet.Meshes));
                        using (var check = new EditorGUI.ChangeCheckScope())
                        {
                            EditorGUILayout.PropertyField(prop);
                            if (check.changed)
                            {
                                SerializedObject.ApplyModifiedProperties();
                            }
                        }
                    }
                }
                CustomGUI.HSplitter();
                GUILayout.Space(5f);
            }
        }
        private void InteractionEditing(int loop)
        {
            int indexer = 0;

            for (int i = 1; i < interactionOptions.Length; i++)
            {
                if (serializedObject.FindProperty(string.Format(InteractionDataAccess, loop)).stringValue == interactionOptions[i])
                {
                    indexer = i;
                    break;
                }
            }

            if (CustomGUI.ChangeCheckingPopup(ref indexer, interactionOptions, Simulation.Strings.InteractionLabelToExtend(loop + 1)))
            {
                serializedObject.FindProperty(string.Format(InteractionDataAccess, loop)).stringValue = interactionOptions[indexer];
            }
        }
        public static void DrawSplitter(string label)
        {
            var splitted = label.Split('`');

            if (splitted.Length > 1)
            {
                label = splitted[0];
            }

            var labelStyle = EditorUtilitiesEx.GetLabelStyle();
            var size       = labelStyle.CalcSize(new GUIContent(label.ToSentenceCase()));

            GUILayout.Label(label.ToSentenceCase().UppercaseWords(), labelStyle);
            var lastRect = GUILayoutUtility.GetLastRect();

            CustomGUI.Splitter(new Rect(lastRect.x, lastRect.y + lastRect.height * 0.5f, lastRect.width * 0.5f - size.x * 0.5f, 1f));
            CustomGUI.Splitter(new Rect(lastRect.x + lastRect.width * 0.5f + size.x * 0.5f, lastRect.y + lastRect.height * 0.5f, lastRect.width * 0.5f - size.x * 0.5f, 1f));
        }