コード例 #1
0
    void StatePanel(List <int> currentList, string title)
    {
        StateDataBase StateData = (StateDataBase)AssetDatabase.LoadAssetAtPath("Assets/DataBase/Data_States.asset", typeof(StateDataBase));

        GUILayout.BeginVertical("box");
        GUILayout.Label(title, center);
        GUILayout.EndVertical();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        scrollAdd = GUILayout.BeginScrollView(scrollAdd, GUILayout.Height(200), GUILayout.Width(230));
        GUILayout.BeginVertical("box", GUILayout.Width(200));
        GUILayout.Label("Add", center);
        StateList(currentList, StateData.States);
        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        GUILayout.Space(20);
        scrollRemove = GUILayout.BeginScrollView(scrollRemove, GUILayout.Height(200), GUILayout.Width(230));
        GUILayout.BeginVertical("box", GUILayout.Width(200));
        GUILayout.Label("Remove", center);
        EditorFunctions.CheckList(currentList, StateData.States);
        for (int i = 0; i < currentList.Count; i++)
        {
            if (GUILayout.Button("" + StateData.States[currentList[i]].Name))
            {
                currentList.RemoveAt(i);
            }
        }
        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();
    }
コード例 #2
0
    protected void OnGUI()
    {
        if (my != null)
        {
            if (my.Items == null)
            {
                my.Items = new List <CollectorDatabase.ItemGet>();
            }
            GUILayout.BeginVertical("box");
            GUILayout.Label("" + titleContent.text, center);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            Save();
            GUILayout.EndHorizontal();
            Multiplers();
            VariantSlider(my);
            EditorFunctions.CheckList(my.Items, items.Components);
            ItemsPanel(my);
            GUILayout.EndVertical();
            ItemsList(my);
        }
        else
        {
            Close();
        }

        if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.Mouse1))
        {
            GUI.FocusControl(null);
        }
    }
コード例 #3
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        EditorFunctions sizeWindow = new EditorFunctions
        {
            autoRepaintOnSceneChange = true
        };

        sizeWindow.Show();
    }
コード例 #4
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        filePath = EditorGUILayout.TextField("Path", filePath);
        fileName = EditorGUILayout.TextField("Name", fileName);
        if (GUILayout.Button("Save"))
        {
            EditorFunctions.WriteToEnum(filePath, fileName, variables.variables);
        }
    }
コード例 #5
0
        private void DrawSettings(Rect a_rect)
        {
            GUILayout.BeginArea(a_rect);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Require", GUILayout.Width(50f));

            MxMPreProcessData preProcessData = m_spTargetPreProcessData.objectReferenceValue as MxMPreProcessData;
            AnimationModule   animModule     = m_spTargetAnimationModule.objectReferenceValue as AnimationModule;

            if (preProcessData != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(preProcessData.TagNames.ToArray(), m_spTags, 75f);
            }
            else if (animModule != null && animModule.TagNames != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(animModule.TagNames.ToArray(), m_spTags, 75f);
            }
            else
            {
                m_spTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField((ETags)m_spTags.intValue);
            }


            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Favour", GUILayout.Width(50f));

            if (preProcessData != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(preProcessData.FavourTagNames.ToArray(), m_spFavourTags, 75f);
            }
            else if (animModule != null && animModule.FavourTagNames != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(animModule.FavourTagNames.ToArray(), m_spFavourTags, 75f);
            }
            else
            {
                m_spFavourTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField((ETags)m_spFavourTags.intValue);
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.PrefixLabel("Min Loops:");
            m_spMinLoops.intValue = EditorGUILayout.IntField(m_spMinLoops.intValue);
            EditorGUILayout.PrefixLabel("Max Loops:");
            m_spMaxLoops.intValue = EditorGUILayout.IntField(m_spMaxLoops.intValue);

            GUILayout.EndArea();
        }
コード例 #6
0
    void ThrowSwitch()
    {
        IThrow item = (IThrow)selected;

        GUILayout.BeginVertical("box");
        GUILayout.Label("Attack", center);
        item.AttackElement    = (Elements)EditorGUILayout.EnumPopup("Attack Element", item.AttackElement);
        item.MissileFlight    = (MissileFlight)EditorGUILayout.EnumPopup("Missile Flight", item.MissileFlight);
        item.Piercing         = EditorGUILayout.IntField("Armor piercing", item.Piercing);
        item.Piercing_Precent = EditorGUILayout.IntSlider("Armor piercing %", item.Piercing_Precent, 0, 100);
        item.Battle.dmg       = EditorGUILayout.IntField("Dmg", item.Battle.dmg);
        if (item.Battle.dmg < 0)
        {
            item.Battle.dmg = 0;
        }
        item.Battle.dmg_dice = EditorGUILayout.IntField("Dmg dice", item.Battle.dmg_dice);
        if (item.Battle.dmg_dice < 0)
        {
            item.Battle.dmg_dice = 0;
        }
        GUILayout.Label(item.Battle.dmg + " - " + (item.Battle.dmg + item.Battle.dmg_dice));
        item.Battle.crit_multiply = EditorGUILayout.FloatField("Crit multiply", item.Battle.crit_multiply);
        item.Battle.range         = EditorGUILayout.FloatField("Range", item.Battle.range);
        item.AreaAttack           = EditorGUILayout.Toggle("Area Attack", item.AreaAttack);
        if (item.AreaAttack)
        {
            item.AreaRange      = EditorGUILayout.FloatField("Range", item.AreaRange);
            item.IgnoreObstacle = EditorGUILayout.Toggle("Ignore Obstacle", item.IgnoreObstacle);
        }
        else
        {
            item.AreaRange      = 0;
            item.IgnoreObstacle = false;
        }
        GUILayout.EndVertical();
        GUILayout.Space(20);
        GUILayout.BeginVertical("box");
        EditorFunctions.ViewState(item.AtkState, "Attack State");
        GUILayout.EndVertical();
        GUILayout.Space(20);
        item.RemoveAllState = (TypeState)EditorGUILayout.EnumPopup("Remove All type state", item.RemoveAllState);
        GUILayout.Space(20);
        GUILayout.BeginVertical("box");
        StatePanel(item.RemoveState, "State Remove");
        GUILayout.EndVertical();
    }
コード例 #7
0
ファイル: MainBodyEditor.cs プロジェクト: Holo74/Test-Build
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Apply to Enums and Variables"))
        {
            string[] names = new string[body.keyCodes.Length];
            body.Variables.UpdateInputsAndEnums(body.keyCodes);
            EditorUtility.SetDirty(body);
            EditorUtility.SetDirty(body.gameObject);
            EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
            for (int i = 0; i < names.Length; i++)
            {
                names[i] = body.keyCodes[i].Name;
            }
            EditorFunctions.WriteToEnum("Assets/Scripts/Enums/", "InputVariables", names);
        }
    }
コード例 #8
0
    void AccessoriesSwitch()
    {
        IAccessories accessories = (IAccessories)selected;

        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        Buttons();
        if (GUILayout.Button("State Resist"))
        {
            typeEdit = 6;
        }
        GUILayout.EndHorizontal();
        switch (typeEdit)
        {
        case 1:
            EditorFunctions.ViewBase(accessories.Stats.Base);
            break;

        case 2:
            EditorFunctions.ViewBattle(accessories.Stats.Battle);
            break;

        case 3:
            EditorFunctions.ViewAbility(accessories.Stats.Ability);
            break;

        case 4:
            EditorFunctions.ViewResist(accessories.Stats.Resistance);
            break;

        case 5:
            EditorFunctions.ViewOther(accessories.Stats.Other);
            break;

        case 6:
            EditorFunctions.ViewState(accessories.Stats.ResistState, "State resist");
            break;

        case 7:
            EditorFunctions.ViewSkills();
            break;
        }
    }
コード例 #9
0
 void ComponentsPanel(List <IComponent> currentList)
 {
     GUILayout.BeginVertical("box");
     GUILayout.Label("Components", center);
     GUILayout.EndVertical();
     GUILayout.BeginHorizontal();
     GUILayout.FlexibleSpace();
     GUILayout.BeginVertical("box", GUILayout.Width(300));
     scrollAdd = GUILayout.BeginScrollView(scrollAdd, GUILayout.Height(200));
     GUILayout.Label("Add", center);
     ComponentList(currentList);
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUILayout.Space(20);
     GUILayout.BeginVertical("box", GUILayout.Width(300));
     scrollRemove = GUILayout.BeginScrollView(scrollRemove, GUILayout.Height(200));
     GUILayout.Label("Remove", center);
     if (currentList.Count >= 8)
     {
         GUILayout.Label("Max Components!");
     }
     EditorFunctions.CheckList(currentList, my.Components);
     for (int i = 0; i < currentList.Count; i++)
     {
         GUILayout.BeginHorizontal("box");
         if (GUILayout.Button("" + my.Components[currentList[i].ID].Name, GUILayout.Width(100)))
         {
             currentList.RemoveAt(i); break;
         }
         currentList[i].amount = EditorGUILayout.IntSlider(currentList[i].amount, 1, 9999);
         GUILayout.EndHorizontal();
     }
     GUILayout.EndScrollView();
     GUILayout.EndVertical();
     GUILayout.FlexibleSpace();
     GUILayout.EndHorizontal();
 }
