コード例 #1
0
ファイル: InvItem.cs プロジェクト: marafrass/Prototype-2
        private List <int> ChoosePlayerGUI(List <int> playerIDs, string api)
        {
            CustomGUILayout.LabelField("Item is carried by:", api);

            foreach (PlayerPrefab playerPrefab in KickStarter.settingsManager.players)
            {
                string playerName = "    " + playerPrefab.ID + ": " + ((playerPrefab.playerOb != null) ? playerPrefab.playerOb.GetName() : "(Unnamed)");
                bool   isActive   = false;
                foreach (int playerID in playerIDs)
                {
                    if (playerID == playerPrefab.ID)
                    {
                        isActive = true;
                    }
                }

                bool wasActive = isActive;
                isActive = EditorGUILayout.Toggle(playerName, isActive);
                if (isActive != wasActive)
                {
                    if (isActive)
                    {
                        playerIDs.Add(playerPrefab.ID);
                    }
                    else
                    {
                        playerIDs.Remove(playerPrefab.ID);
                    }
                }
            }
            return(playerIDs);
        }
コード例 #2
0
ファイル: ObjectiveState.cs プロジェクト: ManuelAGC/StarEater
        public void ShowGUI(string apiPrefix)
        {
            label = CustomGUILayout.TextField("Label:", label, apiPrefix + ".label");
            if (labelLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", labelLineID.ToString());
            }

            if (ID >= 2)
            {
                stateType = (ObjectiveStateType)CustomGUILayout.EnumPopup("State type:", stateType, apiPrefix + ".stateType");
            }
            else
            {
                EditorGUILayout.LabelField("State type: " + stateType.ToString());
            }

            EditorGUILayout.BeginHorizontal();
            CustomGUILayout.LabelField("Description:", GUILayout.Width(140f), apiPrefix + ".description");
            EditorStyles.textField.wordWrap = true;
            description = CustomGUILayout.TextArea(description, GUILayout.MaxWidth(800f), apiPrefix + ".description");
            EditorGUILayout.EndHorizontal();
            if (descriptionLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", descriptionLineID.ToString());
            }
        }
