Esempio n. 1
0
        public void AddEventDecision(EventDecisionData data)
        {
            if (eventIntervals == null)
            {
                eventIntervals = new List <int>();
            }
            if (eventBoosts == null)
            {
                eventBoosts = new List <float>();
            }
            if (storyEvents == null)
            {
                storyEvents = new List <EventDecisionData>();
            }
            if (storyEvents.Find(x => x.title == data.title) != null)
            {
                Debug.Log("We detected story inside!");
                Debug.Log(storyEvents.Count);
                return;
            }
            Debug.Log("Entered!");
            storyEvents.Add(data);
            eventIntervals.Add(0);
            eventBoosts.Add(0.5f);
            if (storyEventTitlesList == null)
            {
                storyEventTitlesList = new List <string>();
            }
            Debug.Log("Adding New Event:" + data.title);
            string tmp = data.title;

            storyEventTitlesList.Add(tmp);
        }
        public void SetupDecisions(EventDecisionData thisEvent)
        {
            activeDecisionCount = thisEvent.eventDecision.Count;
            for (int i = 0; i < decisionOptionsList.Count; i++)
            {
                if (i < thisEvent.eventDecision.Count)
                {
                    decisionOptionsList[i].AddDescription(thisEvent.eventDecision[i]);

                    if (enableDelay)
                    {
                        StartCoroutine(DelayActivationDecision(i));
                    }
                    else
                    {
                        decisionOptionsList[i].gameObject.SetActive(true);
                        decisionOptionsList[i].isClickable = true;
                    }
                }
                else
                {
                    decisionOptionsList[i].gameObject.SetActive(false);
                }
            }
        }
Esempio n. 3
0
        public void RemoveEventDecision(EventDecisionData data)
        {
            Debug.Log("Entering Remove Phase!");
            if (storyEvents == null)
            {
                storyEvents = new List <EventDecisionData>();
            }

            Debug.Log("Attempting Remove!");
            if (storyEvents.Find(x => x.title == data.title) != null)
            {
                Debug.Log("Meow");
                int idx = storyEvents.FindIndex(x => x.title == data.title);
                Debug.Log("Removing At:" + idx);
                storyEvents.RemoveAt(idx);
                eventBoosts.RemoveAt(idx);

                if (eventIntervals == null)
                {
                    eventIntervals = new List <int>();
                }

                eventIntervals.RemoveAt(idx);
                if (storyEventTitlesList == null)
                {
                    storyEventTitlesList = new List <string>();
                }
                storyEventTitlesList.RemoveAt(idx);
            }
        }
Esempio n. 4
0
        // FILTER BY STORY
        public List <EventDecisionData> GetTerritoryDifficultyFilteredEvents(List <EventDecisionData> difficultyTerritoryFiltered)
        {
            /* ================================ COMPUTATION NOTES ================================
             *
             * PLAYER ROLL BASED FOR STORIES
             * COMPUTATION[Base % +(# of Weeks of NO EVENT * 0.007%) = TOTAL STORY % REVEAL]
             *
             * ===================================================================================
             */
            List <EventDecisionData> result = difficultyTerritoryFiltered;
            // Debug.Log("FILTERED COUNT : " + result.Count);
            int chosenStory = result.FindIndex(x => x.isStoryArc);

            bool allowStory        = ComputeStoryArcChance(curPlayerData.weekCount);
            EventDecisionData item = result[chosenStory];

            // ROLL DICE
            if (allowStory && !curPlayerData.IsStoryArcFinished(item.storyArc))
            {
                currentStoryChance = storyChance;
            }
            else
            {
                currentStoryChance += storyChance;
            }

            for (int i = 0; i < result.Count; i++)
            {
                if (i != chosenStory)
                {
                    if (result[i].isStoryArc)
                    {
                        result[i] = null;
                    }
                }
                else
                {
                    // REPLACE CHOSEN STORY FOR INITIAL STORY.
                    if (i == chosenStory && allowStory && !curPlayerData.IsStoryArcFinished(item.storyArc))
                    {
                        EventDecisionData newStory = storyArcEvents.Find(x => x.storyTitle == result[i].storyArc).storyEvents[0];
                        result[i] = newStory;
                    }
                    else
                    {
                        result[i] = null;
                    }
                }
            }

            List <EventDecisionData> filteredResult = result.FindAll(x => x != null);

            return(filteredResult);
        }
 public void ReceiveEvent(EventDecisionData thisEvent)
 {
     if (!string.IsNullOrEmpty(currentEvent.title))
     {
         queuedEvents.Add(thisEvent);
     }
     else
     {
         currentEvent = thisEvent;
         ShowCurrentEvent();
     }
 }