コード例 #10
0
        //============================================================================================

        /**
         *  @brief
         *
         *********************************************************************************************/
        private void OnGUI()
        {
            if (m_soPreProcessData == null)
            {
                Close();
                return;
            }

            m_spCategoryList = m_soPreProcessData.FindProperty("m_compositeCategories");

            if (m_spCategoryList == null)
            {
                Close();
                return;
            }

            if (m_categoryId >= m_spCategoryList.arraySize)
            {
                Close();
                return;
            }

            m_spCategory          = m_spCategoryList.GetArrayElementAtIndex(m_categoryId);
            m_spCategoryName      = m_spCategory.FindPropertyRelative("CatagoryName");
            m_spIgnoreEdges       = m_spCategory.FindPropertyRelative("IgnoreEdges_default");
            m_spExtrapolate       = m_spCategory.FindPropertyRelative("Extrapolate_default");
            m_spFlattenTrajectory = m_spCategory.FindPropertyRelative("FlattenTrajectory_default");
            m_spRuntimeSplicing   = m_spCategory.FindPropertyRelative("RuntimeSplicing_default");
            m_spRequireTags       = m_spCategory.FindPropertyRelative("RequireTags_default");
            m_spFavourTags        = m_spCategory.FindPropertyRelative("FavourTags_default");

            EditorGUILayout.LabelField(m_spCategoryName.stringValue + " Defaults", EditorStyles.boldLabel);
            GUILayout.Space(5f);

            EditorGUI.BeginChangeCheck();
            m_spIgnoreEdges.boolValue = EditorGUILayout.ToggleLeft("IgnoreEdges", m_spIgnoreEdges.boolValue);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_spIgnoreEdges.boolValue)
                {
                    m_spExtrapolate.boolValue     = false;
                    m_spRuntimeSplicing.boolValue = false;
                }
            }

            EditorGUI.BeginChangeCheck();
            m_spExtrapolate.boolValue = EditorGUILayout.ToggleLeft("Extrapolate", m_spExtrapolate.boolValue);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_spExtrapolate.boolValue)
                {
                    m_spIgnoreEdges.boolValue     = false;
                    m_spRuntimeSplicing.boolValue = false;
                }
            }

            EditorGUI.BeginChangeCheck();
            m_spRuntimeSplicing.boolValue = EditorGUILayout.ToggleLeft("Runtime Splicing", m_spRuntimeSplicing.boolValue);
            if (EditorGUI.EndChangeCheck())
            {
                if (m_spRuntimeSplicing.boolValue)
                {
                    m_spExtrapolate.boolValue = false;
                    m_spIgnoreEdges.boolValue = false;
                }
            }

            m_spFlattenTrajectory.boolValue = EditorGUILayout.ToggleLeft("Flatten Trajectory", m_spFlattenTrajectory.boolValue);

            //float labelWidthDefault = EditorGUIUtility.labelWidth;
            //EditorGUIUtility.labelWidth = 90f;



            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Require", GUILayout.Width(50f));
            if (m_moduleData != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(m_moduleData.TagNames.ToArray(), m_spRequireTags, 75f);
            }
            else
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(m_data.TagNames.ToArray(), m_spRequireTags, 75f);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Favour", GUILayout.Width(50f));
            if (m_moduleData != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(m_moduleData.FavourTagNames.ToArray(), m_spFavourTags, 75f);
            }
            else
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(m_data.FavourTagNames.ToArray(), m_spFavourTags, 75f);
            }
            EditorGUILayout.EndHorizontal();

            //m_spRequireTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField("Require Tags", (ETags)m_spRequireTags.intValue);
            //m_spFavourTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField("Favour Tags", (ETags)m_spFavourTags.intValue);
            //EditorGUIUtility.labelWidth = labelWidthDefault;

            GUILayout.Space(5f);

            if (GUILayout.Button("Apply Require Tags"))
            {
                if (EditorUtility.DisplayDialog("Apply Require Tags", "This will apply the default require tags to all existing composites " +
                                                "in this category. Are you sure this is what you want to do?", "Yes", "Cancel"))
                {
                    ApplySettings(0);
                }
            }

            if (GUILayout.Button("Apply Favour Tags"))
            {
                if (EditorUtility.DisplayDialog("Apply Favour Tags", "This will apply the default favour tags to all existing composites " +
                                                "in this category. Are you sure this is what you want to do?", "Yes", "Cancel"))
                {
                    ApplySettings(1);
                }
            }

            if (GUILayout.Button("Apply All"))
            {
                if (EditorUtility.DisplayDialog("Apply All Settings", "This will apply all default settings to all existing composites " +
                                                "in this category. Are you sure this is what you want to do?", "Yes", "Cancel"))
                {
                    ApplySettings(2);
                }
            }

            m_soPreProcessData.ApplyModifiedProperties();
        }
コード例 #11
0
    void ComponentsPanel(List <IComponent> currentList)
    {
        GUILayout.BeginVertical("box");
        GUILayout.Label("Components", center);
        GUILayout.EndVertical();
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.BeginVertical("box", GUILayout.Width(300));
        scrollAdd = GUILayout.BeginScrollView(scrollAdd, GUILayout.Height(200));
        GUILayout.Label("Add", center);
        ComponentsList();
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        GUILayout.Space(10);
        GUILayout.BeginVertical("box", GUILayout.Width(300));
        scrollRemove = GUILayout.BeginScrollView(scrollRemove, GUILayout.Height(200));
        GUILayout.Label("Remove", center);
        if (currentList.Count >= 8)
        {
            GUILayout.Label("Max Components!");
        }
        EditorFunctions.CheckList(currentList, items.Components);
        for (int i = 0; i < currentList.Count; i++)
        {
            GUILayout.BeginHorizontal("box");
            if (GUILayout.Button("" + items.Components[currentList[i].ID].Name, GUILayout.Width(100)))
            {
                currentList.RemoveAt(i); break;
            }
            currentList[i].amount = EditorGUILayout.IntSlider(currentList[i].amount, 1, 9999);
            GUILayout.EndHorizontal();
        }
        GUILayout.EndScrollView();
        GUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();


        void ComponentsList()
        {
            for (int i = 0; i < items.Components.Count; i++)
            {
                bool has = false;
                for (int j = 0; j < currentList.Count; j++)
                {
                    if (i == currentList[j].ID)
                    {
                        has = true;
                        break;
                    }
                }
                if (!has)
                {
                    if (GUILayout.Button("" + items.Components[i].Name) && currentList.Count < 8)
                    {
                        currentList.Add(new IComponent(i, ItemCategory.Component));
                    }
                }
            }
        }
    }