コード例 #3
0
        public void ShowGUI(string apiPrefix, List <InvBin> bins)
        {
            title = CustomGUILayout.TextField("Title:", title, apiPrefix + ".title");
            if (titleLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", titleLineID.ToString());
            }

            texture              = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Texture:", texture, false, apiPrefix + ".texture", "A Texture2D associated with the Document");
            carryOnStart         = CustomGUILayout.Toggle("Carry on start?", carryOnStart, apiPrefix + ".carryOnStart", "If True, the Document will be in the Player's collection when the game begins");
            rememberLastOpenPage = CustomGUILayout.Toggle("Remember last-open page?", rememberLastOpenPage, ".rememberLastOpenPage", "If True, the Document will be re-opened at the same page that it was closed at");

            //
            if (bins.Count > 0)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Category:", "The category that the document belongs to"), GUILayout.Width(146f));
                int binNumber = GetBinSlot(bins, binID);

                List <string> binList = new List <string>();
                foreach (InvBin bin in bins)
                {
                    binList.Add(bin.EditorLabel);
                }

                binNumber = CustomGUILayout.Popup(binNumber, binList.ToArray(), apiPrefix + ".binID");
                binID     = bins[binNumber].id;
                EditorGUILayout.EndHorizontal();
            }
            //

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Document pages:");

            if (pages == null || pages.Count == 0)
            {
                pages.Clear();
                pages.Add(new JournalPage());
            }

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(Mathf.Min(pages.Count * 21, 185f) + 5));
            for (int i = 0; i < pages.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();

                if (GUILayout.Toggle(selectedPage == i, "Page #" + i.ToString(), "Button"))
                {
                    if (selectedPage != i)
                    {
                        selectedPage = i;
                        EditorGUIUtility.editingTextField = false;
                    }
                }

                if (GUILayout.Button("", CustomStyles.IconCog))
                {
                    sidePage = i;
                    EditorGUIUtility.editingTextField = false;
                    SidePageMenu();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndScrollView();

            if (GUILayout.Button("Create new page"))
            {
                Undo.RecordObject(KickStarter.inventoryManager, "Add Document page");
                pages.Add(new JournalPage());

                if (pages.Count == 1)
                {
                    selectedPage = 0;
                    EditorGUIUtility.editingTextField = false;
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            if (selectedPage >= 0 && pages.Count > selectedPage)
            {
                EditorGUILayout.BeginVertical("Button");
                showPageGUI = CustomGUILayout.ToggleHeader(showPageGUI, "Document page #" + selectedPage);
                if (showPageGUI)
                {
                    CustomGUILayout.LabelField("Page text:", apiPrefix + ".pages[" + selectedPage + "].text");
                    EditorStyles.textField.wordWrap = true;
                    pages[selectedPage].text        = EditorGUILayout.TextArea(pages[selectedPage].text, GUILayout.MaxWidth(400f));
                }
                EditorGUILayout.EndVertical();
            }
        }
コード例 #4
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuJournal)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType", "What type of journal this is");
            if (journalType == JournalType.DisplayExistingJournal || journalType == JournalType.DisplayActiveDocument)
            {
                if (journalType == JournalType.DisplayExistingJournal)
                {
                    EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                    otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle", "The name of the Journal element within the same Menu that is used as reference");
                    pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset", "The difference in page index between this and the reference Journal");
                }

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                showPage = 1;

                if (source == MenuSource.AdventureCreator)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                    pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                    EditorGUILayout.EndHorizontal();
                }
            }
            else if (journalType == JournalType.NewJournal)
            {
                if (pages == null)
                {
                    pages = new List <JournalPage>();
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }
                    else
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }

                    if (GUILayout.Button("", CustomStyles.IconCog))
                    {
                        sideMenu = i;
                        SideMenu();
                    }
                    EditorGUILayout.EndHorizontal();

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage", "The index number of the current page being shown ");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage", "If True, then the page index above will be the first open when the game begins");
                }
                else if (numPages == 1)
                {
                    showPage = 1;
                }
                else
                {
                    showPage = 0;
                }
            }

            if (source == MenuSource.AdventureCreator)
            {
                anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor", "The text alignment");
                textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects", "The special FX applied to the text");
                if (textEffects != TextEffects.None)
                {
                    outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize", "The outline thickness");
                }
            }
            else
            {
                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                                #if TextMeshProIsPresent
                uiText = LinkedUiGUI <TMPro.TextMeshProUGUI> (uiText, "Linked Text:", source);
                                #else
                uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                                #endif
            }

            if (journalType == JournalType.NewJournal)
            {
                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage", "An ActionList to run whenever a new page is added");
            }

            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }
