/// <summary> /// deze functie roep je aan als het object een currentposition heeft en een destination om een pad te maken /// </summary> public void SetPath() { //zet de weight van de huidige positie op 0(dit is je begin punt) this.CurrentPosition.Weight = 0; //maak het daad werkelijke pad door het dijkstra object aan te roepen Path = new List <AbstractRoom>(SearchPath.DijkstraFunction(CurrentPosition, Destination)); }
internal static PatternData CreatePatternData( string pattern, SearchPath path = null) { path = path ?? SearchPath.Forward; return(new PatternData(pattern, path)); }
/// <summary> /// Add new respository paths to search for AAR and JAR files (recursive) /// </summary> /// <param name="RepositoryPath">Root directory containing the repository</param> /// <param name="SearchPattern">Search pattern to match</param> public void AddRepositories(string RepositoryPath, string SearchPattern) { if (Directory.Exists(RepositoryPath)) { List <string> ToCheck = new List <string>(); ToCheck.Add(RepositoryPath); while (ToCheck.Count > 0) { int LastIndex = ToCheck.Count - 1; string CurrentDir = ToCheck[LastIndex]; ToCheck.RemoveAt(LastIndex); foreach (string SearchPath in Directory.GetDirectories(CurrentDir)) { if (SearchPath.Contains(SearchPattern)) { Log.TraceInformation("Added repository: {0}", SearchPath); Repositories.Add(SearchPath); } else { ToCheck.Add(SearchPath); } } } } else { Log.TraceInformation("AddRepositories: Directory {0} not found; ignored", RepositoryPath); } }
// Use this for initialization void Start() { this.aud = GetComponent <AudioSource>(); view = GetComponent <PhotonView>(); anchor = GameObject.Find("Anchor"); searchPath = GameObject.Find("SearchPath").GetComponent <SearchPath>(); publicVariable = GameObject.Find("PublicVariable").GetComponent <PublicVariable>(); jangGoonCheck = GameObject.Find("JangGoonCheck").GetComponent <JangGoonCheck>(); GameStartImage.gameObject.SetActive(true); publicVariable.setIsStart(true); StartCoroutine("GameStart"); for (i = 1; i <= 9; i++) { for (j = 1; j <= 10; j++) { position_name = "w" + i + "h" + j; mal_position[i, j] = position_name; attackedPosition[i, j] = false; } } if (!PhotonNetwork.isMasterClient) { field = GameObject.Find("JangGiField(Clone)"); field.transform.Rotate(0, 180.0f, 0); myTag = "Han"; } CreateDefaultMal(); aud.PlayOneShot(startSound); PlayingSound.SetActive(true); }
// tries to resolve reference from the given file path, and compares assembly names // if @specific_version == true, and logs accordingly ResolvedReference ResolveReferenceForPath(string filename, ITaskItem reference, AssemblyName aname, string error_message, SearchPath spath, bool specific_version) { AssemblyName found_aname; if (!TryGetAssemblyNameFromFile(filename, out found_aname)) { if (error_message != null) { log.LogMessage(MessageImportance.Low, error_message); } return(null); } if (!specific_version || AssemblyNamesCompatible(aname, found_aname, specific_version)) { // Check compatibility only if specific_version == true return(GetResolvedReference(reference, filename, found_aname, true, spath)); } else { LogSearchMessage("Considered '{0}', but assembly name '{1}' did not match the " + "expected '{2}' (SpecificVersion={3})", filename, found_aname, aname, specific_version); log.LogMessage(MessageImportance.Low, "Assembly names are not compatible."); } return(null); }
private OperationResult FolderSpecial(DataEntity dataEntity, string entityName) { var operationResult = new OperationResult(); var output = new DataEntity(entityName); dataEntity.Properties.TryGetValue("SearchPath", out var SearchPath); try { switch (entityName) { case EntityNames.CreateFolder: Directory.CreateDirectory(SearchPath.ToString()); break; } return(new OperationResult { ErrorInfo = new ErrorResult[] { null }, ObjectsAffected = new[] { 1 }, Output = new[] { output }, Success = new[] { true } }); } catch (IOException ioEx) { var errorResult = new ErrorResult(); errorResult.Description = ioEx.Message; return(new OperationResult { ErrorInfo = new ErrorResult[] { errorResult }, ObjectsAffected = new[] { 0 }, Success = new[] { false } }); } }
private void RemoveDoubleDots() { if (SearchPath.Contains("/..")) { string beforeDoubleDots = SearchPath.Substring(0, SearchPath.IndexOf("/..")); int numberOfPossibleStepsUp = Regex.Matches(beforeDoubleDots, "/").Count; int numberOfDoubleDots = Regex.Matches(SearchPath, @"/\.\.").Count; if (numberOfPossibleStepsUp <= numberOfDoubleDots) { string afterDoubleDots = SearchPath.Substring(SearchPath.LastIndexOf("/..") + 3); while (numberOfDoubleDots > 0) { if (beforeDoubleDots.LastIndexOf('/') >= 0) { beforeDoubleDots = beforeDoubleDots.Substring(0, beforeDoubleDots.LastIndexOf("/")); } else { break; } numberOfDoubleDots--; } VaultPath = beforeDoubleDots; SearchPath = VaultPath + afterDoubleDots; } } }
private void AutoSearchOptions_FormClosing(object sender, FormClosingEventArgs e) { // only do our checking if the user means to begin the search if (DialogResult != DialogResult.OK) { return; } string strFilters = textBoxSearchFilter.Text.ToLower(); if (m_bNeed2007 && (strFilters.IndexOf(cstrDocxExtension) != -1)) { MessageBox.Show("It doesn't appear that either Office/Word 2007 or the Compatibility Pack for 2007 file formats is installed. Without one of these, this program will not be able to process *.docx files. You can search www.microsoft.com/downloads for \"FileFormatConverters\" and install those to be able to work with .docx files within only Office/Word 2003 installed.", FontsStylesForm.cstrCaption); } SetSearchFilters(strFilters); SearchPath = textBoxSearchStart.Text; Properties.Settings.Default.LastSearchFolderUsed = SearchPath; Properties.Settings.Default.Save(); StorePath = textBoxStoreResults.Text; ConvertBackupFiles = checkBoxConvertBackedupFiles.Checked; if (SearchPath.ToLower() == StorePath.ToLower()) { MessageBox.Show("You can't have the Backup path be the same as the search path", FontsStylesForm.cstrCaption); e.Cancel = true; return; } if (StorePath.ToLower().IndexOf(SearchPath.ToLower()) != -1) { MessageBox.Show("You can't have the Backup path be somewhere within the search path", FontsStylesForm.cstrCaption); e.Cancel = true; return; } if (SearchFilters.Count <= 0) { MessageBox.Show(String.Format("You can't have a null search filter. the default one (i.e. {0}) will be used instead", cstrDefaultFilter), FontsStylesForm.cstrCaption); } // get the fonts to search for foreach (DataGridViewRow aRow in dataGridViewFonts.Rows) { string strFontName = (string)aRow.Cells[cnFontColumn].Value; if (!String.IsNullOrEmpty(strFontName)) { m_astrFontsToSearchFor.Add(strFontName); } } if (m_astrFontsToSearchFor.Count <= 0) { MessageBox.Show("You first have to select some fonts to search for", FontsStylesForm.cstrCaption); e.Cancel = true; } }
private SnapshotPoint Find(SearchPath path, UnmatchedTokenKind kind, int position = 0, int count = 1) { var point = _textBuffer.GetPoint(position); var found = _matchingTokenUtil.FindUnmatchedToken(path, kind, point, count); Assert.True(found.IsSome()); return(found.Value); }
private static void AssertSearch(string offset, string search, SearchPath direction = null) { direction = direction ?? SearchPath.Forward; var data = SearchOffsetData.Parse(offset); Assert.True(data.IsSearch); Assert.Equal(search, ((SearchOffsetData.Search)data).Item.Pattern); Assert.Equal(direction, ((SearchOffsetData.Search)data).Item.Path); }
private void FindNext(string text, int position = 0, SearchPath path = null, bool isWrap = true, SnapshotWordNavigator navigator = null) { navigator = navigator ?? _wordUtil.SnapshotWordNavigator; path = path ?? SearchPath.Forward; var point = _textBuffer.GetPoint(position); _search.FindNext(point, new SearchData(text, path, isWrap), navigator); }
private void Start() { _searchPath = FindObjectOfType <SearchPath>(); if (_searchPath.Path != null) // If the player has a path to move on { StartCoroutine(Movement(_searchPath.Path)); } }
/** * Reset the state of the API completely. The object table is cleared, and * all search paths areset back to their default values. */ public void reset() { scene = new Scene(); includeSearchPath = new SearchPath("include"); textureSearchPath = new SearchPath("texture"); parameterList = new ParameterList(); renderObjects = new RenderObjectMap(); currentFrame = 1; }
private static void AssertSearch(string offset, string search, SearchPath direction = null) { direction = direction ?? SearchPath.Forward; var data = SearchOffsetData.Parse(offset); Assert.True(data.IsSearch); Assert.Equal(search, ((SearchOffsetData.Search)data).PatternData.Pattern); Assert.Equal(direction, ((SearchOffsetData.Search)data).PatternData.Path); }
protected Path <ActionType> ConvertToActionsPath(SearchPath path) { Path <ActionType> res = new Path <ActionType>(); foreach (var item in path) { res.Add(_actionsMap[item]); } return(res); }
public AnnotationEditor(SceneViewModel sceneViewModel) { this.sceneViewModel = sceneViewModel; this.nullTool = new AnnotationEditor.NullTool(this.sceneViewModel.DesignerContext.ToolContext); if (this.AnnotationService != null) { this.AnnotationService.ShowAnnotationsChanged += new EventHandler(this.AnnotationService_ShowAnnotationsChanged); this.AnnotationService.AnnotationsEnabledChanged += new EventHandler(this.AnnotationService_AnnotationsEnabledChanged); } this.sceneViewModel.LateSceneUpdatePhase += new SceneUpdatePhaseEventHandler(this.SceneViewModel_LateSceneUpdatePhase); this.sceneViewModel.Document.EditTransactionCompleting += new EventHandler(this.SceneDocument_EditTransactionCompleting); this.annotationsSearchPath = new SearchPath(new SearchStep[1] { new SearchStep(SearchAxis.DocumentDescendant, (ISearchPredicate) new DelegatePredicate((Predicate <SceneNode>)(sceneNode => { if (sceneNode is AnnotationSceneNode) { return(sceneNode.Parent is SceneElement); } return(false); }), SearchScope.NodeTreeDescendant)) }); this.annotationSub = new SceneNodeSubscription <object, AnnotationEditor.AnnotationInfo>(); this.annotationSub.Path = this.annotationsSearchPath; this.annotationSub.SetPathNodeInsertedHandler(new SceneNodeSubscription <object, AnnotationEditor.AnnotationInfo> .PathNodeInsertedHandler(this.Annotation_InsertedHandler)); this.annotationSub.PathNodeInserted += new SceneNodeSubscription <object, AnnotationEditor.AnnotationInfo> .PathNodeInsertedListener(this.Annotation_Inserted); this.annotationSub.PathNodeContentChanged += new SceneNodeSubscription <object, AnnotationEditor.AnnotationInfo> .PathNodeContentChangedListener(this.Annotation_Changed); this.annotationSub.PathNodeRemoved += new SceneNodeSubscription <object, AnnotationEditor.AnnotationInfo> .PathNodeRemovedListener(this.Annotation_Removed); this.annotationSub.CurrentViewModel = (SceneViewModel)null; IProperty annotationReferencesProperty = this.sceneViewModel.ProjectContext.ResolveProperty(AnnotationSceneNode.ReferencesProperty); this.referenceSub = new SceneNodeSubscription <object, AnnotationEditor.ReferenceInfo>(); this.referenceSub.Path = new SearchPath(new SearchStep[1] { new SearchStep(SearchAxis.DocumentDescendant, (ISearchPredicate) new DelegatePredicate((Predicate <SceneNode>)(sceneNode => { if (sceneNode.DocumentNode.IsProperty) { return(sceneNode.DocumentNode.SitePropertyKey == annotationReferencesProperty); } return(false); }), SearchScope.NodeTreeDescendant)) }); this.referenceSub.SetPathNodeInsertedHandler(new SceneNodeSubscription <object, AnnotationEditor.ReferenceInfo> .PathNodeInsertedHandler(this.References_InsertedHandler)); this.referenceSub.PathNodeInserted += new SceneNodeSubscription <object, AnnotationEditor.ReferenceInfo> .PathNodeInsertedListener(this.References_Inserted); this.referenceSub.PathNodeContentChanged += new SceneNodeSubscription <object, AnnotationEditor.ReferenceInfo> .PathNodeContentChangedListener(this.References_Changed); this.referenceSub.PathNodeRemoved += new SceneNodeSubscription <object, AnnotationEditor.ReferenceInfo> .PathNodeRemovedListener(this.References_Removed); this.referenceSub.CurrentViewModel = (SceneViewModel)null; }
public XamlProjectSubscription(DesignerContext designerContext, IProjectContext projectContext, SearchPath sceneSearch, XamlProjectSubscription.DocumentNodeFilter documentSearch) { this.designerContext = designerContext; this.projectContext = projectContext; this.sceneSearch = sceneSearch; this.documentSearch = documentSearch; this.watchers = new Dictionary <XamlDocument, IXamlSubscription>(); this.chainUpdate = new Queue <XamlDocument>(); this.basisNodes = new DocumentNodeMarkerSortedListOf <DocumentNodePath>(); this.designerContext.ViewService.ViewClosed += new ViewEventHandler(this.ViewService_ViewOpenedOrClosed); this.designerContext.ViewService.ViewOpened += new ViewEventHandler(this.ViewService_ViewOpenedOrClosed); }
protected SearchPath reconstruct_path(TSearchState current) { SearchPath path = new SearchPath(); while (came_from.ContainsKey(current)) { var tmp = came_from[current]; path.Insert(0, tmp.action); current = tmp.state; } return(path); }
public ResolvedReference (ITaskItem item, AssemblyName asm_name, bool copy_local, SearchPath search_path, string original_item_spec) { this.TaskItem = item; AssemblyName = asm_name; CopyLocal = copy_local; IsPrimary = true; FoundInSearchPath = search_path; TaskItem.SetMetadata ("OriginalItemSpec", original_item_spec); TaskItem.SetMetadata ("ResolvedFrom", FoundInSearchPathToString ()); }
public ResolvedReference(ITaskItem item, AssemblyName asm_name, bool copy_local, SearchPath search_path, string original_item_spec) { this.TaskItem = item; AssemblyName = asm_name; CopyLocal = copy_local; IsPrimary = true; FoundInSearchPath = search_path; TaskItem.SetMetadata("OriginalItemSpec", original_item_spec); TaskItem.SetMetadata("ResolvedFrom", FoundInSearchPathToString()); }
public async Task<object> GetPath(int from, int to) { var nodes = await this.nodeStorage.GetAllNodesAsync().ConfigureAwait(false); this.graph.MakeAdjactedBothWay(nodes); var pathSearch = new SearchPath(nodes); var path = pathSearch.ShortestPath(from, to); return new { edges = this.graph.GetHightlightedEdgeIds(from, path), nodes = this.graph.GetHightlightedNodeIds(from, path) }; }
private void OnTriggerEnter(Collider other) { Agent agent = other.GetComponent <Agent>(); if (agent != null) { SearchPath searchPath = agent.GetComponent <SearchPath>(); if (searchPath.Node == this) { searchPath.Node = nextWaypoint; } } }
public override void Execute(Agent owner) { SearchPath searchPath = owner.GetComponent <SearchPath>(); searchPath.Move(owner.movement); GameObject[] gameObjects = owner.perception.GetGameObjects(); GameObject player = Perception.GetGameObjectFromTag(gameObjects, "Player"); if (player != null) { ((StateAgent)owner).StateMachine.SetState("AttackState"); } }
public override IEnumerable <ModelItem> Find(ModelItem startingItem, Predicate <Type> match) { ISceneNodeModelItem root = startingItem as ISceneNodeModelItem; if (root != null) { SearchPath path = new SearchPath(new SearchStep[1] { new SearchStep(SearchAxis.DocumentSelfAndDescendant, (ISearchPredicate) new DelegatePredicate((Predicate <SceneNode>)(node => match(node.TargetType)), SearchScope.NodeTreeSelf)) }); foreach (SceneNode sceneNode in path.Query(root.SceneNode)) { yield return((ModelItem)sceneNode.ModelItem); } } }
public override ModelItem FromName(ModelItem scope, string name, StringComparison comparison) { ISceneNodeModelItem sceneNodeModelItem = (scope ?? this.Root) as ISceneNodeModelItem; if (sceneNodeModelItem != null) { SceneNode sceneNode = new SearchPath(new SearchStep[1] { new SearchStep(SearchAxis.DocumentSelfAndDescendant, (ISearchPredicate) new DelegatePredicate((Predicate <SceneNode>)(node => string.Compare(name, node.Name, comparison) == 0), SearchScope.NodeTreeSelf)) }).QueryFirst(sceneNodeModelItem.SceneNode); if (sceneNode != null) { return((ModelItem)sceneNode.ModelItem); } } return((ModelItem)null); }
public bool AddOrReplace(object moniker, string absolutePath, bool isPersisted) { absolutePath = PathUtils.TrimEndSeparator(absolutePath); if (string.IsNullOrEmpty(absolutePath)) { throw new ArgumentException("cannot be null or empty", nameof(absolutePath)); } if (moniker == null) { throw new ArgumentNullException("cannot be null", nameof(moniker)); } var cookie = Watch(absolutePath); bool any = false, changed = false; lock (_paths) { for (int i = 0; i < _paths.Count; ++i) { var p = _paths[i]; if (p.Moniker == moniker) { if (any) { throw new InvalidOperationException("multiple entries for the one moniker"); } any = true; if (!p.Path.Equals(absolutePath, StringComparison.OrdinalIgnoreCase) || p.Persisted != isPersisted) { _paths[i] = new SearchPath(absolutePath, isPersisted, moniker, cookie); changed = true; } } } if (!any) { _paths.Add(new SearchPath(absolutePath, isPersisted, moniker, cookie)); changed = true; } } if (changed) { Changed?.Invoke(this, EventArgs.Empty); } return(changed); }
public bool CanAtk(BattleRoleObj atker, BattleRoleObj hurt) { int atkRange = atker.GetData().AtkRange; Dictionary <int, List <int> > nearStepDict = SearchPath.GetStepDict(atker.GetData().Pos); foreach (int step in nearStepDict.Keys) { for (int i = 0; i < nearStepDict[step].Count; i++) { if (nearStepDict[step][i] == hurt.GetData().Pos) { return(step <= atkRange); } } } return(false); }
// Use this for initialization void Start() { map = new int[5, 5] { { 0, 1, 0, 0, 0 }, { 0, 1, 0, 0, 0 }, { 0, 1, 0, 0, 0 }, { 0, 1, 0, 0, 0 }, { 0, 0, 0, 0, 0 } }; Graph graph = new Graph(map); SearchPath path = new SearchPath(graph); path.Start(graph.nodes[0], graph.nodes[2]); while (!path.isFinished) { path.Step(); } Debug.Log("最后的路点长度是 " + path.path.Count); }
// Private Methods private List<Field> HighlightPath(Field Start, int movementPoints, Field End) { List<Field> path = SearchPath.FindPath(Start, End).ToList(); List<Field> walkablePath = null; if (movementPoints != 0) { walkablePath = path.Take(movementPoints).ToList(); } ClearAllFields(); foreach (Field field in path) { ShowField(field); } if (walkablePath != null) { foreach (Field field in walkablePath) { HighlightField(field); } } CrossField(path[path.Count - 1]); if (walkablePath != null) CrossFieldWalkable(walkablePath[walkablePath.Count - 1]); return path; }
public void SearchNoWay() { var nodes = new NodeContainer { new Node() { id = 1, adjacentNodes = new int[] {1}, label = "top" }, new Node() { id = 2, adjacentNodes = new int[] {2}, label = "second" } }; var search = new SearchPath(nodes); var result = search.ShortestPath(1, 2); Assert.AreEqual(new int[] {}, result); }
public void MoveStart(BattleRoleObj hurtObj) { int targetPos = hurtObj.GetData().Pos; List <int> limitePosList = BattleManager.Instance.GetLimitePosListBySearchPath(targetPos); List <int> path = SearchPath.QueryPath(this.Data.Pos, targetPos, limitePosList); if (path.Count > 0) { if (path[path.Count - 1] != targetPos) { if (path.Count > 1) { MoveToTargetPos(path[1]); } else { Debug.LogError("与目标点不相邻,且无法移动,进入攻击环节"); BattleManager.Instance.CurBattleStatus = BattleStatus.BattleAtkerAtk; } } else { if (path.Count > 1) { MoveToTargetPos(path[1]); } else { Debug.LogError("与目标点相邻,直接攻击"); BattleManager.Instance.CurBattleStatus = BattleStatus.BattleAtkerAtk; } } } else { Debug.LogError("移动路径判断有误,无出发点"); BattleManager.Instance.CurBattleStatus = BattleStatus.BattleNewAtkByCurRound; } }
// FIXME: to get default values of CopyLocal, compare with TargetFrameworkDirectories // If metadata 'Private' is present then use that or use @default_copy_local_value // as the value for CopyLocal internal ResolvedReference GetResolvedReference(ITaskItem reference, string filename, AssemblyName aname, bool default_copy_local_value, SearchPath search_path) { string pvt = reference.GetMetadata("Private"); bool copy_local = default_copy_local_value; if (!String.IsNullOrEmpty(pvt)) { //FIXME: log a warning for invalid value Boolean.TryParse(pvt, out copy_local); } ITaskItem new_item = new TaskItem(reference); new_item.ItemSpec = filename; return(new ResolvedReference(new_item, aname, copy_local, search_path, reference.ItemSpec)); }
public IFolder Open(SearchPath path) => new FileFolder(Combine(Root, path));
public void SearchPathSuccess() { var nodes = new NodeContainer { new Node() { id = 1, adjacentNodes = new int[] {2, 3}, label = "top" }, new Node() { id = 2, adjacentNodes = new int[] {1}, label = "second" }, new Node() { id = 3, adjacentNodes = new int[] {1, 5, 4}, label = "second" }, new Node() { id = 4, adjacentNodes = new int[] {3}, label = "second" }, new Node() { id = 5, adjacentNodes = new int[] {3}, label = "blind" }, new Node() { id = 6, adjacentNodes = new int[] {4}, label = "end" }, new Node() { id = 7, adjacentNodes = new int[] {1}, label = "blind" }, }; var graphService = new Graph(); graphService.MakeAdjactedBothWay(nodes); var search = new SearchPath(nodes); var result = search.ShortestPath(1, 6); Assert.AreEqual(new int[] {6,4,3}, result); }
private SnapshotPoint Find(SearchPath path, UnmatchedTokenKind kind, int position = 0, int count = 1) { var point = _textBuffer.GetPoint(position); var found = _matchingTokenUtil.FindUnmatchedToken(path, kind, point, count); Assert.True(found.IsSome()); return found.Value; }
public bool AddOrReplace(object moniker, string absolutePath, bool isPersisted) { absolutePath = PathUtils.TrimEndSeparator(absolutePath); if (string.IsNullOrEmpty(absolutePath)) { throw new ArgumentException("cannot be null or empty", nameof(absolutePath)); } if (moniker == null) { throw new ArgumentNullException("cannot be null", nameof(moniker)); } bool any = false, changed = false; lock (_paths) { for (int i = 0; i < _paths.Count; ++i) { var p = _paths[i]; if (p.Moniker == moniker) { if (any) { throw new InvalidOperationException("multiple entries for the one moniker"); } any = true; if (!p.Path.Equals(absolutePath, StringComparison.OrdinalIgnoreCase) || p.Persisted != isPersisted) { _paths[i] = new SearchPath(absolutePath, isPersisted, moniker); changed = true; } } } if (!any) { _paths.Add(new SearchPath(absolutePath, isPersisted, moniker)); changed = true; } } if (changed) { Changed?.Invoke(this, EventArgs.Empty); } return changed; }
/// <summary> /// 清空路径 /// </summary> public void ClearSeachPath() { SearchPath.Clear(); }
private void FindNext(string text, int position = 0, SearchPath path = null, bool isWrap = true, ITextStructureNavigator navigator = null) { navigator = navigator ?? _wordNavigator; path = path ?? SearchPath.Forward; var point = _textBuffer.GetPoint(position); _search.FindNext(point, new SearchData(text, path, isWrap), navigator); }
private SearchResult FindNextPattern(string pattern, SearchPath path, SnapshotPoint point, int count) { var searchData = new SearchData(pattern, path, _globalSettings.WrapScan); return _search.FindNextPattern(point, searchData, _wordNavigator, count); }