Beispiel #1
0
        public static void DisplayWizard(BuildConfig.DefineSymbol symbol, Action onCreate)
        {
            // Display wizzard
            AddDefineSymbolWizard wizzard =
                ScriptableWizard.DisplayWizard <AddDefineSymbolWizard>("Add Define Symbol", "Create");

            // Setup
            wizzard.Symbol   = symbol;
            wizzard.OnCreate = onCreate;
        }
        private void DrawDefineList(List <BuildConfig.DefineSymbol> list, ref Vector2 scrollPos)
        {
            EditorGUILayout.LabelField("Define Symbol List");

            EditorGUILayout.BeginVertical();

            // Display list
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandHeight(false));

            for (int i = 0; i < list.Count; i++)
            {
                DrawItem(list[i]);
            }

            EditorGUILayout.EndScrollView();

            GUIHelper.DrawButton("New Define", () =>
            {
                BuildConfig.DefineSymbol newSymbol = new BuildConfig.DefineSymbol();
                AddDefineSymbolWizard.DisplayWizard(newSymbol, () =>
                {
                    // Check duplicate
                    if (_curConfig.DefineList.Find(i => i.Name == newSymbol.Name) != null)
                    {
                        return;
                    }

                    _curConfig.DefineList.Add(newSymbol);
                    _dataChanged = true;
                });
            }, Color.white);

            GUIHelper.DrawButton("Sync Define Symbols", () =>
            {
                if (QuickBuild.SyncAllDefineSymbols())
                {
                    _dataChanged = true;
                }
            }, Color.white);

            EditorGUILayout.EndVertical();

            DeletePendingDefineItem();
        }
        private void DrawItem(BuildConfig.DefineSymbol item)
        {
            EditorHelper.HorizontalLayout(() =>
            {
                item.Enable = EditorGUILayout.Toggle(item.Enable);

                EditorGUILayout.LabelField(item.Name);

                EditorGUILayout.Space();

                EditorGUILayout.LabelField(string.Format("/*{0}*/", item.Desc ?? ""));

                GUIHelper.DrawButton("Edit",
                                     () => { AddDefineSymbolWizard.DisplayWizard(item, () => { _dataChanged = true; }); },
                                     Color.green);

                GUIHelper.DrawButton("Delete", () => { _pendingDeleteDefineList.Add(item); }, Color.red);
            });
        }