IntField() публичный статический Метод

Make a text field for entering integers.

public static IntField ( GUIContent label, int value ) : int
label UnityEngine.GUIContent Optional label to display in front of the int field.
value int The value to edit.
Результат int
Пример #1
0
 void updateShopItems()
 {
     for (int i = 0; i <= (vars.characters.Count - 1); i++)
     {
         GL.Label("Character " + (i + 1) + " options:", EditorStyles.boldLabel);
         BV();
         GL.Label("Sprite1 for Open Eye / Sprite2 for Close Eye ", EditorStyles.boldLabel);
         BH();
         vars.characters[i].gameCharacterSprite1 = EGL.ObjectField("Game Character sprite1", vars.characters[i].gameCharacterSprite1, typeof(Sprite), false) as Sprite;
         vars.characters[i].gameCharacterSprite2 = EGL.ObjectField("Game Character sprite2", vars.characters[i].gameCharacterSprite2, typeof(Sprite), false) as Sprite;
         EH();
         BH();
         vars.characters[i].shopCharacterSprite = EGL.ObjectField("Shop Character sprite", vars.characters[i].shopCharacterSprite, typeof(Sprite), false) as Sprite;
         EH();
         BH();
         vars.characters[i].characterName = EGL.TextField("Character name", vars.characters[i].characterName);
         if (i != 0)
         {
             vars.characters[i].characterPrice = EGL.IntField("Character price", vars.characters[i].characterPrice);
         }
         EH();
         EV();
         separator();
     }
 }
    void ShowSettings()
    {
        LandmassEditorUtilities editorUtilities = LandmassEditorUtilities.Instance;
        ImporterConfiguration   importCfg       = editorUtilities.ImportCfg;

        EGL.BeginVertical();
        {
            EGL.Separator();

            GUILayout.Label("LOD Levels");

            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                if (importCfg.LodLevels.Count >= 4)
                {
                    GUI.enabled = false;
                }
                if (GUILayout.Button("Add LOD Level"))
                {
                    importCfg.LodLevels.Add(new LodLevel());
                    importCfg.IsDirty = true; // Todo: Nasty
                }
                GUI.enabled = true;

                // Show the list of LODS
                EGL.BeginVertical();
                {
                    _lodScrollPos = EGL.BeginScrollView(_lodScrollPos, GUILayout.MinHeight(96f), GUILayout.MaxHeight(Screen.height));
                    {
                        var removeThese = new List <LodLevel>();
                        int i           = 0;
                        foreach (LodLevel lod in importCfg.LodLevels)
                        {
                            if (ShowLodLevel(lod, i))
                            {
                                removeThese.Add(lod);
                                importCfg.IsDirty = true; // Nasty
                            }
                            i++;
                        }
                        foreach (LodLevel lod in removeThese)
                        {
                            importCfg.LodLevels.Remove(lod);
                        }
                    }
                    EGL.EndScrollView();
                }
                EGL.EndVertical();

                EGL.Space();

                GUILayout.Label("Control how many assets are processed in one go.");
                importCfg.BatchLimit = EGL.IntField("Batch limit", importCfg.BatchLimit);
                GUILayout.Label("Larger batches mean faster processing but require\nmore memory. Change this with care, or Unity's\nmemory might run out!");
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
    bool ShowLodLevel(LodLevel lod, int index)
    {
        bool removeThis = false;

        EGL.BeginVertical(GuiUtils.Skin.box);
        {
            GUILayout.Label("[" + index + "]");

            lod.Level = EGL.IntField("Lod Level", lod.Level);
            GUILayout.BeginHorizontal();
            {
                lod.FolderPath = EGL.TextField("Folder Path", lod.FolderPath);
                if (GUILayout.Button("Browse", GUILayout.Width(50f)))
                {
                    lod.FolderPath = UPath.GetProjectPath(EditorUtility.OpenFolderPanel("Browse", lod.FolderPath, Application.dataPath));
                }
            }
            GUILayout.EndHorizontal();

            lod.GridSize = EGL.IntField("Grid Size", lod.GridSize);

            lod.HeightmapResolution = EGL.IntField("Heightmap Resolution (px)", lod.HeightmapResolution);
            lod.SplatmapResolution  = EGL.IntField("Splatmap Resolution (px)", lod.SplatmapResolution);

            lod.HasDetailMap = EGL.Toggle("Use Detail Map?", lod.HasDetailMap);
            lod.HasTreeMap   = EGL.Toggle("Use Tree Map?", lod.HasTreeMap);

            if (lod.HasDetailMap)
            {
                lod.DetailmapResolution      = EGL.IntField("Detailmap Resolution (px)", lod.DetailmapResolution);
                lod.DetailResolutionPerPatch = EGL.IntField("Detailmap Patch Size (px)", lod.DetailResolutionPerPatch);
            }

            EGL.Space();

            GUILayout.Label("In-game terrain dimensions.");
            lod.TerrainWidth  = EGL.FloatField("Width & Length (m)", lod.TerrainWidth);
            lod.TerrainHeight = EGL.FloatField("Height (m)", lod.TerrainHeight);

            EGL.Space();

            GUILayout.Label("Relief Terrain Configuration");
            lod.ColormapResolution  = EGL.IntField("Colormap Resolution", lod.ColormapResolution);
            lod.NormalmapResolution = EGL.IntField("Normalmap Resolution", lod.NormalmapResolution);


            EGL.Space();

            if (GUILayout.Button("Remove", GUILayout.Width(64f), GUILayout.Height(64f)))
            {
                removeThis = true;
            }
        }
        EGL.EndVertical();

        return(removeThis);
    }
Пример #4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            var tree   = (BehaviourTree)target;
            var script = tree.source;

            if (script)
            {
                if (script.notCompiled)
                {
                    EGL.HelpBox("Script is not compiled.", MessageType.Error);
                }
                if (script.notUpToDate)
                {
                    EGL.HelpBox("Script is not up to date.", MessageType.Warning);
                }
                if (script.compileOkay)
                {
                    EGL.HelpBox("Script is compiled and up to date.", MessageType.Info);
                }
                if (GL.Button("Compile"))
                {
                    script.Compile();
                }
            }

            if (Application.isPlaying)
            {
                EGL.Space();
                EGL.LabelField("Conditions");
                GUI.enabled = false;
                foreach (var cond in tree.blackboard)
                {
                    var k = cond.Key;
                    var v = cond.Value;
                    if (v is float)
                    {
                        EGL.FloatField(k, (float)v);
                    }
                    else if (v is int)
                    {
                        EGL.IntField(k, (int)v);
                    }
                    else if (v is bool)
                    {
                        EGL.Toggle(k, (bool)v);
                    }
                    else if (v is string)
                    {
                        EGL.TextField(k, (string)v);
                    }
                }
                GUI.enabled = true;
                Repaint();
            }
        }
Пример #5
0
 public static IntRange FrameRangeInput(string text, IntRange range)
 {
     EGL.BeginHorizontal();
     EGL.PrefixLabel(text);
     range.from = EGL.IntField(range.from);
     EGL.LabelField("->", GL.Width(30));
     range.to = EGL.IntField(range.to);
     EGL.EndHorizontal();
     return(range);
 }
Пример #6
0
    public void OnGUI()
    {
        if (mapHolder == null)
        {
            mapHolder = GameObject.Find("Atom Map List").transform;
            if (mapHolder == null)
            {
                GUI.Label(new Rect((position.width - 100) / 2, (position.height - 20) / 2, 100, 20), "NO ATOM MAP LIST");
                return;
            }
        }

        if (map == null)
        {
            SetTargetMap(0);
        }

        GL.Label("Radius:");
        radiusIndex = GL.Toolbar(radiusIndex, radiusLabels);

        GL.Label("Subdivision:");
        subdivIndex  = GL.Toolbar(subdivIndex, subdivLabels);
        subdivOffset = EGL.IntField("Subdiv Offset:", subdivOffset);

        GL.Label("Levels:");
        numLevelsIndex = GL.Toolbar(numLevelsIndex, numLevelsLabels);

        bool prevEditingState = isEditing;

        GL.BeginHorizontal();
        //GL.Label("");
        isEditing = GL.Toggle(isEditing, "Enable/Disable Editing");
        if (isEditing != prevEditingState)
        {
            ToggleEditing(isEditing);
        }

        int prevTarget = targetMapIndex;

        targetMapIndex = (int)Mathf.Clamp(EGL.IntField("Target Map", targetMapIndex), 0, mapHolder.childCount - 1);
        if (prevTarget != targetMapIndex)
        {
            SetTargetMap(targetMapIndex);
        }
        GL.EndHorizontal();

        radius    = radiusOptions[radiusIndex];
        subdiv    = subdivOptions[subdivIndex];
        numLevels = numLevelsIndex + 1;
    }
Пример #7
0
        public override void OnInspectorGUI()
        {
            var settings = (ImportSettings)target;

            EditorGUI.BeginChangeCheck();

            using (new GL.HorizontalScope(EditorStyles.toolbar)) {
                GL.Label("Options");
            }

            settings.baseName     = EGL.TextField("Base Name", settings.baseName);
            settings.spriteTarget = EGL.TextField("Target Child Object", settings.spriteTarget);
            EGL.Space();

            settings.ppu       = EGL.IntField("Pixel Per Unit", settings.ppu);
            settings.alignment = (SpriteAlignment)EGL.EnumPopup("Default Align", settings.alignment);
            if (settings.alignment == SpriteAlignment.Custom)
            {
                settings.customPivot = EGL.Vector2Field("Custom Pivot", settings.customPivot);
            }

            settings.densePacked       = EGL.Toggle("Dense Pack", settings.densePacked);
            settings.border            = EGL.IntField("Border", settings.border);
            settings.automaticReimport = EGL.Toggle("Automatic Reimport", settings.automaticReimport);

            EGL.Space();
            using (new GL.HorizontalScope(EditorStyles.toolbar)) {
                GL.Label("Output");
            }

            settings.atlasOutputDirectory = PathSelection("Atlas Directory", settings.atlasOutputDirectory);
            settings.clipOutputDirectory  = PathSelection("Anim Clip Directory", settings.clipOutputDirectory);

            settings.controllerPolicy = (AnimControllerOutputPolicy)EGL.EnumPopup("Anim Controller Policy", settings.controllerPolicy);
            if (settings.controllerPolicy == AnimControllerOutputPolicy.CreateOrOverride)
            {
                settings.animControllerOutputPath = PathSelection("Anim Controller Directory", settings.animControllerOutputPath);
            }

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(settings);
            }
        }
    void ShowTiledImport()
    {
        EGL.BeginVertical();
        {
            EGL.BeginVertical(GuiUtils.Skin.box);
            {
                GUILayout.Label("Terrain input folder");
                _tiledInputLodLevel = EGL.IntField("Lod Level", _tiledInputLodLevel);

                if (GUILayout.Button("Load into scene"))
                {
                    _doTiledImport = true;
                }

                EGL.Separator();
            }
            EGL.EndVertical();
        }
        EGL.EndVertical();
    }
    public override void OnInspectorGUI()
    {
        field = (AsteroidField)target;

        EGL.LabelField("Settings", EditorStyles.boldLabel);
        field.hideFlags        = (HideFlags)EGL.EnumPopup("Hide Flags", field.hideFlags);
        field.desiredAsteroids = EGL.IntField("Desired Asteroids", field.desiredAsteroids);
        EGL.Space();

        EGL.LabelField("GameObject", EditorStyles.boldLabel);
        ShowGameObjectInformation();
        EGL.Space();

        EGL.LabelField("Radius", EditorStyles.boldLabel);
        ShowRadiusInfromation();
        EGL.Space();

        EGL.LabelField("Scale", EditorStyles.boldLabel);
        ShowScaleInformation();
        EGL.Space();

        ShowButtons();
    }
