示例#1
0
        protected override void DrawList()
        {
            for (int i = 0; i < loadedCategories.Count; i++)
            {
                int cachedIndex = i;

                GUILayout.BeginHorizontal();

                if (selectedDataId == i)
                {
                    GUI.color = InsaneEditorStyles.selectedButtonColor;
                }

                var buttonContent = new GUIContent(loadedCategories[i].textId);
                if (loadedCategories[i].icon)
                {
                    buttonContent.image = loadedCategories[i].icon.texture;
                }

                if (GUILayout.Button(buttonContent, GUILayout.MaxHeight(24)))
                {
                    selectedDataId = cachedIndex;
                }

                GUI.color = Color.white;
                if (GUILayout.Button("X", GUILayout.MaxHeight(24), GUILayout.MaxWidth(24)))
                {
                    RemoveDataWindow.Init(AssetDatabase.GetAssetPath(loadedCategories[i]), loadedCategories[i], this);
                }

                GUILayout.EndHorizontal();
            }
        }
示例#2
0
        public static void Init(string fileToRemove, Object dataFile, DataListEditor dataListEditorWindow)
        {
            RemoveDataWindow window = (RemoveDataWindow)EditorWindow.GetWindow(typeof(RemoveDataWindow));

            window.titleContent = new GUIContent("Remove data");
            window.Show();

            fileToRemoveName           = fileToRemove;
            selectedData               = dataFile;
            dataListEditorWindowCaller = dataListEditorWindow;

            textStyle          = new GUIStyle();
            textStyle.richText = true;
            textStyle.padding  = new RectOffset(3, 3, 10, 10);
            textStyle.fontSize = 14;
        }
示例#3
0
        protected override void DrawActions()
        {
            if (selectedDataId >= loadedCategories.Count)
            {
                return;
            }

            if (GUILayout.Button("Clone production category"))
            {
                CreateNewCategory(loadedCategories[selectedDataId]);
            }

            if (GUILayout.Button("Delete production category"))
            {
                RemoveDataWindow.Init(AssetDatabase.GetAssetPath(loadedCategories[selectedDataId]), loadedCategories[selectedDataId], this);
            }
        }
        protected override void DrawList()
        {
            searchString = EditorGUILayout.TextField("Search", searchString);

            for (int i = 0; i < loadedUnitDatas.Count; i++)
            {
                if (searchString != "" && !loadedUnitDatas[i].textId.ToLower().Contains(searchString))
                {
                    continue;
                }

                int cachedIndex = i;

                GUILayout.BeginHorizontal();

                if (selectedDataId == i)
                {
                    GUI.color = InsaneEditorStyles.selectedButtonColor;
                }

                var buttonContent = new GUIContent(" " + loadedUnitDatas[i].textId);                 // space needed to step from icon
                if (loadedUnitDatas[i].icon)
                {
                    buttonContent.image = loadedUnitDatas[i].icon.texture;
                }

                if (GUILayout.Button(buttonContent, GUILayout.MaxHeight(24)))
                {
                    selectedDataId = cachedIndex;
                }

                GUI.color = Color.white;
                if (GUILayout.Button("X", GUILayout.MaxHeight(24), GUILayout.MaxWidth(24)))
                {
                    RemoveDataWindow.Init(AssetDatabase.GetAssetPath(loadedUnitDatas[i]), loadedUnitDatas[i], this);
                }

                GUILayout.EndHorizontal();
            }
        }
        protected override void DrawActions()
        {
            if (selectedDataId >= loadedUnitDatas.Count)
            {
                return;
            }

            bool isUnitDataSuitableForPrefab = loadedUnitDatas[selectedDataId].unitModel != null;

            if (!isUnitDataSuitableForPrefab)
            {
                EditorGUILayout.HelpBox("Add unit model to Unit Data field to generate prefab.", MessageType.Info);
            }
            else
            {
                EditorGUILayout.HelpBox("Unit prefab will be generated and created on opened scene. Also it will be saved to assets.", MessageType.Info);
            }

            GUI.enabled = isUnitDataSuitableForPrefab;

            if (GUILayout.Button("Generate unit prefab"))
            {
                CreateUnitPrefab(loadedUnitDatas[selectedDataId]);
            }

            GUI.enabled = true;

            if (GUILayout.Button("Clone unit"))
            {
                CreateNewUnit(loadedUnitDatas[selectedDataId]);
            }

            if (GUILayout.Button("Delete unit"))
            {
                RemoveDataWindow.Init(AssetDatabase.GetAssetPath(loadedUnitDatas[selectedDataId]), loadedUnitDatas[selectedDataId], this);
            }
        }