private void DrawEntries()
        {
            EditorGUILayout.Space();

            upIndex     = -1;
            downIndex   = -1;
            removeIndex = -1;

            Dictionary <string, List <EntryData> > dict = new Dictionary <string, List <EntryData> >();

            for (int i = 0; i < entries.Count; i++)
            {
                DropItemEntry entry = entries[i];
                if (!dict.ContainsKey(entry.category))
                {
                    dict.Add(entry.category, new List <EntryData>());
                }

                dict[entry.category].Add(new EntryData(i, entry));
            }

            foreach (KeyValuePair <string, List <EntryData> > pair in dict)
            {
                DrawCategory(pair.Key, pair.Value);
            }

            if (upIndex > 0)
            {
                entries.Swap(upIndex, upIndex - 1);
                upIndex = -1;
                return;
            }

            if (downIndex >= 0)
            {
                entries.Swap(downIndex, downIndex + 1);
                downIndex = -1;
                return;
            }

            if (removeIndex >= 0)
            {
                entries.RemoveAt(removeIndex);
                removeIndex = -1;
            }
        }
 public void Paste(DropItemEntry otherEntry)
 {
     dropPrefabPath   = otherEntry.dropPrefabPath;
     trackPrefabPath  = otherEntry.trackPrefabPath;
     impactPrefabPath = otherEntry.impactPrefabPath;
 }
        private int EntryComparison(DropItemEntry a, DropItemEntry b)
        {
            int val1 = a.category.CompareTo(b.category);

            return(val1 != 0 ? val1 : a.rarity.CompareTo(b.rarity));
        }
 public EntryData(int index, DropItemEntry entry)
 {
     this.index = index;
     this.entry = entry;
 }
        private void DrawEntry(int index, DropItemEntry entry)
        {
            EditorGUILayout.Space();
            using (new EditorHelper.Box(false))
            {
                using (new EditorHelper.Horizontal())
                {
                    bool existed = foldEntries.ContainsKey(entry);
                    if (!existed)
                    {
                        foldEntries[entry] = false;
                    }

                    bool foldout = foldEntries[entry];

                    GUIStyle gs = new GUIStyle(EditorStyles.foldout);
                    gs.fontStyle = FontStyle.Bold;
                    gs.fontSize  = 13;
                    if (hudConfig)
                    {
                        GUIStyleState normal = new GUIStyleState();
                        normal.textColor = hudConfig.GetHUDTextInfo(entry.rarity.ToHudTextType()).color * 2;
                        gs.normal        = normal;
                        gs.focused       = normal;
                        gs.hover         = normal;
                        gs.active        = normal;
                        gs.onActive      = normal;
                        gs.onFocused     = normal;
                        gs.onHover       = normal;
                        gs.onNormal      = normal;
                    }

                    foldout            = GUILayout.Toggle(foldout, $"{entry.category} - {entry.rarity}", gs);
                    foldEntries[entry] = foldout;

                    if (GUILayout.Button("Copy", GUILayout.Width(70)))
                    {
                        copiedEntry = entry;
                    }

                    if (GUILayout.Button("Paste", GUILayout.Width(70)))
                    {
                        if (copiedEntry != null)
                        {
                            entry.Paste(copiedEntry);
                        }
                    }

                    /*using (new EditorHelper.DisabledGroup(index == 0))
                     * {
                     *  if (GUILayout.Button("Up", GUILayout.Width(70)))
                     *  {
                     *      upIndex = index;
                     *  }
                     * }
                     *
                     * using (new EditorHelper.DisabledGroup(index == entries.Count - 1))
                     * {
                     *  if (GUILayout.Button("Down", GUILayout.Width(70)))
                     *  {
                     *      downIndex = index;
                     *  }
                     * }*/

                    if (GUILayout.Button("Remove", GUILayout.Width(70)))
                    {
                        removeIndex = index;
                    }

                    if (!foldout)
                    {
                        return;
                    }
                }

                entry.dropPrefabPath   = new EditorHelper.PrefabDrawer().DrawFromPathString("Drop Prefab", entry.dropPrefabPath);
                entry.trackPrefabPath  = new EditorHelper.PrefabDrawer().DrawFromPathString("Track Prefab", entry.trackPrefabPath);
                entry.impactPrefabPath = new EditorHelper.PrefabDrawer().DrawFromPathString("Impact Prefab", entry.impactPrefabPath);
            }
        }