Пример #10
0
    void OnGUI()
    {
        EGL.LabelField("3D Texture properties", EditorStyles.boldLabel);

        int new_size = EGL.IntField("Resolution", data.size);

        new_size  = new_size <= 512 ? new_size : 512;
        new_size  = new_size >= 8 ? new_size : 8;
        data.size = new_size;

        EGL.LabelField("Worley noise");
        data.freqs[0]   = EGL.FloatField("Frequency", data.freqs[0]);
        data.octaves[0] = EGL.IntField("Octaves", data.octaves[0]);
        bool inv = EGL.Toggle("Invert", data.inverts[0] > 0);

        data.inverts[0] = inv ? 1 : 0;

        if (GUILayout.Button("Generate"))
        {
            CreateTexture();
        }

        EGL.HelpBox(status, MessageType.None, true);

        if (GUILayout.Button("Preview"))
        {
            CloudPreviewer.ShowTexture(texture);
        }

        EGL.BeginHorizontal();
        assetName = EGL.TextField("Asset name:", assetName);
        if (GUILayout.Button("Save"))
        {
            AssetDatabase.CreateAsset(texture, "Assets/" + assetName + ".asset");
        }
        EGL.EndHorizontal();
    }
Пример #11
0
        /// <summary>
        /// Field drawing utility used when a field of an object needs to be drawn
        /// </summary>
        private static object DrawPropertyObject(object property, Type type, int indent = 0)
        {
            var _val = property;

            // UnityEngine.Object
            if (typeof(U.Object).IsAssignableFrom(type))
            {
                U.Object _elementAsObject = null;
                _val.TryCast <U.Object>(out _elementAsObject);

#if UNITY_EDITOR
                _elementAsObject = EGl.ObjectField(_elementAsObject, type, true);
#else
                Gl.Label(_elementAsObject.ToString());
#endif

                _elementAsObject.TryCast <object>(out _val);

                return(_val);
            }

            // Initialize new if null (and newable).
            // Doing this after the Unity Object check will assure no GameObjects are spawned in the current scene
            if (_val == null)
            {
                var _constructorInfo = type.GetConstructor(Type.EmptyTypes);
                if (_constructorInfo != null)
                {
                    _val = _constructorInfo.Invoke(null);
                }
                else
                {
                    _val = default(object);
                }
            }

            // Implements the iDrawableProperty
            if (_val is iDrawableProperty)
            {
                iDrawableProperty _asDrawable = (iDrawableProperty)_val;
                _asDrawable.DrawAsProperty();
                return(_val);
            }

            // Bool
            if (_val is bool)
            {
                bool _elementAsBool = default(bool);

                if (_val.TryCast <bool>(out _elementAsBool))
                {
                    _elementAsBool = Gl.Toggle(_elementAsBool, "");
                }

                _elementAsBool.TryCast <object>(out _val);

                return(_val);
            }

            // Int
            if (_val is int)
            {
                int _elementAsInt = default(int);

                if (_val.TryCast <int>(out _elementAsInt))
                {
#if UNITY_EDITOR
                    _elementAsInt = EGl.IntField(_elementAsInt);
#else
                    int.TryParse(Gl.TextField(_elementAsInt.ToString()), out _elementAsInt);
#endif
                }

                _elementAsInt.TryCast <object>(out _val);

                return(_val);
            }

            // Float
            if (_val is float)
            {
                float _elementAsFloat = default(float);

                if (_val.TryCast <float>(out _elementAsFloat))
                {
#if UNITY_EDITOR
                    _elementAsFloat = EGl.FloatField(_elementAsFloat);
#else
                    float.TryParse(Gl.TextField(_elementAsFloat.ToString()), out _elementAsFloat);
#endif
                }

                _elementAsFloat.TryCast <object>(out _val);

                return(_val);
            }

            // String
            if (_val is string || typeof(string).IsAssignableFrom(type))
            {
                string _elementAsString = string.Empty;

                if (_val != null)
                {
                    if (_val.TryCast <string>(out _elementAsString))
                    {
                        _elementAsString = Gl.TextField(_elementAsString);
                    }
                }
                else
                {
                    Gl.Label("EMPTY STRING");
                }

                _elementAsString.TryCast <object>(out _val);

                return(_val);
            }

            // Try drawing using reflection,
            // expecting that it is a newable type that is already initialized in the code above
            if (_val != null)
            {
                var _valType = _val.GetType();
                if (indent == 0)
                {
                    Gl.Label(_valType.Name);
                }

                var _fieldInfo = _valType.GetFields(BindingFlags.Public | BindingFlags.Instance);

                if (indent < PROPERTY_DEPTH_LIMIT)
                {
                    indent++;

                    OpenIndent(indent);
                    foreach (var _field in _fieldInfo)
                    {
                        Gl.BeginHorizontal();
                        Gl.Label(StringUtil.WordSplit(_field.Name, true), Gl.ExpandWidth(false));
                        Gl.BeginVertical();
                        var _fieldValue = _field.GetValue(_val);
                        _field.SetValue(_val, DrawPropertyObject(_fieldValue, _field.FieldType, indent));
                        Gl.EndVertical();
                        Gl.EndHorizontal();
                    }

                    CloseIndent();
                }
                else
                {
                    Gl.Label(string.Format("[!] MAX DRAWING DEPTH ({0}) REACHED", PROPERTY_DEPTH_LIMIT));
                }

                return(_val);
            }

            Gl.Label("[ERROR] Unknown Type");
            return(null);
        }
