public override void SpawnWindow(SegmentEntity targetEntity) { if (!(targetEntity is QuantumOutputPortMachine)) { UIManager.RemoveUIRules("Machine"); } else { manager.SetTitle("Quantum Output Port"); if (!_itemSearch) { manager.AddIcon(OutputItemIcon, "empty", Color.white, 10, 0); manager.AddBigLabel(OutputTitleLabel, PersistentSettings.GetString("Choose_output"), Color.white, 70, 0); manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, OutputStatusLabel, string.Empty, Color.white, false, 10, TextHeight * 2); manager.AddButton(ChooseItemButton, PersistentSettings.GetString("Choose_Item"), 100, ButtonsRowStart + QuantumStorageModSettings.ButtonHeight * 2); manager.AddButton(ToggleStatusButton, "Toggle item output", 100, ButtonsRowStart + QuantumStorageModSettings.ButtonHeight * 3); } else { ItemSearchWindow.SpawnWindow((BaseMachineWindow)this); } Dirty = true; } }
private string GetIssueText(eIssues issue) { string txt = ""; string seeHandbook = "\n\nCheck handbook? (H)\n" + PersistentSettings.GetString("See_the_handbook_for_details"); switch (issue) { case eIssues.Power: txt += "\nIssue: Low Power!" + seeHandbook; break; case eIssues.Input: txt += "\nIssue: Cannot find lenses!"; txt += "\nAre hoppers locked?"; txt += "\nPress T to insert lenses!" + seeHandbook; // ^^^ replace with dynamic text for "T" break; case eIssues.Output: txt += "\nIssue: Attached storage missing or full!" + seeHandbook; break; case eIssues.SetLens: txt += "\nIssue: (T)ell the machine what lens to use!"; // ^^^ replace with dynamic text for "T" break; case eIssues.Ready: break; default: break; } return(txt); }
public void Load(PersistentSettings settings) { writeSerialized = settings.GetBool("WriteSerialized", true); rendererDirectory = settings.GetString("RendererDirectory", ""); xres = settings.GetInteger("XResolution", 1024); yres = settings.GetInteger("YResolution", 768); pathLength = settings.GetInteger("PathLength", 3); samplesPerPixel = settings.GetInteger("SamplesPerPixel", 4); integrator = (Integrator)settings.GetInteger("Integrator", (int)Integrator.EDirectIllumination); }
public override void ButtonEnter(string name, SegmentEntity targetEntity) { var quantumIoPort = targetEntity as QuantumIoPortMachine; var controller = quantumIoPort.GetController(); if (controller == null || !controller.IsOperating()) { return; } if (name.Contains("iconItem")) { int.TryParse(name.Replace("iconItem", string.Empty), out var slot); if (slot > -1 && slot < SlotCount) { var item = controller.GetItem(slot); if (item == null) { return; } if (HotBarManager.mbInited) { HotBarManager.SetCurrentBlockLabel(ItemManager.GetItemName(item)); } else { if (!SurvivalHotBarManager.mbInited) { return; } var name1 = WorldScript.mLocalPlayer.mResearch.IsKnown(item) ? ItemManager.GetItemName(item) : PersistentSettings.GetString("Unknown_Material"); var currentStackSize = ItemManager.GetCurrentStackSize(item); if (currentStackSize > 1) { SurvivalHotBarManager.SetCurrentBlockLabel(string.Format("{0} {1}", currentStackSize, name1)); } else { SurvivalHotBarManager.SetCurrentBlockLabel(name1); } } } } }
public void SetExemplar(ItemBase lItem) { if (lItem == null) { Exemplar = null; MarkDirtyDelayed(); FloatingCombatTextManager.instance.QueueText(mnX, mnY, mnZ, QuantumStorageModSettings.MachinesFloatingTextScale, "Cleared!", QuantumStorageModSettings.MachinesFloatingTextColor, QuantumStorageModSettings.MachinesFloatingTextDuration, QuantumStorageModSettings.MachinesFloatingTextDistance); return; } if (lItem?.mType == null) { return; } if (lItem.mType == ItemType.ItemCubeStack) { if (Exemplar != null && Exemplar.mType == ItemType.ItemCubeStack) { if ((lItem as ItemCubeStack).mCubeType == (this.Exemplar as ItemCubeStack).mCubeType && (lItem as ItemCubeStack).mCubeValue == (this.Exemplar as ItemCubeStack).mCubeValue) { return; } } } else { if (Exemplar != null && lItem.mnItemID == Exemplar.mnItemID) { return; } } Exemplar = lItem; MarkDirtyDelayed(); FloatingCombatTextManager.instance.QueueText(mnX, mnY, mnZ, QuantumStorageModSettings.MachinesFloatingTextScale, PersistentSettings.GetString("Currently_outputting") + " " + ItemManager.GetItemName(Exemplar), QuantumStorageModSettings.MachinesFloatingTextColor, QuantumStorageModSettings.MachinesFloatingTextDuration, QuantumStorageModSettings.MachinesFloatingTextDistance); }
public static void SpawnWindow(BaseMachineWindow sourcewindow) { UpdateWindowCooldown = 0; sourcewindow.manager.AddButton(SearchCancelButton, PersistentSettings.GetString("Cancel"), 100, 0); sourcewindow.manager.AddBigLabel(SearchTitleLabel, PersistentSettings.GetString("Enter_Search_Term"), Color.white, 50, 40); sourcewindow.manager.AddBigLabel(SearchTextLabel, "_", Color.cyan, 50, 65); if (SearchResults == null) { return; } int count = SearchResults.Count; for (int index = 0; index < count; ++index) { sourcewindow.manager.AddIcon(ItemIcon + index, "empty", Color.white, 10, 100 + 60 * index); sourcewindow.manager.AddBigLabel(ItemInfoLabel + index, PersistentSettings.GetString("Inventory_Item"), Color.white, 60, 90 + 60 * index); sourcewindow.manager.AddLabel(GenericMachineManager.LabelType.OneLineFullWidth, ItemCountLabel + index, String.Empty, Color.white, false, 60, 120 + 60 * index); } }
private void PlayerStoreRequest() { int lnAvailable = 0; ItemBase itemToStore = UIManager.instance.GetCurrentHotBarItemOrCubeAsItem(out lnAvailable, true); Player player = WorldScript.mLocalPlayer; if (player == null) { return; } if (lnAvailable < 0) { return; } if (itemToStore == null) { return; } if (!isValidLensID(itemToStore.mnItemID)) { Debug.Log("[Auto Lens Swapper] Player " + player.mUserName + " tried inserting a non-lens, but was denied!"); Debug.Log("[Auto Lens Swapper] itemID: " + itemToStore.mnItemID + " itemName: " + itemToStore.GetName()); return; } if (mTargetLens != null) { if (itemToStore.mnItemID != mTargetLens.mnItemID && getStorageAvailable() < mnStorageMax) { Debug.Log("[Auto Lens Swapper][info] Player " + player.mUserName + " tried inserting a differing lens than what was still in the machine!"); return; } } //Easy case, only setting target, not modifying storage. //(User didn't have any lenses on them, but they had the target in their hotbar) if (lnAvailable == 0) { Debug.Log("[Auto Lens Swapper][info] Player " + player.mUserName + " set target (new) lens without depositing any."); mTargetLens = ItemManager.SpawnItem(itemToStore.mnItemID); if (player.mbIsLocalPlayer) { Color lCol = Color.red; FloatingCombatTextManager.instance.QueueText(mnX, mnY + 1L, mnZ, 0.75f, string.Format("Lens Swapper set to: \n", (object)player.GetItemName(itemToStore)), lCol, 1.5f, 64f); } return; } int amount = lnAvailable; int storageAvailable = getStorageAvailable(); int maxStackSize = ItemManager.GetMaxStackSize(itemToStore); //Determine amount that can be transfered. if (itemToStore.mnItemID == -1) { return; } if (amount > 10 && Input.GetKey(KeyCode.LeftShift)) { amount = 10; } if (amount > 1 && Input.GetKey(KeyCode.LeftControl)) { amount = 1; } if (amount > getStorageAvailable()) { amount = getStorageAvailable(); } if (amount > ItemManager.GetMaxStackSize(itemToStore)) { amount = ItemManager.GetMaxStackSize(itemToStore); } ItemManager.SetItemCount(itemToStore, amount); if (!player.mInventory.RemoveItemByExample(itemToStore, true)) { Debug.Log("[Auto Lens Swapper][info] Player " + player.mUserName + " doesnt have " + itemToStore.GetName()); return; } mTargetLens = ItemManager.SpawnItem(itemToStore.mnItemID); if (mStoredLenses == null || mStoredLenses.mnItemID != mTargetLens.mnItemID) { mStoredLenses = ItemManager.SpawnItem(itemToStore.mnItemID); AddLenses(-1);// SpawnItem starts with the amount as 1. } AddLenses(amount); player.mInventory.VerifySuitUpgrades(); //Shouldn't be needed, but lets be safe. Debug.Log("[Auto Lens Swapper][info] Player " + player.mUserName + " stored lenses manually!"); //render in-world pop-up text. if (player.mbIsLocalPlayer) { Color lCol = Color.cyan; FloatingCombatTextManager.instance.QueueText(mnX, mnY + 1L, mnZ, 0.75f, string.Format(PersistentSettings.GetString("Stored_X"), (object)player.GetItemName(itemToStore)), lCol, 1.5f, 64f); } //else //StorageHopperWindowNew.networkRedraw = true; player.mInventory.VerifySuitUpgrades(); /* * if (!WorldScript.mbIsServer) * NetworkManager.instance.SendInterfaceCommand(nameof(StorageHopperWindowNew), nameof(StoreItems), (string)null, itemToStore, (SegmentEntity)hopper, 0.0f); */ // ^^^ Reimplement? MarkDirtyDelayed(); RequestImmediateNetworkUpdate(); UIManager.ForceNGUIUpdate = 0.1f; AudioHUDManager.instance.HUDOut(); SurvivalHotBarManager.MarkAsDirty(); SurvivalHotBarManager.MarkContentDirty(); }
public static bool UpdateMachine(BaseMachineWindow sourcewindow) { if (SearchResults == null) { ++Counter; foreach (char ch in Input.inputString) { if ((int)ch == (int)"\b"[0]) { if (EntryString.Length != 0) { EntryString = EntryString.Substring(0, EntryString.Length - 1); } } else { if (ch == "\n"[0] || ch == "\r"[0]) { SearchResults = new List <ItemBase>(); for (int index = 0; index < ItemEntry.mEntries.Length; ++index) { if (ItemEntry.mEntries[index] != null && PersistentSettings.GetString(ItemEntry.mEntries[index].Name).ToLower().Contains(EntryString.ToLower())) { SearchResults.Add(ItemManager.SpawnItem(ItemEntry.mEntries[index].ItemID)); } } for (int index1 = 0; index1 < TerrainData.mEntries.Length; ++index1) { bool flag = false; TerrainDataEntry mEntry = TerrainData.mEntries[index1]; if (mEntry != null && !mEntry.Hidden) { if (PersistentSettings.GetString(mEntry.Name).ToLower().Contains(EntryString.ToLower())) { int count = mEntry.Values.Count; for (int index2 = 0; index2 < count; ++index2) { if (PersistentSettings.GetString(mEntry.Values[index2].Name).ToLower().Contains(EntryString.ToLower())) { SearchResults.Add(ItemManager.SpawnCubeStack(mEntry.CubeType, mEntry.Values[index2].Value, 1)); flag = true; } } if (!flag && string.IsNullOrEmpty(mEntry.PickReplacement)) { SearchResults.Add(ItemManager.SpawnCubeStack(mEntry.CubeType, mEntry.DefaultValue, 1)); } } if ((EntryString.ToLower().Contains("component") || EntryString.ToLower().Contains("placement") || EntryString.ToLower().Contains("multi")) && mEntry.CubeType == (ushort)600) { int count = mEntry.Values.Count; for (int index2 = 0; index2 < count; ++index2) { SearchResults.Add(ItemManager.SpawnCubeStack(600, mEntry.Values[index2].Value, 1)); } } } } if (SearchResults.Count == 0) { SearchResults = null; } UIManager.mbEditingTextField = false; UIManager.RemoveUIRules("TextEntry"); sourcewindow.manager.RedrawWindow(); return(true); } EntryString += ch; } } sourcewindow.manager.UpdateLabel(SearchTextLabel, EntryString + (Counter % 20 <= 10 ? string.Empty : "_"), Color.cyan); return(true); } sourcewindow.manager.UpdateLabel(SearchTitleLabel, PersistentSettings.GetString("Searching_for"), Color.white); sourcewindow.manager.UpdateLabel(SearchTextLabel, EntryString, Color.cyan); if (!(sourcewindow is QuantumIoPortWindow target)) { return(false); }