Пример #1
0
        public void SaveToStoryArcs(EventDecisionData thisEvent)
        {
            int idx = curKingdomEventData.storyArcEvents.FindIndex(x => x.storyTitle == thisEvent.storyArc);

            if (curKingdomEventData.storyArcEvents[idx].storyEvents.Find(x => x.title == thisEvent.title) != null)
            {
                int storyIdx = curKingdomEventData.storyArcEvents[idx].storyEvents.FindIndex(x => x.title == thisEvent.title);
                curKingdomEventData.storyArcEvents[idx].storyEvents[storyIdx] = thisEvent;
            }
            else
            {
                curKingdomEventData.storyArcEvents[idx].AddEventDecision(thisEvent);
            }
            curKingdomEventData.storyArcEvents[idx].eventIntervals.Add(0);
            curKingdomEventData.storyArcEvents[idx].storyEventTitlesList.Add(thisEvent.title);
            thisEvent.SetMyStoryArc(curKingdomEventData.storyArcEvents[idx]);
        }
Пример #2
0
        public void ShowEventStorage()
        {
            bool SaveStorage = false;

            GUILayout.BeginArea(new Rect(5, 12, leftPanelWidth, 300));


            GUILayout.ExpandWidth(false);
            EditorStyles.textField.wordWrap = true;
            // Title
            GUILayout.BeginHorizontal();
            EditorGUIUtility.labelWidth = 34;
            EditorGUILayout.LabelField("Title:", EditorStyles.boldLabel, GUILayout.Width(75));
            curEvent.title = EditorGUILayout.TextField(curEvent.title, GUILayout.MaxWidth(300));
            GUILayout.EndHorizontal();
            // Description
            GUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Description:", GUILayout.MaxWidth(75));
            curEvent.description = EditorGUILayout.TextArea(curEvent.description, GUILayout.MaxHeight(100), GUILayout.MaxWidth(300));
            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            // ENUM TYPES
            GUILayout.BeginArea(new Rect(400, 10, 400, 300));
            GUILayout.BeginHorizontal();
            GUILayout.Label("Event Card:", GUILayout.Width(100));
            curEvent.eventType = (CardType)EditorGUILayout.EnumPopup(curEvent.eventType, GUILayout.MaxWidth(150));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Reporter:", GUILayout.Width(100));
            curEvent.reporterType = (ReporterType)EditorGUILayout.EnumPopup(curEvent.reporterType, GUILayout.MaxWidth(150));
            GUILayout.EndHorizontal();
            EditorGUILayout.LabelField("[Level and Difficulty]", EditorStyles.boldLabel);
            GUILayout.BeginHorizontal();
            GUILayout.Label("Kingdom Level:", GUILayout.Width(100));
            curEvent.levelRequired = (Territory.TerritoryLevel)EditorGUILayout.EnumPopup(curEvent.levelRequired, GUILayout.MaxWidth(150));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Difficulty :", GUILayout.Width(100));
            curEvent.difficultyType = (DifficultyType)EditorGUILayout.EnumPopup(curEvent.difficultyType, GUILayout.MaxWidth(150));
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Story Arc :", GUILayout.Width(75));
            curEvent.isStoryArc = EditorGUILayout.Toggle(curEvent.isStoryArc, GUILayout.MaxWidth(20));
            if (curEvent.isStoryArc)
            {
                if (!string.IsNullOrEmpty(curEvent.storyArc))
                {
                    storyArcPopupIdx = curKingdomEventData.storyArcEvents.FindIndex(x => x.storyTitle == curEvent.storyArc);
                }
                else
                {
                    storyArcPopupIdx = 0;
                    curEvent.SetMyStoryArc(curKingdomEventData.storyArcEvents[storyArcPopupIdx]);
                }

                storyArcPopupIdx = EditorGUILayout.Popup(storyArcPopupIdx, ObtainStoryArc(), GUILayout.MaxWidth(150));

                if (string.IsNullOrEmpty(curEvent.storyArc))
                {
                    if (curKingdomEventData.storyArcEvents != null && curKingdomEventData.storyArcEvents.Count > 0)
                    {
                        // ADD THIS EVENT TO STORY ARC
                        Debug.Log("Entering :" + storyArcPopupIdx);
                        if (curKingdomEventData.kingdomEvents.Contains(curEvent))
                        {
                            SaveToStoryArcs(curEvent);
                        }
                    }
                }
                else if (curKingdomEventData.storyArcEvents[storyArcPopupIdx] != null && curEvent.storyArc != curKingdomEventData.storyArcEvents[storyArcPopupIdx].storyTitle)
                {
                    Debug.Log("Changes has been made!");
                    // Removing from previous Event
                    int prevIdx = curKingdomEventData.storyArcEvents.FindIndex(x => x.storyTitle == curEvent.storyArc);
                    Debug.Log("Index:" + prevIdx + " Story Title:" + curKingdomEventData.storyArcEvents[prevIdx].storyTitle);
                    curKingdomEventData.storyArcEvents[prevIdx].RemoveEventDecision(curEvent);

                    // Setting Changes made
                    curKingdomEventData.storyArcEvents[storyArcPopupIdx].AddEventDecision(curEvent);
                    curEvent.SetMyStoryArc(curKingdomEventData.storyArcEvents[storyArcPopupIdx]);
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(curEvent.storyArc))
                {
                    RemoveFromStoryArc(curEvent);
                    storyArcPopupIdx = 0;
                }
            }
            GUILayout.EndHorizontal();


            GUILayout.EndArea();

            GUILayout.BeginArea(new Rect(300, position.height - 50, leftPanelWidth, 300));
            SaveStorage = GUILayout.Button("SAVE STORAGE", GUILayout.MaxWidth(300));
            if (SaveStorage)
            {
                Save();
                SaveStorage = false;
            }
            GUILayout.EndArea();
            ShowDecisionOptions();
        }