Пример #12
0
        public override void OnInspectorGUI()
        {
            transition = (Transition)target;

            EditorGUI.BeginChangeCheck();

            var fromName    = transition.fromState.GetStatePreview();
            var toName      = transition.targetInfo;
            var displayName = fromName + "->" + toName;

            EGL.LabelField(displayName);
            EGL.Space();

            FromStateFilterInspector(transition.profile, transition.fromState, ref fromStateRect);
            EGL.Space();

            transition.triggerRangeType = (TriggerRangeType)EGL.EnumPopup("Trigger Range Type", transition.triggerRangeType);

            if (transition.triggerRangeType == TriggerRangeType.Range)
            {
                transition.triggerRange = EditorGUIUtil.FrameRangeInput("Trigger Frame", transition.triggerRange);
            }
            if (transition.triggerRangeType == TriggerRangeType.FrameSinceExec || transition.triggerRangeType == TriggerRangeType.FrameSinceExecBefore)
            {
                transition.triggerFrameSinceExec = EGL.IntField("Frame Since Exec", transition.triggerFrameSinceExec);
            }

            transition.timeBuffer = EGL.FloatField("Time Buffer", transition.timeBuffer);

            using (new EGL.VerticalScope(EditorStyles.helpBox))  {
                var conds      = transition.conditions;
                var paramNames = transition.profile.parameters.Select(it => it.name).ToArray();

                using (new EGL.HorizontalScope()) {
                    EGL.LabelField("Conditions", EditorStyles.boldLabel);
                    GL.FlexibleSpace();
                    if (GL.Button("+", GL.Width(30)))
                    {
                        conds.Add(new Condition());
                    }
                }
                for (int i = 0; i < conds.Count; ++i)
                {
                    var cond = conds[i];

                    EGL.BeginHorizontal();

                    int condSelectIndex = Mathf.Max(0, Array.IndexOf(paramNames, cond.name));

                    // cond.name = EGL.TextField(cond.name, GL.Width(70));
                    condSelectIndex = EGL.Popup(condSelectIndex, paramNames);
                    cond.name       = paramNames[condSelectIndex];

                    var param = transition.profile.FindParam(cond.name);
                    if (param == null)
                    {
                        EGL.LabelField("!Doesn't exist");
                    }
                    else
                    {
                        var type = param.type;
                        if (type == ParamType.Bool)
                        {
                            cond.boolValue = EGL.Toggle(cond.boolValue);
                        }
                        else if (type != ParamType.Trigger) // Trigger 不需要编辑
                        {
                            cond.cmp = (Cmp)EGL.EnumPopup(cond.cmp, GL.Width(50));

                            if (type == ParamType.Int)
                            {
                                cond.intValue = EGL.IntField(cond.intValue);
                            }
                            else
                            {
                                cond.floatValue = EGL.FloatField(cond.floatValue);
                            }
                        }
                    }

                    GL.FlexibleSpace();
                    if (GL.Button("-", GL.Width(30)))
                    {
                        conds.RemoveAt(i);
                        --i;
                    }

                    EGL.EndHorizontal();
                }
            }

            EGL.LabelField("", GUI.skin.horizontalSlider);

            transition.actionType = (ActionType)EGL.EnumPopup("Action", transition.actionType);

            if (transition.actionType == ActionType.ChangeState)
            {
                EGL.BeginHorizontal();
                EGL.PrefixLabel("Target State");
                EditorGUIUtil.AutoCompleteList(transition.targetStateName, allStateNames,
                                               str => transition.targetStateName = str, ref targetStateRect);

                transition.targetStateFrame = EGL.IntField(transition.targetStateFrame, GL.Width(30));
                EGL.LabelField("F", GUILayout.Width(20));

                var targetState = transition.profile.FindState(transition.targetStateName);
                if (targetState)
                {
                    if (GL.Button("Focus"))
                    {
                        Utils.FocusEditingAnimation(transition.profile, targetState.stateName);
                    }
                }
                EGL.EndHorizontal();

                if (!targetState)
                {
                    EGL.HelpBox("No target state " + targetState, MessageType.Error);
                }
            }
            else // SendMessage
            {
                transition.messageName = EGL.TextField("Message Name", transition.messageName);

                EGL.Space();
                transition.messageParType = (MessageParType)EGL.EnumPopup("Parameter Type", transition.messageParType);

                switch (transition.messageParType)
                {
                case MessageParType.Int:
                    transition.messageParInt = EGL.IntField("Value", transition.messageParInt);
                    break;

                case MessageParType.Float:
                    transition.messageParFloat = EGL.FloatField("Value", transition.messageParFloat);
                    break;

                case MessageParType.Bool:
                    transition.messageParBool = EGL.Toggle("Value", transition.messageParBool);
                    break;
                }
            }

            transition.priority    = EGL.IntField("Priority", transition.priority);
            transition.shouldDelay = EGL.Toggle("Should Delay", transition.shouldDelay);
            if (transition.shouldDelay)
            {
                transition.delay = EGL.FloatField("Delay", transition.delay);
            }

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(transition);
            }

            if (transition.fromState.type == FromStateType.State)
            {
                EGL.LabelField("", GUI.skin.horizontalSlider);
                using (new EGL.VerticalScope(EditorStyles.helpBox)) {
                    EGL.LabelField("From State", EditorStyles.boldLabel);
                    ++EditorGUI.indentLevel;
                    var fromState = transition.profile.FindState(transition.fromState.stateOrTagName);
                    if (fromState)
                    {
                        GUI.enabled = false;
                        if (!fromStateEditor || fromStateEditor.target != fromState)
                        {
                            if (fromStateEditor)
                            {
                                DestroyImmediate(fromStateEditor);
                            }
                            fromStateEditor = Editor.CreateEditor(fromState);
                        }

                        fromStateEditor.OnInspectorGUI();
                        GUI.enabled = true;
                    }
                    --EditorGUI.indentLevel;
                }
            }
        }
