protected override void OnScrollableGUI(ref VerticalGUIRect rect, int index)
        {
            ItemData item = MainWnd.Items[index];

            rect.Space(10);

            using (new EditorGUI.DisabledGroupScope(true))
            {
                EditorGUI.IntField(rect.Next, s_IDContent, item.ID);
            }

            item.InternalName  = EditorGUI.TextField(rect.Next, s_InternalNameContent, item.InternalName);
            item.Icon          = EditorAssetUtility.AssetPtrField(rect.Next, s_IconContent, item.Icon, typeof(Sprite));
            item.Block         = EditorGUI.TextField(rect.Next, s_BlockContent, item.Block);
            item.Attack        = EditorGUI.IntField(rect.Next, s_AttackContent, item.Attack);
            item.Rarity        = EditorGUI.IntSlider(rect.Next, s_RarityContent, item.Rarity, 1, 6);
            item.MaxStackCount = EditorGUI.IntSlider(rect.Next, s_MaxStackCountContent, item.MaxStackCount, 1, 99);
            rect.Space(10);

            EditorGUI.LabelField(rect.Next, s_DescriptionContent, EditorStyles.boldLabel);
            item.Description = EditorGUI.TextArea(rect.GetNext(s_TextAreaHeight, true, true), item.Description);
            rect.Space(10);

            EditorGUI.LabelField(rect.Next, s_UsageContent, EditorStyles.boldLabel);
            item.Usage = EditorGUI.TextArea(rect.GetNext(s_TextAreaHeight, true, true), item.Usage);
            rect.Space(10);

            EditorGUI.LabelField(rect.Next, s_ObtainApproachContent, EditorStyles.boldLabel);
            item.ObtainApproach = EditorGUI.TextArea(rect.GetNext(s_TextAreaHeight, true, true), item.ObtainApproach);
            rect.Space(10);
        }
Exemple #2
0
        protected override void OnBeforeScrollableGUI(ref VerticalGUIRect rect, int index)
        {
            base.OnBeforeScrollableGUI(ref rect, index);

            rect.Space(10);
            m_SelectedCategoryIndex = GUI.Toolbar(rect.GetNext(22, false, true), m_SelectedCategoryIndex, s_FieldCategoryNames);
            rect.Space(10);
        }
Exemple #3
0
        private void AudioFieldsGUI(ref VerticalGUIRect guiRect, BlockData block)
        {
            block.DigAudio   = EditorAssetUtility.AssetPtrField(guiRect.Next, s_DigAudioContent, block.DigAudio, typeof(AudioClip));
            block.PlaceAudio = EditorAssetUtility.AssetPtrField(guiRect.Next, s_PlaceAudioContent, block.PlaceAudio, typeof(AudioClip));
            guiRect.Space(10);

            m_StepAudioList ??= new ReorderableList(null, typeof(AssetPtr), true, true, true, true)
            {
                elementHeight      = EditorGUIUtility.standardVerticalSpacing + EditorGUIUtility.singleLineHeight,
                drawHeaderCallback = (Rect pos) =>
                {
                    EditorGUI.LabelField(pos, s_StepAudiosContent);
                },
                drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                {
                    rect.y     += EditorGUIUtility.standardVerticalSpacing;
                    rect.height = EditorGUIUtility.singleLineHeight;

                    AssetPtr asset = m_StepAudioList.list[index] as AssetPtr;
                    m_StepAudioList.list[index] = EditorAssetUtility.AssetPtrField(rect, GUIContent.none, asset, typeof(AudioClip));
                }
            };
            m_StepAudioList.list = block.StepAudios ??= new List <AssetPtr>();
            m_StepAudioList.DoList(guiRect.GetNext(m_StepAudioList.GetHeight(), true, true));
        }
Exemple #4
0
        private void PhysicsFieldsGUI(ref VerticalGUIRect guiRect, BlockData block)
        {
            block.Hardness     = EditorGUI.IntField(guiRect.Next, s_HardnessContent, block.Hardness);
            block.LightValue   = EditorGUI.IntSlider(guiRect.Next, s_LightValueContent, block.LightValue, 0, LightingUtility.MaxLight);
            block.LightOpacity = EditorGUI.IntSlider(guiRect.Next, s_LightOpacityContent, block.LightOpacity, 0, LightingUtility.MaxLight);
            block.PhysicState  = (PhysicState)EditorGUI.EnumPopup(guiRect.Next, s_PhysicStateContent, block.PhysicState);
            guiRect.Space(10);

            EditorGUI.LabelField(guiRect.Next, s_PhysicMaterialContent, EditorStyles.boldLabel);
            block.PhysicMaterial.CoefficientOfRestitution     = EditorGUI.Slider(guiRect.Next, s_CoefficientOfRestitutionContent, block.PhysicMaterial.CoefficientOfRestitution, 0, 1);
            block.PhysicMaterial.CoefficientOfStaticFriction  = EditorGUI.FloatField(guiRect.Next, s_CoefficientOfStaticFrictionContent, block.PhysicMaterial.CoefficientOfStaticFriction);
            block.PhysicMaterial.CoefficientOfDynamicFriction = EditorGUI.FloatField(guiRect.Next, s_CoefficientOfDynamicFrictionContent, block.PhysicMaterial.CoefficientOfDynamicFriction);
        }
