public override void UpdateEvent() { if (chatMessage == null) { foreach (string discoveryId in discoveries) { Discovery discovery = NeverdawnDatabase.GetDisovery(discoveryId); PlayerJournal.CreateEntry(discovery, target); } chatMessage = new ChatMessage(null, updatedMessage, ChatMessageIconMode.None); UIChatMenu.SendChatMessage(chatMessage); return; } if (controllers == null || controllers.Count == 0) { controllers = GameController.activeControllers; } foreach (AvatarController controller in controllers) { if (controller.inputModule.GetButtonDown(NeverdawnInputButton.Confirm)) { close(); } if (controller.inputModule.GetButtonDown(NeverdawnInputButton.Cancel)) { close(); } } }
public void PlayerFoundClue(ClueObject clue) { // TODO: check if the object is the not-paper photo. If so, play PICKUP AudioPlayer.PlaySound(AudioClipIndex.PAPER); ClueItem item = clue.mItem; PersonState player = mPeople[0]; // add clue to journal if (item.info != null) { PlayerJournal.AddClue(item.info); } player.knowledge.AddKnowledge(item.info.GetSentence()); List <ClueItem> clues = mCluesInRooms[mCurrentRoom]; clues.Remove(item); Destroy(clue.gameObject); Sprite relevantImage = SpriteManager.GetSprite(item.spriteName); DialogBlock discussion = new DialogBlock(new PersonState[] { player }, OnClueDismissed); discussion.QueueDialogue(player, new Sprite[] { relevantImage }, item.description); mCluesFoundThisRound++; if (mCluesFoundThisRound >= MAX_CLUES_PER_ROUND) { discussion.QueueDialogue(player, new Sprite[] { }, "I'd better get back to the common area now."); } discussion.Start(); }
void Awake() { if (instance == null) { instance = this; } _entries = new List <JournalEntry>(); }
private void Awake() { if (Instance == null) { Instance = this; } else { Debug.LogError("Multiple PlayerJournals"); } }
public void ToggleJournal() { GameObject journal = transform.root.gameObject.transform.Find("journalContent").gameObject; journal.SetActive(!journal.activeSelf); if (journal.activeSelf) { List <PlayerJournal.SentenceHistory> strings = PlayerJournal.GetJournal(); if (strings.Count > 0) { journal.GetComponentInChildren <Text>().text = "• " + string.Join("\n• ", strings); } } }
private void Awake() { if (instance != null) { Debug.LogWarning("More than one instance"); return; } instance = this; PlayerQuests = new List <Quest>(); playerJournal.SetActive(false); controllers = new Dictionary <QuestType, QuestItemController>() { { QuestType.Combat, null }, { QuestType.Fetch, null }, }; }
public override void UpdateEvent() { if (selectedEvent != null && !selectedEvent.IsEventComplete()) { selectedEvent.UpdateEvent(); return; } if (chatMessage == null) { if (target != null) { Talker talker = target.GetComponent <Talker>(); if (talker != null) { Topic[] talkerTopics = NeverdawnDatabase.GetTopics(talker.topicIds, true); Topic[] talkTopics = PlayerJournal.GetCommonTopics(talkerTopics); TopicQuestion[] questions = new TopicQuestion[talkTopics.Length + 1]; for (int i = 0; i < talkTopics.Length; i++) { questions[i] = TopicQuestion.Create(talker, talkTopics[i]); } questions[questions.Length - 1] = new TopicQuestion() { message = "That'll be all.", trigger = null }; chatMessage = new QuestionMessage(getTargetSelf(0).identity.icon, string.Empty, questions); UIChatMenu.SendQuestionMessage(chatMessage, questionSelected); } } } }
public override bool IsEventAvailable() { return(!PlayerJournal.HasDiscoveries(discoveries) && base.IsEventAvailable()); }
public void Read(BinaryReader _br, uint _version) { //ECD ecd = new EntityCreationData(); ecd.read(_br, false); //FOOD/DRINK food = new LiveStats(Constants.cMaxPlayerFood, Constants.cFoodOversaturate); food.Read(_br); drink = new LiveStats(Constants.cMaxPlayerDrink, Constants.cDrinkOversaturate); drink.Read(_br); //INVENTORY inventory = GameUtils.ReadItemStack(_br); selectedInventorySlot = _br.ReadByte(); //BAG bag = GameUtils.ReadItemStack(_br); //REMOVED - To allow for bigger backpack mods //if (bag.Length > 32) //{ // var destinationArray = ItemStack.CreateArray(32); // Array.Copy(bag, destinationArray, 32); // bag = destinationArray; //} //CRAFTED alreadyCraftedList = new HashSet <string>(); int num = _br.ReadUInt16(); for (var i = 0; i < num; i++) { alreadyCraftedList.Add(_br.ReadString()); } //SPAWNS var b = _br.ReadByte(); for (var j = 0; j < b; j++) { spawnPoints.Add(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32())); } selectedSpawnPointKey = _br.ReadInt64(); //LOADED _br.ReadBoolean(); _br.ReadInt16(); if (_version > 1u) { bLoaded = _br.ReadBoolean(); } //LASTSPAWN if (_version > 2u) { lastSpawnPosition = new SpawnPosition(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()), _br.ReadSingle()); } else if (_version > 1u) { lastSpawnPosition = new SpawnPosition(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()), 0f); } //ID if (_version > 3u) { id = _br.ReadInt32(); } //BACKPACK if (_version > 4u) { droppedBackpackPosition = new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()); } //STATS/EQUIPMENT if (_version > 5u) { playerKills = _br.ReadInt32(); zombieKills = _br.ReadInt32(); deaths = _br.ReadInt32(); score = _br.ReadInt32(); equipment = Equipment.Read(_br); } //RECIPES if (_version > 6u) { unlockedRecipeList = new List <string>(); num = _br.ReadUInt16(); for (var k = 0; k < num; k++) { unlockedRecipeList.Add(_br.ReadString()); } } //MARKER if (_version > 7u) { _br.ReadUInt16(); markerPosition = NetworkUtils.ReadVector3i(_br); } //FAVS if (_version > 8u) { favoriteEquipment = Equipment.Read(_br); } //EXP if (_version > 10u) { experience = _br.ReadUInt32(); } //LEVEL if (_version > 22u) { level = _br.ReadInt32(); } //CROUCHED if (_version > 11u) { bCrouchedLocked = _br.ReadBoolean(); } //CRAFTINGDATA craftingData.Read(_br, _version); //SKILLS - part1 if (_version > 14u) { if (_version < 18u) { var pdfskills = new Skills(); pdfskills.Read(_br, _version); } } //FAVRECIPES if (_version > 16u) { favoriteRecipeList = new List <string>(); num = _br.ReadUInt16(); for (var l = 0; l < num; l++) { favoriteRecipeList.Add(_br.ReadString()); } } //SKILLS - part2 if (_version > 17u) { var num2 = (int)_br.ReadUInt32(); if (num2 > 0) { //custom skill loader var pdfskills = new MemoryStream(_br.ReadBytes(num2)); var skillsReader = new Skills(); skillsReader.Read(new BinaryReader(pdfskills), _version); skills = skillsReader.GetAllSkills(); //end custom skill loader } } //STATS if (_version > 18u) { totalItemsCrafted = _br.ReadUInt32(); distanceWalked = _br.ReadSingle(); longestLife = _br.ReadSingle(); } if (_version > 35u) { gameStageLifetimeTicks = _br.ReadUInt64(); } else { gameStageLifetimeTicks = 0uL; } if (_version > 19u) { waypoints = new WaypointCollection(); waypoints.Read(_br); } if (_version > 23u) { skillPoints = _br.ReadInt32(); } if (_version > 24u) { questJournal = new QuestJournal(); questJournal.Read(_br); } if (_version > 25u) { deathUpdateTime = _br.ReadInt32(); } if (_version > 26u) { currentLife = _br.ReadSingle(); } if (_version > 29u) { bDead = _br.ReadBoolean(); } if (_version > 30u) { _br.ReadByte(); IsModdedSave = _br.ReadBoolean(); } if (_version > 31u) { playerJournal = new PlayerJournal(); playerJournal.Read(_br); } if (_version > 32u) { rentedVMPosition = NetworkUtils.ReadVector3i(_br); rentalEndTime = _br.ReadUInt64(); } if (_version > 33u) { trackedFriendEntityIds.Clear(); int num3 = _br.ReadUInt16(); for (var m = 0; m < num3; m++) { trackedFriendEntityIds.Add(_br.ReadInt32()); } } if (_version > 34u) { var num4 = _br.ReadInt32(); if (num4 > 0) { //var pdfstealth = new MemoryStream(_br.ReadBytes(num4)); //todo: custom loader } } }
public virtual bool IsEventAvailable() { return(PlayerJournal.HasDiscoveries(conditions, inverseConditions)); }
public void Read(BinaryReader _br, uint _version) { ecd = new EntityCreationData(); ecd.read(_br, false); food = new LiveStats(Constants.cMaxPlayerFood, Constants.cFoodOversaturate); food.Read(_br); drink = new LiveStats(Constants.cMaxPlayerDrink, Constants.cDrinkOversaturate); drink.Read(_br); inventory = GameUtils.ReadItemStack(_br); selectedInventorySlot = _br.ReadByte(); bag = GameUtils.ReadItemStack(_br); if (bag.Length > 32) { ItemStack[] destinationArray = ItemStack.CreateArray(32); Array.Copy(bag, destinationArray, 32); bag = destinationArray; } alreadyCraftedList = new HashSet <string>(); int num = _br.ReadUInt16(); for (int i = 0; i < num; i++) { alreadyCraftedList.Add(_br.ReadString()); } byte b = _br.ReadByte(); for (int j = 0; j < b; j++) { spawnPoints.Add(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32())); } selectedSpawnPointKey = _br.ReadInt64(); _br.ReadBoolean(); _br.ReadInt16(); if (_version > 1u) { bLoaded = _br.ReadBoolean(); } if (_version > 2u) { lastSpawnPosition = new SpawnPosition(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()), _br.ReadSingle()); } else if (_version > 1u) { lastSpawnPosition = new SpawnPosition(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()), 0f); } if (_version > 3u) { id = _br.ReadInt32(); } if (_version > 4u) { droppedBackpackPosition = new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()); } if (_version > 5u) { playerKills = _br.ReadInt32(); zombieKills = _br.ReadInt32(); deaths = _br.ReadInt32(); score = _br.ReadInt32(); equipment = Equipment.Read(_br); } if (_version > 6u) { unlockedRecipeList = new List <string>(); num = _br.ReadUInt16(); for (int k = 0; k < num; k++) { unlockedRecipeList.Add(_br.ReadString()); } } if (_version > 7u) { _br.ReadUInt16(); markerPosition = NetworkUtils.ReadVector3i(_br); } if (_version > 8u) { favoriteEquipment = Equipment.Read(_br); } if (_version > 10u) { experience = _br.ReadUInt32(); } if (_version > 22u) { level = _br.ReadInt32(); } if (_version > 11u) { bCrouchedLocked = _br.ReadBoolean(); } craftingData.Read(_br, _version); if (_version > 14u) { if (_version < 18u) { Skills pdfskills = new Skills(); pdfskills.Read(_br, _version); } } if (_version > 16u) { favoriteRecipeList = new List <string>(); num = _br.ReadUInt16(); for (int l = 0; l < num; l++) { favoriteRecipeList.Add(_br.ReadString()); } } if (_version > 17u) { int num2 = (int)_br.ReadUInt32(); if (num2 > 0) { //custom skill loader MemoryStream pdfskills = new MemoryStream(0); pdfskills = new MemoryStream(_br.ReadBytes(num2)); EntityPlayer EP = new EntityPlayer(); EP.Skills = new Skills(); if (pdfskills.Length > 0L) { EP.Skills.Read(new BinaryReader(pdfskills), 34u); } skills = EP.Skills.GetAllSkills(); //end custom skill loader } } if (_version > 18u) { totalItemsCrafted = _br.ReadUInt32(); distanceWalked = _br.ReadSingle(); longestLife = _br.ReadSingle(); } if (_version > 19u) { waypoints = new WaypointCollection(); waypoints.Read(_br); } if (_version > 23u) { skillPoints = _br.ReadInt32(); } if (_version > 24u) { questJournal = new QuestJournal(); questJournal.Read(_br); } if (_version > 25u) { deathUpdateTime = _br.ReadInt32(); } if (_version > 26u) { currentLife = _br.ReadSingle(); } if (_version > 29u) { bDead = _br.ReadBoolean(); } if (_version > 30u) { _br.ReadByte(); IsModdedSave = _br.ReadBoolean(); } if (_version > 31u) { playerJournal = new PlayerJournal(); playerJournal.Read(_br); } if (_version > 32u) { rentedVMPosition = NetworkUtils.ReadVector3i(_br); rentalEndTime = _br.ReadUInt64(); } if (_version > 33u) { trackedFriendEntityIds.Clear(); int num3 = _br.ReadUInt16(); for (int m = 0; m < num3; m++) { trackedFriendEntityIds.Add(_br.ReadInt32()); } } }
private void StartStage(GameStage stage) { Debug.Log("starting stage " + stage); mCurrentStage = stage; if (stage == GameStage.SEARCH_1) { // NEVER COMMIT THESE LINES // mArrestedPerson = Player; // stage = GameStage.CLOSURE; } if (stage == GameStage.SEARCH_1 || stage == GameStage.SEARCH_2 || stage == GameStage.SEARCH_3) { if (stage == GameStage.SEARCH_1) { PlayerJournal.AddListen(VictimId, mStartingClue.GetSentence()); // wait until after the dialogue is over to add this to the player journal } UIController.Get().ShowJournalButton(); UIController.Get().ShowMusicButton(); // assign npcs to rooms (for now, ensure they go to different rooms) int[] roomChoices = Utilities.RandomList(clueRooms.Length, 2); for (int i = 0, j = 0; i < 3; ++i) { mRoundClues[i] = null; if (i != PlayerId) { string npcRoom = clueRooms[roomChoices[j++]]; MoveToRoom(i, npcRoom); // npcs pick up a clue in the room they move to if (mCluesInRooms.ContainsKey(npcRoom)) { List <ClueItem> cluesInRoom = mCluesInRooms[npcRoom]; if (cluesInRoom.Count > 0) { int clueIdx = Random.Range(0, cluesInRoom.Count); ClueItem clue = cluesInRoom[clueIdx]; cluesInRoom.RemoveAt(clueIdx); ClueInfo info = clue.info; mPeople[i].knowledge.AddKnowledge(info.GetSentence()); mRoundClues[i] = info; } } } } MoveToRoom(PlayerId, mCurrentRoom); // hack to reload room with npcs gone } else if (stage == GameStage.COMMUNAL_1 || stage == GameStage.COMMUNAL_2 || stage == GameStage.COMMUNAL_3) { for (int i = 0; i < 3; ++i) { MoveToRoom(i, openingScene); } } else if (stage == GameStage.POLICE) { MoveToRoom(PlayerId, "EndScene"); } else if (stage == GameStage.REVEAL) { DialogBlock discussion = new DialogBlock(mPeople, OnDialogueDismissed); // check each accusation int[] votes = { 0, 0, 0 }; int highestVoteIdx = -1; int majority = -1; int mostVotes = 0; int totalVotes = 0; for (int i = 0; i < 3; ++i) { if (mAccusations[i] >= 0 && mAccusations[i] < 3) { votes[mAccusations[i]]++; totalVotes++; if (votes[mAccusations[i]] > mostVotes) { mostVotes = votes[mAccusations[i]]; highestVoteIdx = mAccusations[i]; } if (votes[mAccusations[i]] >= 2) { majority = mAccusations[i]; } } } if (majority >= 0) { discussion.QueueDialogue(Police, new Sprite[] { }, "So it was the " + mPeople[majority].AttributeMap[NounType.HairColor] + "?"); discussion.QueueDialogue(Police, new Sprite[] { mPeople[majority].HeadSprite }, "You're under arrest, ma'am."); discussion.QueueDialogue(Police, new Sprite[] { mPeople[(majority + 1) % 3].HeadSprite, mPeople[(majority + 2) % 3].HeadSprite }, "You two, come along and we'll get official statements."); mWasAllArrested = false; mArrestedPerson = mPeople[majority]; } else { // no one got a majority Sprite[] allThree = new Sprite[] { mPeople[0].HeadSprite, mPeople[1].HeadSprite, mPeople[2].HeadSprite }; discussion.QueueDialogue(Police, allThree, "You can't agree on what happened?"); discussion.QueueDialogue(Police, allThree, "I'm going to have to take you all in to the station."); mWasAllArrested = true; } discussion.Start(); } else if (stage == GameStage.CLOSURE) { blackFade.SetTrigger("FadeOut"); // Give me closure please! // TODO - tell more of the story. // TODO - typing sound if (mWasAllArrested) { mEpilogueLines.Add("Because you could not come to a decision as a group, all three of you were arrested."); if (Player.IsKiller) { mEpilogueLines.Add("You were the killer."); } else { mEpilogueLines.Add(mPeople[KillerId].AttributeMap[NounType.HairColor].AsSubject() + " was the killer."); } } else { if (mArrestedPerson.IsKiller && mArrestedPerson.IsPlayer) { mEpilogueLines.Add("You were the killer, and you were caught."); } else if (!mArrestedPerson.IsKiller && mArrestedPerson.IsPlayer) { mEpilogueLines.Add(mPeople[KillerId].AttributeMap[NounType.HairColor].AsSubject() + " was the killer, but you were the one arrested."); } else if (mArrestedPerson.IsKiller && !mArrestedPerson.IsPlayer) { mEpilogueLines.Add(mPeople[KillerId].AttributeMap[NounType.HairColor].AsSubject() + " was the killer, and was correctly arrested."); } else if (!mArrestedPerson.IsKiller && !mArrestedPerson.IsPlayer) { mEpilogueLines.Add(mPeople[KillerId].AttributeMap[NounType.HairColor].AsSubject() + " was the killer, but " + mArrestedPerson.AttributeMap[NounType.HairColor].AsSubject() + " was arrested instead."); } else if (!mArrestedPerson.IsKiller && Player.IsKiller) { mEpilogueLines.Add("You were the killer, and you escaped because " + mArrestedPerson.AttributeMap[NounType.HairColor].AsSubject() + " was arrested instead."); } else { // I dont think this is possible. But just in case... if (Player.IsKiller) { mEpilogueLines.Add("You were the killer"); } else { mEpilogueLines.Add(mPeople[KillerId].AttributeMap[NounType.HairColor].AsSubject() + " was the killer"); } if (mArrestedPerson.IsPlayer) { mEpilogueLines.Add("You were arrested"); } else { mEpilogueLines.Add(mArrestedPerson.AttributeMap[NounType.HairColor].AsSubject() + " was arrested"); } } } mEpilogueLines.Add("The killer " + mPeople[KillerId].AttributeMap[NounType.Identity].AsObject()); mEpilogueLines.Add("The killer " + mPeople[KillerId].AttributeMap[NounType.Motive].AsObject()); for (int j = 0; j < 3; j++) { mEpilogueLines.Add(mPeople[j].AttributeMap[NounType.HairColor].AsSubject() + " " + mPeople[j].AttributeMap[NounType.Name].AsObject()); mEpilogueLines.Add(mPeople[j].AttributeMap[NounType.HairColor].AsSubject() + " " + mPeople[j].AttributeMap[NounType.Identity].AsObject()); } InvokeRepeating("UpdateEpilogueText", 1.5f, 0.5f); // after 1 seconds start the epilogue text, and do a new line every 0.3 seconds } }
public void Continue() { if (mDialogEntries.Count == 0) { if (mDismissedCallback != null) { mDismissedCallback(0); mDismissedCallback = null; } return; } DialogEntry entry = mDialogEntries[0]; mDialogEntries.RemoveAt(0); AudioPlayer.PlaySound(entry.audio); if (entry.isInfoExchangeRequest) { UIController.Get().ShowMessage( entry.speaker, entry.sprites, entry.message, new string[] { "Yes", "No" }, new UIButtonCallback[] { buttonIndex => { InsertInformationExchange(0); Continue(); }, buttonIndex => { InsertDialogue(0, entry.speaker, entry.sprites, "Alright. Let's talk more later."); Continue(); }, }); } else if (entry.isInfoExchange) { if (entry.speaker.IsPlayer) { // Show prompt, and share the result with other participants of this dialog UIController.Get().AskForSentence(entry.sprites, sentence => { ShareInfo(GameState.Get().Player, sentence); Continue(); }); } else { // The GameState round-clues is guaranteed to be a recent clue that is not the result of combining multiple clues ClueInfo clueInfo = GameState.Get().mRoundClues[entry.speaker.PersonId]; string message; if (clueInfo != null) { Sentence newInfo = clueInfo.GetSentence(); message = "I found out " + entry.speaker.Speak(newInfo); // TODO: Announce the room where it was found if (newInfo.Subject.Type() == NounType.Unique) { message = "I found " + entry.speaker.Speak(newInfo); // TODO: Announce the room where it was found } ShareInfo(entry.speaker, newInfo); PlayerJournal.AddListen(entry.speaker.PersonId, newInfo); } else { message = "I found nothing."; } UIController.Get().ShowMessage(entry.speaker, entry.sprites, message, new string[] { "Continue" }, new UIButtonCallback[] { buttonIndex => Continue() }); } } else if (entry.isCustomSentence) { UIController.Get().AskForSentence(new Sprite[] { }, sentence => { if (entry.customSentenceCallback != null) { entry.customSentenceCallback(sentence); } Continue(); }, entry.subjectOverrides, entry.objectOverrides); } else // a regular message, just show it { UIController.Get().ShowMessage(entry.speaker, entry.sprites, entry.message, new string[] { "Continue" }, new UIButtonCallback[] { buttonIndex => Continue() }); } }