Esempio n. 6
0
        public void ShowNewEvent(EventDecisionData thisEvent)
        {
            CardOption thisCard = cardsList.Find(x => x.thisCardType == thisEvent.eventType);


            if (thisCard != null)
            {
                thisCard.gameObject.SetActive(true);
                thisCard.InitializeText(thisEvent.title, thisEvent.description);
                currentCard = thisCard;
                currentCard.ShowCardAnim();
            }
        }
Esempio n. 7
0
        public void RemoveFromStoryArc(EventDecisionData thisEvent)
        {
            int idx = curKingdomEventData.storyArcEvents.FindIndex(x => x.storyTitle == thisEvent.storyArc);

            curKingdomEventData.storyArcEvents[idx].RemoveEventDecision(thisEvent);

            if (curKingdomEventData.storyArcEvents[idx].eventIntervals.Count - 1 >= idx)
            {
                curKingdomEventData.storyArcEvents[idx].eventIntervals.RemoveAt(idx);
            }
            if (curKingdomEventData.storyArcEvents[idx].storyEventTitlesList.Contains(thisEvent.title))
            {
                curKingdomEventData.storyArcEvents[idx].storyEventTitlesList.RemoveAt(idx);
            }
            thisEvent.storyArc = "";
        }
Esempio n. 8
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]);
        }
Esempio n. 9
0
        public void AddKingdomEvent(EventDecisionData thisEvent)
        {
            if (kingdomEvents == null)
            {
                return;
            }

            if (kingdomEvents.Find(x => x.title == thisEvent.title) != null)
            {
                return;
            }
            if (kingdomEvents == null)
            {
                kingdomEvents = new List <EventDecisionData>();
            }

            kingdomEvents.Add(thisEvent);
        }
Esempio n. 10
0
        public EventDecisionData ForcedInitialStoryEventDataToReturn(string thisArc = "")
        {
            EventDecisionData        thisData          = null;
            List <EventDecisionData> filteredEventList = new List <EventDecisionData>();

            filteredEventList = kingdomEvents.FindAll(x => x.storyArc == arcForced);
            StoryArcEventsData arc = new StoryArcEventsData();

            if (string.IsNullOrEmpty(thisArc))
            {
                arc = storyArcEvents.Find(x => x.storyTitle == arcForced);
            }
            else
            {
                arc = storyArcEvents.Find(x => x.storyTitle == thisArc);
            }

            thisData = arc.storyEvents[0];
            Debug.Log("FORCED EVENT NAME: " + arc.storyEvents[0].title);
            return(thisData);
        }
Esempio n. 11
0
        public void SwapArcEvents(int transferTo, int transferFrom)
        {
            EventDecisionData tmp = curKingdomEventData.storyArcEvents[selectedArcIdx].storyEvents[transferFrom];

            curKingdomEventData.storyArcEvents[selectedArcIdx].storyEvents[transferFrom] = curKingdomEventData.storyArcEvents[selectedArcIdx].storyEvents[transferTo];
            curKingdomEventData.storyArcEvents[selectedArcIdx].storyEvents[transferTo]   = tmp;


            int temp = curKingdomEventData.storyArcEvents[selectedEventIdx].eventIntervals[transferFrom];

            curKingdomEventData.storyArcEvents[selectedEventIdx].eventIntervals[transferFrom] = curKingdomEventData.storyArcEvents[selectedEventIdx].eventIntervals[transferTo];
            curKingdomEventData.storyArcEvents[selectedEventIdx].eventIntervals[transferTo]   = temp;


            float boost = curKingdomEventData.storyArcEvents[selectedEventIdx].eventBoosts[transferFrom];

            curKingdomEventData.storyArcEvents[selectedEventIdx].eventBoosts[transferFrom] = curKingdomEventData.storyArcEvents[selectedEventIdx].eventBoosts[transferTo];
            curKingdomEventData.storyArcEvents[selectedEventIdx].eventBoosts[transferTo]   = boost;

            if (curKingdomEventData.storyArcEvents.Count - 1 <= selectedArcIdx)
            {
                curKingdomEventData.storyArcEvents[selectedArcIdx].AdjustTitleList();
            }
        }
