Пример #1
0
        private async void ShowPaths(object sender, RoutedEventArgs e)
        {
            var entry = _metadata.ImcEntries[(int)ImcVariantBox.SelectedItem];

            var paths = new List <(string title, string path)>();

            var mtrl   = new Mtrl(XivCache.GameInfo.GameDirectory);
            var folder = mtrl.GetMtrlFolder(_metadata.Root.Info, entry.MaterialSet) + "/";

            paths.Add(("Material Folder", folder));

            if (entry.Vfx > 0)
            {
                var pair = await ATex.GetVfxPath(_metadata.Root.Info, entry.Vfx);

                paths.Add(("VFX File Path", pair.Folder + "/" + pair.File));
            }
            else
            {
                paths.Add(("VFX File Path", "--"));
            }


            var wind = new PathDisplay(paths);

            wind.Show();
        }
Пример #2
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            // Get selected site
            string selected     = WebCompareViewModel.Instance.GraphSitesSelected;
            Vertex selectedVert = LoaderViewModel.Instance.MainGraph.GetVertexWithData(selected);

            AddMessage("Selected source: " + selectedVert.Data);
            // Use dijkstras to find shortest path
            List <int>[] paths = new List <int> [5];
            for (int r = 0; r < 5; ++r)
            {
                paths[r] = new List <int>();
                AddMessage("Searching for path to: " + LoaderViewModel.Instance.Roots[r].Name);
                paths[r] = Dijkstras(selectedVert, LoaderViewModel.Instance.Roots[r].RootVertex);
            }
            AddMessage("Found all available paths.");
            AddMessage("Displaying..\n\n");
            // Graphically display the path
            Application.Current.Dispatcher.Invoke((Action) delegate {
                PathDisplay pd = new PathDisplay();
                if (selectedVert != null)
                {
                    pd.SrcText = selectedVert.ID.ToString();
                }
                pd.ShowPaths(paths);
            }); // End dispatcher
        }
Пример #3
0
    void SetPreviewTile(Tile t)
    {
        // MDebug.Log("setpreview tile");
        //TODO: Send a filter list custom to the unit e.g. Enemies should walk on camp tiles, Tiles need properties as components
        List <Tile> pathToTile = TileManager.Instance.FindPath(Owner.currentTile, t, Owner);

        if (PathWalkable(pathToTile))
        {
            if (pathpreview != null)
            {
                Destroy(pathpreview.gameObject);
            }

            pathpreview = PathDisplay.MakePathDisplay();
            pathpreview.UpdatePositions(pathToTile);
            currentTargetTile = t;
            currentPath       = pathToTile;
            SetAttackPreview(currentTargetTile);

            if (OnSetPreviewTile != null)
            {
                OnSetPreviewTile(t, true);
            }
        }
        else
        {
            ResetAttackPreview();
            ResetPathPreview();
            if (OnSetPreviewTile != null)
            {
                OnSetPreviewTile(t, false);
            }
        }
    }
Пример #4
0
            public bool Equals(IPath?other)
            {
                if (other == null)
                {
                    return(false);
                }

                return((this is IFilePath) == (other is IFilePath) &&
                       PathFormat == other.PathFormat &&
                       PathDisplay.AsSpan(0, RootLength).Equals(other.PathDisplay.AsSpan(0, other.RootLength), StringComparison.OrdinalIgnoreCase) &&
                       PathDisplay.AsSpan(RootLength).Equals(other.PathDisplay.AsSpan(other.RootLength), StringComparison.Ordinal));
            }
Пример #5
0
    public static void setRoute(PathDisplay in_path, string _display_text, HexData _display_text_at)
    {
        display_text_at = _display_text_at;
        display_text = _display_text;

        if(current_path_display != null)
        {
            if(!current_path_display.Equals(in_path))
            {
                current_path_display.hidePath();
                current_path_display.destroySelf();
            }
        }
        current_path_display = in_path;

        if(current_path_display != null)
        {
            current_path_display.displayPath();
        }
    }
Пример #6
0
 // TODO: Combine case-insensitive root with case-sensitive remainder hash codes to avoid hash collisions with different case paths when new
 // ReadOnlySpan<char> StringComparer APIs become available: https://github.com/dotnet/runtime/issues/27229
 public override int GetHashCode() => PathDisplay.GetHashCode(StringComparison.OrdinalIgnoreCase);
Пример #7
0
    void OnMouseOver()
    {
        if(hex_data.vision_state != Vision.Unvisted)
        {

            draw_mode = true;

            if(!border.active)
                border.active = true;
            if(!glow.active)
                glow.active = true;

            border.SetColor(enginePlayerS.select_color);
            border.Draw3DAuto();
            glow.Draw3DAuto();

            HexData mech_hex = hexManagerS.getHex(entityManagerS.getMech().x, entityManagerS.getMech().z);

            //if mech standing on this hex
            if(mech_hex.Equals(hex_data))
            {

                //if the mech is on this hex, and this hex has a node as well
                if(node_occupier)
                {
        //					Debug.LogWarning("STANDING ON HEX WITH NODE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                    genTextString(SelectLevel.Scavenge, entityManagerS.getMech().getScavengeAPCost());

                    if(entityManagerS.getMech().current_ap > entityManagerS.getMech().getScavengeAPCost() && node_data.node_level != NodeLevel.Empty)
                        border.SetColor(enginePlayerS.scavenge_color);
                    else
                    {
                        genTextString(SelectLevel.Scavenge, -999);
                        border.SetColor(enginePlayerS.disable_color);
                    }
                    enginePlayerS.setRoute(null, display_text, hex_data);
                    return;
                }
                enginePlayerS.setRoute(null, "", hex_data);

                return;
            }

        //			if()

            //if the path is no longer starting from where the player mechu currently is...
            if(!mech_location_when_path_made.Equals(mech_hex) || path_display == null || path_display.path_line == null)
            {
                if(path_display != null)
                    path_display.destroySelf();

                path_from_mech = entityManagerS.getMech().getPathFromMechTo(hexManagerS.getHex (hex_data.x, hex_data.z));
                path_display = pathDrawS.getPathLine(path_from_mech);
                mech_location_when_path_made = mech_hex;
            }

            //if the mech could possibly walk here
            if(path_display != null && entityManagerS.getMech().canTraverse(hex_data))
            {
                genTextString(SelectLevel.Travel, (int) path_from_mech.TotalCost);
                enginePlayerS.setRoute(path_display, display_text, hex_data);
            }
            else
            {
                genTextString(SelectLevel.Disabled, -1);
                enginePlayerS.setRoute(null, display_text, hex_data);
            }
        }
    }