private void ManageCurrent() { if (!PlayerManager.Instance.CheckIsNormalWithAlert()) { return; } if (CurrentStructure.Info.Manageable && CurrentStructure.DoManage()) { WindowsManager.HideWindow(this, true); } }
public void UnloadAndRequestChunks() { if (Game.StructureRoot == null) { //World is not setup yet //Prevents NullReferenceException return; } foreach (Collections.KeyValuePair <System.Tuple <int, int>, Collections.List <Structure> > Chunk in Building.Chunks) { Vector3 ChunkPos = new Vector3(Chunk.Key.Item1, 0, Chunk.Key.Item2); if (ChunkPos.DistanceTo(new Vector3(Translation.x, 0, Translation.z)) <= Game.ChunkRenderDistance * (Building.PlatformSize * 9)) { if (GetTree().IsNetworkServer()) { foreach (Structure CurrentStructure in Chunk.Value) { CurrentStructure.Show(); } } } else { foreach (Structure CurrentStructure in Chunk.Value) { if (GetTree().IsNetworkServer()) { CurrentStructure.Hide(); } else { CurrentStructure.QueueFree(); } } } } if (!GetTree().IsNetworkServer()) { Building.Self.RequestChunks(GetTree().GetNetworkUniqueId(), Translation, Game.ChunkRenderDistance); } }
public static void UnloadAndRequestChunks() { if (!World.IsOpen) { //World is not setup yet //Prevents NullReferenceException return; } foreach (KeyValuePair <System.Tuple <int, int>, ChunkClass> Chunk in World.Chunks.ToArray()) { Vector3 ChunkPos = new Vector3(Chunk.Key.Item1, 0, Chunk.Key.Item2); if (ChunkPos.DistanceTo(new Vector3(Game.PossessedPlayer.Translation.x, 0, Game.PossessedPlayer.Translation.z)) <= Game.ChunkRenderDistance * (World.PlatformSize * 9)) { if (Self.GetTree().IsNetworkServer()) { foreach (Structure CurrentStructure in Chunk.Value.Structures) { CurrentStructure.Show(); } foreach (DroppedItem Item in Chunk.Value.Items) { Item.Show(); } } } else { List <Structure> StructuresBeingRemoved = new List <Structure>(); foreach (Structure CurrentStructure in Chunk.Value.Structures) { if (Self.GetTree().IsNetworkServer()) { CurrentStructure.Hide(); } else { StructuresBeingRemoved.Add(CurrentStructure); } } foreach (Structure CurrentStructure in StructuresBeingRemoved) { CurrentStructure.Remove(Force: true); } List <DroppedItem> ItemsBeingRemoved = new List <DroppedItem>(); foreach (DroppedItem Item in Chunk.Value.Items) { if (Self.GetTree().IsNetworkServer()) { Item.Hide(); } else { ItemsBeingRemoved.Add(Item); } } foreach (DroppedItem Item in ItemsBeingRemoved) { Item.Remove(); } } } if (!Self.GetTree().IsNetworkServer()) { World.Self.RequestChunks(Self.GetTree().GetNetworkUniqueId(), Game.PossessedPlayer.Translation, Game.ChunkRenderDistance); } }
public static void TraverseFile(string file) { int errorCount = 0; List <PurchaseOrderHeader> listPurchaseOrders = new List <PurchaseOrderHeader>(); PurchaseOrderHeader poHeader; PmTransaction pmTransaction; Log log = new Log(@"C:\Sinex\TraverseLog.txt"); log.Clear(); TextFile.WriteTextFile(@"C:\Sinex\File.txt", file); CurrentStructure currentStructure = CurrentStructure.start; int currentIndex = 0; int fileLength = file.Length; Bracket nextBracket = new Bracket(); nextBracket = NextBracket(file, currentIndex); bool continueLoop = true; int recordStart = 0; int recordEnd = 0; string record = ""; SinexPo po = new SinexPo(); SinexPoLine poLine = new SinexPoLine(); string recordString; Log xmlLog = new Tools.Log(@"C:\Sinex\recordXml.txt"); xmlLog.Clear(); while (continueLoop) { nextBracket = NextBracket(file, currentIndex); // log.Write("Next => " + nextBracket.ToString()); if (nextBracket.Index != -1) { #region switch switch (nextBracket.BracketType) { case "[": switch (currentStructure) { case CurrentStructure.start: currentStructure = CurrentStructure.poLoop; break; case CurrentStructure.poLoop: currentStructure = CurrentStructure.lineLoop; break; case CurrentStructure.lineLoop: MessageBox.Show($"1 - Bad Config " + currentStructure + ", " + currentStructure.ToString()); break; default: MessageBox.Show("Bad Config"); break; } break; case "]": switch (currentStructure) { case CurrentStructure.start: MessageBox.Show($"2 - Bad Config " + currentStructure + ", " + currentStructure.ToString()); break; case CurrentStructure.poLoop: currentStructure = CurrentStructure.start; break; case CurrentStructure.lineLoop: currentStructure = CurrentStructure.poLoop; break; default: MessageBox.Show($"3 - Bad Config " + currentStructure + ", " + currentStructure.ToString()); break; } break; case "{": switch (currentStructure) { case CurrentStructure.poLoop: recordStart = nextBracket.Index; recordEnd = file.IndexOf("lineItems", recordStart) - 2; record = file.SubFromTo(recordStart, recordEnd) + "}"; JsonSerializerSettings microsoftDateFormatSettings = new JsonSerializerSettings { DateFormatHandling = DateFormatHandling.MicrosoftDateFormat }; //log.Write(record); po = JsonConvert.DeserializeObject <SinexPo>(record, microsoftDateFormatSettings); XNode node = JsonConvert.DeserializeXNode(record, "Root"); //xmlLog.Write(node.ToString()); recordString = po.ToString(); log.Write(" "); log.Write(" "); log.Write("HEADER => " + recordString); log.Write($" - {po.requiredBy}, {po.poCreatedBy}, {po.shipTo}"); pmTransaction = new PmTransaction(po, GetGPConnection()); //pmTransaction.Insert("TWO"); string xml = pmTransaction.ToEconnectXML(); //xmlLog.Write("----------------------------------------------"); //xmlLog.Write(xml); //xml = xml.RemoveNode("<connection>"); //xmlLog.Write("----------------------------------------------"); //xmlLog.Write(xml); //xml = xml.RemoveNode("PmTransaction", true); //xmlLog.Write("----------------------------------------------"); //xmlLog.Write(xml); //xml = xml.RemoveNode("?xml", true); //xmlLog.Write("----------------------------------------------"); //xmlLog.Write(xml); //xml = xml.Replace("</PmTransaction>", ""); //xmlLog.Write("----------------------------------------------"); //xmlLog.Write(xml); //string header = "<eConnect xmlns:dt=\"urn:schemas - microsoft - com:datatypes\">"; //header = header + "<PMTransactionType>"; //header = header + "<eConnectProcessInfo>"; //header = header + "</eConnectProcessInfo>"; //header = header + "<taPMTransactionInsert>"; //string footer ="</taPMTransactionInsert>"; //footer = footer + "</PMTransactionType>"; //footer = footer + "</eConnect>"; //xml = header + xml + footer; //xmlLog.Write("----------------------------------------------"); xmlLog.Write(xml); errorCount = errorCount + pmTransaction.InsertXml(xml); break; case CurrentStructure.lineLoop: recordStart = nextBracket.Index; recordEnd = file.IndexOf("}", recordStart) - 1; record = file.SubFromTo(recordStart, recordEnd) + "}"; poLine = JsonConvert.DeserializeObject <SinexPoLine>(record); recordString = poLine.ToString(); log.Write("LINE => " + recordString); po.AddLine(poLine); break; } break; po.ToLog(log); } #endregion Switch currentIndex = nextBracket.Index + 1; if (currentIndex >= fileLength) { continueLoop = false; } } else { continueLoop = false; } } }
public void Hide(bool hide, params object[] args) { if (args == null || args.Length > 0 && (CurrentPreview && CurrentPreview.Equals(args[0]) || CurrentStructure && CurrentStructure.Equals(args[0]))) { if (IsHidden != hide) { IsHidden = hide; content.alpha = hide ? 0 : 1; content.blocksRaycasts = !hide; } if (warehouse && warehouse.IsOpen) { warehouse.Close(); } warehouse = null; } }