Esempio n. 12
0
        public EventDecisionData GetEventByTitle(string eventTitle)
        {
            EventDecisionData tmp = kingdomEvents.Find(x => x.title == eventTitle);

            return(tmp);
        }
Esempio n. 13
0
        public void ShowStoryArcList()
        {
            bool addArc    = false;
            bool saveArc   = false;
            bool removeArc = false;

            GUILayout.BeginArea(new Rect(680, 275, 400, position.height - 375));
            GUILayout.BeginHorizontal();
            GUILayout.Box("Story Arcs", titleText, GUILayout.Width(295), GUILayout.Height(20));
            GUILayout.EndHorizontal();

            arcScrollPos = EditorGUILayout.BeginScrollView(arcScrollPos, new GUIStyle("RL Background"), GUILayout.Width(300), GUILayout.Height(position.height - 10));

            if (curKingdomEventData.storyArcEvents != null && curKingdomEventData.storyArcEvents.Count > 0)
            {
                for (int i = 0; i < curKingdomEventData.storyArcEvents.Count; i++)
                {
                    bool isClicked = false;
                    isClicked = GUILayout.Button(curKingdomEventData.storyArcEvents[i].storyTitle, (selectedArc != null && curKingdomEventData.storyArcEvents[i].storyTitle == selectedArc.storyTitle) ? selectedText : notSelectedText);
                    if (isClicked)
                    {
                        if (curKingdomEventData.storyArcEvents[i] != null)
                        {
                            selectedArc    = curKingdomEventData.storyArcEvents[i];
                            selectedArcIdx = i;
                            curArc         = selectedArc;
                        }
                        isClicked = false;
                    }
                }
            }

            EditorGUILayout.EndScrollView();
            GUILayout.EndArea();

            GUILayout.BeginArea(new Rect(680, position.height - 95, 400, 225));

            GUILayout.BeginHorizontal();
            saveArc = GUILayout.Button((curArc == selectedArc) ? "Modify" : "Save", GUILayout.MaxWidth(100));
            if (curKingdomEventData.storyArcEvents == null)
            {
                curKingdomEventData.storyArcEvents = new List <StoryArcEventsData>();
            }
            if (curKingdomEventData.storyArcEvents.Find(x => x.storyTitle == curArc.storyTitle) != null)
            {
                addArc = GUILayout.Button("Create New", GUILayout.MaxWidth(100));
            }
            if (curKingdomEventData.storyArcEvents.Find(x => x.storyTitle == curArc.storyTitle) != null)
            {
                removeArc = GUILayout.Button("Remove", GUILayout.MaxWidth(100));
            }
            GUILayout.EndHorizontal();

            GUILayout.EndArea();

            // ADD BUTTON
            if (addArc)
            {
                curEvent      = new EventDecisionData();
                selectedEvent = null;
            }
            // REMOVE BUTTON
            if (removeArc)
            {
                GUI.FocusControl(null);
                removeArc = false;
                if (selectedEvent != null)
                {
                    curKingdomEventData.storyArcEvents.RemoveAt(selectedArcIdx);
                    selectedEvent = null;
                    curEvent      = new EventDecisionData();
                }
            }
            // SAVE BUTTON
            if (saveArc && !string.IsNullOrEmpty(curArc.storyTitle))
            {
                GUI.FocusControl(null);
                if (curKingdomEventData.storyArcEvents == null)
                {
                    curKingdomEventData.storyArcEvents = new List <StoryArcEventsData>();
                }
                if (curKingdomEventData.storyArcEvents.Find(x => x.storyTitle == curArc.storyTitle) == null)
                {
                    curKingdomEventData.storyArcEvents.Add(curArc);
                    curArc = new StoryArcEventsData();
                }
                else
                {
                    // MODIFY CURRENT EVENT
                    if ((curArc == selectedArc))
                    {
                        curKingdomEventData.storyArcEvents[selectedArcIdx] = curArc;
                        curArc      = new StoryArcEventsData();
                        selectedArc = null;
                    }
                    else
                    {
                        Debug.LogError("MULTIPLE ARCS WITH SAME TITLE OCCURRED, PLEACE CHECK LIST!");
                    }
                }
                saveArc = false;
            }
        }