コード例 #12
0
    void Content()
    {
        try
        {
            switch (Type)
            {
            case 1:    //Sw - Selected weapon
                WeaponUpgrade Sw = (WeaponUpgrade)selected;
                break;

            case 2:
                ArmorUpgrade Sa = (ArmorUpgrade)selected;
                break;
            } //for nulls
            GUILayout.BeginVertical("box");
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            GUILayout.Label("Stage " + (stageSelect + 1));
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            switch (Type)
            {
            case 1:    //Sw - Selected weapon
                WeaponUpgrade Sw = (WeaponUpgrade)selected;
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical("box");
                Sw.Stage[stageSelect].AddStats.dmg            = EditorGUILayout.IntField("Dmg", Sw.Stage[stageSelect].AddStats.dmg);
                Sw.Stage[stageSelect].AddStats.dmg_dice       = EditorGUILayout.IntField("Dmg dice", Sw.Stage[stageSelect].AddStats.dmg_dice);
                Sw.Stage[stageSelect].AddStats.crit_multiply  = EditorGUILayout.FloatField("Crit multiply", Sw.Stage[stageSelect].AddStats.crit_multiply);
                Sw.Stage[stageSelect].AddStats.range          = EditorGUILayout.FloatField("Range", Sw.Stage[stageSelect].AddStats.range);
                Sw.Stage[stageSelect].AddStats.armor_phisical = EditorGUILayout.IntField("Armor Phisical", Sw.Stage[stageSelect].AddStats.armor_phisical);
                Sw.Stage[stageSelect].AddStats.armor_magicial = EditorGUILayout.IntField("Armor Magicial", Sw.Stage[stageSelect].AddStats.armor_magicial);
                EditorFunctions.ViewBattle(Sw.Stage[stageSelect].AddStats);
                GUILayout.EndVertical();
                GUILayout.BeginVertical("box", GUILayout.Width(610));
                ComponentsPanel(Sw.Stage[stageSelect].Components);
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
                break;

            case 2:
                ArmorUpgrade Sa = (ArmorUpgrade)selected;
                scrollContent = GUILayout.BeginScrollView(scrollContent);
                GUILayout.BeginVertical();
                for (int i = 0; i < Sa.Weight_Type.Count; i++)
                {
                    GUILayout.Space(10);
                    GUILayout.BeginVertical("box");
                    GUILayout.Label("" + ((Weight)i), center);
                    GUILayout.EndVertical();
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginVertical("box");
                    Sa.Weight_Type[i].Stage[stageSelect].AddStats.armor_phisical = EditorGUILayout.IntField("Armor Phisical", Sa.Weight_Type[i].Stage[stageSelect].AddStats.armor_phisical);
                    Sa.Weight_Type[i].Stage[stageSelect].AddStats.armor_magicial = EditorGUILayout.IntField("Armor Magicial", Sa.Weight_Type[i].Stage[stageSelect].AddStats.armor_magicial);
                    EditorFunctions.ViewBattle(Sa.Weight_Type[i].Stage[stageSelect].AddStats);
                    GUILayout.EndVertical();
                    GUILayout.BeginVertical("box", GUILayout.Width(610));
                    ComponentsPanel(Sa.Weight_Type[i].Stage[stageSelect].Components);
                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
                GUILayout.EndScrollView();
                break;
            }

            GUILayout.EndVertical();
        }
        catch {}
    }
コード例 #13
0
        //===========================================================================================

        /**
         *  @brief
         *
         *********************************************************************************************/
        public void OnGUI(Rect a_position)
        {
            if (m_data == null)
            {
                MxMSettings settings = MxMSettings.Instance();
                if (settings != null)
                {
                    m_data = settings.ActiveBlendSpace;

                    if (m_data != null)
                    {
                        SetData(m_data);
                    }
                }
            }

            if (m_data != null)
            {
                Event evt = Event.current;

                float labelWidth = EditorGUIUtility.labelWidth;

                if (evt.type == EventType.Repaint)
                {
                    if (m_queueDeleteIndex >= 0 && m_queueDeleteIndex < m_spClips.arraySize)
                    {
                        if (m_selectId == m_queueDeleteIndex)
                        {
                            m_selectId = -1;
                        }

                        if (m_spClips.GetArrayElementAtIndex(m_queueDeleteIndex).objectReferenceValue != null)
                        {
                            m_spClips.DeleteArrayElementAtIndex(m_queueDeleteIndex);
                        }

                        m_spClips.DeleteArrayElementAtIndex(m_queueDeleteIndex);
                        m_spPositions.DeleteArrayElementAtIndex(m_queueDeleteIndex);

                        m_queueDeleteIndex = -1;
                    }
                }

                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.Height(20f), GUILayout.ExpandWidth(true));

                EditorGUI.BeginChangeCheck();
                m_previewActive = GUILayout.Toggle(m_previewActive, "Preview", EditorStyles.toolbarButton, GUILayout.Width(60f));
                if (EditorGUI.EndChangeCheck())
                {
                    if (m_previewActive)
                    {
                        BeginPreview();
                    }
                    else
                    {
                        EndPreview();
                    }
                }



                if (m_previewActive && MxMPreviewScene.IsSceneLoaded)
                {
                    EditorGUIUtility.labelWidth = 20f;

                    EditorGUI.BeginChangeCheck();
                    m_previewPos.x = EditorGUILayout.FloatField("X: ", m_previewPos.x, EditorStyles.toolbarTextField);
                    m_previewPos.y = EditorGUILayout.FloatField("Y: ", m_previewPos.y, EditorStyles.toolbarTextField);
                    if (EditorGUI.EndChangeCheck())
                    {
                        m_previewPos.x = Mathf.Clamp(m_previewPos.x, -1f, 1f);
                        m_previewPos.y = Mathf.Clamp(m_previewPos.y, -1f, 1f);

                        CalculateBlendWeights();
                        ApplyBlendWeights();
                    }
                    EditorGUIUtility.labelWidth = labelWidth;

                    UpdatePreview();
                    MxMAnimConfigWindow.Inst().Repaint();
                }

                GUILayout.FlexibleSpace();

                m_spNormalizeTime.boolValue = GUILayout.Toggle(m_spNormalizeTime.boolValue, "Normalize Time",
                                                               EditorStyles.toolbarButton, GUILayout.Width(90f));

                EditorGUILayout.LabelField("Type:", GUILayout.Width(40f));
                m_spScatterSpace.enumValueIndex = (int)(EBlendSpaceType)EditorGUILayout.EnumPopup(
                    (EBlendSpaceType)m_spScatterSpace.enumValueIndex, GUILayout.Width(70f));
                GUILayout.Space(5f);

                switch ((EBlendSpaceType)m_spScatterSpace.enumValueIndex)
                {
                case EBlendSpaceType.Standard:
                {
                    EditorGUILayout.LabelField("Magnitude ", GUILayout.Width(62f));
                    m_spMagnitude.vector2Value = EditorGUILayout.Vector2Field("", m_spMagnitude.vector2Value, GUILayout.Width(100f));
                    EditorGUILayout.LabelField("Smoothing ", GUILayout.Width(65f));
                    m_spSmoothing.vector2Value = EditorGUILayout.Vector2Field("", m_spSmoothing.vector2Value, GUILayout.Width(100f));
                }
                break;

                case EBlendSpaceType.Scatter:
                {
                    EditorGUILayout.LabelField("Spacing", GUILayout.Width(50f));
                    m_spScatterSpacing.vector2Value = EditorGUILayout.Vector2Field("", m_spScatterSpacing.vector2Value, GUILayout.Width(100f));
                }
                break;

                case EBlendSpaceType.ScatterX:
                {
                    EditorGUILayout.LabelField("Spacing X", GUILayout.Width(60f));
                    float spacingX = EditorGUILayout.FloatField(m_spScatterSpacing.vector2Value.x, GUILayout.Width(35f));

                    m_spScatterSpacing.vector2Value = new Vector2(spacingX, m_spScatterSpacing.vector2Value.y);
                }
                break;

                case EBlendSpaceType.ScatterY:
                {
                    EditorGUILayout.LabelField("Spacing Y", GUILayout.Width(60f));
                    float spacingY = EditorGUILayout.FloatField(m_spScatterSpacing.vector2Value.y, GUILayout.Width(35f));

                    m_spScatterSpacing.vector2Value = new Vector2(m_spScatterSpacing.vector2Value.x, spacingY);
                }
                break;
                }



                GUILayout.Space(2f);
                m_showClipNames = GUILayout.Toggle(m_showClipNames, "Show Clips", EditorStyles.toolbarButton, GUILayout.Width(80f));
                GUILayout.Space(5f);
                m_snapActive = GUILayout.Toggle(m_snapActive, "Snap", EditorStyles.toolbarButton, GUILayout.Width(40f));

                if (m_snapActive)
                {
                    m_snapInterval = EditorGUILayout.FloatField(m_snapInterval, EditorStyles.toolbarTextField, GUILayout.Width(30f));
                }

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

                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.Height(20f), GUILayout.ExpandWidth(true));

                if (m_selectId >= 0 && m_selectId < m_spClips.arraySize)
                {
                    AnimationClip      clip       = m_spClips.GetArrayElementAtIndex(m_selectId).objectReferenceValue as AnimationClip;
                    SerializedProperty spPosition = m_spPositions.GetArrayElementAtIndex(m_selectId);

                    if (clip != null && spPosition != null)
                    {
                        EditorGUILayout.LabelField(clip.name, GUILayout.Width(GUI.skin.label.CalcSize(new GUIContent(clip.name)).x + 4f));

                        EditorGUI.BeginChangeCheck();
                        spPosition.vector2Value = EditorGUILayout.Vector2Field("", spPosition.vector2Value);
                        if (EditorGUI.EndChangeCheck())
                        {
                            if (m_previewActive && MxMPreviewScene.IsSceneLoaded)
                            {
                                CalculateBlendWeights();
                                ApplyBlendWeights();
                            }
                        }
                    }
                }

                EditorGUILayout.LabelField("Require", GUILayout.Width(50f));
                MxMPreProcessData preProcessData = m_spTargetPreProcessData.objectReferenceValue as MxMPreProcessData;
                AnimationModule   animModule     = m_spTargetAnimModule.objectReferenceValue as AnimationModule;

                if (preProcessData != null)
                {
                    EditorFunctions.DrawTagFlagFieldWithCustomNames(preProcessData.TagNames.ToArray(), m_spGlobalTags, 100f);
                }
                else if (animModule != null && animModule.TagNames != null)
                {
                    EditorFunctions.DrawTagFlagFieldWithCustomNames(animModule.TagNames.ToArray(), m_spGlobalTags, 100f);
                }
                else
                {
                    m_spGlobalTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField((ETags)m_spGlobalTags.intValue);
                }

                EditorGUILayout.LabelField("Favour", GUILayout.Width(45f));

                if (preProcessData != null)
                {
                    EditorFunctions.DrawTagFlagFieldWithCustomNames(preProcessData.FavourTagNames.ToArray(), m_spGlobalFavourTags, 100f);
                }
                else if (animModule != null && animModule.FavourTagNames != null)
                {
                    EditorFunctions.DrawTagFlagFieldWithCustomNames(animModule.FavourTagNames.ToArray(), m_spGlobalFavourTags, 100f);
                }
                else
                {
                    m_spGlobalFavourTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField((ETags)m_spGlobalFavourTags.intValue);
                }

                GUILayout.FlexibleSpace();

                if (GUILayout.Button(new GUIContent("Open Timeline"), EditorStyles.toolbarButton))
                {
                    MxMTaggingWindow.ShowWindow();
                }

                GUILayout.Space(5f);

                if (m_spTargetPreProcessData.objectReferenceValue != null ||
                    m_spTargetAnimModule.objectReferenceValue != null)
                {
                    if (GUILayout.Button(EditorGUIUtility.IconContent("back").image, EditorStyles.toolbarButton))
                    {
                        LastBlendSpace();
                    }

                    if (GUILayout.Button(EditorGUIUtility.IconContent("forward").image, EditorStyles.toolbarButton))
                    {
                        NextBlendSpace();
                    }
                }

                EditorGUI.BeginDisabledGroup(true);

                EditorGUIUtility.labelWidth = 110f;
                if (preProcessData != null)
                {
                    EditorGUILayout.ObjectField(m_spTargetPreProcessData, new GUIContent("Target PreProcess"));
                }
                else if (animModule != null)
                {
                    EditorGUILayout.ObjectField(m_spTargetAnimModule, new GUIContent("Target Anim Module"));
                }

                EditorGUIUtility.labelWidth = 95f;
                EditorGUILayout.ObjectField(m_spTargetPrefab, new GUIContent("Preview Prefab"));

                EditorGUI.EndDisabledGroup();

                EditorGUIUtility.labelWidth = labelWidth;

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                Rect blendSpaceRect = new Rect(30f, 40f, a_position.width - 60f, a_position.height - 90f);

                GUI.Box(blendSpaceRect, "");

                Rect labelRect = new Rect(blendSpaceRect.x - 18f, blendSpaceRect.y, 18f, 18f);

                GUI.Label(labelRect, "1");
                labelRect.y += blendSpaceRect.height / 2f - 9f;
                GUI.Label(labelRect, "0");
                labelRect.y = blendSpaceRect.y + blendSpaceRect.height - 18f;
                GUI.Label(labelRect, "-1");
                labelRect.y += labelRect.height;
                labelRect.x += labelRect.width;
                GUI.Label(labelRect, "-1");
                labelRect.x += blendSpaceRect.width / 2f - 9f;
                GUI.Label(labelRect, "0");
                labelRect.x = blendSpaceRect.x + blendSpaceRect.width - 18f;
                GUI.Label(labelRect, "1");

                float spacingH = blendSpaceRect.width / 10f;
                float spacingV = blendSpaceRect.height / 10f;

                float top    = blendSpaceRect.y;
                float bottom = blendSpaceRect.y + blendSpaceRect.height;
                float left   = blendSpaceRect.x;
                float right  = blendSpaceRect.x + blendSpaceRect.width;

                Handles.color = Color.grey;
                for (int i = 1; i < 10; ++i)
                {
                    float horizontal = i * spacingH + blendSpaceRect.x;
                    float vertical   = i * spacingV + blendSpaceRect.y;

                    Handles.DrawLine(new Vector3(horizontal, top), new Vector3(horizontal, bottom));
                    Handles.DrawLine(new Vector3(left, vertical), new Vector3(right, vertical));
                }

                Handles.color = Color.black;
                Handles.DrawLine(new Vector3(blendSpaceRect.x + blendSpaceRect.width / 2f, top),
                                 new Vector3(blendSpaceRect.x + blendSpaceRect.width / 2f, bottom));

                Handles.DrawLine(new Vector3(left, blendSpaceRect.y + blendSpaceRect.height / 2f),
                                 new Vector3(right, blendSpaceRect.y + blendSpaceRect.height / 2f));

                Rect    animDrawRect    = new Rect(0f, 0f, 18f, 18f);
                Vector2 blendSpaceRatio = new Vector2(2f / blendSpaceRect.width, 2f / blendSpaceRect.height);

                Texture blendKey         = EditorGUIUtility.IconContent("blendKey").image;
                Texture blendKeySelected = EditorGUIUtility.IconContent("blendKeySelected").image;
                Texture previewPointTex  = EditorGUIUtility.IconContent("d_P4_AddedLocal").image;

                Vector2 centerPos = blendSpaceRect.position;
                centerPos.x += blendSpaceRect.width / 2f;
                centerPos.y += blendSpaceRect.height / 2f;

                //Draw Points
                for (int i = 0; i < m_spClips.arraySize; ++i)
                {
                    Vector2 normalizedPos = m_spPositions.GetArrayElementAtIndex(i).vector2Value;
                    normalizedPos.y *= -1f;

                    animDrawRect.position = (normalizedPos / blendSpaceRatio) + centerPos;

                    animDrawRect.size = new Vector2(14f, 14f);

                    if (m_previewActive && MxMPreviewScene.IsSceneLoaded)
                    {
                        float size = 9f + 5f * m_blendWeights[i];
                        animDrawRect.size = new Vector2(size, size);
                    }
                    else
                    {
                        animDrawRect.size = new Vector2(14f, 14f);
                    }

                    animDrawRect.position -= (animDrawRect.size / 2f);

                    if (m_selectId == i)
                    {
                        GUI.DrawTexture(animDrawRect, blendKeySelected);
                    }
                    else
                    {
                        GUI.DrawTexture(animDrawRect, blendKey);
                    }

                    if (m_showClipNames)
                    {
                        AnimationClip clip = m_spClips.GetArrayElementAtIndex(i).objectReferenceValue as AnimationClip;

                        Vector2 labelSize = GUI.skin.label.CalcSize(new GUIContent(clip.name));

                        Rect clipNameRect = new Rect(animDrawRect.x + (animDrawRect.width / 2f) - labelSize.x / 2f,
                                                     animDrawRect.y - labelSize.y, labelSize.x, labelSize.y);

                        GUI.Label(clipNameRect, clip.name);
                    }

                    if (evt.type == EventType.MouseDown && evt.button == 0)
                    {
                        if (animDrawRect.Contains(evt.mousePosition))
                        {
                            m_selectId       = i;
                            m_dragging       = true;
                            m_cumulativeDrag = m_spPositions.GetArrayElementAtIndex(i).vector2Value;

                            if (evt.clickCount >= 2)
                            {
                                EditorGUIUtility.PingObject(m_spClips.GetArrayElementAtIndex(i).objectReferenceValue);
                            }

                            evt.Use();
                            MxMAnimConfigWindow.Inst().Repaint();
                        }
                    }
                }

                //Draw Preview Point
                if (m_previewActive && MxMPreviewScene.IsSceneLoaded)
                {
                    Vector3 previewDrawPos = m_previewPos;
                    previewDrawPos.y *= -1f;

                    animDrawRect.size     = new Vector2(18f, 18f);
                    animDrawRect.position = (previewDrawPos / blendSpaceRatio) + centerPos - (animDrawRect.size / 2f);

                    GUI.DrawTexture(animDrawRect, previewPointTex);
                }

                switch (evt.type)
                {
                case EventType.MouseDown:
                {
                    if (m_previewActive && blendSpaceRect.Contains(evt.mousePosition) && MxMPreviewScene.IsSceneLoaded)
                    {
                        Vector2 blendSpacePos = evt.mousePosition - (blendSpaceRect.position + (blendSpaceRect.size / 2f));
                        m_previewPos    = blendSpacePos * blendSpaceRatio;
                        m_previewPos.y *= -1f;

                        m_previewPos.x = Mathf.Clamp(m_previewPos.x, -1f, 1f);
                        m_previewPos.y = Mathf.Clamp(m_previewPos.y, -1f, 1f);

                        CalculateBlendWeights();
                        ApplyBlendWeights();


                        m_draggingPreview = true;
                    }

                    m_dragging = false;
                    m_selectId = -1;
                    evt.Use();
                }
                break;

                case EventType.MouseUp:
                {
                    if (m_dragging || m_draggingPreview)
                    {
                        m_draggingPreview = false;
                        m_dragging        = false;
                        m_cumulativeDrag  = Vector2.zero;
                        evt.Use();
                    }
                }
                break;

                case EventType.MouseDrag:
                {
                    if (m_dragging)
                    {
                        if (m_selectId >= 0 && m_selectId < m_spPositions.arraySize)
                        {
                            SerializedProperty spPosition = m_spPositions.GetArrayElementAtIndex(m_selectId);
                            Vector2            moveDelta  = evt.delta;
                            moveDelta.y *= -1f;

                            if (m_snapActive)
                            {
                                m_cumulativeDrag += moveDelta * blendSpaceRatio;

                                m_cumulativeDrag.x = Mathf.Clamp(m_cumulativeDrag.x, -1f, 1f);
                                m_cumulativeDrag.y = Mathf.Clamp(m_cumulativeDrag.y, -1f, 1f);

                                spPosition.vector2Value = m_cumulativeDrag;
                                SnapClip(m_selectId);
                            }
                            else
                            {
                                Vector2 newPos = spPosition.vector2Value + moveDelta * blendSpaceRatio;

                                newPos.x = Mathf.Clamp(newPos.x, -1f, 1f);
                                newPos.y = Mathf.Clamp(newPos.y, -1f, 1f);
                                spPosition.vector2Value = newPos;
                            }

                            if (m_previewActive && MxMPreviewScene.IsSceneLoaded)
                            {
                                CalculateBlendWeights();
                                ApplyBlendWeights();
                            }

                            evt.Use();
                        }
                        else
                        {
                            m_dragging = false;
                        }
                    }
                    else if (m_previewActive && m_draggingPreview && MxMPreviewScene.IsSceneLoaded)
                    {
                        Vector2 blendSpacePos = evt.mousePosition - (blendSpaceRect.position + (blendSpaceRect.size / 2f));
                        m_previewPos    = blendSpacePos * blendSpaceRatio;
                        m_previewPos.y *= -1f;

                        m_previewPos.x = Mathf.Clamp(m_previewPos.x, -1f, 1f);
                        m_previewPos.y = Mathf.Clamp(m_previewPos.y, -1f, 1f);

                        CalculateBlendWeights();
                        ApplyBlendWeights();

                        if (m_snapActive)
                        {
                            SnapPreview();
                        }

                        evt.Use();
                    }
                }
                break;

                case EventType.KeyDown:
                {
                    if (m_selectId >= 0 && m_selectId < m_spClips.arraySize)
                    {
                        if (evt.keyCode == KeyCode.Delete)
                        {
                            m_queueDeleteIndex = m_selectId;
                            MxMAnimConfigWindow.Inst().Repaint();
                            evt.Use();
                        }
                    }
                }
                break;
                }

                DragDropAnimations(blendSpaceRect);

                if (m_soData != null)
                {
                    m_soData.ApplyModifiedProperties();
                }
            }
            else
            {
                GUILayout.Space(18f);
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUILayout.LabelField("No Blend Space Selected.", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
            }
        }