Пример #13
0
        void OnGUI()
        {
            if (!profile)
            {
                return;
            }

            if (Selection.activeObject != profile && Selection.activeObject is TransitionProfile)
            {
                BeginEdit(Selection.activeObject as TransitionProfile);
            }

            globalPanel = (GlobalPanelType)GL.Toolbar((int)globalPanel, new string[] { "States", "Params", "Tags", "Transitions" }, EditorStyles.toolbarButton);

            switch (globalPanel)
            {
            case GlobalPanelType.States: {
                profile.controller = (AnimatorController)EGL.ObjectField("Controller", profile.controller, typeof(AnimatorController), allowSceneObjects: false);

                if (profile.controller)
                {
                    EGL.BeginHorizontal();
                    EGL.PrefixLabel("Layer");
                    profile.controllerLayer = EGL.IntField(profile.controllerLayer);

                    // GL.FlexibleSpace();
                    if (GL.Button("Sync", EditorStyles.miniButtonRight, GL.Width(40)) && profile.controller)
                    {
                        SyncControllerStates();
                        statePanelView.Reload();
                    }
                    EGL.EndHorizontal();
                }
                EGL.Space();

                if (statePanelView == null)
                {
                    statePanelView = new StatesTreeView(statePanelState, profile);
                    statePanelView.searchString = "";

                    searchFieldState.downOrUpArrowKeyPressed += statePanelView.SetFocusAndEnsureSelectedItem;
                }
                statePanelView.searchString = ToolbarSearchField(statePanelView.searchString, searchFieldState);
                statePanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));
            } break;

            case GlobalPanelType.Parameters: {
                if (paramPanelView == null)
                {
                    paramPanelView = new ParamsTreeView(paramPanelState, profile);
                    paramPanelView.searchString = "";
                }

                paramPanelView.searchString = ToolbarSearchField(paramPanelView.searchString, searchFieldParam);

                paramPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));
            } break;

            case GlobalPanelType.Tags: {
                if (tagsPanelView == null)
                {
                    tagsPanelView = new TagsTreeView(tagsPanelState, profile);
                }

                tagsPanelView.searchString = ToolbarSearchField(tagsPanelView.searchString, searchFieldTag);

                tagsPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));

                var selection = tagsPanelView.GetSelection();
                if (selection.Any())
                {
                    string selectedTag   = profile.tags[selection.First()];
                    var    relatedStates = profile.states.Where(state => state.HasTagAnyFrame(Animator.StringToHash(selectedTag))).Select(it => it.stateName);

                    string statesStr = string.Join(",", relatedStates.ToArray());
                    GL.Label(statesStr, EditorStyles.textArea);
                }
            } break;

            default: { // Transitions
                if (transitionPanelView == null)
                {
                    transitionPanelView = new TransitionTreeView(transitionPanelState, profile);
                }

                EditorGUI.BeginChangeCheck();
                transitionPanelView.fromStateFilter   = searchFieldFromState.OnGUI("From State", transitionPanelView.fromStateFilter);
                transitionPanelView.targetStateFilter = searchFieldTargetState.OnGUI("Target State", transitionPanelView.targetStateFilter);
                if (EditorGUI.EndChangeCheck())
                {
                    transitionPanelView.Reload();
                }
                EGL.Space();

                transitionPanelView.OnGUI(GUILayoutUtility.GetRect(0, 10000, 0, 10000));

                Repaint();
            } break;
            }
        }
