Beispiel #1
0
        public List <LocationConversationData> ConversationDailyFilter(NPCData pNPC)
        {
            if (ShowDebug)
            {
                Debug.Log("Getting Daily filtered conversations");
            }
            List <LocationConversationData> dataList = new List <LocationConversationData>();

            foreach (LocationConversationData locationData in ConversationLocations)
            {
                //Get conversations that are eligible
                List <Conversation>      eligibleConversations = new List <Conversation>();
                LocationConversationData newLocationData       = new LocationConversationData();
                newLocationData.Location      = locationData.Location;
                newLocationData.Conversations = new List <Conversation>();
                foreach (Conversation conversation in locationData.Conversations)
                {
                    if (ShowDebug)
                    {
                        Debug.Log("Conversation: " + conversation.Title);
                    }
                    Field field = conversation.fields.Find(f => string.Equals(f.title, "SaidToday"));
                    if (field != null)
                    {
                        field.value = "False";
                    }

                    if (conversation.LookupBool("SayOncePerGame"))
                    {
                        if (conversation.LookupBool("SaidThisGame"))
                        {
                            if (ShowDebug)
                            {
                                Debug.Log("SaidThisGame, not adding");
                            }
                            continue;
                        }
                    }
                    if (CheckDailyFilter(conversation, pNPC))
                    {
                        eligibleConversations.Add(conversation);
                    }
                }
                newLocationData.Conversations = eligibleConversations;
                dataList.Add(newLocationData);
            }
            return(dataList);
        }
Beispiel #2
0
        List <LocationConversationData> CheckLocationFilter()
        {
            List <LocationConversationData> locationDatas = new List <LocationConversationData>();
            string locationString = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;

            GameManager.GameLocations location     = (GameManager.GameLocations)System.Enum.Parse((typeof(GameManager.GameLocations)), locationString);
            LocationConversationData  allLocations = new LocationConversationData();

            foreach (LocationConversationData locationData in DailyConversationLocations)
            {
                if (locationData.Location == GameManager.GameLocations.All)
                {
                    allLocations = locationData;
                    locationDatas.Add(allLocations);
                }
                if (locationData.Location == location)
                {
                    locationDatas.Add(locationData);
                }
            }
            return(locationDatas);
        }
Beispiel #3
0
        void FetchConversations()
        {
            if (ActorID == -1)
            {
                return;
            }
            if (DialogueDB == null)
            {
                return;
            }
            AllConversations.Clear();
            Meetings.Clear();
            List <Conversation> allConversations = DialogueDB.conversations;

            string[] allLocations = System.Enum.GetNames(typeof(GameManager.GameLocations));
            ConversationLocations.Clear();

            foreach (string location in allLocations)
            {
                LocationConversationData data = new LocationConversationData();
                data.Conversations = new List <Conversation>();
                data.Location      = (GameManager.GameLocations)System.Enum.Parse(typeof(GameManager.GameLocations), location);
                ConversationLocations.Add(data);
            }


            foreach (Conversation conversation in allConversations)
            {
                if (conversation.ActorID == ActorID)
                {
                    Field said = conversation.fields.Find(f => string.Equals(f.title, "SaidThisGame"));
                    said.value = "False";
                    bool isMeeting = conversation.LookupBool("isMeeting");
                    if (isMeeting)
                    {
                        Meetings.Add(conversation);
                        continue;
                    }
                    if (conversation.LookupBool("Cutscene"))
                    {
                        continue;
                    }
                    AllConversations.Add(conversation);

                    Field field = conversation.fields.Find(f => string.Equals(f.title, "Locations"));

                    if (field != null)
                    {
                        string        conversationLocations = field.value;
                        List <string> locationsList         = conversationLocations.Split(',').ToList <string>();
                        if (locationsList.Contains(GameManager.GameLocations.All.ToString()) || field.value == string.Empty)
                        {
                            if (ConversationLocations.Find(x => x.Location == GameManager.GameLocations.All) != null)
                            {
                                LocationConversationData locationData = ConversationLocations.Find(x => x.Location == GameManager.GameLocations.All);
                                locationData.Conversations.Add(conversation);
                            }
                            continue;
                        }
                        else
                        {
                            foreach (LocationConversationData locationData in ConversationLocations)
                            {
                                if (locationsList.Contains(locationData.Location.ToString()))
                                {
                                    locationData.Conversations.Add(conversation);
                                }
                            }
                        }
                    }
                }
            }
        }