コード例 #14
0
ファイル: VegetationMaskEditor.cs プロジェクト: d-oglesby/VS
        public override void OnInspectorGUI()
        {
            VegetationMask = (VegetationMask)target;

            base.OnInspectorGUI();
            EditorGUIUtility.labelWidth = 200;

            GUILayout.BeginVertical("box");
            EditorGUILayout.HelpBox("Create the area where you want to modify the vegetation, you can remove and/or include vegetation types", MessageType.Info);
            GUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            if (VegetationMask.enabled)
            {
                EditorGUILayout.LabelField("Insert Node: Ctrl-Click", LabelStyle);
                EditorGUILayout.LabelField("Delete Node: Ctrl-Shift-Click", LabelStyle);
            }
            else
            {
                EditorGUILayout.HelpBox("Enable mask to edit nodes", MessageType.Info);
            }

            if (VegetationMask.Nodes.Count < 4)
            {
                EditorGUILayout.HelpBox("There has to be at least 3 nodes to define the area", MessageType.Warning);
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            EditorGUILayout.HelpBox("Select ground layers that will be used for selection when adding and moving masks. These will be used in addition to unity terrains.", MessageType.Info);
            VegetationMask.GroundLayerMask = LayerMaskField("Ground Layers", VegetationMask.GroundLayerMask);
            GUILayout.EndVertical();


            GUILayout.BeginVertical("box");
            EditorGUI.BeginChangeCheck();
            VegetationMask.ShowArea    = EditorGUILayout.Toggle("Show Area", VegetationMask.ShowArea);
            VegetationMask.ShowHandles = EditorGUILayout.Toggle("Show Handles", VegetationMask.ShowHandles);
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(VegetationMask);
            }

            GUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Mask settings", LabelStyle);
            EditorGUI.BeginChangeCheck();
            VegetationMask.MaskName = EditorGUILayout.TextField("Mask Name", VegetationMask.MaskName);

            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(VegetationMask);
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            EditorGUI.BeginChangeCheck();

            EditorGUILayout.LabelField("Global vegetation removal", LabelStyle);
            EditorGUILayout.HelpBox("The area within the additional perimeter range will be filtered by a noise texture. To get a 100% removal in this area set min and max range to the same distance.", MessageType.Info);

            VegetationMask.RemoveGrass = EditorGUILayout.Toggle("Remove Grass", VegetationMask.RemoveGrass);
            if (VegetationMask.RemoveGrass)
            {
                //vegetationMask.AdditionalGrassPerimiter = EditorGUILayout.Slider("Additional perimeter distance", vegetationMask.AdditionalGrassPerimiter, 0f, 40f);
                EditorFunctions.FloatRangeField("Additional perimeter range", ref VegetationMask.AdditionalGrassPerimiter,
                                                ref VegetationMask.AdditionalGrassPerimiterMax, 0, 40);
                VegetationMask.NoiseScaleGrass = EditorGUILayout.Slider("Noise scale", VegetationMask.NoiseScaleGrass, 1f, 40f);
            }
            EditorGUILayout.Space();
            VegetationMask.RemovePlants = EditorGUILayout.Toggle("Remove Plants", VegetationMask.RemovePlants);
            if (VegetationMask.RemovePlants)
            {
                //   vegetationMask.AdditionalPlantPerimiter = EditorGUILayout.Slider("Additional perimeter distance", vegetationMask.AdditionalPlantPerimiter, 0f, 40f);
                EditorFunctions.FloatRangeField("Additional perimeter range", ref VegetationMask.AdditionalPlantPerimiter,
                                                ref VegetationMask.AdditionalPlantPerimiterMax, 0, 40);
                VegetationMask.NoiseScalePlant = EditorGUILayout.Slider("Noise scale", VegetationMask.NoiseScalePlant, 1f, 40f);
            }
            EditorGUILayout.Space();
            VegetationMask.RemoveTrees = EditorGUILayout.Toggle("Remove Trees", VegetationMask.RemoveTrees);
            if (VegetationMask.RemoveTrees)
            {
                //vegetationMask.AdditionalTreePerimiter = EditorGUILayout.Slider("Additional perimeter distance", vegetationMask.AdditionalTreePerimiter, 0f, 40f);
                EditorFunctions.FloatRangeField("Additional perimeter range", ref VegetationMask.AdditionalTreePerimiter,
                                                ref VegetationMask.AdditionalTreePerimiterMax, 0, 40);
                VegetationMask.NoiseScaleTree = EditorGUILayout.Slider("Noise scale", VegetationMask.NoiseScaleTree, 1f, 40f);
            }


            EditorGUILayout.Space();
            VegetationMask.RemoveObjects = EditorGUILayout.Toggle("Remove Objects", VegetationMask.RemoveObjects);
            if (VegetationMask.RemoveObjects)
            {
                // vegetationMask.AdditionalObjectPerimiter = EditorGUILayout.Slider("Additional perimeter distance", vegetationMask.AdditionalObjectPerimiter, 0f, 40f);
                EditorFunctions.FloatRangeField("Additional perimeter range", ref VegetationMask.AdditionalObjectPerimiter,
                                                ref VegetationMask.AdditionalObjectPerimiterMax, 0, 40);
                VegetationMask.NoiseScaleObject = EditorGUILayout.Slider("Noise scale", VegetationMask.NoiseScaleObject, 1f, 40f);
            }


            EditorGUILayout.Space();
            VegetationMask.RemoveLargeObjects = EditorGUILayout.Toggle("Remove Large Objects", VegetationMask.RemoveLargeObjects);
            if (VegetationMask.RemoveLargeObjects)
            {
                //vegetationMask.AdditionalLargeObjectPerimiter = EditorGUILayout.Slider("Additional perimeter distance", vegetationMask.AdditionalLargeObjectPerimiter, 0f, 40f);
                EditorFunctions.FloatRangeField("Additional perimeter range", ref VegetationMask.AdditionalLargeObjectPerimiter,
                                                ref VegetationMask.AdditionalLargeObjectPerimiterMax, 0, 40);
                VegetationMask.NoiseScaleLargeObject = EditorGUILayout.Slider("Noise scale", VegetationMask.NoiseScaleLargeObject, 1f, 40f);
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Localized vegetation placement", LabelStyle);
            VegetationMask.IncludeVegetationType = EditorGUILayout.Toggle("Include vegetation", VegetationMask.IncludeVegetationType);

            if (EditorGUI.EndChangeCheck())
            {
                SetMaskDirty();
            }

            if (VegetationMask.IncludeVegetationType)
            {
                if (GUILayout.Button("Add vegetation type"))
                {
                    VegetationTypeSettings newVegetationTypeSettings = new VegetationTypeSettings();
                    VegetationMask.VegetationTypeList.Add(newVegetationTypeSettings);
                    _vegetationTypeIndex = VegetationMask.VegetationTypeList.Count - 1;
                    SetMaskDirty();
                }

                string[] packageNameList = new string[VegetationMask.VegetationTypeList.Count];
                for (int i = 0; i <= VegetationMask.VegetationTypeList.Count - 1; i++)
                {
                    packageNameList[i] = (i + 1).ToString() + ". Item";
                }


                if (VegetationMask.VegetationTypeList.Count > 0)
                {
                    if (_vegetationTypeIndex > VegetationMask.VegetationTypeList.Count - 1)
                    {
                        _vegetationTypeIndex = VegetationMask.VegetationTypeList.Count - 1;
                    }
                    _vegetationTypeIndex = EditorGUILayout.Popup("Selected item", _vegetationTypeIndex, packageNameList);

                    EditorGUI.BeginChangeCheck();
                    GUILayout.BeginVertical("box");

                    VegetationMask.VegetationTypeList[_vegetationTypeIndex].Index   = (VegetationTypeIndex)EditorGUILayout.EnumPopup("Vegetation type", VegetationMask.VegetationTypeList[_vegetationTypeIndex].Index);
                    VegetationMask.VegetationTypeList[_vegetationTypeIndex].Density = EditorGUILayout.Slider("Density", VegetationMask.VegetationTypeList[_vegetationTypeIndex].Density, 0f, 1f);
                    VegetationMask.VegetationTypeList[_vegetationTypeIndex].Size    = EditorGUILayout.Slider("Size", VegetationMask.VegetationTypeList[_vegetationTypeIndex].Size, 0f, 2f);

                    if (GUILayout.Button("Delete selected item"))
                    {
                        VegetationMask.VegetationTypeList.RemoveAt(_vegetationTypeIndex);
                    }

                    GUILayout.EndVertical();

                    if (EditorGUI.EndChangeCheck())
                    {
                        SetMaskDirty();
                    }
                }
            }


            GUILayout.EndVertical();
        }
コード例 #15
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.LabelField("");
            Rect lastRect = GUILayoutUtility.GetLastRect();

            float curHeight = lastRect.y + 9f;

            curHeight = EditorFunctions.DrawTitle("MxM Input Profile", curHeight);

            Texture  deleteIcon   = EditorGUIUtility.IconContent("d_P4_DeletedLocal").image;
            GUIStyle invisiButton = new GUIStyle(GUI.skin.label);

            int deleteIndex = -1;

            for (int i = 0; i < m_spViableInputs.arraySize; ++i)
            {
                SerializedProperty spViableInput = m_spViableInputs.GetArrayElementAtIndex(i);
                SerializedProperty spMin         = spViableInput.FindPropertyRelative("minInput");
                SerializedProperty spMax         = spViableInput.FindPropertyRelative("maxInput");
                SerializedProperty spRemapInput  = spViableInput.FindPropertyRelative("viableInput");
                SerializedProperty spPosBias     = spViableInput.FindPropertyRelative("posBias");
                SerializedProperty spDirBias     = spViableInput.FindPropertyRelative("dirBias");

                Rect areaRect = new Rect(0f, curHeight, EditorGUIUtility.currentViewWidth, 18f * 8f + 5f);


                GUILayout.BeginArea(areaRect);
                GUI.Box(new Rect(0f, 0f, areaRect.width, areaRect.height), "");

                GUILayout.Label("Remap Set " + i.ToString(), EditorStyles.boldLabel);

                Rect btnRect = new Rect(areaRect.width - 20f, 2f, 18f, 18f);
                GUI.DrawTexture(btnRect, deleteIcon);
                if (GUI.Button(btnRect, "", invisiButton))
                {
                    if (EditorUtility.DisplayDialog("Delete Remap Set?",
                                                    "Are you sure you want to delete the track?", "Yes", "Cancel"))
                    {
                        deleteIndex = i;
                    }
                }

                GUILayout.Label("Input Range: ", GUILayout.Width(90f));
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(30f);
                GUILayout.Label("Min", GUILayout.Width(110f));

                spMin.floatValue = EditorGUILayout.FloatField(spMin.floatValue, GUILayout.Width(25f));

                float min = spMin.floatValue;
                float max = spMax.floatValue;

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.MinMaxSlider(ref min, ref max, 0f, 1f);
                if (EditorGUI.EndChangeCheck())
                {
                    spMin.floatValue = min;
                    spMax.floatValue = max;
                }

                spMax.floatValue = EditorGUILayout.FloatField(spMax.floatValue, GUILayout.Width(25f));

                GUILayout.Space(10f);
                EditorGUILayout.EndHorizontal();


                GUILayout.Label("Viable Input: ", GUILayout.Width(80f));
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(30f);
                GUILayout.Label("Magnitude", GUILayout.Width(110f));
                spRemapInput.floatValue = EditorGUILayout.Slider(spRemapInput.floatValue, 0f, 1f);
                GUILayout.Space(10f);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(30f);
                GUILayout.Label("PosBias Multiplier", GUILayout.Width(110f));
                spPosBias.floatValue = EditorGUILayout.Slider(spPosBias.floatValue, 0f, 1f);
                GUILayout.Space(10f);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(30f);
                GUILayout.Label("DirBias Multiplier", GUILayout.Width(110f));
                spDirBias.floatValue = EditorGUILayout.Slider(spDirBias.floatValue, 0f, 1f);
                GUILayout.Space(10f);
                EditorGUILayout.EndHorizontal();

                GUILayout.EndArea();
                curHeight += areaRect.height + 10f;
                GUILayout.Space(areaRect.height + 10f);
            }

            if (deleteIndex > -1 && deleteIndex < m_spViableInputs.arraySize)
            {
                m_spViableInputs.DeleteArrayElementAtIndex(deleteIndex);
                Repaint();
            }

            curHeight += 50f;

            if (GUILayout.Button("New Viable Input"))
            {
                m_spViableInputs.InsertArrayElementAtIndex(m_spViableInputs.arraySize);
                SerializedProperty spNewViableInput = m_spViableInputs.GetArrayElementAtIndex(m_spViableInputs.arraySize - 1);
            }

            serializedObject.ApplyModifiedProperties();
        }
