/// <summary> /// Sets the selected Clue to discovered and adds it to the found clues list. /// </summary> /// <param name="newClue">Selected Clue.</param> public void FoundClue(GameObject newClue) { if(GameState.IsState(GameState.States.Interrogating) && GameController.instance.GetCurrentSuspect().GetComponent<Suspect>().IsNervous) { return; } else { if(newClue.tag == "Clue") { selectedClue = newClue.GetComponent<Clue>(); selectedClue.SetDiscovered(); if(!foundClues.Contains(selectedClue.clueName)) foundClues.Add(selectedClue.clueName); } else if(newClue.tag == "Interactable") { if(!foundClues.Contains(prefix + newClue.name)) { foundClues.Add(prefix + newClue.name); } } SoundManager.instance.PlaySoundEffect("Notebook"); NoteBook.instance.UpdateNoteButtonList(); } }
public void DoorCantBeUnlockedWithNotEnoughClues() { var testDoor = new Door(new QuickGraph.TaggedEdge<int, string>(0, 1, "test"), new Connection(0, 1), new Connection(0, 1), "door1", 0, 2); var clue0 = new Clue(testDoor, new List<int>()); Assert.IsFalse(testDoor.CanDoorBeUnlockedWithClues(new List<Clue>(new Clue[] { clue0 }))); }
public void MultipleLockDoorCanBeUnlockedWithEnoughClues() { var testDoor = new Door(new QuickGraph.TaggedEdge<int, string>(0, 1, "test"), new Connection(0, 1), new Connection(0, 1), "door1", 0, 2); var clue0 = new Clue(testDoor, new List<int>()); var clue1 = new Clue(testDoor, new List<int>()); Assert.IsTrue(testDoor.CanDoorBeUnlockedWithClues(new List<Clue>(new Clue[] { clue0, clue1 }))); }
public void DoorCantBeUnlockedWithTheWrongClues() { var testDoor = new Door(new QuickGraph.TaggedEdge<int, string>(0, 1, "test"), new Connection(0, 1), new Connection(0, 1), "door1", 0, 1); //door index is important here var testDoor2 = new Door(new QuickGraph.TaggedEdge<int, string>(0, 1, "test"), new Connection(0, 1), new Connection(0, 1), "door2", 1, 1); var clue0 = new Clue(testDoor2, new List<int>()); Assert.IsFalse(testDoor.CanDoorBeUnlockedWithClues(new List<Clue>(new Clue[] { clue0 }))); }
private Button InstantiateButton(string title, Transform buttonParent, Clue assignedClue) { Button newButton = Instantiate(journalButtonPrefab, buttonParent); newButton.transform.SetParent(buttonParent, false); int offset = buttonParent.childCount * buttonHeight; newButton.GetComponent <RectTransform>().anchoredPosition += new Vector2(0, -offset); newButton.GetComponent <ClueComponent>().clue = assignedClue; newButton.GetComponentInChildren <TextMeshProUGUI>().text = title; return(newButton); }
private static void LineEmptyCheck(ref VoxelManager.VoxelState[] line, ref Clue lineClue) { if (lineClue.VoxelCount == 0) { for (int voxelIndex = 0; voxelIndex < line.Length; voxelIndex++) { line[voxelIndex] = VoxelManager.VoxelState.Cleared; } lineClue.Complete = true; } }
protected void AddEmailAddressEdges(Clue clue, IEnumerable <EmailAddress> addresses, EntityEdgeType edgeType) { if (addresses == null) { return; } foreach (var recipient in addresses) { AddEmailAddressEdge(clue, recipient, edgeType); } }
/// <summary>Builds the clues.</summary> /// <param name="context">The context.</param> /// <param name="query">The query.</param> /// <param name="result">The result.</param> /// <param name="request">The request.</param> /// <returns>The clues.</returns> public override IEnumerable <Clue> BuildClues(ExecutionContext context, IExternalSearchQuery query, IExternalSearchQueryResult result, IExternalSearchRequest request) { if (result is IExternalSearchQueryResult <LibpostalResponse> libpostalResult) { var code = GetOriginEntityCode(libpostalResult, request); var clue = new Clue(code, context.Organization); clue.Data.EntityData.Codes.Add(request.EntityMetaData.Codes.First()); PopulateMetadata(clue.Data.EntityData, libpostalResult, request); return(new[] { clue }); } return(null); }
private void Clear() { clueButtons.Clear(); selectedButton1 = null; selectedButton2 = null; selectedClue1 = null; selectedClue2 = null; }
/// <inheritdoc/> public override IEnumerable <Clue> BuildClues(ExecutionContext context, IExternalSearchQuery query, IExternalSearchQueryResult result, IExternalSearchRequest request) { var resultItem = result.As <GleifResponse>(); var code = this.GetOriginEntityCode(resultItem.Data.Data.First()?.Attributes.Lei); var clue = new Clue(code, context.Organization); this.PopulateMetadata(clue.Data.EntityData, resultItem, request); return(new[] { clue }); }
//discovered clue public void discoverClue(int clueNum, Clue tempClue) { if (theJournal.getIsEnabled()) { increaseFoundCount(clueNum); } else { waitingCount++; foundClues.Add(clueNum); print("waitingcount: " + waitingCount); } }
protected bool Equals(Clue other) { MyDebug.Assert(this.attributes.Length == other.attributes.Length); for (int ii = 0; ii < this.attributes.Length; ii++) { if (this.attributes[ii] != other.attributes[ii]) { return(false); } } return(true); }
public void RemoveClue(Clue oldClue) { // Remove from document tags record Clues.Remove(oldClue); // Remove from home as well Home home = (App.Current as MULTITUDE.App).CurrentHome; ClueManager.Manager.RemoveClue(oldClue, this); // Also add current document to forgotten universe if we have no clues left and we don't have a name home.Relocate(this); }
public DownloadItemInfo GetInfo(Clue metadata) { Container <DownloadItemInfo> container; if (!_downloadItemInfos.TryGetValue(metadata, out container)) { return(null); } container.UpdateTime = DateTime.UtcNow; return(container.Value); }
public void Remove(Clue metadata) { Container <DownloadItemInfo> container; if (!_downloadItemInfos.TryGetValue(metadata, out container)) { return; } _downloadItemInfos.Remove(metadata); this.OnRemove(container.Value); }
private void OnDetectiveRemarkStart(Clue clue) { if (clue != null && clue.isJournalEntry) { switch (clue.type) { case Clue.TypeOfClue.Evidence: SetEventTrigger(InstantiateButton(clue.title, buttonParentEvidence, clue)); DisplayInfo(clue); break; } } }
private void OnTriggerExit2D(Collider2D collision) { Clue clue = collision.gameObject.GetComponent <Clue>(); if (clue != null) { if (clue.GetCase() == InvestigationManager.me.currentCase) { collidingClues.Remove(collision.gameObject.GetComponent <Clue>()); VerbUI.Hide(VerbType.INVESTIGATE); } } }
public void SelectClue(Clue clue, UIPanel panel) { if (panel == m_HorizontalCluePanel) { m_VerticalCluePanel.ClearSelected(); } else { m_HorizontalCluePanel.ClearSelected(); } m_HelpPanel.SelectedClue = clue; m_ButtonPanel.HideClueEnabled = clue != null; }
/// <summary>Builds the clues.</summary> /// <param name="context">The context.</param> /// <param name="query">The query.</param> /// <param name="result">The result.</param> /// <param name="request">The request.</param> /// <returns>The clues.</returns> public override IEnumerable <Clue> BuildClues(ExecutionContext context, IExternalSearchQuery query, IExternalSearchQueryResult result, IExternalSearchRequest request) { var resultItem = result.As <CompanyNew>(); var code = new EntityCode(EntityType.Organization, GetCodeOrigin(), resultItem.Data.company_number); var clue = new Clue(code, context.Organization); clue.Data.OriginProviderDefinitionId = Id; PopulateMetadata(clue.Data.EntityData, resultItem.Data); yield return(clue); }
// Returns whether the given string in any means matches any clue, processed in lower case public bool IsPartialCLue(string partialString) { Clue compareClue = new Clue(partialString); foreach (Clue clue in Clues) { if (clue.Contains(compareClue)) { return(true); } } return(false); }
public override IEnumerable <Clue> BuildClues(ExecutionContext context, IExternalSearchQuery query, IExternalSearchQueryResult result, IExternalSearchRequest request) { var resultItem = result.As <User>(); var code = GetOriginEntityCode(resultItem); var clue = new Clue(code, context.Organization); PopulateMetadata(clue.Data.EntityData, resultItem); // If necessary, you can create multiple clues and return them. return(new[] { clue }); }
public void Reset(Clue metadata, string path) { lock (_lockObject) { var info = _downloadItemInfoManager.GetInfo(metadata, path); if (info == null) { return; } this.Remove(metadata, path); this.Add(metadata, path, info.MaxLength); } }
private void OnDetectiveRemarkStart(Clue clue) { if (clue != null) { if (clue.ID == "irrelevant") { Clue randomClue = Resources.Load <Clue>("IrrelevantRemarks/irrelevant_remark_" + RandomGenerator.currentRandomInt); DisplayText(randomClue.detectiveRemarkText); return; } DisplayText(clue.detectiveRemarkText); } }
private static void MethodDoingSomethingWithClue(Clue clue) { // This is your opportunity to add custom actions for clue processing testing //var info = clue.Serialize(); // this outputs the full data of the clue. Useful for debugging. //var data = clue.Serialize(); //var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); //Directory.CreateDirectory(string.Format("{0}\\ClueData", path)); //File.WriteAllText(string.Format("{0}\\ClueData\\{1}.txt", path, clue.Id), data); var info = clue.OriginEntityCode.Value; //Just outputs the ID of the clue System.Console.WriteLine(info); }
private void DebugDumpClueToDisk(Clue clue, string directory) { Func <string, string> replace = input => { if (input == null) { return(string.Empty); } var chars = Path.GetInvalidFileNameChars().Union(Path.GetInvalidFileNameChars()).Union(new[] { '\\', '/' }); var result = chars.Aggregate(input, (current, c) => current.Replace(c.ToString(CultureInfo.InvariantCulture), "-")); if (result.Length > 50) { result = result.Substring(0, 50); } return(result); }; try { var serialized = clue.Serialize(); var file = directory + replace(clue.Data.EntityData.EntityType.ToString()) + " - " + replace(clue.Data.EntityData.Name) + " - " + clue.Id + ".clue.xml"; if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } if (File.Exists(file)) { File.Delete(file); } using (var writer = File.CreateText(file)) writer.Write(serialized); } catch (Exception ex) { _output.WriteLine("Could not dump clue to disk: " + ex.Message, ex); } }
public void PrintInventoryTest() { Player player = CreatePlayerCharacter(); using (StringWriter consoleOutput = new StringWriter()) { Console.SetOut(consoleOutput); player.Inventory = new List <BaseObject>(); Clue clue = new Clue("Red pants", "very nice pants"); player.Inventory.Add(clue); player.PrintInventory(); Assert.IsTrue(consoleOutput.ToString().Contains($"{clue.Name} {clue.Description}")); } }
public void OpenDetailUI(Clue clue) { if (!isDetail) { isDetail = true; nameText.text = clue.name; explainText.text = clue.explain; detailImageSprite.sprite = clue.clueImage; detailImageSprite.preserveAspect = true; detailUI.SetActive(isDetail); } }
public override void Initialize() { base.Initialize(); box = new Sprite(Manager.Graphics.LoadTexture(@"GameUI\EndGame\main1")); box.Center = true; box.Location = Helper.PointToVector2(Manager.Graphics.ScreenBounds.Center); contentText = Session.Strings["gameover_message"]; currentChar = 0; title = new Label(); title.Initialize(); title.Center = true; title.Caption = Session.Strings["gameover_warningtitle"]; title.Location = new Vector2(Manager.Graphics.ScreenSafeArea.Center.X, Manager.Graphics.ScreenSafeArea.Center.Y - 170); title.Scale = 1.5f; warningContent = new Label(); warningContent.Initialize(); warningContent.SmallFont = true; warningContent.Caption = ""; warningContent.Location = new Vector2(Manager.Graphics.ScreenSafeArea.X + 250, Manager.Graphics.ScreenSafeArea.Y + 210); warningContent.Scale = 0.9f; Manager.Graphics.LoadTexture(@"Clues\msc_281x282"); clue1 = new Clue(); clue1.Texture = "msc_281x282"; clue1.Location = new Vector2(144, 380); Manager.Graphics.LoadTexture(@"Clues\msc_281x282b"); clue2 = new Clue(); clue2.Texture = "msc_281x282b"; clue2.Location = new Vector2(250, 60); Manager.Graphics.LoadTexture(@"Clues\msc_281x282c"); clue3 = new Clue(); clue3.Texture = "msc_281x282c"; clue3.Location = new Vector2(848, 200); typing = new SoundPlayer[4]; for (int i = 0; i < 4; i++) { typing[i] = new SoundPlayer(@"Audio\FX\typing0" + i); } timer = new Timer(); ZOrder = -999999999; }
public IActionResult AddTournamentSubscriberGameAnswerAttempt(Guid tournamentid, Guid subscriberid, Guid gameid, Guid id, [FromBody] AnswerAttemptUpdateModel answerAttempt) { // Get the tournament Tournament tournament = this.TournamentRepository.Get(tournamentid); if (tournament == null) { return(NotFound()); } Subscriber subscriber = this.TournamentRepository.GetSubscriber(tournamentid, subscriberid); if (subscriber == null) { return(NotFound()); } Game tournamentGame = this.TournamentRepository.GetGame(tournamentid, gameid); if (tournamentGame == null) { return(NotFound()); } // Reject any answer to a game that not in play if (tournament.InplayGameId != tournamentGame.Id) { return(BadRequest()); } Clue clue = tournamentGame.Clues.FirstOrDefault(x => x.Id == id); if (clue == null) { return(NotFound()); } // Check the answer int score; bool isCorrect = this.GameLogic.EvaluateSubscriberAnswer(answerAttempt.Answer, clue, out score); // Records the answer attempt and score this.TournamentRepository.UpdateSubscriberGameResult(tournamentid, subscriberid, gameid, clue.Id, answerAttempt.Answer, score); if (isCorrect) { return(Ok()); } return(BadRequest()); }
public int GetNumGivenClues() { int iCount = 0; for (int i = 0; i < m_Clues.Count; i++) { Clue c = m_Clues[i]; if (c.m_Type == eClueType.Given) { iCount++; } } return(iCount); }
/// <summary> /// This relies on the commutative property of this operation. /// clueA, clueB must have the same effect as clueB, clueA /// </summary> /// <param name="clueA">kind of the principal clue</param> /// <param name="clueB">kind of the secondary clue</param> /// <returns></returns> private static (Change, Clue) MakeDirectInference(Clue clueA, Clue clueB) { bool AreIncompatibleClues(Clue a, Clue b) { foreach (int idx in new[] { AttributeType.Color, AttributeType.Nationality, AttributeType.Pet, AttributeType.Drink, AttributeType.Smoke, AttributeType.Position }) { if (IsResolvedAttribute(a.attributes[idx]) && IsResolvedAttribute(b.attributes[idx]) && a.attributes[idx] != b.attributes[idx]) { return(true); } } return(false); } if (clueA == clueB) { return(Change.None, clueA); } for (int ii = 0; ii < clueA.attributes.Length; ii++) { if (IsResolvedAttribute(clueA.attributes[ii]) && clueA.attributes[ii] == clueB.attributes[ii]) { // hurah! 2 different clues with the same attribute continue; } if (IsResolvedAttribute(clueA.attributes[ii]) && IsResolvedAttribute(clueB.attributes[ii])) { // 2 different clues where each has already resolved this attribute continue; } else if (IsResolvedAttribute(clueB.attributes[ii]) && AreIncompatibleClues(clueA, clueB)) { // one of the attributes is confirmed so we can eliminate that from the other clue (bool modified, Clue resultClue) = CombineAttributes(clueA, clueB, ii); if (modified) { return(Change.Enhanced, resultClue); } } } return(Change.None, clueA); }
private static void Infer(ISet <Clue> clues) { ISet <Clue> cluesIn = clues; ISet <Clue> cluesOut = new HashSet <Clue>(); ISet <Clue> combined = new HashSet <Clue>(); bool somethingGoodHappened = true; while (somethingGoodHappened) { somethingGoodHappened = false; combined.Clear(); cluesOut.Clear(); foreach (Clue clueA in cluesIn) { /* * if (combined.Contains(clueA)) * break; */ Clue resultClue = new Clue(); foreach (var clueB in cluesIn) { Change modified; (modified, resultClue) = MakeDirectInference(clueA, clueB); if (modified != Change.None) { if (modified == Change.Combined) { combined.Add(clueB); } somethingGoodHappened = true; break; } } cluesOut.Add(resultClue); // we allow this to be updated twice with the same clue // we rely on the commutative property of MakeDirectInference } bool modifiedn = false; (modifiedn, cluesOut) = InferNeighbours(cluesOut); if (modifiedn) { somethingGoodHappened = true; } (_, cluesOut) = CombineMatchingClues(cluesOut); cluesIn = new HashSet <Clue>(cluesOut); } }
/// <summary>Builds the clues.</summary> /// <param name="context">The context.</param> /// <param name="query">The query.</param> /// <param name="result">The result.</param> /// <param name="request">The request.</param> /// <returns>The clues.</returns> public override IEnumerable <Clue> BuildClues(ExecutionContext context, IExternalSearchQuery query, IExternalSearchQueryResult result, IExternalSearchRequest request) { var resultItem = result.As <Person>(); var code = this.GetOriginEntityCode(resultItem); var clue = new Clue(code, context.Organization); clue.Data.OriginProviderDefinitionId = this.Id; this.PopulateMetadata(clue.Data.EntityData, resultItem); this.DownloadPreviewImage(context, resultItem.Data.avatar, clue); return(new[] { clue }); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Clue = await _context.Clue.FirstOrDefaultAsync(m => m.ID == id); if (Clue == null) { return(NotFound()); } return(Page()); }
/// <summary> /// Add a clue for a doorId at requested room / vertex. /// No checks and no updates to the dependency graph. /// </summary> /// <param name="room"></param> /// <param name="doorId"></param> private Clue BuildAndAddClueToMap(int room, Door thisDoor, Objective thisObjective) { //Find the possible rooms that this clue could be placed in the real map var possibleRooms = mapNoCycles.roomMappingNoCycleToFullMap[room]; Clue newClue; if (thisDoor != null) newClue = new Clue(thisDoor, possibleRooms); else newClue = new Clue(thisObjective, possibleRooms); List<Clue> clueListAtVertex; clueMap.TryGetValue(room, out clueListAtVertex); if (clueListAtVertex == null) { clueMap[room] = new List<Clue>(); } clueMap[room].Add(newClue); return newClue; }
public SolutionEngine(Clue clue) { Clue = clue; }
public bool Equals(Clue other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Prompt, Prompt) && other.ShouldMatch.Equals(ShouldMatch); }
// Use this for initialization void Start() { objClues = GameObject.FindGameObjectsWithTag ("Clue"); for (int i = 0; i<objClues.Length; i++) { Clues[i] = new Clue{}; /*Random gen = new Random (); int prob = gen.Next(100); if(prob < 50)//tweak depending on number of clues. ranUsed = true; else if(prob>=50) ranUsed = false;*/ Clues[i].clue = objClues[i]; Clues[i].attribute = dialogue.Attribute[int.Parse (objClues[i].name)]; Clues[i].evidence = dialogue.Evidence[int.Parse(objClues[i].name)]; Clues[i].used = ranUsed; Clues[i].found = false; } }
public ClueEntry(Clue p_clue, bool p_selected) : base((p_selected ? " " : "") + p_clue.m_name) { m_clue = p_clue; }
//Creates a clue using the base definition of an item listed in the database //and from the killer's attributes private Clue ItemToClue(Item a_item) { Clue clue = new Clue (); clue.item = a_item; //fill in clue.attributes with the killer's info. return clue; }
public void AddClueToInventory(Clue a_clue) { clueInventory.Add(a_clue); Debug.Log("Clue Added!"); Debug.Log(a_clue); }
public SolutionEngineAnagramType(IAnagramDictionary dictionary, Clue clue) : base(clue) { anagramDictionary = dictionary; }