public override void PreInitialise() { base.PreInitialise(); NavCell = new RenderNavCell(OwnGraphicsClass); NavCell.Init(OurCellInfo); assets.Add(RefManager.GetNewRefID(), NavCell); }
public SpatialCell(SpatialCell_InitParams InitParams) { OwnGraphicsClass = InitParams.OwnGraphics; boundingBox = InitParams.CellExtents; assets = new Dictionary <int, IRenderer>(); RefID = RefManager.GetNewRefID(); }
// TODO: Make OwnGraphics in the base class public RenderNavCell(GraphicsClass InGraphicsOwner) { OwnGraphics = InGraphicsOwner; Lines = new List <RenderLine>(); string LineBatchID = string.Format("NavCellLineBatch_{0}", RefManager.GetNewRefID()); LineBatch = new PrimitiveBatch(PrimitiveType.Line, LineBatchID); }
public FrameEntry(FrameEntry entry) { refID = RefManager.GetNewRefID(); refs = new Dictionary <FrameEntryRefTypes, int>(); for (int i = 0; i < entry.refs.Count; i++) { refs.Add(entry.refs.ElementAt(i).Key, entry.refs.ElementAt(i).Value); } }
public void Init(AIWorld WorldInfo) { InitWorldInfo = WorldInfo; string BoxID = string.Format("AIWorld_{0}", RefManager.GetNewRefID()); AIWorldBatch = new PrimitiveBatch(PrimitiveType.Box, BoxID); WorldInfo.PopulatePrimitiveBatch(AIWorldBatch); OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(AIWorldBatch); }
public void RequestUpdate() { OwnGraphics.OurPrimitiveManager.RemovePrimitiveBatch(AIWorldBatch); string BoxID = string.Format("AIWorld_{0}", RefManager.GetNewRefID()); AIWorldBatch = new PrimitiveBatch(PrimitiveType.Box, BoxID); InitWorldInfo.PopulatePrimitiveBatch(AIWorldBatch); OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(AIWorldBatch); }
public RenderNav(GraphicsClass InGraphicsClass) { OwnGraphics = InGraphicsClass; SelectedIndex = -1; BoundingBoxes = new List <RenderBoundingBox>(); ConnectionsList = new List <RenderLine>(); string ConnectionList = string.Format("NavConnectionList_{0}", RefManager.GetNewRefID()); PointConnectionsBatch = new PrimitiveBatch(PrimitiveType.Line, ConnectionList); }
void AwakeInstance() { // First we check if there are any other instances conflicting if (Instance != null && Instance != this) { // If that is the case, we destroy other instances Destroy(gameObject); } // Here we save our singleton instance Instance = this; // Furthermore we make sure that we don't destroy between scenes (this is optional) DontDestroyOnLoad(gameObject); }
public MainWindow() { InitializeComponent(); treeFolderMap = new List <KeyValuePair <TreeViewItem, FileAndFolderModel> >(); treeSingleVersionMap = new List <KeyValuePair <TreeViewItem, SingleVersionFile> >(); treeVersionMap = new List <KeyValuePair <TreeViewItem, VersionModel> >(); if (File.Exists("record.xml")) { XmlDecoder xmlDecoder = new XmlDecoder("record.xml"); MainFolder = xmlDecoder.MainFolder; Versions = xmlDecoder.Versions; } else { MainFolder = new FileAndFolderModel("Folder"); Versions = new List <VersionModel>(); } refManager = new RefManager(); newFile.IsEnabled = false; refreshFile.IsEnabled = false; deleteFile.IsEnabled = false; newFolder.IsEnabled = false; renameFolder.IsEnabled = false; deleteFolder.IsEnabled = false; createVerion.IsEnabled = false; deleteVersion.IsEnabled = false; newRef.IsEnabled = false; deleteRef.IsEnabled = false; //MessageBox.Show(MainFolder.GetTreeInfo(0)); //MessageBox.Show(VersionModel.ShowAllVersion(Versions)); ShowFolderTree(); ShowVersionTree(); treeView.SelectedItemChanged += TreeView_SelectedItemChanged; treeViewVersion.SelectedItemChanged += TreeViewVersion_SelectedItemChanged; /*Directory.CreateDirectory(targetFolder); * MessageBox.Show("" + Directory.Exists(targetFolder)); * Directory.Delete(targetFolder, true); //不能删除非空文件夹 * MessageBox.Show("" + Directory.Exists(targetFolder));*/ this.KeyDown += MainWindow_KeyDown; newRef.Click += NewRef_Click; deleteRef.Click += DeleteRef_Click; createVerion.Click += CreateVerion_Click; deleteVersion.Click += DeleteVersion_Click; newFolder.Click += NewFolder_Click; newFile.Click += NewFile_Click; }
public ContextMenu GetContextMenu(HierarchicalViewModelBase selected) { ContextMenuBuilder builder = new ContextMenuBuilder(null); int refId = -1; string refCode = null; if (selected is ReferenceFavoriteViewModel) { var fav = selected as ReferenceFavoriteViewModel; if (!fav.IsGroup) { refId = fav.RefID; refCode = fav.RefCode; } else { builder.New("Export favorite group").Handler(() => ExportReferenceFavorite(fav)).End(); } } else if (selected is ReferenceSearchResultViewModel) { var vm = selected as ReferenceSearchResultViewModel; refId = vm.RefID; refCode = vm.RefCode; } builder.New("Add New...").Handler(() => RefManager.Owner.AddNewReference()).End(); if (refId >= 0) { builder.Separator(); builder.New("Delete").Handler(() => RefManager.DeleteReference(refId, refCode)).End(); builder.Separator(); builder.New("Edit Details...").Handler(() => RefManager.Owner.EditReference(refId)).End(); } return(builder.ContextMenu); }
public void SelectNode(int Index) { // TODO: Big problem here - The graphics class isn't aware of the selecting logic here. // So we'll one day need to support the graphics class aware of this and deselect this whenever another // object has been selected. if (SelectedIndex != -1) { BoundingBoxes[SelectedIndex].Unselect(); } // Move the selection to the new Vertex BoundingBoxes[Index].Select(); SelectedIndex = Index; // Render debug work OBJData.VertexStruct PathPoint = data.vertices[Index]; RenderLine FromA = CreateConnectionLine(PathPoint, data.vertices[PathPoint.Unk3], System.Drawing.Color.Yellow); RenderLine FromB = CreateConnectionLine(PathPoint, data.vertices[PathPoint.Unk4], System.Drawing.Color.Brown); RenderLine FromC = CreateConnectionLine(PathPoint, data.vertices[PathPoint.Unk5], System.Drawing.Color.Red); PointConnectionsBatch.ClearObjects(); PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), FromA); PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), FromB); PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), FromC); foreach (var IncomingPoint in PathPoint.IncomingConnections) { RenderLine Connection = CreateConnectionLine(PathPoint, IncomingPoint, System.Drawing.Color.Green); PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), Connection); } foreach (var OutgoingPoint in PathPoint.OutgoingConnections) { RenderLine Connection = CreateConnectionLine(PathPoint, OutgoingPoint, System.Drawing.Color.Blue); PointConnectionsBatch.AddObject(RefManager.GetNewRefID(), Connection); } PointConnectionsBatch.SetIsDirty(); }
public void Init(OBJData data) { DoRender = true; this.data = data; string VertexBatchID = string.Format("NavObjData_{0}", RefManager.GetNewRefID()); PathVertexBatch = new PrimitiveBatch(PrimitiveType.Box, VertexBatchID); foreach (OBJData.VertexStruct Vertex in data.vertices) { RenderBoundingBox navigationBox = new RenderBoundingBox(); navigationBox.Init(new BoundingBox(new Vector3(-0.1f), new Vector3(0.1f))); navigationBox.SetColour(System.Drawing.Color.Green); navigationBox.SetTransform(Matrix4x4.CreateTranslation(Vertex.Position)); int PathHandle = RefManager.GetNewRefID(); PathVertexBatch.AddObject(PathHandle, navigationBox); BoundingBoxes.Add(navigationBox); } OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(PathVertexBatch); OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(PointConnectionsBatch); }
private void Update() { // TODO: Ideally, we should be using the same primitive batcher. // Problem is, calling ClearObjects on the batcher shuts down the lines too. // Once the RenderLine and RenderBBox has been decoupled, then this should be easier. OwnGraphics.OurPrimitiveManager.RemovePrimitiveBatch(LineBatch); if (DoRender) { if (Lines.Count > 0) { string LineBatchID = string.Format("NavCellLineBatch_{0}", RefManager.GetNewRefID()); LineBatch = new PrimitiveBatch(PrimitiveType.Line, LineBatchID); foreach (RenderLine line in Lines) { int PathHandle = RefManager.GetNewRefID(); LineBatch.AddObject(PathHandle, line); } OwnGraphics.OurPrimitiveManager.AddPrimitiveBatch(LineBatch); } } }
public GraphicsClass() { InitObjectStack = new Dictionary <int, IRenderer>(); Profile = new Profiler(); Assets = new Dictionary <int, IRenderer>(); selectionBox = new RenderBoundingBox(); translokatorGrid = new SpatialGrid(); navigationGrids = new SpatialGrid[0]; OurPrimitiveManager = new PrimitiveManager(); OnSelectedObjectUpdated += OnSelectedObjectHasUpdated; // Create bespoke batches for any lines or boxes passed in via the construct stack string LineBatchID = string.Format("Graphics_LineBatcher_{0}", RefManager.GetNewRefID()); LineBatch = new PrimitiveBatch(PrimitiveType.Line, LineBatchID); string BBoxBatchID = string.Format("Graphics_BBoxBatcher_{0}", RefManager.GetNewRefID()); BBoxBatch = new PrimitiveBatch(PrimitiveType.Box, BBoxBatchID); OurPrimitiveManager.AddPrimitiveBatch(LineBatch); OurPrimitiveManager.AddPrimitiveBatch(BBoxBatch); }
public IType(AIWorld InWorld) { RefID = RefManager.GetNewRefID(); OwnWorld = InWorld; bIsVisible = true; }
public FrameEntry() { refID = RefManager.GetNewRefID(); }