Пример #14
0
    public void OnGUI()
    {
        EditorGUIUtility.labelWidth = 75;
        if (atomMapHolder == null)
        {
            atomMapHolder = GameObject.Find("Atom Map List").transform;
            if (atomMapHolder == null)
            {
                GUI.Label(new Rect((position.width - 100) / 2, (position.height - 20) / 2, 100, 20), "NO ATOM MAP LIST");
                return;
            }
        }

        if (ionMapHolder == null)
        {
            ionMapHolder = GameObject.Find("Ion Map List").transform;
            if (ionMapHolder == null)
            {
                GUI.Label(new Rect((position.width - 100) / 2, (position.height - 20) / 2, 100, 20), "NO ION MAP LIST");
                return;
            }
        }

        if (atomMap == null || ionMap == null)
        {
            SetTargetMap(0);
        }

        GL.BeginHorizontal();
        type      = (IonType)EGL.EnumPopup("Ion Type:", type);
        behaviour = (IonBehaviour)EGL.EnumPopup("Behaviour:", behaviour);
        GL.EndHorizontal();

        radiusIndex = EGL.IntSlider("Radius:", radiusIndex, 0, 500);

        GL.Label("Subdivision:");
        subdivIndex  = GL.Toolbar(subdivIndex, subdivLabels);
        subdivOffset = EGL.IntField("Subdiv Offset:", subdivOffset);

        if (behaviour == IonBehaviour.Orbit)
        {
            orbitFreq    = EGL.FloatField("Orbit Speed:", orbitFreq);
            resetTrigger = (Atom)EGL.ObjectField("Reset Trig:", resetTrigger, typeof(Atom));
        }

        bool prevEditingState = isEditing;

        GL.BeginHorizontal();
        //GL.Label("");
        isEditing = GL.Toggle(isEditing, "Enable/Disable Editing");
        if (isEditing != prevEditingState)
        {
            ToggleEditing(isEditing);
        }

        int prevTarget = targetMapIndex;

        targetMapIndex = (int)Mathf.Clamp(EGL.IntField("Target Map", targetMapIndex), 0, atomMapHolder.childCount - 1);
        if (prevTarget != targetMapIndex)
        {
            SetTargetMap(targetMapIndex);
        }
        GL.EndHorizontal();

        radius = radiusIndex * baseRadiusUnit;
        subdiv = subdivOptions[subdivIndex];
    }