コード例 #16
0
        private void DrawSettings(Rect a_rect)
        {
            GUILayout.BeginArea(a_rect);

            m_spLooping.boolValue = EditorGUILayout.ToggleLeft(new GUIContent(
                                                                   "Loop", "Check if this animation loops"), m_spLooping.boolValue);

            if (!m_spLooping.boolValue)
            {
                m_spIgnoreEdges.boolValue = EditorGUILayout.ToggleLeft(new GUIContent(
                                                                           "Ignore Edges", "Clip edges will be marked as DoNotUse"), m_spIgnoreEdges.boolValue);

                if (!m_spIgnoreEdges.boolValue)
                {
                    m_spExtrapolateTrajectory.boolValue = EditorGUILayout.ToggleLeft(new GUIContent(
                                                                                         "Extrapolate", "Trajectory will be extrapolated"), m_spExtrapolateTrajectory.boolValue);
                }
            }

            m_spFlattenTrajectory.boolValue = EditorGUILayout.ToggleLeft(new GUIContent(
                                                                             "Flatten Trajectory", "Flatten the trejectory so that the 'y' axis component is always zero"),
                                                                         m_spFlattenTrajectory.boolValue);

            if (m_spAfterClips.arraySize > 0)
            {
                m_spRuntimeSplicing.boolValue = EditorGUILayout.ToggleLeft(new GUIContent(
                                                                               "Runtime Splicing", "Splice together the primary clip and first after clip at runtime to ensure continuity"),
                                                                           m_spRuntimeSplicing.boolValue);
            }

            MxMPreProcessData preProcessData = m_spTargetPreProcessData.objectReferenceValue as MxMPreProcessData;
            AnimationModule   animModule     = m_spTargetAnimModule.objectReferenceValue as AnimationModule;


            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Require", GUILayout.Width(50f));
            if (preProcessData != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(preProcessData.TagNames.ToArray(), m_spGlobalTags, 75f);
            }
            else if (animModule != null && animModule.FavourTagNames != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(animModule.TagNames.ToArray(), m_spGlobalTags, 75f);
            }
            else
            {
                m_spGlobalTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField((ETags)m_spGlobalTags.intValue);
            }

            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Favour", GUILayout.Width(50f));
            if (preProcessData != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(preProcessData.FavourTagNames.ToArray(), m_spGlobalFavourTags, 75f);
            }
            else if (animModule != null && animModule.FavourTagNames != null)
            {
                EditorFunctions.DrawTagFlagFieldWithCustomNames(animModule.FavourTagNames.ToArray(), m_spGlobalFavourTags, 75f);
            }
            else
            {
                m_spGlobalFavourTags.intValue = (int)(ETags)EditorGUILayout.EnumFlagsField((ETags)m_spGlobalFavourTags.intValue);
            }

            EditorGUILayout.EndHorizontal();

            GUILayout.EndArea();
        }