Esempio n. 14
0
        public void ShowEventList()
        {
            bool addEvent    = false;
            bool saveEvent   = false;
            bool removeEvent = false;

            GUILayout.BeginArea(new Rect(680, 10, 400, position.height - 375));
            GUILayout.BeginHorizontal();
            GUILayout.Box("Kingdom Events", titleText, GUILayout.Width(295), GUILayout.Height(20));
            GUILayout.EndHorizontal();

            eventScrollPos = GUILayout.BeginScrollView(eventScrollPos, new GUIStyle("RL Background"), GUILayout.Width(300), GUILayout.Height(position.height - 400));

            if (curKingdomEventData.kingdomEvents != null && curKingdomEventData.kingdomEvents.Count > 0)
            {
                for (int i = 0; i < curKingdomEventData.kingdomEvents.Count; i++)
                {
                    bool   isClicked = false;
                    string listName  = "";

                    GUILayout.BeginHorizontal();
                    isClicked = GUILayout.Button(curKingdomEventData.kingdomEvents[i].title, (selectedEvent != null && curKingdomEventData.kingdomEvents[i].title == selectedEvent.title) ? selectedText : notSelectedText);
                    if (!string.IsNullOrEmpty(curKingdomEventData.kingdomEvents[i].storyArc))
                    {
                        listName = "[" + curKingdomEventData.kingdomEvents[i].storyArc + "]";
                        GUILayout.Label(listName);
                    }
                    GUILayout.EndHorizontal();
                    if (isClicked)
                    {
                        if (curKingdomEventData.kingdomEvents[i] != null)
                        {
                            selectedEvent    = curKingdomEventData.kingdomEvents[i];
                            selectedEventIdx = i;
                            curEvent         = selectedEvent;
                        }
                        isClicked = false;
                    }
                }
            }

            GUILayout.EndArea();
            GUILayout.EndScrollView();

            GUILayout.BeginArea(new Rect(680, position.height - 360, 400, 225));

            GUILayout.BeginHorizontal();
            saveEvent = GUILayout.Button((curEvent == selectedEvent) ? "Modify" : "Save", GUILayout.MaxWidth(100));
            if (curKingdomEventData.kingdomEvents.Find(x => x.title == curEvent.title) != null)
            {
                addEvent = GUILayout.Button("Create New", GUILayout.MaxWidth(100));
            }
            if (curKingdomEventData.kingdomEvents.Find(x => x.title == curEvent.title) != null)
            {
                removeEvent = GUILayout.Button("Remove", GUILayout.MaxWidth(100));
            }
            GUILayout.EndHorizontal();

            GUILayout.EndArea();

            // ADD BUTTON
            if (addEvent)
            {
                curEvent      = new EventDecisionData();
                selectedEvent = null;
            }
            // REMOVE BUTTON
            if (removeEvent)
            {
                GUI.FocusControl(null);
                removeEvent = false;
                if (selectedEvent != null)
                {
                    curKingdomEventData.kingdomEvents.RemoveAt(selectedEventIdx);
                    selectedEvent = null;
                    curEvent      = new EventDecisionData();
                }
            }
            // SAVE BUTTON
            if (saveEvent && !string.IsNullOrEmpty(curEvent.title))
            {
                GUI.FocusControl(null);
                if (curKingdomEventData.kingdomEvents == null)
                {
                    curKingdomEventData.kingdomEvents = new List <EventDecisionData>();
                    curEvent = new EventDecisionData();
                }
                else if (curKingdomEventData.kingdomEvents.Find(x => x.title == curEvent.title) == null)
                {
                    curKingdomEventData.kingdomEvents.Add(curEvent);
                    if (curEvent.isStoryArc)
                    {
                        SaveToStoryArcs(curEvent);
                    }
                    curEvent = new EventDecisionData();
                }
                else
                {
                    // MODIFY CURRENT EVENT
                    if ((curEvent == selectedEvent))
                    {
                        if (selectedEvent.isStoryArc)
                        {
                            SaveToStoryArcs(selectedEvent);
                        }
                        curKingdomEventData.kingdomEvents[selectedEventIdx] = curEvent;
                        curEvent      = new EventDecisionData();
                        selectedEvent = null;
                    }
                    else
                    {
                        Debug.LogError("MULTIPLE EVENTS WITH SAME TITLE OCCURRED, PLEACE CHECK LIST!");
                    }
                }
                saveEvent = false;
            }
        }