Exemple #5
0
        public bool OnGUI(Rect rect, int index)
        {
            Rect            initialRect = rect;
            VerticalGUIRect guiRect     = GetGUIRectWithMargin(ref rect);

            OnBeforeScrollableGUI(ref guiRect, index);

            Rect scrollViewRect = new Rect(initialRect.x, initialRect.y + guiRect.UsedHeight, initialRect.width, initialRect.height - guiRect.UsedHeight);

            m_ScrollPos = GUI.BeginScrollView(scrollViewRect, m_ScrollPos, m_LastRect);

            EditorGUI.BeginChangeCheck();
            OnScrollableGUI(ref guiRect, index);
            guiRect.Space(10);
            bool changed = EditorGUI.EndChangeCheck();

            GUI.EndScrollView();
            m_LastRect = new Rect(scrollViewRect.x, scrollViewRect.y, rect.xMax - scrollViewRect.x, guiRect.UsedHeight + scrollViewRect.height - initialRect.height);
            return(changed);
        }
Exemple #6
0
        protected override void OnScrollableGUI(ref VerticalGUIRect rect, int index)
        {
            BiomeData biome = MainWnd.Biomes[index];

            rect.Space(10);

            using (new EditorGUI.DisabledGroupScope(true))
            {
                EditorGUI.IntField(rect.Next, s_IDContent, biome.ID);
                EditorGUI.TextField(rect.Next, s_InternalNameContent, biome.InternalName);
            }

            biome.BaseHeight      = EditorGUI.FloatField(rect.Next, s_BaseHeightContent, biome.BaseHeight);
            biome.HeightVariation = EditorGUI.FloatField(rect.Next, s_HeightVariationContent, biome.HeightVariation);
            biome.Temperature     = EditorGUI.FloatField(rect.Next, s_TemperatureContent, biome.Temperature);
            biome.Rainfall        = EditorGUI.FloatField(rect.Next, s_RainfallContent, biome.Rainfall);
            biome.EnableSnow      = EditorGUI.Toggle(rect.Next, s_EnableSnowContent, biome.EnableSnow);
            biome.EnableRain      = EditorGUI.Toggle(rect.Next, s_EnableRainContent, biome.EnableRain);
            biome.TopBlock        = EditorGUI.TextField(rect.Next, s_TopBlockContent, biome.TopBlock);
            biome.FillerBlock     = EditorGUI.TextField(rect.Next, s_FillerBlockContent, biome.FillerBlock);

            biome.TreesPerChunk     = EditorGUI.IntField(rect.Next, s_TreesPerChunkContent, biome.TreesPerChunk);
            biome.ExtraTreeChance   = EditorGUI.FloatField(rect.Next, s_ExtraTreeChanceContent, biome.ExtraTreeChance);
            biome.GrassPerChunk     = EditorGUI.IntField(rect.Next, s_GrassPerChunkContent, biome.GrassPerChunk);
            biome.FlowersPerChunk   = EditorGUI.IntField(rect.Next, s_FlowersPerChunkContent, biome.FlowersPerChunk);
            biome.MushroomsPerChunk = EditorGUI.IntField(rect.Next, s_MushroomsPerChunkContent, biome.MushroomsPerChunk);

            biome.DeadBushPerChunk = EditorGUI.IntField(rect.Next, s_DeadBushPerChunkContent, biome.DeadBushPerChunk);
            biome.ReedsPerChunk    = EditorGUI.IntField(rect.Next, s_ReedsPerChunkContent, biome.ReedsPerChunk);
            biome.CactiPerChunk    = EditorGUI.IntField(rect.Next, s_CactiPerChunkContent, biome.CactiPerChunk);

            biome.ClayPerChunk          = EditorGUI.IntField(rect.Next, s_ClayPerChunkContent, biome.ClayPerChunk);
            biome.WaterlilyPerChunk     = EditorGUI.IntField(rect.Next, s_WaterlilyPerChunkContent, biome.WaterlilyPerChunk);
            biome.SandPatchesPerChunk   = EditorGUI.IntField(rect.Next, s_SandPatchesPerChunkContent, biome.SandPatchesPerChunk);
            biome.GravelPatchesPerChunk = EditorGUI.IntField(rect.Next, s_GravelPatchesPerChunkContent, biome.GravelPatchesPerChunk);
        }