コード例 #17
0
    void Content()
    {
        if (selected != null)
        {
            scrollContent = GUILayout.BeginScrollView(scrollContent, GUILayout.Height(position.height));
            GUILayout.BeginVertical("box");

            GUILayout.BeginHorizontal();
            GUILayout.Label("ID: " + index);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Remove", GUILayout.Width(100)))
            {
                my.Races.RemoveAt(index);
                selected = null;
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            selected.Name = EditorGUILayout.TextField("Name", selected.Name);
            GUILayout.Label("");
            selected.awakenChance = EditorGUILayout.IntField("Awaken Chance", selected.awakenChance);
            GUILayout.Label("%");
            selected.randomRate = EditorGUILayout.IntField("Race Rate", selected.randomRate);
            GUILayout.Label(CalculatePrecent() + "%");
            GUILayout.EndHorizontal();
            GUILayout.Label("Description");
            selected.Description = EditorGUILayout.TextArea(selected.Description, GUILayout.MinHeight(50));
            GUILayout.Space(20);
            GUILayout.BeginHorizontal();
            Buttons();
            GUILayout.EndHorizontal();
            switch (typeEdit)
            {
            case 1:
                EditorFunctions.ViewBase(selected.Stats.Base);
                break;

            case 2:
                ViewBattle();
                break;

            case 3:
                EditorFunctions.ViewAbility(selected.Stats.Ability);
                break;

            case 4:
                EditorFunctions.ViewResist(selected.Stats.Resistance);
                break;

            case 5:
                EditorFunctions.ViewOther(selected.Stats.Other);
                break;

            case 6:
                EditorFunctions.ViewState(selected.Stats.ResistState, "State resist");
                break;

            case 7:
                EditorFunctions.TraitPanel(selected.Traits, "Traits");
                break;

            case 8:
                EditorFunctions.ViewSkills();
                break;

            default:
                break;
            }
            GUILayout.EndVertical();
            GUILayout.EndScrollView();
        }
    }
コード例 #18
0
    void Content()
    {
        if (selected != null)
        {
            scrollContent = GUILayout.BeginScrollView(scrollContent, GUILayout.Height(position.height));
            GUILayout.BeginVertical("box");

            GUILayout.BeginHorizontal();
            GUILayout.Label("ID: " + index);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Remove", GUILayout.Width(100)))
            {
                my.States.RemoveAt(index);
                selected = null;
                index    = 0;
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            selected.Name           = EditorGUILayout.TextField("Name", selected.Name);
            selected.Restriction    = (Restriction)EditorGUILayout.EnumPopup("Restriction", selected.Restriction);
            selected.TypeState      = (TypeState)EditorGUILayout.EnumPopup("Type", selected.TypeState);
            selected.DoubleEffect   = (StateDoubleEffect)EditorGUILayout.EnumPopup("Double Effect", selected.DoubleEffect);
            selected.Remove_by_time = (StateRemoveByTime)EditorGUILayout.EnumPopup("Remove by time", selected.Remove_by_time);
            switch (selected.Remove_by_time)
            {
            case StateRemoveByTime.None:
                selected.Min = 0;
                selected.Max = 0;
                break;

            case StateRemoveByTime.Turn:
                GUILayout.BeginHorizontal();
                selected.Min = EditorGUILayout.IntField("Min", selected.Min);
                selected.Max = EditorGUILayout.IntField("Max", selected.Max);
                GUILayout.EndHorizontal();
                if (selected.Max < selected.Min)
                {
                    selected.Max = selected.Min;
                }
                break;
            }
            selected.Remove_by_Damage = EditorGUILayout.Toggle("Remove by damage", selected.Remove_by_Damage);
            if (selected.Remove_by_Damage)
            {
                GUILayout.BeginHorizontal();
                selected.chance_Remove = EditorGUILayout.IntSlider("Rate to remove", selected.chance_Remove, 0, 100);
                GUILayout.Label("%");
                GUILayout.EndHorizontal();
            }
            else
            {
                selected.chance_Remove = 0;
            }

            GUILayout.Space(20f);
            selected.recover.hp         = EditorGUILayout.IntField("Recover HP", selected.recover.hp);
            selected.recover.mp         = EditorGUILayout.IntField("Recover MP", selected.recover.mp);
            selected.recover.precent_hp = EditorGUILayout.IntSlider("Recover HP %", selected.recover.precent_hp, 0, 100);
            selected.recover.precent_mp = EditorGUILayout.IntSlider("Recover MP %", selected.recover.precent_mp, 0, 100);

            GUILayout.EndVertical();
            GUILayout.Label("");
            selected.Icon = (Sprite)EditorGUILayout.ObjectField("Icon", selected.Icon, typeof(Sprite), true);
            GUILayout.EndHorizontal();
            GUILayout.Space(20);
            GUILayout.BeginHorizontal();
            Buttons();
            GUILayout.EndHorizontal();
            switch (typeEdit)
            {
            case 1:
                EditorFunctions.ViewBase(selected.Stats.Base);
                break;

            case 2:
                EditorFunctions.ViewBattle(selected.Stats.Battle);
                break;

            case 3:
                EditorFunctions.ViewAbility(selected.Stats.Ability);
                break;

            case 4:
                EditorFunctions.ViewResist(selected.Stats.Resistance);
                break;

            case 5:
                EditorFunctions.ViewOther(selected.Stats.Other);
                break;

            case 6:
                EditorFunctions.ViewSkills();
                break;

            case 7:
                ViewBasePrecent(selected.Precent_Stats.Base);
                break;

            case 8:
                ViewBattlePrecent(selected.Precent_Stats.Battle);
                break;

            case 9:
                ViewOtherPrecent(selected.Precent_Stats.Other);
                break;

            default:
                break;
            }
            GUILayout.EndVertical();
            GUILayout.EndScrollView();
        }
    }
コード例 #19
0
    void WeaponSwitch()
    {
        IWeapon weapon = (IWeapon)selected;

        weapon.WCategory = (IWeaponCategory)EditorGUILayout.EnumPopup("Category", weapon.WCategory);
        switch (weapon.WCategory) //type
        {
        case IWeaponCategory.Bow:
        case IWeaponCategory.Rifle:
        case IWeaponCategory.Shotgun:
        case IWeaponCategory.Staff:
            weapon.WType = IWeaponType.Two_handed;
            GUILayout.Label("Type Two handed");
            break;

        default:
            weapon.WType = (IWeaponType)EditorGUILayout.EnumPopup("Type", weapon.WType);
            break;
        }
        switch (weapon.WCategory) //missile flight
        {
        case IWeaponCategory.Bow:
        case IWeaponCategory.Crossbow:
            weapon.MissileFlight = MissileFlight.curve;
            break;

        case IWeaponCategory.Pistol:
        case IWeaponCategory.Rifle:
        case IWeaponCategory.Shotgun:
            weapon.MissileFlight = MissileFlight.simply;
            break;

        default:
            weapon.MissileFlight = MissileFlight.none;
            break;
        }
        GUILayout.Label("MissileFlight: " + weapon.MissileFlight);
        switch (weapon.WCategory)
        {
        case IWeaponCategory.Staff:
        case IWeaponCategory.Wand:
            weapon.FullAttackElement = (Elements)EditorGUILayout.EnumPopup("Element", weapon.FullAttackElement);
            break;

        default:
            weapon.FullAttackElement = Elements.Physical;
            break;
        }
        weapon.Weight = (Weight)EditorGUILayout.EnumPopup("Weight", weapon.Weight);
        GUILayout.BeginHorizontal();
        GUILayout.Label("Runes: " + weapon.Runes.Count);
        if (GUILayout.Button("+"))
        {
            weapon.Runes.Add(-1);
        }
        if (GUILayout.Button("-") && weapon.Runes.Count > 0)
        {
            weapon.Runes.RemoveAt(weapon.Runes.Count - 1);
        }
        GUILayout.EndHorizontal();
        weapon.Piercing = EditorGUILayout.IntField("Armor piercing", weapon.Piercing);
        if (weapon.Piercing < 0)
        {
            weapon.Piercing = 0;
        }
        if (weapon.Piercing != 0)
        {
            weapon.Piercing_Precent = 0;
        }
        weapon.Piercing_Precent = EditorGUILayout.IntSlider("Armor piercing %", weapon.Piercing_Precent, 0, 100);
        if (weapon.Piercing_Precent != 0)
        {
            weapon.Piercing = 0;
        }
        GUILayout.Space(20);

        GUILayout.BeginHorizontal();
        Buttons();
        if (GUILayout.Button("Requires"))
        {
            typeEdit = 8;
        }
        if (GUILayout.Button("Elements"))
        {
            typeEdit = 9;
        }
        if (GUILayout.Button("Atk state"))
        {
            typeEdit = 6;
        }
        switch (weapon.WCategory)
        {
        case IWeaponCategory.Bow:
        case IWeaponCategory.Crossbow:
        case IWeaponCategory.Pistol:
        case IWeaponCategory.Rifle:
        case IWeaponCategory.Shotgun:
            if (GUILayout.Button("Ammunition"))
            {
                typeEdit = 10;
            }
            break;

        default:
            weapon.Ammunition = null;
            if (typeEdit == 10)
            {
                typeEdit = 0;
            }
            break;
        }
        switch (weapon.WCategory)
        {
        case IWeaponCategory.Bow:
        case IWeaponCategory.Crossbow:
            weapon.MissileFlight = MissileFlight.curve;
            break;

        case IWeaponCategory.Pistol:
        case IWeaponCategory.Rifle:
        case IWeaponCategory.Shotgun:
        case IWeaponCategory.Wand:
            weapon.MissileFlight = MissileFlight.simply;
            break;

        default:
            weapon.MissileFlight = MissileFlight.none;
            break;
        }
        GUILayout.EndHorizontal();
        switch (typeEdit)
        {
        case 1:
            EditorFunctions.ViewBase(weapon.Stats.Base);
            break;

        case 2:
            weapon.Stats.Battle.dmg = EditorGUILayout.IntField("Dmg", weapon.Stats.Battle.dmg);
            if (weapon.Stats.Battle.dmg < 0)
            {
                weapon.Stats.Battle.dmg = 0;
            }
            weapon.Stats.Battle.dmg_dice = EditorGUILayout.IntField("Dmg dice", weapon.Stats.Battle.dmg_dice);
            if (weapon.Stats.Battle.dmg_dice < 0)
            {
                weapon.Stats.Battle.dmg_dice = 0;
            }
            GUILayout.Label(weapon.Stats.Battle.dmg + " - " + (weapon.Stats.Battle.dmg + weapon.Stats.Battle.dmg_dice));
            weapon.Stats.Battle.crit_multiply  = EditorGUILayout.FloatField("Crit multiply", weapon.Stats.Battle.crit_multiply);
            weapon.Stats.Battle.range          = EditorGUILayout.FloatField("Range", weapon.Stats.Battle.range);
            weapon.Stats.Battle.armor_phisical = EditorGUILayout.IntField("Armor Phisical", weapon.Stats.Battle.armor_phisical);
            weapon.Stats.Battle.armor_magicial = EditorGUILayout.IntField("Armor Magicial", weapon.Stats.Battle.armor_magicial);
            EditorFunctions.ViewBattle(weapon.Stats.Battle);
            break;

        case 3:
            EditorFunctions.ViewAbility(weapon.Stats.Ability);
            break;

        case 4:
            EditorFunctions.ViewResist(weapon.Stats.Resistance);
            break;

        case 5:
            EditorFunctions.ViewOther(weapon.Stats.Other);
            break;

        case 6:
            GUILayout.BeginVertical("box");
            EditorFunctions.ViewState(weapon.Stats.AtkState, "Attack State");
            GUILayout.EndVertical();
            break;

        case 7:
            EditorFunctions.ViewSkills();
            break;

        case 8:
            EditorFunctions.ViewBase(weapon.Requires);
            break;

        case 9:
            ElementsPanel(weapon.OtherAttackElement);
            break;

        case 10:
            AmmunitionPanel(weapon);
            break;
        }
    }
コード例 #20
0
    void Content()
    {
        if (selected != null)
        {
            scrollContent = GUILayout.BeginScrollView(scrollContent, GUILayout.Height(position.height));
            GUILayout.BeginVertical("box");

            GUILayout.BeginHorizontal();
            GUILayout.Label("ID: " + index);
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Remove", GUILayout.Width(100)))
            {
                my.Traits.RemoveAt(index);
                selected = null;
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();
            selected.Name = EditorGUILayout.TextField("Name", selected.Name);
            GUILayout.Space(20);
            selected.canAddToKnowledge = EditorGUILayout.Toggle("Can add to knowledge", selected.canAddToKnowledge);
            if (selected.canAddToKnowledge)
            {
                GUILayout.BeginHorizontal();
                selected.randomRate = EditorGUILayout.IntField("Trait Rate", selected.randomRate);
                GUILayout.Label(CalculatePrecent() + "%");
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
            GUILayout.Label("");
            selected.Icon = (Sprite)EditorGUILayout.ObjectField("Icon", selected.Icon, typeof(Sprite), true);
            GUILayout.EndHorizontal();
            GUILayout.Space(20);
            GUILayout.BeginHorizontal();
            Buttons();
            GUILayout.EndHorizontal();
            switch (typeEdit)
            {
            case 1:
                EditorFunctions.ViewBase(selected.Stats.Base);
                break;

            case 2:
                EditorFunctions.ViewBattle(selected.Stats.Battle);
                break;

            case 3:
                EditorFunctions.ViewAbility(selected.Stats.Ability);
                break;

            case 4:
                EditorFunctions.ViewResist(selected.Stats.Resistance);
                break;

            case 5:
                EditorFunctions.ViewOther(selected.Stats.Other);
                break;

            case 6:
                EditorFunctions.ViewSkills();
                break;

            case 7:
                ViewBasePrecent(selected.Precent_Stats.Base);
                break;

            case 8:
                ViewBattlePrecent(selected.Precent_Stats.Battle);
                break;

            case 9:
                ViewOtherPrecent(selected.Precent_Stats.Other);
                break;

            case 10:
                EditorFunctions.ViewState(selected.Stats.ResistState, "State resist");
                break;

            default:
                break;
            }
            GUILayout.EndVertical();
            GUILayout.EndScrollView();
        }
    }
コード例 #21
0
    void ArmorSwitch()
    {
        IArmor armor = (IArmor)selected;

        armor.ACategory = (IArmorCategory)EditorGUILayout.EnumPopup("Category", armor.ACategory);
        armor.Weight    = (Weight)EditorGUILayout.EnumPopup("Weight", armor.Weight); GUILayout.BeginHorizontal();
        GUILayout.Label("Runes: " + armor.Runes.Count);
        if (GUILayout.Button("+"))
        {
            armor.Runes.Add(-1);
        }
        if (GUILayout.Button("-") && armor.Runes.Count > 0)
        {
            armor.Runes.RemoveAt(armor.Runes.Count - 1);
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        Buttons();
        if (GUILayout.Button("State Resist"))
        {
            typeEdit = 6;
        }
        if (GUILayout.Button("Requires"))
        {
            typeEdit = 8;
        }
        GUILayout.EndHorizontal();
        switch (typeEdit)
        {
        case 1:
            EditorFunctions.ViewBase(armor.Stats.Base);
            break;

        case 2:
            armor.Stats.Battle.armor_phisical = EditorGUILayout.IntField("Armor Phisical", armor.Stats.Battle.armor_phisical);
            armor.Stats.Battle.armor_magicial = EditorGUILayout.IntField("Armor Magicial", armor.Stats.Battle.armor_magicial);
            EditorFunctions.ViewBattle(armor.Stats.Battle);
            break;

        case 3:
            EditorFunctions.ViewAbility(armor.Stats.Ability);
            break;

        case 4:
            EditorFunctions.ViewResist(armor.Stats.Resistance);
            break;

        case 5:
            EditorFunctions.ViewOther(armor.Stats.Other);
            break;

        case 6:
            EditorFunctions.ViewState(armor.Stats.ResistState, "State resist");
            break;

        case 7:
            EditorFunctions.ViewSkills();
            break;

        case 8:
            EditorFunctions.ViewBase(armor.Requires);
            break;
        }
    }
コード例 #22
0
    void ConsumeSwitch()
    {
        IConsume consume = (IConsume)selected;

        consume.RemoveAllState = (TypeState)EditorGUILayout.EnumPopup("Remove All type state", consume.RemoveAllState);
        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        Buttons();
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Add State"))
        {
            typeEdit = 10;
        }
        if (GUILayout.Button("Remove State"))
        {
            typeEdit = 11;
        }
        if (GUILayout.Button("Add Trait"))
        {
            typeEdit = 12;
        }
        if (GUILayout.Button("Remove Trait"))
        {
            typeEdit = 13;
        }
        if (GUILayout.Button("Recover"))
        {
            typeEdit = 14;
        }
        GUILayout.EndHorizontal();
        switch (typeEdit)
        {
        case 1:
            EditorFunctions.ViewBase(consume.Stats.Base);
            break;

        case 2:
            EditorFunctions.ViewBattle(consume.Stats.Battle);
            break;

        case 3:
            EditorFunctions.ViewAbility(consume.Stats.Ability);
            break;

        case 4:
            EditorFunctions.ViewResist(consume.Stats.Resistance);
            break;

        case 5:
            EditorFunctions.ViewOther(consume.Stats.Other);
            break;

        case 6:
            //EditorFunctions.ViewState();
            break;

        case 7:
            EditorFunctions.ViewSkills();
            break;

        case 10:
            StatePanel(consume.AddState, "States add");
            break;

        case 11:
            StatePanel(consume.RemoveState, "States remove");
            break;

        case 12:
            EditorFunctions.TraitPanel(consume.AddTrait, "Traits add");
            break;

        case 13:
            EditorFunctions.TraitPanel(consume.RemoveTrait, "Traits remove");
            break;

        case 14:
            RecoverStats(consume.Recover);
            break;
        }
    }
コード例 #23
0
        public override void OnInspectorGUI()
        {
            HelpTopic = "grass-patch-generator";

            base.OnInspectorGUI();
            _grassPatchGenerator = (GrassPatchGenerator)target;

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Patch settings", LabelStyle);
            EditorGUI.BeginChangeCheck();

            _grassPatchGenerator.PlaneCount = EditorGUILayout.IntSlider("Plane count", _grassPatchGenerator.PlaneCount, 1, 30);
            _grassPatchGenerator.Size       = EditorGUILayout.Slider("Size", _grassPatchGenerator.Size, 0.1f, 2f);


            EditorFunctions.FloatRangeField("Min/Max Scale", ref _grassPatchGenerator.MinScale,
                                            ref _grassPatchGenerator.MaxScale, 0.1f, 2f);

            _grassPatchGenerator.PlaneWidth  = EditorGUILayout.Slider("Plane height", _grassPatchGenerator.PlaneWidth, 0f, 1f);
            _grassPatchGenerator.PlaneHeight = EditorGUILayout.Slider("Plane width", _grassPatchGenerator.PlaneHeight, 0f, 1f);


            //EditorFunctions.FloatRangeField("Min/Max Width", ref _grassPatchGenerator.PlaneWidth,
            //    ref _grassPatchGenerator.PlaneMaxWidth, 0.1f, 2f);

            //EditorFunctions.FloatRangeField("Min/Max Height", ref _grassPatchGenerator.PlaneHeight,
            //    ref _grassPatchGenerator.PlaneMaxHeight, 0.1f, 2f);

            //_grassPatchGenerator.PlaneWidth = EditorGUILayout.Slider("Width", _grassPatchGenerator.PlaneWidth, 0.1f, 2f);
            //_grassPatchGenerator.PlaneHeight = EditorGUILayout.Slider("Height", _grassPatchGenerator.PlaneHeight, 0.1f, 2f);
            EditorGUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Resolution", LabelStyle);
            _grassPatchGenerator.PlaneWidthSegments  = EditorGUILayout.IntSlider("Width segments", _grassPatchGenerator.PlaneWidthSegments, 2, 8);
            _grassPatchGenerator.PlaneHeightSegments = EditorGUILayout.IntSlider("Height segments", _grassPatchGenerator.PlaneHeightSegments, 2, 8);
            EditorGUILayout.EndVertical();

            //GUILayout.BeginVertical("box");
            //EditorGUILayout.LabelField("View LOD of patch.", LabelStyle);
            //EditorGUI.BeginDisabledGroup(true);
            //_grassPatchGenerator.GrassPatchLod = (GrassPatchLod)EditorGUILayout.EnumPopup("Select LOD", _grassPatchGenerator.GrassPatchLod);
            //EditorGUI.EndDisabledGroup();
            //EditorGUILayout.HelpBox("Not yet implemented", MessageType.Warning);
            //EditorGUILayout.EndVertical();


            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Bending", LabelStyle);
            _grassPatchGenerator.MinBendHeight   = EditorGUILayout.Slider("Minimum bend height", _grassPatchGenerator.MinBendHeight, 0f, 1f);
            _grassPatchGenerator.MaxBendDistance = EditorGUILayout.Slider("Bend", _grassPatchGenerator.MaxBendDistance, 0.1f, 0.8f);
            _grassPatchGenerator.CurveOffset     = EditorGUILayout.Slider("Curve", _grassPatchGenerator.CurveOffset, 0.1f, 0.8f);
            EditorGUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Mesh", LabelStyle);
            _grassPatchGenerator.GenerateBackside = EditorGUILayout.Toggle("Generate backside", _grassPatchGenerator.GenerateBackside);
            if (_grassPatchGenerator.GenerateBackside)
            {
                EditorGUILayout.HelpBox("With the Vegetation Studio custom grass shader backside is not needed. Will give unnecessary extra polygons", MessageType.Warning);
            }
            EditorGUILayout.EndVertical();

            EditorGUI.BeginChangeCheck();

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Grass texture", LabelStyle);
            _grassPatchGenerator.GrassTexture = (Texture2D)EditorGUILayout.ObjectField(_grassPatchGenerator.GrassTexture, typeof(Texture2D), false, GUILayout.Height(64), GUILayout.Width(64));
            EditorGUILayout.EndVertical();



            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Shader settings", LabelStyle);
            _grassPatchGenerator.ColorTint1      = EditorGUILayout.ColorField("Tint color 1", _grassPatchGenerator.ColorTint1);
            _grassPatchGenerator.ColorTint2      = EditorGUILayout.ColorField("Tint color 2", _grassPatchGenerator.ColorTint2);
            _grassPatchGenerator.RandomDarkening = EditorGUILayout.Slider("Random darkening", _grassPatchGenerator.RandomDarkening, 0f, 1f);
            _grassPatchGenerator.RootAmbient     = EditorGUILayout.Slider("Root ambient", _grassPatchGenerator.RootAmbient, 0f, 1f);
            _grassPatchGenerator.TextureCutoff   = EditorGUILayout.Slider("Alpha cutoff", _grassPatchGenerator.TextureCutoff, 0f, 1f);

            if (EditorGUI.EndChangeCheck())
            {
                _grassPatchGenerator.UpdateTexture();
                _grassPatchGenerator.GenerateGrassPatch();
                EditorUtility.SetDirty(_grassPatchGenerator);
            }

            EditorGUILayout.EndVertical();
            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Ambient occlusion", LabelStyle);
            //EditorGUI.BeginDisabledGroup(true);
            _grassPatchGenerator.AmbientOcclusion = EditorGUILayout.CurveField(_grassPatchGenerator.AmbientOcclusion, Color.green, new Rect(0, 0, 1, 1), GUILayout.Height(75));
            //EditorGUI.EndDisabledGroup();
            EditorGUILayout.HelpBox("Horizontal: min -> max height. Vertical: bottom: no ambient -> top: max ambient", MessageType.Info);
            EditorGUILayout.EndVertical();


            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Wind bending", LabelStyle);
            _grassPatchGenerator.WindBend = EditorGUILayout.CurveField(_grassPatchGenerator.WindBend, Color.green, new Rect(0, 0, 1, 1), GUILayout.Height(75));
            EditorGUILayout.HelpBox("Horizontal: min -> max height. Vertical: bottom: do not bend -> top: max bend", MessageType.Info);

            _grassPatchGenerator.BakePhase = EditorGUILayout.Toggle("Include phase", _grassPatchGenerator.BakePhase);
            _grassPatchGenerator.BakeBend  = EditorGUILayout.Toggle("Include bending", _grassPatchGenerator.BakeBend);
            _grassPatchGenerator.BakeAo    = EditorGUILayout.Toggle("Include Ambient occlusion", _grassPatchGenerator.BakeAo);
            EditorGUILayout.LabelField("Vertex colors", LabelStyle);
            _grassPatchGenerator.ShowVertexColors = EditorGUILayout.Toggle("Show vertex colors", _grassPatchGenerator.ShowVertexColors);

            EditorGUILayout.EndVertical();

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Random", LabelStyle);
            _grassPatchGenerator.RandomSeed = EditorGUILayout.IntSlider("Seed", _grassPatchGenerator.RandomSeed, 1, 100);
            EditorGUILayout.EndVertical();

            if (EditorGUI.EndChangeCheck())
            {
                _grassPatchGenerator.GenerateGrassPatch();
                EditorUtility.SetDirty(_grassPatchGenerator);
            }

            GUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Mesh info", LabelStyle);
            EditorGUILayout.LabelField("Verts: " + _grassPatchGenerator.GetMeshVertexCount().ToString(), LabelStyle);
            EditorGUILayout.LabelField("Tris: " + _grassPatchGenerator.GetMeshTriangleCount().ToString(), LabelStyle);
            EditorGUILayout.EndVertical();

            if (GUILayout.Button("Save prefab and add to scene"))
            {
                _grassPatchGenerator.BuildPrefab();
            }

            if (GUILayout.Button("Save prefab with LOD and add to scene"))
            {
                _grassPatchGenerator.BuildPrefabLod();
            }

            EditorUtility.SetDirty(_grassPatchGenerator);
        }
コード例 #24
0
    void RuneSwitch()
    {
        IRune rune = (IRune)selected;

        rune.Type = (IRune.TypeRune)EditorGUILayout.EnumPopup("Type", rune.Type);
        GUILayout.Space(20);
        GUILayout.BeginHorizontal();
        rune.Category = ItemCategory.Rune;
        Buttons();
        switch (rune.Type)
        {
        case IRune.TypeRune.Weapon:
            if (GUILayout.Button("Elements"))
            {
                typeEdit = 8;
            }
            if (GUILayout.Button("Atk state"))
            {
                typeEdit = 6;
            }
            break;

        case IRune.TypeRune.Armor:
            rune.Elements = new List <AttackElementRate>();
            if (typeEdit == 8)
            {
                typeEdit = 0;
            }
            if (GUILayout.Button("Resist state"))
            {
                typeEdit = 9;
            }
            break;
        }
        GUILayout.EndHorizontal();
        switch (typeEdit)
        {
        case 1:
            EditorFunctions.ViewBase(rune.Stats.Base);
            break;

        case 2:
            EditorFunctions.ViewBattle(rune.Stats.Battle);
            break;

        case 3:
            EditorFunctions.ViewAbility(rune.Stats.Ability);
            break;

        case 4:
            EditorFunctions.ViewResist(rune.Stats.Resistance);
            break;

        case 5:
            EditorFunctions.ViewOther(rune.Stats.Other);
            break;

        case 6:
            GUILayout.BeginVertical("box");
            EditorFunctions.ViewState(rune.Stats.AtkState, "Attack State");
            GUILayout.EndVertical();
            break;

        case 7:
            EditorFunctions.ViewSkills();
            break;

        case 8:
            ElementsPanel(rune.Elements);
            break;

        case 9:
            GUILayout.BeginVertical("box");
            EditorFunctions.ViewState(rune.Stats.ResistState, "Resist State");
            GUILayout.EndVertical();
            break;
        }
    }