Пример #15
0
        public override void OnInspectorGUI()
        {
            var settings = (ImportSettings)target;

            EditorGUI.BeginChangeCheck();

            using (new GL.HorizontalScope(EditorStyles.toolbar)) {
                GL.Label("Options");
            }

            settings.baseName = EGL.TextField(new GUIContent("Base Name",
                                                             "Used to name the atlas, clips, and other assets generated"),
                                              settings.baseName);

            settings.spriteTarget = EGL.TextField(new GUIContent("Target Child Object",
                                                                 "Optional name of child object containing destination Sprite Renderer"),
                                                  settings.spriteTarget);

            EGL.Space();

            settings.ppu = EGL.IntField(new GUIContent("Pixel Per Unit",
                                                       "How many pixels span a Unity unit"),
                                        settings.ppu);

            settings.pixelOrigin = (PixelOrigin)EGL.EnumPopup(new GUIContent("Pixel Origin",
                                                                             "Where on the sprite's pixel data aligns to." +
                                                                             "\nCenter: center of the pixel (recommended)" +
                                                                             "\nBottom Left: bottom left of the pixel (original)"),
                                                              settings.pixelOrigin);

            EGL.Space();

            settings.alignment = (SpriteAlignment)EGL.EnumPopup(new GUIContent("Sprite Align",
                                                                               "Where the pivot aligns to the sprite\n" +
                                                                               "Note that a @pivot layer will override this"),
                                                                settings.alignment);

            if (settings.alignment == SpriteAlignment.Custom)
            {
                settings.customPivot = EGL.Vector2Field("Custom Pivot", settings.customPivot);
            }

            settings.densePacked = EGL.Toggle("Dense Pack", settings.densePacked);
            settings.border      = EGL.IntField("Border", settings.border);

            EGL.Space();
            using (new GL.HorizontalScope(EditorStyles.toolbar)) {
                GL.Label("Output");
            }

            settings.atlasOutputDirectory = PathSelection("Atlas Directory", settings.atlasOutputDirectory);
            settings.clipOutputDirectory  = PathSelection("Anim Clip Directory", settings.clipOutputDirectory);

            settings.controllerPolicy = (AnimControllerOutputPolicy)EGL.EnumPopup("Anim Controller Policy", settings.controllerPolicy);
            if (settings.controllerPolicy == AnimControllerOutputPolicy.CreateOrOverride)
            {
                settings.animControllerOutputPath = PathSelection("Anim Controller Directory", settings.animControllerOutputPath);
            }

            settings.dataOutputDirectory = PathSelection("Anim Data Directory", settings.dataOutputDirectory);

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(settings);
            }
        }
