Exemple #1
0
        override public void SkipActionGUI(List <Action> actions, bool showGUI)
        {
            if (numSockets < 0)
            {
                numSockets = 0;
            }

            if (numSockets < endings.Count)
            {
                endings.RemoveRange(numSockets, endings.Count - numSockets);
            }
            else if (numSockets > endings.Count)
            {
                if (numSockets > endings.Capacity)
                {
                    endings.Capacity = numSockets;
                }
                for (int i = endings.Count; i < numSockets; i++)
                {
                    ActionEnd newEnd = new ActionEnd();
                    if (i > 0)
                    {
                        newEnd.resultAction = ResultAction.Stop;
                    }
                    endings.Add(newEnd);
                }
            }

            foreach (ActionEnd ending in endings)
            {
                if (showGUI)
                {
                    EditorGUILayout.Space();
                    int i = endings.IndexOf(ending);

                    GVar _var = (parameterID < 0) ? GetVariable() : null;
                    if (_var != null)
                    {
                        string[] popUpLabels = _var.GenerateEditorPopUpLabels();
                        ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup("If = '" + popUpLabels[i] + "':", (ResultAction)ending.resultAction);
                    }
                    else if (AdvGame.GetReferences().variablesManager == null)
                    {
                        ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup("If = '" + i.ToString() + "':", (ResultAction)ending.resultAction);
                    }
                    else
                    {
                        PopUpLabelData popUpLabelData = AdvGame.GetReferences().variablesManager.GetPopUpLabelData(placeholderPopUpLabelDataID);
                        if (parameterID >= 0 && popUpLabelData != null)
                        {
                            ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup("If = '" + popUpLabelData.GetValue(i) + "':", (ResultAction)ending.resultAction);
                        }
                        else
                        {
                            ending.resultAction = (ResultAction)EditorGUILayout.EnumPopup("If = '" + i.ToString() + "':", (ResultAction)ending.resultAction);
                        }
                    }
                }

                if (ending.resultAction == ResultAction.RunCutscene && showGUI)
                {
                    if (isAssetFile)
                    {
                        ending.linkedAsset = (ActionListAsset)EditorGUILayout.ObjectField("ActionList to run:", ending.linkedAsset, typeof(ActionListAsset), false);
                    }
                    else
                    {
                        ending.linkedCutscene = (Cutscene)EditorGUILayout.ObjectField("Cutscene to run:", ending.linkedCutscene, typeof(Cutscene), true);
                    }
                }
                else if (ending.resultAction == ResultAction.Skip)
                {
                    SkipActionGUI(ending, actions, showGUI);
                }
            }
        }