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);
        }
Example #2
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));
        }
Example #3
0
        public void ElementGUI(Rect rect, GUIContent label, ref int?location)
        {
            AssetPtr asset    = location == null ? AssetPtr.NullPtr : Elements[location.Value].Asset;
            AssetPtr newAsset = EditorAssetUtility.AssetPtrField(rect, label, asset, typeof(T), out bool changed);

            if (changed)
            {
                SetAssetToLocation(ref location, newAsset);
            }
        }