Пример #16
0
        private void DrawOneView(Rect drawPos, LookDevEditionContext context)
        {
            bool flag = (this.m_LookDevView.config.lookDevMode != LookDevMode.Single1 && context == LookDevEditionContext.Left) || (this.m_LookDevView.config.lookDevMode != LookDevMode.Single2 && context == LookDevEditionContext.Right);

            GUILayout.BeginArea(drawPos);
            GUILayout.Label(LookDevViewsWindow.styles.sViewTitle[(int)context], LookDevViewsWindow.styles.sViewTitleStyles[(int)context], new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.BeginVertical(new GUILayoutOption[]
            {
                GUILayout.Width(this.m_WindowWidth)
            });
            GUILayout.BeginHorizontal(new GUILayoutOption[]
            {
                GUILayout.Height(LookDevViewsWindow.kLineHeight)
            });
            GUILayout.Label(LookDevViewsWindow.styles.sExposure, LookDevViewsWindow.styles.sMenuItem, new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kLabelWidth)
            });
            float num = this.m_LookDevView.config.GetFloatProperty(LookDevProperty.ExposureValue, context);

            EditorGUI.BeginChangeCheck();
            float num2 = Mathf.Round(this.m_LookDevView.config.exposureRange);

            num = Mathf.Clamp(GUILayout.HorizontalSlider(num, -num2, num2, new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kSliderWidth)
            }), -num2, num2);
            num = Mathf.Clamp(EditorGUILayout.FloatField((float)Math.Round((double)num, (num >= 0f) ? 2 : 1), new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kSliderFieldWidth)
            }), -num2, num2);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_LookDevView.config.UpdateFocus(context);
                this.m_LookDevView.config.UpdateFloatProperty(LookDevProperty.ExposureValue, num);
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[]
            {
                GUILayout.Height(LookDevViewsWindow.kLineHeight)
            });
            int hdriCount = this.m_LookDevView.envLibrary.hdriCount;

            using (new EditorGUI.DisabledScope(hdriCount <= 1))
            {
                GUILayout.Label(LookDevViewsWindow.styles.sEnvironment, LookDevViewsWindow.styles.sMenuItem, new GUILayoutOption[]
                {
                    GUILayout.Width(LookDevViewsWindow.kLabelWidth)
                });
                if (hdriCount > 1)
                {
                    int num3 = hdriCount - 1;
                    int num4 = this.m_LookDevView.config.GetIntProperty(LookDevProperty.HDRI, context);
                    EditorGUI.BeginChangeCheck();
                    num4 = (int)GUILayout.HorizontalSlider((float)num4, 0f, (float)num3, new GUILayoutOption[]
                    {
                        GUILayout.Width(LookDevViewsWindow.kSliderWidth)
                    });
                    num4 = Mathf.Clamp(EditorGUILayout.IntField(num4, new GUILayoutOption[]
                    {
                        GUILayout.Width(LookDevViewsWindow.kSliderFieldWidth)
                    }), 0, num3);
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_LookDevView.config.UpdateFocus(context);
                        this.m_LookDevView.config.UpdateIntProperty(LookDevProperty.HDRI, num4);
                    }
                }
                else
                {
                    GUILayout.HorizontalSlider(0f, 0f, 0f, new GUILayoutOption[]
                    {
                        GUILayout.Width(LookDevViewsWindow.kSliderWidth)
                    });
                    GUILayout.Label(LookDevViewsWindow.styles.sZero, LookDevViewsWindow.styles.sMenuItem, new GUILayoutOption[0]);
                }
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[]
            {
                GUILayout.Height(LookDevViewsWindow.kLineHeight)
            });
            GUILayout.Label(LookDevViewsWindow.styles.sShadingMode, LookDevViewsWindow.styles.sMenuItem, new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kLabelWidth)
            });
            int num5 = this.m_LookDevView.config.GetIntProperty(LookDevProperty.ShadingMode, context);

            EditorGUI.BeginChangeCheck();
            num5 = EditorGUILayout.IntPopup("", num5, LookDevViewsWindow.styles.sShadingModeStrings, LookDevViewsWindow.styles.sShadingModeValues, new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kSliderFieldWidth + LookDevViewsWindow.kSliderWidth + 4f)
            });
            if (EditorGUI.EndChangeCheck())
            {
                this.m_LookDevView.config.UpdateFocus(context);
                this.m_LookDevView.config.UpdateIntProperty(LookDevProperty.ShadingMode, num5);
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[]
            {
                GUILayout.Height(LookDevViewsWindow.kLineHeight)
            });
            GUILayout.Label(LookDevViewsWindow.styles.sRotation, LookDevViewsWindow.styles.sMenuItem, new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kLabelWidth)
            });
            float num6 = this.m_LookDevView.config.GetFloatProperty(LookDevProperty.EnvRotation, context);

            EditorGUI.BeginChangeCheck();
            num6 = GUILayout.HorizontalSlider(num6, 0f, 720f, new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kSliderWidth)
            });
            num6 = Mathf.Clamp(EditorGUILayout.FloatField((float)Math.Round((double)num6, 0), new GUILayoutOption[]
            {
                GUILayout.Width(LookDevViewsWindow.kSliderFieldWidth)
            }), 0f, 720f);
            if (EditorGUI.EndChangeCheck())
            {
                this.m_LookDevView.config.UpdateFocus(context);
                this.m_LookDevView.config.UpdateFloatProperty(LookDevProperty.EnvRotation, num6);
            }
            GUILayout.EndHorizontal();
            if (this.NeedLoD())
            {
                GUILayout.BeginHorizontal(new GUILayoutOption[]
                {
                    GUILayout.Height(LookDevViewsWindow.kLineHeight)
                });
                if (this.m_LookDevView.config.GetObjectLoDCount(context) > 1)
                {
                    int num7 = this.m_LookDevView.config.GetIntProperty(LookDevProperty.LoDIndex, context);
                    GUILayout.Label((num7 != -1) ? LookDevViewsWindow.styles.sLoD : LookDevViewsWindow.styles.sLoDAuto, LookDevViewsWindow.styles.sMenuItem, new GUILayoutOption[]
                    {
                        GUILayout.Width(LookDevViewsWindow.kLabelWidth)
                    });
                    EditorGUI.BeginChangeCheck();
                    int num8 = this.m_LookDevView.config.GetObjectLoDCount(context) - 1;
                    if (this.m_LookDevView.config.lookDevMode != LookDevMode.Single1 && this.m_LookDevView.config.lookDevMode != LookDevMode.Single2 && this.m_LookDevView.config.IsPropertyLinked(LookDevProperty.LoDIndex))
                    {
                        num8 = Math.Min(this.m_LookDevView.config.GetObjectLoDCount(LookDevEditionContext.Left), this.m_LookDevView.config.GetObjectLoDCount(LookDevEditionContext.Right)) - 1;
                    }
                    num7 = Mathf.Clamp(num7, -1, num8);
                    num7 = (int)GUILayout.HorizontalSlider((float)num7, -1f, (float)num8, new GUILayoutOption[]
                    {
                        GUILayout.Width(LookDevViewsWindow.kSliderWidth)
                    });
                    num7 = EditorGUILayout.IntField(num7, new GUILayoutOption[]
                    {
                        GUILayout.Width(LookDevViewsWindow.kSliderFieldWidth)
                    });
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_LookDevView.config.UpdateFocus(context);
                        this.m_LookDevView.config.UpdateIntProperty(LookDevProperty.LoDIndex, num7);
                    }
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            if (flag)
            {
                GUILayout.BeginVertical(new GUILayoutOption[]
                {
                    GUILayout.Width(LookDevViewsWindow.kIconSize)
                });
                LookDevProperty[] array = new LookDevProperty[]
                {
                    LookDevProperty.ExposureValue,
                    LookDevProperty.HDRI,
                    LookDevProperty.ShadingMode,
                    LookDevProperty.EnvRotation,
                    LookDevProperty.LoDIndex
                };
                int num9 = 4 + ((!this.NeedLoD()) ? 0 : 1);
                for (int i = 0; i < num9; i++)
                {
                    EditorGUI.BeginChangeCheck();
                    bool flag2 = this.m_LookDevView.config.IsPropertyLinked(array[i]);
                    bool value = GUILayout.Toggle(flag2, this.GetGUIContentLink(flag2), LookDevViewsWindow.styles.sToolBarButton, new GUILayoutOption[]
                    {
                        GUILayout.Height(LookDevViewsWindow.kLineHeight)
                    });
                    if (EditorGUI.EndChangeCheck())
                    {
                        this.m_LookDevView.config.UpdatePropertyLink(array[i], value);
                    }
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
Пример #17
0
        public override void OnInspectorGUI()
        {
            var settings = (ImportSettings)target;

            Undo.RecordObject(settings, "AseFileSettings");

            using (new GL.HorizontalScope(EditorStyles.toolbar))
            {
                GL.Label("Options");
            }

            settings.generatePrefab = EGL.Toggle("Generate Prefab", settings.generatePrefab);
            settings.ppu            = EGL.IntField("Pixel Per Unit", settings.ppu);
            settings.alignment      = (SpriteAlignment)EGL.EnumPopup("Default Align", settings.alignment);
            if (settings.alignment == SpriteAlignment.Custom)
            {
                settings.customPivot = EGL.Vector2Field("Custom Pivot", settings.customPivot);
            }

            settings.densePacked = EGL.Toggle("Dense Pack", settings.densePacked);
            settings.border      = EGL.IntField("Border", settings.border);

            EGL.Space();
            if (settings.generatePrefab)
            {
                using (new GL.HorizontalScope(EditorStyles.toolbar))
                {
                    GL.Label("Prefab Options");
                }
                EGL.BeginHorizontal();

                string[] opetions = SortingLayer.layers.Select(it => it.name).ToArray();
                settings.sortIndex          = EGL.Popup("Sort In Layer", settings.sortIndex, opetions);
                settings.spritesSortInLayer = SortingLayer.NameToID(opetions[settings.sortIndex]);

                if (GL.Button("Edit", GL.Width(36)))
                {
                    Selection.objects = AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset");
                }
                EGL.EndHorizontal();
                settings.orderInLayerInterval = EGL.IntField("Interval of order in layer", settings.orderInLayerInterval);
            }

            EGL.Space();
            using (new GL.HorizontalScope(EditorStyles.toolbar))
            {
                GL.Label("Output");
            }

            settings.atlasOutputDirectory = PathSelection("Atlas Directory", settings.atlasOutputDirectory);
            settings.clipOutputDirectory  = PathSelection("Anim Clip Directory", settings.clipOutputDirectory);

            settings.controllerPolicy = (AnimControllerOutputPolicy)EGL.EnumPopup("Anim Controller Policy", settings.controllerPolicy);
            if (settings.controllerPolicy == AnimControllerOutputPolicy.CreateOrOverride || settings.controllerPolicy == AnimControllerOutputPolicy.CreateNotOverride)
            {
                settings.animControllerOutputPath = PathSelection("Anim Controller Directory", settings.animControllerOutputPath);
            }

            if (settings.generatePrefab)
            {
                settings.prefabsDirectory = PathSelection("Prefab Directory", settings.prefabsDirectory);
            }
        }
Пример #18
0
        public override void OnGUI(Rect rect)
        {
            if (s_Styles == null)
            {
                s_Styles = new Styles();
            }
            GameViewSize other = base.m_Object as GameViewSize;

            if (other == null)
            {
                Debug.LogError("Invalid object");
            }
            else
            {
                if (this.m_GameViewSize == null)
                {
                    this.m_GameViewSize = new GameViewSize(other);
                }
                bool flag = (this.m_GameViewSize.width > 0) && (this.m_GameViewSize.height > 0);
                GUILayout.Space(3f);
                GUILayout.Label((base.m_MenuType != FlexibleMenuModifyItemUI.MenuType.Add) ? s_Styles.headerEdit : s_Styles.headerAdd, EditorStyles.boldLabel, new GUILayoutOption[0]);
                FlexibleMenu.DrawRect(GUILayoutUtility.GetRect((float)1f, (float)1f), !EditorGUIUtility.isProSkin ? new Color(0.6f, 0.6f, 0.6f, 1.333f) : new Color(0.32f, 0.32f, 0.32f, 1.333f));
                GUILayout.Space(4f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(90f) };
                GUILayout.Label(s_Styles.optionalText, options);
                GUILayout.Space(10f);
                this.m_GameViewSize.baseText = EditorGUILayout.TextField(this.m_GameViewSize.baseText, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(90f) };
                GUILayout.Label(s_Styles.typeName, optionArray2);
                GUILayout.Space(10f);
                this.m_GameViewSize.sizeType = (GameViewSizeType)EditorGUILayout.Popup((int)this.m_GameViewSize.sizeType, s_Styles.typeNames, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(90f) };
                GUILayout.Label(s_Styles.widthHeightText, optionArray3);
                GUILayout.Space(10f);
                this.m_GameViewSize.width = EditorGUILayout.IntField(this.m_GameViewSize.width, new GUILayoutOption[0]);
                GUILayout.Space(5f);
                this.m_GameViewSize.height = EditorGUILayout.IntField(this.m_GameViewSize.height, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();
                GUILayout.Space(10f);
                float pixels    = 10f;
                float cropWidth = rect.width - (2f * pixels);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(pixels);
                GUILayout.FlexibleSpace();
                string displayText = this.m_GameViewSize.displayText;
                using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(displayText)))
                {
                    if (string.IsNullOrEmpty(displayText))
                    {
                        displayText = "Result";
                    }
                    else
                    {
                        displayText = this.GetCroppedText(displayText, cropWidth, EditorStyles.label);
                    }
                    GUILayout.Label(GUIContent.Temp(displayText), EditorStyles.label, new GUILayoutOption[0]);
                }
                GUILayout.FlexibleSpace();
                GUILayout.Space(pixels);
                GUILayout.EndHorizontal();
                GUILayout.Space(5f);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                GUILayout.Space(10f);
                if (GUILayout.Button(s_Styles.cancel, new GUILayoutOption[0]))
                {
                    base.editorWindow.Close();
                }
                using (new EditorGUI.DisabledScope(!flag))
                {
                    if (GUILayout.Button(s_Styles.ok, new GUILayoutOption[0]))
                    {
                        other.Set(this.m_GameViewSize);
                        base.Accepted();
                        base.editorWindow.Close();
                    }
                }
                GUILayout.Space(10f);
                GUILayout.EndHorizontal();
            }
        }