コード例 #5
0
        public void ShowGUI(string apiPrefix)
        {
            title = CustomGUILayout.TextField("Title:", title, apiPrefix + ".title");
            if (titleLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", titleLineID.ToString());
            }

            texture              = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Texture:", texture, false, apiPrefix + ".texture");
            carryOnStart         = CustomGUILayout.Toggle("Carry on start?", carryOnStart, apiPrefix + ".carryOnStart");
            rememberLastOpenPage = CustomGUILayout.Toggle("Remember last-open page?", rememberLastOpenPage, ".carryOnStart");

            EditorGUILayout.Space();

            if (pages == null || pages.Count == 0)
            {
                pages.Clear();
                pages.Add(new JournalPage());
            }

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(Mathf.Min(pages.Count * 21, 185f) + 5));
            for (int i = 0; i < pages.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();

                if (GUILayout.Toggle(selectedPage == i, "Page #" + i.ToString(), "Button"))
                {
                    if (selectedPage != i)
                    {
                        selectedPage = i;
                        EditorGUIUtility.editingTextField = false;
                    }
                }

                if (GUILayout.Button(Resource.CogIcon, GUILayout.Width(20f), GUILayout.Height(15f)))
                {
                    sidePage = i;
                    EditorGUIUtility.editingTextField = false;
                    SidePageMenu();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndScrollView();

            if (GUILayout.Button("Create new page"))
            {
                Undo.RecordObject(KickStarter.inventoryManager, "Add Document page");
                pages.Add(new JournalPage());

                if (pages.Count == 1)
                {
                    selectedPage = 0;
                    EditorGUIUtility.editingTextField = false;
                }
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            if (selectedPage >= 0 && pages.Count > selectedPage)
            {
                EditorGUILayout.BeginVertical("Button");
                showPageGUI = CustomGUILayout.ToggleHeader(showPageGUI, "Document page #" + selectedPage);
                if (showPageGUI)
                {
                    CustomGUILayout.LabelField("Page text:", apiPrefix + ".pages[" + selectedPage + "].text");
                    pages[selectedPage].text = EditorGUILayout.TextArea(pages[selectedPage].text);
                }
                EditorGUILayout.EndVertical();
            }
        }
コード例 #6
0
ファイル: Objective.cs プロジェクト: ManuelAGC/StarEater
        public void ShowGUI(string apiPrefix)
        {
            if (Application.isPlaying && KickStarter.runtimeObjectives != null)
            {
                ObjectiveState currentState = KickStarter.runtimeObjectives.GetObjectiveState(ID);
                if (currentState != null)
                {
                    EditorGUILayout.LabelField("Current state::", currentState.ID + ": " + currentState.Label, EditorStyles.boldLabel);
                }
                else
                {
                    EditorGUILayout.LabelField("Current state:", "INACTIVE", EditorStyles.boldLabel);
                }
                EditorGUILayout.Space();
            }

            title = CustomGUILayout.TextField("Title:", title, apiPrefix + ".title");
            if (titleLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", titleLineID.ToString());
            }

            EditorGUILayout.BeginHorizontal();
            CustomGUILayout.LabelField("Description:", GUILayout.Width(140f), apiPrefix + ".description");
            EditorStyles.textField.wordWrap = true;
            description = CustomGUILayout.TextArea(description, GUILayout.MaxWidth(800f), apiPrefix + ".description");
            EditorGUILayout.EndHorizontal();
            if (descriptionLineID > -1)
            {
                EditorGUILayout.LabelField("Speech Manager ID:", descriptionLineID.ToString());
            }

            if (KickStarter.settingsManager != null && KickStarter.settingsManager.playerSwitching == PlayerSwitching.Allow)
            {
                perPlayer = CustomGUILayout.Toggle("Per-Player?", perPlayer, apiPrefix + ".perPlayer");
            }

            texture = (Texture2D)CustomGUILayout.ObjectField <Texture2D> ("Texture:", texture, false, apiPrefix + ".texture");
            lockStateWhenComplete = CustomGUILayout.Toggle("Lock state when complete?", lockStateWhenComplete, apiPrefix + ".lockStateWhenComplete");
            lockStateWhenFail     = CustomGUILayout.Toggle("Lock state when fail?", lockStateWhenFail, apiPrefix + ".lockStateWhenFail");

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("Objective states:");

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Height(Mathf.Min(states.Count * 21, 185f) + 5));
            for (int i = 0; i < states.Count; i++)
            {
                EditorGUILayout.BeginHorizontal();

                ObjectiveState thisState = states[i];
                if (GUILayout.Toggle(selectedState == i, thisState.ID.ToString() + ": " + thisState.Label, "Button"))
                {
                    if (selectedState != i)
                    {
                        selectedState = i;
                        EditorGUIUtility.editingTextField = false;
                    }
                }

                if (GUILayout.Button(string.Empty, CustomStyles.IconCog))
                {
                    sideState = i;
                    EditorGUIUtility.editingTextField = false;
                    SideStateMenu();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndScrollView();

            if (GUILayout.Button("Create new state"))
            {
                Undo.RecordObject(KickStarter.inventoryManager, "Add Objective state");
                states.Add(new ObjectiveState(GetStateIDArray()));
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            if (selectedState >= 0 && states.Count > selectedState)
            {
                EditorGUILayout.BeginVertical("Button");
                showStateGUI = CustomGUILayout.ToggleHeader(showStateGUI, "State #" + states[selectedState].ID.ToString() + ": " + states[selectedState].Label);
                if (showStateGUI)
                {
                    states[selectedState].ShowGUI(apiPrefix + ".states[" + selectedState.ToString() + "].");
                }
                EditorGUILayout.EndVertical();
            }
        }
コード例 #7
0
ファイル: GVar.cs プロジェクト: cvkumar/out-of-body
        public void ShowGUI(VariableLocation location, bool canEdit, List <VarPreset> _varPresets = null, string apiPrefix = "", Variables _variables = null)
        {
            string labelPrefix = (canEdit) ? "Initial value:" : "Current value:";
            string helpText    = (canEdit) ? "Its initial value" : "Its current value";

            if (!canEdit && HasTranslations() && Options.GetLanguage() > 0)
            {
                labelPrefix = "Original language value:";
            }

            if (canEdit)
            {
                label = CustomGUILayout.TextField("Label:", label, apiPrefix + ".label", "Its editor name");
                type  = (VariableType)CustomGUILayout.EnumPopup("Type:", type, apiPrefix + ".type", "Its variable type");
            }
            else
            {
                EditorGUILayout.LabelField("Label: " + label);
                EditorGUILayout.LabelField("Type: " + type.ToString());
            }

            switch (type)
            {
            case VariableType.Boolean:
                if (val != 1)
                {
                    val = 0;
                }
                val = CustomGUILayout.Popup(labelPrefix, val, boolType, apiPrefix + ".BooleanValue", helpText);
                break;

            case VariableType.Float:
                floatVal = CustomGUILayout.FloatField(labelPrefix, floatVal, apiPrefix + ".FloatValue", helpText);
                break;

            case VariableType.Integer:
                val = CustomGUILayout.IntField(labelPrefix, val, apiPrefix + ".IntegerValue", helpText);
                break;

            case VariableType.PopUp:
                Object objectToRecord = null;
                if (location == VariableLocation.Global)
                {
                    objectToRecord = KickStarter.variablesManager;
                }
                if (location == VariableLocation.Local)
                {
                    objectToRecord = KickStarter.localVariables;
                }
                if (location == VariableLocation.Component)
                {
                    objectToRecord = _variables;
                }

                VariablesManager.ShowPopUpLabelsGUI(this, canEdit, objectToRecord);

                if (GetNumPopUpValues() > 0)
                {
                    string[] popUpLabels = GenerateEditorPopUpLabels();
                    val = CustomGUILayout.Popup(labelPrefix, val, popUpLabels, apiPrefix + ".IntegerValue", helpText);
                }
                else
                {
                    val = 0;
                }

                if (popUpID > 0)
                {
                    if (Application.isPlaying && canTranslate)
                    {
                        EditorGUILayout.LabelField("Values can be translated");
                    }
                }
                else
                {
                    if (canEdit)
                    {
                        canTranslate = CustomGUILayout.Toggle("Values can be translated?", canTranslate, apiPrefix + ".canTranslate", "If True, the variable's value can be translated");
                    }
                    else if (canTranslate)
                    {
                        EditorGUILayout.LabelField("Values can be translated");
                    }
                }
                break;

            case VariableType.String:
                EditorGUILayout.BeginHorizontal();
                CustomGUILayout.LabelField(labelPrefix, GUILayout.Width(140f), apiPrefix + ".TextValue");
                EditorStyles.textField.wordWrap = true;
                textVal = CustomGUILayout.TextArea(textVal, GUILayout.MaxWidth(800f), apiPrefix + ".TextValue");
                EditorGUILayout.EndHorizontal();

                if (canEdit)
                {
                    canTranslate = CustomGUILayout.Toggle("Values can be translated?", canTranslate, apiPrefix + ".canTranslate", "If True, the variable's value can be translated");
                }
                else if (canTranslate)
                {
                    EditorGUILayout.LabelField("Values can be translated");
                }
                break;

            case VariableType.Vector3:
                vector3Val = CustomGUILayout.Vector3Field(labelPrefix, vector3Val, apiPrefix + ".Vector3Value", helpText);
                break;
            }

            switch (location)
            {
            case VariableLocation.Global:
                CustomGUILayout.TokenLabel("[var:" + id.ToString() + "]");
                break;

            case VariableLocation.Local:
                CustomGUILayout.TokenLabel("[localvar:" + id.ToString() + "]");
                break;

            case VariableLocation.Component:
                if (_variables != null)
                {
                    ConstantID _constantID = _variables.GetComponent <ConstantID> ();
                    if (_constantID != null && _constantID.constantID != 0)
                    {
                        CustomGUILayout.TokenLabel("[compvar:" + _constantID.constantID.ToString() + ":" + id.ToString() + "]");
                    }
                }
                break;
            }

            if (_varPresets != null)
            {
                EditorGUILayout.Space();
                foreach (VarPreset _varPreset in _varPresets)
                {
                    // Local
                    string apiPrefix2 = (location == VariableLocation.Local) ?
                                        "AC.KickStarter.localVariables.GetPreset (" + _varPreset.ID + ").GetPresetValue (" + id + ")" :
                                        "AC.KickStarter.runtimeVariables.GetPreset (" + _varPreset.ID + ").GetPresetValue (" + id + ")";

                    _varPreset.UpdateCollection(this);

                    string label = "'" +
                                   (!string.IsNullOrEmpty(_varPreset.label) ? _varPreset.label : ("Preset #" + _varPreset.ID.ToString())) +
                                   "' value:";

                    PresetValue presetValue = _varPreset.GetPresetValue(this);
                    switch (type)
                    {
                    case VariableType.Boolean:
                        presetValue.val = CustomGUILayout.Popup(label, presetValue.val, boolType, apiPrefix2 + ".BooleanValue");
                        break;

                    case VariableType.Float:
                        presetValue.floatVal = CustomGUILayout.FloatField(label, presetValue.floatVal, apiPrefix2 + ".FloatValue");
                        break;

                    case VariableType.Integer:
                        presetValue.val = CustomGUILayout.IntField(label, presetValue.val, apiPrefix2 + ".IntegerValue");
                        break;

                    case VariableType.PopUp:
                        presetValue.val = CustomGUILayout.Popup(label, presetValue.val, popUps, apiPrefix2 + ".IntegerValue");
                        break;

                    case VariableType.String:
                        presetValue.textVal = CustomGUILayout.TextField(label, presetValue.textVal, apiPrefix2 + ".TextValue");
                        break;

                    case VariableType.Vector3:
                        presetValue.vector3Val = CustomGUILayout.Vector3Field(label, presetValue.vector3Val, apiPrefix2 + ".Vector3Value");
                        break;
                    }
                }
            }

            EditorGUILayout.Space();
            if (canEdit)
            {
                switch (location)
                {
                case VariableLocation.Local:
                    link = VarLink.None;
                    break;

                case VariableLocation.Global:
                case VariableLocation.Component:
                    link = (VarLink)CustomGUILayout.EnumPopup("Link to:", link, apiPrefix + ".link", "What it links to");
                    if (link == VarLink.PlaymakerVariable)
                    {
                        if (PlayMakerIntegration.IsDefinePresent())
                        {
                            if (location == VariableLocation.Global)
                            {
                                pmVar = CustomGUILayout.TextField("Playmaker Global Variable:", pmVar, apiPrefix + ".pmVar", "The name of the Playmaker variable to link to.");
                            }
                            else if (location == VariableLocation.Component)
                            {
                                if (_variables != null && PlayMakerIntegration.HasFSM(_variables.gameObject))
                                {
                                    pmVar = CustomGUILayout.TextField("Playmaker Local Variable:", pmVar, apiPrefix + ".pmVar", "The name of the Playmaker variable to link to. It is assumed to be placed on the same GameObject as this Variables component.");
                                }
                                else
                                {
                                    EditorGUILayout.HelpBox("A Playmaker FSM component must be present on the Variables GameObject.", MessageType.Info);
                                }
                            }

                            if (!string.IsNullOrEmpty(pmVar))
                            {
                                updateLinkOnStart = CustomGUILayout.Toggle("Use PM for initial value?", updateLinkOnStart, apiPrefix + ".updateLinkOnStart", "If True, then Playmaker will be referred to for the initial value");
                            }
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("The 'PlayMakerIsPresent' Scripting Define Symbol must be listed in the\nPlayer Settings. Please set it from Edit -> Project Settings -> Player", MessageType.Warning);
                        }
                    }
                    else if (link == VarLink.OptionsData)
                    {
                        if (location == VariableLocation.Global)
                        {
                            EditorGUILayout.HelpBox("This Variable will be stored in PlayerPrefs, and not in saved game files.", MessageType.Info);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("Component variables cannot be linked to Options Data - use Global variables instead.", MessageType.Warning);
                        }
                    }
                    else if (link == VarLink.CustomScript)
                    {
                        updateLinkOnStart = CustomGUILayout.Toggle("Script sets initial value?", updateLinkOnStart, apiPrefix + ".updateLinkOnStart", "If True, then a custom script will be referred to for the initial value");
                        EditorGUILayout.HelpBox("See the Manual's 'Global variable linking' chapter for details on how to synchronise values.", MessageType.Info);
                    }
                    break;
                }
            }
            else
            {
                if (link != VarLink.None)
                {
                    EditorGUILayout.LabelField("Links to: " + link.ToString());
                    if (link == VarLink.PlaymakerVariable && !string.IsNullOrEmpty(pmVar))
                    {
                        EditorGUILayout.LabelField("Linked PM variable: " + pmVar);
                    }
                    if (link == VarLink.PlaymakerVariable || link == VarLink.CustomScript)
                    {
                        if (updateLinkOnStart)
                        {
                            EditorGUILayout.LabelField("Script sets initial value");
                        }
                    }
                }
            }

            if (canEdit)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Internal description:", "An Editor-only description to aid designers"), GUILayout.MaxWidth(146f));
                description = EditorGUILayout.TextArea(description);
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                if (!string.IsNullOrEmpty(description))
                {
                    EditorGUILayout.LabelField("Internal description: " + description);
                }
            }
        }
コード例 #8
0
        public override void ShowGUI(Menu menu)
        {
            string apiPrefix = "(AC.PlayerMenus.GetElementWithName (\"" + menu.title + "\", \"" + title + "\") as AC.MenuJournal)";

            MenuSource source = menu.menuSource;

            EditorGUILayout.BeginVertical("Button");

            journalType = (JournalType)CustomGUILayout.EnumPopup("Journal type:", journalType, apiPrefix + ".journalType");
            if (journalType == JournalType.DisplayExistingJournal)
            {
                EditorGUILayout.HelpBox("This Journal will share pages from another Journal element in the same Menu.", MessageType.Info);
                otherJournalTitle = CustomGUILayout.TextField("Existing element name:", otherJournalTitle, apiPrefix + ".otherJournalTitle");
                pageOffset        = CustomGUILayout.IntField("Page offset #:", pageOffset, apiPrefix + ".pageOffset");

                if (pages == null || pages.Count != 1)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Placeholder text:", GUILayout.Width(146f));
                pages[0].text = CustomGUILayout.TextArea(pages[0].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[0].text");
                showPage      = 1;
                EditorGUILayout.EndHorizontal();

                if (source == MenuSource.AdventureCreator)
                {
                    anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
                    textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
                    if (textEffects != TextEffects.None)
                    {
                        outlineSize = CustomGUILayout.Slider("Effect size:", outlineSize, 1f, 5f, apiPrefix + ".outlineSize");
                    }
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }
            }
            else
            {
                if (pages == null || pages.Count == 0)
                {
                    pages.Clear();
                    pages.Add(new JournalPage());
                }
                numPages = pages.Count;

                for (int i = 0; i < pages.Count; i++)
                {
                    EditorGUILayout.BeginHorizontal();

                    if (pages[i].lineID >= 0)
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ", Text ID #" + pages[i].lineID + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }
                    else
                    {
                        CustomGUILayout.LabelField("Page #" + (i + 1).ToString() + ":", apiPrefix + ".pages[" + i.ToString() + "].text");
                    }

                    if (GUILayout.Button(Resource.CogIcon, GUILayout.Width(20f), GUILayout.Height(15f)))
                    {
                        sideMenu = i;
                        SideMenu();
                    }
                    EditorGUILayout.EndHorizontal();

                    pages[i].text = CustomGUILayout.TextArea(pages[i].text, GUILayout.MaxWidth(370f), apiPrefix + ".pages[" + i.ToString() + "].text");
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                }

                if (GUILayout.Button("Create new page", EditorStyles.miniButton))
                {
                    Undo.RecordObject(this, "Create journal page");
                    pages.Add(new JournalPage());
                }

                numPages = pages.Count;

                EditorGUILayout.EndVertical();
                EditorGUILayout.BeginVertical("Button");

                if (numPages > 1)
                {
                    showPage      = CustomGUILayout.IntSlider("Preview page #:", showPage, 1, numPages, apiPrefix + ".showPage");
                    startFromPage = CustomGUILayout.Toggle("Start from this page?", startFromPage, apiPrefix + ".startFromPage");
                }
                else
                {
                    showPage = 1;
                }

                if (source == MenuSource.AdventureCreator)
                {
                    anchor      = (TextAnchor)CustomGUILayout.EnumPopup("Text alignment:", anchor, apiPrefix + ".anchor");
                    textEffects = (TextEffects)CustomGUILayout.EnumPopup("Text effect:", textEffects, apiPrefix + ".textEffects");
                }
                else
                {
                    EditorGUILayout.EndVertical();
                    EditorGUILayout.BeginVertical("Button");
                    uiText = LinkedUiGUI <Text> (uiText, "Linked Text:", source);
                }

                actionListOnAddPage = (ActionListAsset)CustomGUILayout.ObjectField <ActionListAsset> ("ActionList on add page:", actionListOnAddPage, false, apiPrefix + ".actionListOnAddPage");
            }
            EditorGUILayout.EndVertical();

            base.ShowGUI(menu);
        }