From 9675ea402094570d2c498bd02a757ef811aa6094 Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 29 Jun 2016 14:47:27 -0700 Subject: [PATCH 01/23] UIUtil first draft Function in my tests with my Freight cart stations. --- Utilities/UIUtil.cs | 139 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Utilities/UIUtil.cs diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs new file mode 100644 index 0000000..6e6573e --- /dev/null +++ b/Utilities/UIUtil.cs @@ -0,0 +1,139 @@ +using System; +using System.Reflection; +using UnityEngine; + +namespace FortressCraft.Community.Utilities +{ + public class UIUtil + { + /// + /// Timer to delay dissociation of UI panel to overcome race condition + /// + public static int UIdelay; + /// + /// Lock to prevent running the dissociation when it isn't needed + /// + public static bool UILock; + + /// + /// Call this in GetPopupText to handle your UI Window + /// + /// Pass the current machine + /// The mod window inherited from BaseMachineWindow + /// + public static bool HandleThisMachineWindow(SegmentEntity theMachine, BaseMachineWindow theWindow) + { + try + { + //GenericMachineManager manager = GenericMachinePanelScript.instance.manager; // not yet + GenericMachineManager manager = typeof(GenericMachinePanelScript).GetField("manager", BindingFlags.NonPublic | + BindingFlags.Instance).GetValue(GenericMachinePanelScript.instance) as GenericMachineManager; + + // this will replace with the current machine's window, which is OK as long as each Mod uses this technique + manager.windows[eSegmentEntity.Mod] = theWindow; + theWindow.manager = manager; + } + catch (Exception ex) + { + //this.error = "Window Registration failed : " + ex.Message; + UnityEngine.Debug.LogError("Window Registration failed : " + ex.Message + " : " + ex.StackTrace); + } + GenericMachinePanelScript panel = GenericMachinePanelScript.instance; + + try + { + // player looking at this machine + if (WorldScript.instance.localPlayerInstance.mPlayerBlockPicker.selectedEntity == theMachine) + { + if (panel.Background_Panel.activeSelf == true) // window is open + { + panel.gameObject.SetActive(true); // undoes the default handler hiding the window + } + + // player interacts with machine + if (Input.GetButtonDown("Interact")) // "E" by default + { + // UIManager.UpdateGenericMachineWindow() -> GenericMachinePanelScript.TryShow() + // default handler will try and fail as intended because our window is not in its dictionary, this is fine + // similarly, the Hide() should not occur because the selectedEntity is this machine (panel.targetEntity) + //Debug.Log("Interacted"); + if (panel.Background_Panel.activeSelf == true) // window is not already opened + { + // Do nothing + } + else // window IS already opened, we pressed to interact again (meaning to close it) + { + Hide(panel); // hide window, since we are not focused on this machine anymore + DragAndDropManager.instance.CancelDrag(); + DragAndDropManager.instance.DisableDragBackground(); + } + } + else if (Input.GetKeyDown(KeyCode.Escape)) // escape should close window also + { + if (panel.isActiveAndEnabled) + UIManager.instance.UnpauseGame(); + Hide(panel); // hide window + DragAndDropManager.instance.CancelDrag(); + DragAndDropManager.instance.DisableDragBackground(); + } + } + else // we are not the selected machine, or no machine is selected; but not due to user input (probably) + { + if (panel.targetEntity == theMachine) // this machine WAS focused with window open a moment ago, so it should handle closing its own window + { + Hide(panel); // hide window, since we are not focused on this machine anymore + DragAndDropManager.instance.CancelDrag(); + DragAndDropManager.instance.DisableDragBackground(); + } + } + } + catch (Exception ex) + { + return false; + } + + return (panel.targetEntity == theMachine); // true if machine window is currently open, false otherwise (such as if Hide() called) + } + + /// + /// Internal sub function for hiding the panel + /// + /// The working panel + public static void Hide(GenericMachinePanelScript panel) + { + UIManager.RemoveUIRules("Machine"); + panel.currentWindow.OnClose(panel.targetEntity); + panel.Scroll_Bar.GetComponent().scrollValue = 0f; + panel.targetEntity = null; + panel.currentWindow = null; + + GenericMachineManager manager = typeof(GenericMachinePanelScript).GetField("manager", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(panel) as GenericMachineManager; + manager.ClearWindow(); + + panel.gameObject.SetActive(false); + panel.Background_Panel.SetActive(false); + } + + /// + /// Insert in machine UnityUpdate to disconnect the UI when finished. + /// + public static void DisconnectUI() + { + if (UIdelay > 30 && UILock) + { + GenericMachinePanelScript panel = GenericMachinePanelScript.instance; + panel.gameObject.SetActive(false); + panel.Background_Panel.SetActive(false); + panel.currentWindow = null; + panel.targetEntity = null; + GenericMachineManager manager2 = typeof(GenericMachinePanelScript).GetField("manager", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(GenericMachinePanelScript.instance) as GenericMachineManager; + manager2.windows.Remove(eSegmentEntity.Mod); + UIManager.RemoveUIRules("Machine"); + DragAndDropManager.instance.CancelDrag(); + DragAndDropManager.instance.DisableDragBackground(); + UILock = false; + } + UIdelay++; + } + } +} From 330b291105c05b53964164f98582a188a650daec Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 29 Jun 2016 14:49:14 -0700 Subject: [PATCH 02/23] Create temp --- Utilities/UIExample/temp | 1 + 1 file changed, 1 insertion(+) create mode 100644 Utilities/UIExample/temp diff --git a/Utilities/UIExample/temp b/Utilities/UIExample/temp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Utilities/UIExample/temp @@ -0,0 +1 @@ + From 05b82d4328e7b30b30b0c7044277726f695f65c2 Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 29 Jun 2016 14:49:40 -0700 Subject: [PATCH 03/23] Example of UIUtil in use --- Utilities/UIExample/FreightCartWindow.cs | 268 +++++++++++++++++++++++ 1 file changed, 268 insertions(+) create mode 100644 Utilities/UIExample/FreightCartWindow.cs diff --git a/Utilities/UIExample/FreightCartWindow.cs b/Utilities/UIExample/FreightCartWindow.cs new file mode 100644 index 0000000..8237cf5 --- /dev/null +++ b/Utilities/UIExample/FreightCartWindow.cs @@ -0,0 +1,268 @@ +using UnityEngine; +using System.Collections.Generic; +using FortressCraft.Community.Utilities; + +public class FreightCartWindow : BaseMachineWindow +{ + public const string InterfaceName = "FreightCartStation"; + + private bool dirty; + private bool ChooseLowStock = false; + + public override void SpawnWindow(SegmentEntity targetEntity) + { + FreightCartStation station = targetEntity as FreightCartStation; + Debug.Log("Before close?"); + //Catch for when the window is called on an inappropriate machine + if (station == null) + { + GenericMachinePanelScript.instance.Hide(); + UIManager.RemoveUIRules("Machine"); + return; + } + //station.UIdelay = 0; + //station.UILock = true; + UIUtil.UIdelay = 0; + UIUtil.UILock = true; + Debug.Log("After close?"); + + this.manager.SetTitle("Freight Cart Station - Register Freight"); + + this.manager.AddButton("switchlowstock", "Edit Low Stock", 25, 0); + this.manager.AddButton("switchhighstock", "Edit High Stock", 175, 0); + + int spacing = 175; + int count = 0; + int offset = 50; + if (station.massStorageCrate != null) + count = FreightCartManager.instance.GetFreightEntries(station.massStorageCrate).Count; + for (int n = 0; n < count + 1; n++) + { + int suffix = n; + if (n == count) + suffix = -1; + this.manager.AddIcon("registry" + suffix, "empty", Color.white, 0, offset + (spacing * n)); + this.manager.AddBigLabel("registrytitle" + n, "Add New Freight", Color.white, 60, offset + (spacing * n)); + if (suffix != -1) + { + this.manager.AddLabel(GenericMachineManager.LabelType.OneLineHalfWidth, "lowstocktitle" + n, "Low Stock Limit", this.ChooseLowStock == true ? Color.white : Color.gray, false, 0, offset + (spacing * n + 40)); + this.manager.AddLabel(GenericMachineManager.LabelType.OneLineHalfWidth, "highstocktitle" + n, "High Stock Limit", this.ChooseLowStock == false ? Color.white : Color.gray, false, 150, offset + (spacing * n + 40)); + this.manager.AddLabel(GenericMachineManager.LabelType.OneLineHalfWidth, "lowstock" + n, "Low Stock Limit", this.ChooseLowStock == true ? Color.white : Color.gray, false, 0, offset + (spacing * n + 60)); + this.manager.AddLabel(GenericMachineManager.LabelType.OneLineHalfWidth, "highstock" + n, "High Stock Limit", this.ChooseLowStock == false ? Color.white : Color.gray, false, 150, offset + (spacing * n + 60)); + this.manager.AddButton("decreasestock" + n, "Decrease Stock", 25, offset + (spacing * n + 100)); + this.manager.AddButton("increasestock" + n, "Increase Stock", 175, offset + (spacing * n + 100)); + } + } + this.dirty = true; + } + + public override void UpdateMachine(SegmentEntity targetEntity) + { + FreightCartStation station = targetEntity as FreightCartStation; + //Catch for when the window is called on an inappropriate machine + if (station == null) + { + GenericMachinePanelScript.instance.Hide(); + UIManager.RemoveUIRules("Machine"); + return; + } + //station.UIdelay = 0; + UIUtil.UIdelay = 0; + List registries = new List(); + if (station.massStorageCrate != null) + registries = FreightCartManager.instance.GetFreightEntries(station.massStorageCrate); + else + return; + + for (int index = 0; index < registries.Count; index++) + { + ItemBase item = registries[index].FreightItem; + int lowstock = registries[index].LowStock; + int highstock = registries[index].HighStock; + + string itemname = ItemManager.GetItemName(item); + string iconname = ItemManager.GetItemIcon(item); + + this.manager.UpdateIcon("registry" + index, iconname, Color.white); + this.manager.UpdateLabel("registrytitle" + index, itemname, Color.white); + this.manager.UpdateLabel("lowstock" + index, registries[index].LowStock.ToString(), this.ChooseLowStock == true ? Color.white : Color.gray); + this.manager.UpdateLabel("highstock" + index, registries[index].HighStock.ToString(), this.ChooseLowStock == false ? Color.white : Color.gray); + this.manager.UpdateLabel("lowstocktitle" + index, "Low Stock Limit", this.ChooseLowStock == true ? Color.white : Color.gray); + this.manager.UpdateLabel("highstocktitle" + index, "High Stock Limit", this.ChooseLowStock == false ? Color.white : Color.gray); + } + if (this.dirty == true) + { + this.UpdateState(station); + this.dirty = false; + } + } + + private void UpdateState(FreightCartStation machine) + { + return; + } + + public override bool ButtonClicked(string name, SegmentEntity targetEntity) + { + FreightCartStation station = targetEntity as FreightCartStation; + + if (name.Contains("registry")) // drag drop to a slot + { + int slotNum = -1; + int.TryParse(name.Replace("registry", ""), out slotNum); //Get slot name as number + List registries = FreightCartManager.instance.GetFreightEntries(station.massStorageCrate); + + if (slotNum > -1) // valid slot + { + //clear registry + FreightCartManager.instance.RemoveRegistry(station.massStorageCrate, registries[slotNum].FreightItem); + this.manager.RedrawWindow(); + } + + return true; + } + else if (name.Contains("switchlowstock")) + { + this.ChooseLowStock = true; + this.manager.RedrawWindow(); + } + else if (name.Contains("switchhighstock")) + { + this.ChooseLowStock = false; + this.manager.RedrawWindow(); + } + else if (name.Contains("decreasestock")) + { + int slotNum = -1; + int.TryParse(name.Replace("decreasestock", ""), out slotNum); //Get slot name as number + List registries = FreightCartManager.instance.GetFreightEntries(station.massStorageCrate); + + if (slotNum > -1) // valid slot + { + int amount = 100; + if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) + amount = 10; + if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) + amount = 1; + if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) + amount = 1000; + + int stock; + if (this.ChooseLowStock) + { + stock = registries[slotNum].LowStock - amount; + if (stock < 0) + stock = 0; + FreightCartManager.instance.UpdateRegistry(station.massStorageCrate, registries[slotNum].FreightItem, stock, registries[slotNum].HighStock); + this.manager.UpdateLabel("lowstock" + slotNum, stock.ToString(), Color.white); + } + else + { + stock = registries[slotNum].HighStock - amount; + if (stock < 0) + stock = 0; + FreightCartManager.instance.UpdateRegistry(station.massStorageCrate, registries[slotNum].FreightItem, registries[slotNum].LowStock, stock); + this.manager.UpdateLabel("highstock" + slotNum, stock.ToString(), Color.white); + } + } + } + else if (name.Contains("increasestock")) + { + int slotNum = -1; + int.TryParse(name.Replace("increasestock", ""), out slotNum); //Get slot name as number + List registries = FreightCartManager.instance.GetFreightEntries(station.massStorageCrate); + + if (slotNum > -1) // valid slot + { + int amount = 100; + if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) + amount = 10; + if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) + amount = 1; + if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) + amount = 1000; + + int stock; + if (this.ChooseLowStock) + { + stock = registries[slotNum].LowStock + amount; + FreightCartManager.instance.UpdateRegistry(station.massStorageCrate, registries[slotNum].FreightItem, stock, registries[slotNum].HighStock); + this.manager.UpdateLabel("lowstock" + slotNum, stock.ToString(), Color.white); + } + else + { + stock = registries[slotNum].HighStock + amount; + FreightCartManager.instance.UpdateRegistry(station.massStorageCrate, registries[slotNum].FreightItem, registries[slotNum].LowStock, stock); + this.manager.UpdateLabel("highstock" + slotNum, stock.ToString(), Color.white); + } + } + } + + return false; + } + + public override ItemBase GetDragItem(string name, SegmentEntity targetEntity) + { + FreightCartStation machine = targetEntity as FreightCartStation; + + return null; + } + + public override bool RemoveItem(string name, ItemBase originalItem, ItemBase swapitem, SegmentEntity targetEntity) + { + FreightCartStation machine = targetEntity as FreightCartStation; + + return false; + } + + public override void HandleItemDrag(string name, ItemBase draggedItem, DragAndDropManager.DragRemoveItem dragDelegate, SegmentEntity targetEntity) + { + FreightCartStation station = targetEntity as FreightCartStation; + if (station.massStorageCrate == null) + return; + + if (name.Contains("registry")) // drag drop to a slot + { + int slotNum = -1; + int.TryParse(name.Replace("registry", ""), out slotNum); //Get slot name as number + + if (slotNum == -1) // valid slot + { + if (this.manager.mWindowLookup[name + "_icon"].GetComponent().spriteName == "empty") + { + FreightCartManager.instance.AddRegistry(station.massStorageCrate, draggedItem, 0, 0); + this.manager.RedrawWindow(); + } + //machine.filterCubeId[slotNum] = cubeId; + //machine.filterCubeValue[slotNum] = cubeValue; + //machine.filterItem[slotNum] = draggedItem.mnItemID; + //UnityEngine.Debug.LogError("SET: " + cubeId + " : " + cubeValue + " : " + draggedItem.mnItemID + " : " + draggedItem.mType); + + //UnityEngine.Debug.LogError("item set"); + } + } + + return; + } + + public static NetworkInterfaceResponse HandleNetworkCommand(Player player, NetworkInterfaceCommand nic) + { + FreightCartStation station = nic.target as FreightCartStation; + + string command = nic.command; + if (command != null) + { + if (command == "test") + { + // do whatever + } + } + + return new NetworkInterfaceResponse + { + entity = station, + inventory = player.mInventory + }; + } +} + From 4cac007a0ab9bdd25b0ca67dd5fd430c7aa4b6ff Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 29 Jun 2016 14:50:01 -0700 Subject: [PATCH 04/23] No longer needed --- Utilities/UIExample/temp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Utilities/UIExample/temp diff --git a/Utilities/UIExample/temp b/Utilities/UIExample/temp deleted file mode 100644 index 8b13789..0000000 --- a/Utilities/UIExample/temp +++ /dev/null @@ -1 +0,0 @@ - From c2fc1ce0eac062498566ce0ca2647a51ed00d6e5 Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 29 Jun 2016 14:58:55 -0700 Subject: [PATCH 05/23] Update for credits --- Utilities/UIUtil.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs index 6e6573e..e30b8d1 100644 --- a/Utilities/UIUtil.cs +++ b/Utilities/UIUtil.cs @@ -4,6 +4,9 @@ namespace FortressCraft.Community.Utilities { + /// + /// Simple cross-mod compatible UI support. Original code by BinaryAlgorithm, updated by steveman0 + /// public class UIUtil { /// From 13b2af18ba1d791a7ae52019b18a0524c2e71589 Mon Sep 17 00:00:00 2001 From: steveman0 Date: Tue, 5 Jul 2016 13:49:44 -0700 Subject: [PATCH 06/23] Fixed bug with Compare Properly compares cube values with itembase type. --- Utilities/ItemBaseUtil.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Utilities/ItemBaseUtil.cs b/Utilities/ItemBaseUtil.cs index 4b6f2bb..e6797d7 100644 --- a/Utilities/ItemBaseUtil.cs +++ b/Utilities/ItemBaseUtil.cs @@ -33,7 +33,17 @@ public static Boolean CompareDeep(this ItemBase original, ItemBase comparer) /// True if ItemID and Type of both Items match, otherwise false public static bool Compare(this ItemBase original, ItemBase comparer) { - return original.mnItemID == comparer.mnItemID && original.mType == comparer.mType; + if (original == null || comparer == null) + return false; + if (original.mType == comparer.mType) + { + if (original.mType == ItemType.ItemCubeStack && comparer.mType == ItemType.ItemCubeStack) + return (original as ItemCubeStack).CompareCubes(comparer as ItemCubeStack); + else + return original.mnItemID == comparer.mnItemID && original.mType == comparer.mType; + } + else + return false; } /// @@ -43,10 +53,10 @@ public static bool Compare(this ItemBase original, ItemBase comparer) /// Original Item /// Item to Compare Against /// True if ItemID, Type, CubeType, CubeValue of both Items match, otherwise false - public static bool Compare(this ItemCubeStack original, ItemCubeStack comparer) + public static bool CompareCubes(this ItemCubeStack original, ItemCubeStack comparer) { // We'll ignore the original stacks for now. May revisit in the future - return original != null && comparer != null && original.Compare(comparer.As()) && + return original != null && comparer != null && original.mCubeType == comparer.mCubeType && original.mCubeValue == comparer.mCubeValue; // && original.mnAmount == comparer.mnAmount; } @@ -183,14 +193,15 @@ public static void DecrementStack(this ItemBase item, Int32 amount = 1) /// /// The Item Stack /// The amount of Items - public static void SetAmount(this ItemBase item, Int32 amount) + public static ItemBase SetAmount(this ItemBase item, Int32 amount) { if (!item.IsStack()) - return; + return item; if (item.mType == ItemType.ItemCubeStack) item.As().mnAmount = amount; if (item.mType == ItemType.ItemStack) item.As().mnAmount = amount; + return item; } /// From 336ca6c64dca61563942dfe06978d4bf854ab245 Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 6 Jul 2016 16:25:11 -0700 Subject: [PATCH 07/23] temp --- bin/temp | 1 + 1 file changed, 1 insertion(+) create mode 100644 bin/temp diff --git a/bin/temp b/bin/temp new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/bin/temp @@ -0,0 +1 @@ + From 261a02fe4715cfcf6cc81b37ab2f2430dc4716e8 Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 6 Jul 2016 16:26:04 -0700 Subject: [PATCH 08/23] Latest compile --- bin/FCECommunityTools.dll | Bin 0 -> 25088 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 bin/FCECommunityTools.dll diff --git a/bin/FCECommunityTools.dll b/bin/FCECommunityTools.dll new file mode 100644 index 0000000000000000000000000000000000000000..f34ae144edffb4a6f55f0e57890e614c35b853e4 GIT binary patch literal 25088 zcmeHv3z%G0mF_x^I_K1*tGlW?-3fV6AtV%3cbgZn0};~c?vTd3I^BT;k{c@Br#nTu z>vXEBlQd0Y2Nj7D6-N*pm4Ns_fsqd!0YQTT;sdYD=#0!&21ZA5#&Ir+_aYwNd~`=*jwXRo!_UVE*z*IxTkRlV-A50XJdCf)}Zvr>foozNQLqE4urOz_)Ax zK%Lm?>kUj^Nun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kbo|$u|+0!e##A`X$syI{>?J`sl-X zdINs{vIEccv>Ii8J!1a*ab6_Vn<-qzPnHGZ=Vo~Fe6D_V0ns2egHy?B|K!5wlp&mt z_;seV;$tYEhYC2^@cBudc7%bxU_K0?8gxRUCri3ncotIW-%=bjIoX_smYN&} zM{%%L_aOx(7=NdxQa2|3Pr%xY@cAsb$%uoi)L$1Q6mYiU!#f`C{Wti1@cEYYFZq%&9uWfNjeJ+Jqf6}A2$>#i8<%r#^_ab}EdCubk3+4D x6G!93v1pez9k34f=g@m6Ea8ioH) Date: Wed, 6 Jul 2016 16:26:22 -0700 Subject: [PATCH 09/23] not needed --- bin/temp | 1 - 1 file changed, 1 deletion(-) delete mode 100644 bin/temp diff --git a/bin/temp b/bin/temp deleted file mode 100644 index 8b13789..0000000 --- a/bin/temp +++ /dev/null @@ -1 +0,0 @@ - From f97d1cf1b6761e2cfc2c1f62c183cc4802b3e2b3 Mon Sep 17 00:00:00 2001 From: steveman0 Date: Wed, 6 Jul 2016 16:26:43 -0700 Subject: [PATCH 10/23] Help comments --- bin/FCECommunityTools.XML | 639 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 639 insertions(+) create mode 100644 bin/FCECommunityTools.XML diff --git a/bin/FCECommunityTools.XML b/bin/FCECommunityTools.XML new file mode 100644 index 0000000..c7a7600 --- /dev/null +++ b/bin/FCECommunityTools.XML @@ -0,0 +1,639 @@ + + + + FCECommunityTools + + + +

+ A community interface to allow cross-mod communication for item storage + + + + + Checks to see if a Storage Medium has any items + + True if the storage medium has any item, false otherwise + + + + Checks to see if a Storage Medium has the specified item + + Checks for Ore/Item/Cube + + The Item to Check For + True if the storage medium has the specified item, false otherwise + + + + Checks to see if a Storage Medium has the specified item + + Checks for Ore/Item/Cube + + The Item to Check For + Stores the amount of the items available + True if the storage medium has the specified item, false otherwise + + + + Checks to see if a Storage Medium has amount capcity free + + The amount of capcity to check for + True if the storage medium has amount capacity free, otherwise false + + + + Get the free capcity of the entity + + The free capcity of the entity + + + + Attempts to give the Item to a Storage Medium + + The Item to give to a Storage Medium + True if the Storage Medium accepted the item, otherwise false + + + + Attempts to take an Item from a Storage Medium + + The Item to Retrieve + An ItemBase if the requested Item was found, otherwise null + + + + Attempts to take any item from a Storage Medium + + An ItemBase if there's something to return, or null if empty + + + + Extension Methods and Helpers for the ItemBase Class + + + Extension Methods and Helpers for the ItemBase Class + + + + + Gets the amount of items and cubes in any type of Enumerable ItemBase + + The list of items to get the total count from + The amount of Items and Cubes + + + + Gets the amount of items in any type of Enumerable ItemBase + + The list of items to get the total count from + The unique id of the item to count + The amount of Items + + + + Gets the amount of cubes in any type of Enumerable ItemBase + + + + + The amount of Cubes + + + + Gets the amount of cubes OR items from any Enumerable ItemBase, based off of an ItemBase + + The list of items to get the total count from + The ItemBase which to restrain the Count to + The amount of Cubes or Items + + + + Adds an ItemBase to a list, consolidating stacks - obeys list storage capacity by returning excess items + + The item to add to the list + The list to transfer it to + If true returns partial stack when insufficient stack size found + The list's storage capacity + The remaining items that do not fit in the list + + + + Deduct an item from an item list by example + + The example item to attempt to remove from the list + The list to take the item from + If true returns partial stack when insufficient stack size found + The ItemBase object or null if unavailable + + + + Moves specified amount of any items from one list to another obeying target storage capacity. + + Source list of items + Target list of items + Quantity of items to move + Storage capacity of target item list + Moves only the first item found + A list of items to server as a whitelist or blacklist for transferring + True if whitelist otherwise treat as a blacklist + + + + Moves specified amount of any items from one list to another obeying target storage capacity. + + Source item to move + Target list of items + Quantity of items to move (for stacks) + Storage capacity of target item list + Moves only the first item found + A list of items to server as a whitelist or blacklist for transferring + True if whitelist otherwise treat as a blacklist + + + + Compares all possible + + The original ItemBase + The ItemBase to Compare Against + True if all major properties match + + + + Compare the ItemID and Type values of ItemBase + + Original Item + Item to Compare Against + True if ItemID and Type of both Items match, otherwise false + + + + Compares the ItemID, Type, CubeType, and CubeValue values of ItemCubeStack + Does not compare the Amounts + + Original Item + Item to Compare Against + True if ItemID, Type, CubeType, CubeValue of both Items match, otherwise false + + + + Compares the ItemID, Type, CurrentDurability, and MaxDurability values of ItemDurability + + Original Item + Item to Compare Against + True if ItemID, Type, CurrentDurability, and MaxDurability of both Items match, otherwise false + + + + Compares the ItemID and Type values of ItemStack + + Original Item + Item to Compare Against + True if ItemID and Type of both Items match, otherwise false + + + + Compares ItemID and Type values of ItemSingle + + Original Item + Item to Compare Against + True if ItemID and Type of both Items match, otherwise false + + + + Compares ItemID, Type, and ChargeLevel of ItemCharge + + Original Item + Item to Compare Against + True if ItemID, Type and ChargeLevel of both Items match, otherwise false + + + + Compares ItemID, Type, LocationX, LocationY, LocationZ, LookVectorX, LookVectorY amd LookVectoryZ of ItemLocation + + Original Item + Item to Compare Against + + True if ItemID, Type, LocationX, LocationY, LocationZ, LookVectorX, LookVectorY amd LookVectoryZ of both Items + match, otherwise false + + + + + Is the Item original Stack Type + + The Item + True if Item is original Stack, otherwise False + + + + Compares two Items to check if they are both stacks and identical + + The original Item + The item to compare against + True if both Items are stacks and the same + + + + Increases the Stack Size by the specified amount + + The Item Stack + The amount to increment by (Default: 1) + + + + Decrement the Stack Size by the specified amount + + The Item Stack + The amount to increment by (Default: 1) + + + + Set the amount of items in original Item Stack + + The Item Stack + The amount of Items + + + + Creates original new instance of the ItemBase type + + The original to create original new instance of + The new original, or null if unknown type + + + + Gets the amount of items in an ItemBase, while being Stack friendly + + The original + The amount of items + + + + Convert a ItemBase into a class that inherits ItemBase + + Class that Inherits ItemBase + The entity to convert + The entity as + + + + A Float Equals method with tolerance. + Based off of: https://msdn.microsoft.com/en-us/library/ya2zha7s.aspx + + + + + Checks the N/E/S/W/Up/Down directions of the Center block for any SegmentEntitys of T; + Will report whether there was a failure because a segment wasn't loaded. + + The SegmentEntity class to search for. + The MachineEntity to Search Around + Whether or not a Null Segment was Encountered + + + + + Extension Methods and Helpers for the GameObject class + + + + + Stores all of the GameObjects from the Games Resources into a cached object + + + + + Gets a GameObject from the Resources + Originally created by binaryalgorithm & steveman0 + + The Name of the GameObject to retrieve + The named GameObject, or null + + + + Generic machine inventory class with list inventory support + + Origianl code by steveman0 + + + + For associating the machine owner of the inventory + + + + + For associating the mob owner of the inventory + + + + + The total item capacity of the storage + + + + + The list of items in the inventory + + + + + Generic machine inventory class with list inventory support + + For associating the owner machine + The storage capacity of the inventory + + + + Generic machine inventory class with list inventory support + + For associating the owner mob + The storage capacity of the inventory + + + + Add a single item type to the inventory + + The item to add + Amount of items added if given a stack + Returns the remainder that doesn't fit or null if successful + + + + Add items from a source inventory or item list + + The source inventory or list of items + The number of items to transfer + + + + Transfers items to machine inventory if they are on the provided whitelist + + Source inventory or list of items + List of items types allowed in the transfer + Number of items to add + + + + Transfers items to machine inventory if they are on the provided whitelist + + Source inventory or list of items + Item type allowed in the transfer + Number of items to add + + + + Transfers items to machine inventory if they are not on the provided blacklist + + Source inventory or list of items + List of items forbidden from transfer + Number of items to add + + + + Transfers items to machine inventory if they are not on the provided blacklist + + Source inventory or list of items + Item forbidden from transfer + Number of items to add + + + + Fills the inventory to capacity with source items + + Source items to fill the inventory + + + + Fills the inventory to capacity with source items + + Source items to fill the inventory + Item type allowed in the transfer + + + + Fills the inventory to capacity with source items + + Source items to fill the inventory + Item type allowed in the transfer + + + + Fills the inventory to capacity with source items + + Source items to fill the inventory + Item forbidden from transfer + + + + Fills the inventory to capacity with source items + + Source items to fill the inventory + Item forbidden from transfer + + + + Empty the inventory of items + + Target inventory or list + Maximum number of items to take + + + + Return item from inventory by example (obeys stack size) + + Example item to find in inventory + Returns the item or null if unavailable or insufficient stack size + + + + Return item from inventory by example including partial item stack + + Example item to find in inventory + Returns the item or partial stack (null if item not found) + + + + Remove any single item type from the inventory + + Amount to remove (for stacks) + The ItemBase removed from inventory + + + + Remove items from inventory if items are on the whitelist + + The target inventory or list to store the items + The list of items allowed to transfer + Storage capacity of target inventory + Amount of items to move in this transfer + + + + Remove items from inventory if items are on the whitelist + + The target inventory or list to store the items + Item allowed to transfer + Storage capacity of target inventory + Amount of items to move in this transfer + + + + Remove items from inventory if items are not on the blacklist + + The target inventory or list to store the items + The list of items forbidden from transfer + Storage capacity of target inventory + Amount of items to move in this transfer + + + + Remove items from inventory if items are not on the blacklist + + The target inventory or list to store the items + Item forbidden from transfer + Storage capacity of target inventory + Amount of items to move in this transfer + + + + Returns the spare capacity of the inventory + + The spare capacity of the inventory + + + + Returns the current number of items in the inventory + + Current number of items in inventory + + + + Helper logic for checking if the inventory has space + + + + + + Helper logic for checking if the inventory is empty + + + + + + Helper logic for checking if the inventory is full + + + + + + Item drop code for emptying the inventory on the ground on machine delete + + + + + Item drop code for emptying the inventory on the ground on mob delete + + + + + Generic serialization function for writing the inventory to disk + + + + + + Generic serialization function for reading the inventory from disk + + + + + + Extension Methods and Helpers for the SegmentEntity class + + + + + Convert a SegmentEntity into a class that inherit SegmentEntity + + Class that Inherits SegmentEntity + The entity to convert + The entity as TSegmentEntity + + + + Simple cross-mod compatible UI support. Original code by BinaryAlgorithm, updated by steveman0 + + + + + Timer to delay dissociation of UI panel to overcome race condition + + + + + Lock to prevent running the dissociation when it isn't needed + + + + + Call this in GetPopupText to handle your UI Window + + Pass the current machine + The mod window inherited from BaseMachineWindow + + + + + Internal sub function for hiding the panel + + The working panel + + + + Insert in machine UnityUpdate to disconnect the UI when finished. + + + + + A class that provides Interopability between Storage and Machines for Pre-StorageInterface mods + + + + + Checks to see if the entity has any items + + A SegmentEntity + True if the entity has any items, false otherwise + + + + + + + + + + + + Will attempt to return the requested item from the entity + + The entity to try and get the item from + The ItemBase with details of what to retrrieve + + + + + Will return any item from the entity + + The entity to get a item from + A item, or NULL + + + + This interface needs to mimic CommunityItemInterface's methods, + but take a SegmentEntity as the first param. + + + + From 22b61aa4678bf10c379bb2e64d135e5126050922 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 19 Jul 2016 14:58:57 -0700 Subject: [PATCH 11/23] Missing machine inventory --- Utilities/MachineInventory.cs | 409 ++++++++++++++++++++++++++++++++++ 1 file changed, 409 insertions(+) create mode 100644 Utilities/MachineInventory.cs diff --git a/Utilities/MachineInventory.cs b/Utilities/MachineInventory.cs new file mode 100644 index 0000000..7d106ca --- /dev/null +++ b/Utilities/MachineInventory.cs @@ -0,0 +1,409 @@ +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +namespace FortressCraft.Community.Utilities +{ + /// + /// Generic machine inventory class with list inventory support + /// + /// Origianl code by steveman0 + public class MachineInventory + { + /// + /// For associating the machine owner of the inventory + /// + public MachineEntity Machine; + + /// + /// For associating the mob owner of the inventory + /// + public MobEntity Mob; + + /// + /// The total item capacity of the storage + /// + public int StorageCapacity; + + /// + /// The list of items in the inventory + /// + public List Inventory; + + /// + /// Generic machine inventory class with list inventory support + /// + /// For associating the owner machine + /// The storage capacity of the inventory + public MachineInventory(MachineEntity machineentity, int storagecapacity) + { + this.Machine = machineentity; + this.StorageCapacity = storagecapacity; + this.Inventory = new List(); + } + + /// + /// Generic machine inventory class with list inventory support + /// + /// For associating the owner mob + /// The storage capacity of the inventory + public MachineInventory(MobEntity mobentity, int storagecapacity) + { + this.Mob = mobentity; + this.StorageCapacity = storagecapacity; + this.Inventory = new List(); + } + + /// + /// Add a single item type to the inventory + /// + /// The item to add + /// Amount of items added if given a stack + /// Returns the remainder that doesn't fit or null if successful + public ItemBase AddItem(ItemBase item, int amount = 1) + { + return ItemBaseUtil.AddListItem(item, ref this.Inventory, true, this.StorageCapacity); + } + + /// + /// Add items from a source inventory or item list + /// + /// The source inventory or list of items + /// The number of items to transfer + public void AddItem(ref List items, int amount = 1) + { + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, amount, this.StorageCapacity, false); + } + + /// + /// Transfers items to machine inventory if they are on the provided whitelist + /// + /// Source inventory or list of items + /// List of items types allowed in the transfer + /// Number of items to add + public void AddWhiteList(ref List items, IEnumerable whitelist, int amount = 1) + { + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, amount, this.StorageCapacity, false, whitelist, true); + } + + /// + /// Transfers items to machine inventory if they are on the provided whitelist + /// + /// Source inventory or list of items + /// Item type allowed in the transfer + /// Number of items to add + public void AddWhiteList(ref List items, ItemBase whitelist, int amount = 1) + { + ItemBase[] WhiteList = new[] { whitelist }; + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, amount, this.StorageCapacity, false, WhiteList, true); + } + + /// + /// Transfers items to machine inventory if they are not on the provided blacklist + /// + /// Source inventory or list of items + /// List of items forbidden from transfer + /// Number of items to add + public void AddBlackList(ref List items, IEnumerable blacklist, int amount = 1) + { + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, amount, this.StorageCapacity, false, blacklist, false); + } + + + + /// + /// Transfers items to machine inventory if they are not on the provided blacklist + /// + /// Source inventory or list of items + /// Item forbidden from transfer + /// Number of items to add + public void AddBlackList(ref List items, ItemBase blacklist, int amount = 1) + { + ItemBase[] BlackList = new[] { blacklist }; + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, amount, this.StorageCapacity, false, BlackList, false); + } + + /// + /// Fills the inventory to capacity with source items + /// + /// Source items to fill the inventory + public void Fill(ref List items) + { + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, this.SpareCapacity(), this.StorageCapacity); + } + + /// + /// Fills the inventory to capacity with source items + /// + /// Source items to fill the inventory + /// Item type allowed in the transfer + public void FillWhiteList(ref List items, IEnumerable whitelist) + { + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, this.SpareCapacity(), this.StorageCapacity, false, whitelist, true); + } + + /// + /// Fills the inventory to capacity with source items + /// + /// Source items to fill the inventory + /// Item type allowed in the transfer + public void FillWhiteList(ref List items, ItemBase whitelist) + { + ItemBase[] WhiteList = new[] { whitelist }; + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, this.SpareCapacity(), this.StorageCapacity, false, WhiteList, true); + } + + /// + /// Fills the inventory to capacity with source items + /// + /// Source items to fill the inventory + /// Item forbidden from transfer + public void FillBlackList(ref List items, IEnumerable blacklist) + { + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, this.SpareCapacity(), this.StorageCapacity, false, blacklist, false); + } + + /// + /// Fills the inventory to capacity with source items + /// + /// Source items to fill the inventory + /// Item forbidden from transfer + public void FillBlackList(ref List items, ItemBase blacklist) + { + ItemBase[] BlackList = new[] { blacklist }; + ItemBaseUtil.MoveItems(ref items, ref this.Inventory, this.SpareCapacity(), this.StorageCapacity, false, BlackList, false); + } + + /// + /// Empty the inventory of items + /// + /// Target inventory or list + /// Maximum number of items to take + public void Empty(ref List items, int amount) + { + ItemBaseUtil.MoveItems(ref this.Inventory, ref items, amount); + } + + /// + /// Return item from inventory by example (obeys stack size) + /// + /// Example item to find in inventory + /// Returns the item or null if unavailable or insufficient stack size + public ItemBase RemoveItem(ItemBase item) + { + return ItemBaseUtil.RemoveListItem(item, ref this.Inventory, false); + } + + /// + /// Return item from inventory by example including partial item stack + /// + /// Example item to find in inventory + /// Returns the item or partial stack (null if item not found) + public ItemBase RemovePartialStack(ItemBase item) + { + return ItemBaseUtil.RemoveListItem(item, ref this.Inventory, true); + } + + /// + /// Remove any single item type from the inventory + /// + /// Amount to remove (for stacks) + /// The ItemBase removed from inventory + public ItemBase RemoveAnySingle(int amount = 1) + { + List output = new List(); + ItemBaseUtil.MoveItems(ref this.Inventory, ref output, amount, amount, true); + if (output.Count == 0) + return null; + return output[0]; + } + + /// + /// Remove items from inventory if items are on the whitelist + /// + /// The target inventory or list to store the items + /// The list of items allowed to transfer + /// Storage capacity of target inventory + /// Amount of items to move in this transfer + public void RemoveWhiteList(ref List items, IEnumerable whitelist, int storagecapacity = int.MaxValue, int amount = 1) + { + ItemBaseUtil.MoveItems(ref this.Inventory, ref items, amount, storagecapacity, false, whitelist, true); + } + + /// + /// Remove items from inventory if items are on the whitelist + /// + /// The target inventory or list to store the items + /// Item allowed to transfer + /// Storage capacity of target inventory + /// Amount of items to move in this transfer + public void RemoveWhiteList(ref List items, ItemBase whitelist, int storagecapacity = int.MaxValue, int amount = 1) + { + ItemBase[] WhiteList = new [] { whitelist }; + ItemBaseUtil.MoveItems(ref this.Inventory, ref items, amount, storagecapacity, false, WhiteList, true); + } + + /// + /// Remove items from inventory if items are not on the blacklist + /// + /// The target inventory or list to store the items + /// The list of items forbidden from transfer + /// Storage capacity of target inventory + /// Amount of items to move in this transfer + public void RemoveBlackList(ref List items, IEnumerable blacklist, int storagecapacity = int.MaxValue, int amount = 1) + { + ItemBaseUtil.MoveItems(ref this.Inventory, ref items, amount, storagecapacity, false, blacklist, false); + } + + /// + /// Remove items from inventory if items are not on the blacklist + /// + /// The target inventory or list to store the items + /// Item forbidden from transfer + /// Storage capacity of target inventory + /// Amount of items to move in this transfer + public void RemoveBlackList(ref List items, ItemBase blacklist, int storagecapacity = int.MaxValue, int amount = 1) + { + ItemBase[] BlackList = new[] { blacklist }; + ItemBaseUtil.MoveItems(ref this.Inventory, ref items, amount, storagecapacity, false, BlackList, false); + } + + /// + /// Returns the spare capacity of the inventory + /// + /// The spare capacity of the inventory + public int SpareCapacity() + { + return this.StorageCapacity - this.Inventory.GetItemCount(); + } + + /// + /// Returns the current number of items in the inventory + /// + /// Current number of items in inventory + public int ItemCount() + { + return this.Inventory.GetItemCount(); + } + + /// + /// Helper logic for checking if the inventory has space + /// + /// + public bool HasSpareCapcity() + { + return this.SpareCapacity() > 0; + } + + /// + /// Helper logic for checking if the inventory is empty + /// + /// + public bool IsEmpty() + { + return this.ItemCount() == 0; + } + + /// + /// Helper logic for checking if the inventory is full + /// + /// + public bool IsFull() + { + return this.ItemCount() >= this.StorageCapacity; + } + + /// + /// Item drop code for emptying the inventory on the ground on machine delete + /// + public void DropOnDelete() + { + if (this.Machine == null) + { + Debug.LogWarning("Tried to drop machine inventory when not associated with a machine!"); + return; + } + if (!WorldScript.mbIsServer) + return; + System.Random random = new System.Random(); + for (int index = 0; index < this.Inventory.Count; ++index) + { + if (this.Inventory[index] != null) + { + Vector3 velocity = new Vector3((float)random.NextDouble() - 0.5f, (float)random.NextDouble() - 0.5f, (float)random.NextDouble() - 0.5f); + ItemManager.instance.DropItem(this.Inventory[index], this.Machine.mnX, this.Machine.mnY, this.Machine.mnZ, velocity); + } + } + this.Inventory = null; + } + + /// + /// Item drop code for emptying the inventory on the ground on mob delete + /// + public void DropOnMobDelete() + { + if (this.Mob == null) + { + Debug.LogWarning("Tried to drop mob inventory when not associated with a mob!"); + return; + } + if (!WorldScript.mbIsServer) + return; + System.Random random = new System.Random(); + for (int index = 0; index < this.Inventory.Count; ++index) + { + if (this.Inventory[index] != null) + { + Vector3 velocity = new Vector3((float)random.NextDouble() - 0.5f, (float)random.NextDouble() - 0.5f, (float)random.NextDouble() - 0.5f); + ItemManager.instance.DropItem(this.Inventory[index], this.Mob.mnX, this.Mob.mnY, this.Mob.mnZ, velocity); + } + } + this.Inventory = null; + } + + /// + /// Generic serialization function for writing the inventory to disk + /// + /// + public void WriteInventory(BinaryWriter writer) + { + int listcount = this.Inventory.Count; + int version = 0; + + writer.Write(version); + writer.Write(listcount); + for (int index = 0; index < listcount; ++index) + { + ItemFile.SerialiseItem(this.Inventory[index], writer); + } + } + + /// + /// Generic serialization function for reading the inventory from disk + /// + /// + public void ReadInventory(BinaryReader reader) + { + int listcount; + int version = reader.ReadInt32(); + + switch (version) + { + case 0: + listcount = reader.ReadInt32(); + for (int index = 0; index < listcount; ++index) + { + ItemBase item = ItemFile.DeserialiseItem(reader); + if (item != null) + this.Inventory.Add(item); + else + Debug.LogError("Machine inventory tried to read in a null item! Corrupt save?"); + } + break; + default: + Debug.LogError("Attempted to read Machine inventory version that does not exist!"); + break; + } + } + } +} From bbd30ce4a728a36fa96b097f963c5190aff23dd6 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 19 Jul 2016 23:47:27 -0700 Subject: [PATCH 12/23] Added EscapeUI function --- Utilities/UIUtil.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs index e30b8d1..785bcf8 100644 --- a/Utilities/UIUtil.cs +++ b/Utilities/UIUtil.cs @@ -122,7 +122,7 @@ public static void Hide(GenericMachinePanelScript panel) ///
public static void DisconnectUI() { - if (UIdelay > 30 && UILock) + if (UIdelay > 50 && UILock) { GenericMachinePanelScript panel = GenericMachinePanelScript.instance; panel.gameObject.SetActive(false); @@ -138,5 +138,22 @@ public static void DisconnectUI() } UIdelay++; } + + /// + /// An emergency escape function when looking at the wrong machine + /// + public static void EscapeUI() + { + GenericMachinePanelScript panel = GenericMachinePanelScript.instance; + panel.gameObject.SetActive(false); + panel.Background_Panel.SetActive(false); + panel.currentWindow = null; + panel.targetEntity = null; + GenericMachineManager manager2 = typeof(GenericMachinePanelScript).GetField("manager", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(GenericMachinePanelScript.instance) as GenericMachineManager; + manager2.windows.Remove(eSegmentEntity.Mod); + UIManager.RemoveUIRules("Machine"); + DragAndDropManager.instance.CancelDrag(); + DragAndDropManager.instance.DisableDragBackground(); + } } } From 595e7652e6a2a7fc45b2b252e5939b23d3251630 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 19 Jul 2016 23:47:58 -0700 Subject: [PATCH 13/23] Latest bin --- bin/FCECommunityTools.XML | 5 +++++ bin/FCECommunityTools.dll | Bin 25088 -> 25088 bytes 2 files changed, 5 insertions(+) diff --git a/bin/FCECommunityTools.XML b/bin/FCECommunityTools.XML index c7a7600..9eca64d 100644 --- a/bin/FCECommunityTools.XML +++ b/bin/FCECommunityTools.XML @@ -594,6 +594,11 @@ Insert in machine UnityUpdate to disconnect the UI when finished.
+ + + An emergency escape function when looking at the wrong machine + + A class that provides Interopability between Storage and Machines for Pre-StorageInterface mods diff --git a/bin/FCECommunityTools.dll b/bin/FCECommunityTools.dll index f34ae144edffb4a6f55f0e57890e614c35b853e4..e93662ebe138791ae19b30badcbd2d58c0d44403 100644 GIT binary patch delta 5778 zcmcIodvF!i8ULNLyJz>lHa8(4sX>X5U@$x)3L+qh5KCGV)9?@)Mkq#!MKMB60wK#w z6wxBNmO*MUNgah27$J&6#U>3=w9-OLM{q<#wTRk>X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atibility! No longer requires the EscapeUI() function. Mods using UI now no longer lock up other mod machines that don't use the UIUtil. --- Utilities/UIUtil.cs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs index 785bcf8..77b36a8 100644 --- a/Utilities/UIUtil.cs +++ b/Utilities/UIUtil.cs @@ -18,6 +18,11 @@ public class UIUtil /// public static bool UILock; + /// + /// Associates the machine so that it, and only it, can handle releasing the UI + /// + public static SegmentEntity TargetMachine; + /// /// Call this in GetPopupText to handle your UI Window /// @@ -34,7 +39,10 @@ public static bool HandleThisMachineWindow(SegmentEntity theMachine, BaseMachine // this will replace with the current machine's window, which is OK as long as each Mod uses this technique manager.windows[eSegmentEntity.Mod] = theWindow; + UIUtil.TargetMachine = theMachine; theWindow.manager = manager; + UIUtil.UIdelay = 0; + UIUtil.UILock = true; } catch (Exception ex) { @@ -120,27 +128,35 @@ public static void Hide(GenericMachinePanelScript panel) /// /// Insert in machine UnityUpdate to disconnect the UI when finished. /// - public static void DisconnectUI() + public static void DisconnectUI(SegmentEntity theCaller) { - if (UIdelay > 50 && UILock) + if (UIdelay > 5 && UILock && UIUtil.TargetMachine != null && UIUtil.TargetMachine == theCaller) { + Debug.LogWarning("Disconnecting UI"); GenericMachinePanelScript panel = GenericMachinePanelScript.instance; panel.gameObject.SetActive(false); panel.Background_Panel.SetActive(false); panel.currentWindow = null; panel.targetEntity = null; - GenericMachineManager manager2 = typeof(GenericMachinePanelScript).GetField("manager", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(GenericMachinePanelScript.instance) as GenericMachineManager; - manager2.windows.Remove(eSegmentEntity.Mod); UIManager.RemoveUIRules("Machine"); DragAndDropManager.instance.CancelDrag(); DragAndDropManager.instance.DisableDragBackground(); + GenericMachineManager manager2 = typeof(GenericMachinePanelScript).GetField("manager", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(GenericMachinePanelScript.instance) as GenericMachineManager; + manager2.windows.Remove(eSegmentEntity.Mod); + if (manager2.windows.ContainsKey(eSegmentEntity.Mod)) + { + Debug.LogWarning("DisconnectUI was not able to remove the window entry!"); + return; + } + UIUtil.TargetMachine = null; UILock = false; } - UIdelay++; + else if (UIUtil.TargetMachine != null && UIUtil.TargetMachine == theCaller) + UIdelay++; } /// - /// An emergency escape function when looking at the wrong machine + /// An emergency escape function when looking at the wrong machine (no longer necessary!) /// public static void EscapeUI() { From ae390c1fe7c72333f29a63a39d7f1f26de7549db Mon Sep 17 00:00:00 2001 From: Steve Date: Mon, 1 Aug 2016 23:07:54 -0700 Subject: [PATCH 15/23] Remove log spam --- Utilities/UIUtil.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs index 77b36a8..490c4e6 100644 --- a/Utilities/UIUtil.cs +++ b/Utilities/UIUtil.cs @@ -132,7 +132,6 @@ public static void DisconnectUI(SegmentEntity theCaller) { if (UIdelay > 5 && UILock && UIUtil.TargetMachine != null && UIUtil.TargetMachine == theCaller) { - Debug.LogWarning("Disconnecting UI"); GenericMachinePanelScript panel = GenericMachinePanelScript.instance; panel.gameObject.SetActive(false); panel.Background_Panel.SetActive(false); From c9fcdd9109409b660c1e57fd4a2c0591584fb944 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 2 Aug 2016 16:10:06 -0700 Subject: [PATCH 16/23] Fixed network support for Machine Inventory --- Utilities/MachineInventory.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Utilities/MachineInventory.cs b/Utilities/MachineInventory.cs index 7d106ca..1507cd8 100644 --- a/Utilities/MachineInventory.cs +++ b/Utilities/MachineInventory.cs @@ -367,6 +367,11 @@ public void DropOnMobDelete() /// public void WriteInventory(BinaryWriter writer) { + if (this.Inventory == null) + { + Debug.LogWarning("Trying to write Machine Inventory but inventory is null?"); + return; + } int listcount = this.Inventory.Count; int version = 0; @@ -386,6 +391,7 @@ public void ReadInventory(BinaryReader reader) { int listcount; int version = reader.ReadInt32(); + this.Inventory = new List(); switch (version) { From c089d5f981c47d40ccd9de76d4ccc9abb8a813e8 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 3 Aug 2016 11:11:20 -0700 Subject: [PATCH 17/23] Updated for latest patches --- bin/FCECommunityTools.XML | 9 +++++++-- bin/FCECommunityTools.dll | Bin 25088 -> 25600 bytes 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/FCECommunityTools.XML b/bin/FCECommunityTools.XML index 9eca64d..87cee83 100644 --- a/bin/FCECommunityTools.XML +++ b/bin/FCECommunityTools.XML @@ -575,6 +575,11 @@ Lock to prevent running the dissociation when it isn't needed + + + Associates the machine so that it, and only it, can handle releasing the UI + + Call this in GetPopupText to handle your UI Window @@ -589,14 +594,14 @@ The working panel - + Insert in machine UnityUpdate to disconnect the UI when finished. - An emergency escape function when looking at the wrong machine + An emergency escape function when looking at the wrong machine (no longer necessary!) diff --git a/bin/FCECommunityTools.dll b/bin/FCECommunityTools.dll index e93662ebe138791ae19b30badcbd2d58c0d44403..0b46e1fb2ba9aee93a146a3679bc0ac7e4594132 100644 GIT binary patch delta 6601 zcmbtZ3v^c1mHy7T_nv$I_n(lEL;@rbLP)|RJOu(xBvGP4jDRAKLZFmHkdOz2_a6qN zfFi;z3?k4VtO`>=F+(-jI*CAd3^3YKg+Va1Qz{OlP_+XsV)r@!%?oCxt84CB_xty^ z_da{?^SI}p+*BQ9RVUcXtGjgWzVm4~S0lP4cvv4`5-CJjxp~ose|pNFvj`Y16;;4H z+J?k--fF;0+`ABnw-b4~{S52w-Zp_$33N}g*RnMBef#IEJDX--W?kYIPy~66q?^OQ z*j$R#4`4Q%FsSAU{+KK10rYM?W0IG-Nw_QK+sxa}e$Ue(#ZMeu+!YiGe+s#fwGd3kvGaQay)GuU;BgHpX3MSrkudl4aezMtkRTia|)Ln`cqF56*GI!Dk_X6= z%F6BaNsn@>=3>&YUa}F*S_GEK3OZ!OE|WE+M=X=orMuM+ze@|Iy;}@^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{3a;?uAK} zlsVnS-C$SKExWlcLM)=J+&2~4RvFH+iy?(UNxn;3VWVli_~Pg*NH`%ymGV=>fUbON>+|P zs=+)&+l?VZm)N~CBHctsJUySs(~E(8P>dxskfh{PLO;C^{N5j?yR^h2g(V706+WPF zmck0c-dLpMYK1-~a|TIfcpk&Fp(MAnkysbOIc+?VadruwC#NvU7tM0)LAkvftI(#%mPWKZ_#$5B5rm@>MF~BV z%V{}<;W6>-6z(Lvhc72b$4g)<0~*!Ez)mdbt<^DXj}&7EbB zMuK;11*+cy)%zY~1e*CrY`^)Gc9E^qwrXctLQIp^#x{r$zr@=8yOFO}I-kX9N3|l7 zk86$W9e$GVVe7P($7JC=CJW~=S-6BP(hc}{s`a^6%3eV>_wiwt(8p7|k&%eylkK7U zEcOQNfC`o+T50?IiQTJLQ_^xhi4PF7^i^zb@L_!-E}J8ME*|`?&KTvJYM79r04UhnCB@^nfbqZHoHSK=|y~Xa2v@vqBlx-rEh0MFXiv> zJ%p14Ln;4)UQbK-GT%OZ7C*$A^a`>bAe^HyRI@#lu7d9i9Hyih_ECKi8>;`BWZ{!SgLS_!U~0r3U_f?c#o0~D7j6^N0oeB$`PDa3t>qQx7WL%k~UphAF#pLO0%cgHAY<}wAPc%cAx@9@lQ!e>^rpDuH z55(2BHP=i%$DMi8x8iK4lwo&3^)#&_c8T From f10295c3a7fdaa1b4bb3671a4c9098b49d9425c8 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 16 Aug 2016 19:15:09 -0700 Subject: [PATCH 18/23] Added UI scaling helper functions UNTESTED!!! --- Utilities/UIUtil.cs | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs index 490c4e6..d28ce3d 100644 --- a/Utilities/UIUtil.cs +++ b/Utilities/UIUtil.cs @@ -23,6 +23,16 @@ public class UIUtil /// public static SegmentEntity TargetMachine; + /// + /// Vector for recording default window position for scaled UI + /// + private Vector3 StartPos; + + /// + /// Used to prevent rescaling the UI after it's already been done + /// + private bool firstopen; + /// /// Call this in GetPopupText to handle your UI Window /// @@ -170,5 +180,54 @@ public static void EscapeUI() DragAndDropManager.instance.CancelDrag(); DragAndDropManager.instance.DisableDragBackground(); } + + + /// + /// Helper class for scaling UI window elements + /// + /// Multiplying factor for the window width + /// Allows manual overriding of the window content offset if required + public void ScaleUIWindow(float scalingfactorx, float xoffsetoverride = 0) + { + if (!firstopen) + { + float xoffset = 0; + if (scalingfactorx > 0) + xoffset = -140 * scalingfactorx; + if (xoffsetoverride != 0) + xoffset = xoffsetoverride; + this.StartPos = GenericMachinePanelScript.instance.gameObject.transform.localPosition; + GenericMachinePanelScript.instance.gameObject.transform.localScale = new Vector3(scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.gameObject.transform.localPosition = this.StartPos + new Vector3(-xoffset, 0f, 0f); + GenericMachinePanelScript.instance.Background_Panel.transform.localScale = new Vector3(scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Label_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Icon_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Content_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Content_Icon_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Scroll_Bar.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Source_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Generic_Machine_Title_Label.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); + + firstopen = true; + } + } + + /// + /// Used in UI window OnClose method to restore default window settings + /// + public void RestoreUIScale() + { + GenericMachinePanelScript.instance.gameObject.transform.localPosition = this.StartPos; + GenericMachinePanelScript.instance.gameObject.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Background_Panel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Label_Holder.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Icon_Holder.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Content_Holder.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Content_Icon_Holder.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Scroll_Bar.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Source_Holder.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + GenericMachinePanelScript.instance.Generic_Machine_Title_Label.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); + this.firstopen = false; + } } } From cba2639b94716b16872ac33cbf3fc95133702a74 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 16 Aug 2016 19:15:52 -0700 Subject: [PATCH 19/23] Added Window scaling helper functions --- bin/FCECommunityTools.XML | 22 ++++++++++++++++++++++ bin/FCECommunityTools.dll | Bin 25600 -> 27136 bytes 2 files changed, 22 insertions(+) diff --git a/bin/FCECommunityTools.XML b/bin/FCECommunityTools.XML index 87cee83..076b80b 100644 --- a/bin/FCECommunityTools.XML +++ b/bin/FCECommunityTools.XML @@ -580,6 +580,16 @@ Associates the machine so that it, and only it, can handle releasing the UI + + + Vector for recording default window position for scaled UI + + + + + Used to prevent rescaling the UI after it's already been done + + Call this in GetPopupText to handle your UI Window @@ -604,6 +614,18 @@ An emergency escape function when looking at the wrong machine (no longer necessary!) + + + Helper class for scaling UI window elements + + Multiplying factor for the window width + Allows manual overriding of the window content offset if required + + + + Used in UI window OnClose method to restore default window settings + + A class that provides Interopability between Storage and Machines for Pre-StorageInterface mods diff --git a/bin/FCECommunityTools.dll b/bin/FCECommunityTools.dll index 0b46e1fb2ba9aee93a146a3679bc0ac7e4594132..f07565f50773640c6053c338dc4d68c5c31e3cd5 100644 GIT binary patch delta 7427 zcmbVR33yahmOl5swW?k%sjvm3ChSXqq>->CO(IDk23ZUY3epfl0VN@kBnTnG3of+a zilsClBLQ4+259LTglOwm2&RLeh+|7L4Hz2bQ(;ul0as?uJ@2K8O7bzzyf5|F`Oi7` zoO73V-+h(3CRX+YyWNyM8I zdX3%eh@gZCV1DQ{>z4FAMikdr{BTgfCDCRrwx88bM(*$I4{AS1OqT$gLlQtjRV}(XRcX0T3K;I%Gn(&;L5s>3fcw06S}xFq_z$_+hDN6|PSO>@bXj-j*Lk;Y{gUr~*{sdzxZ zIstz`SnkAltqdYs-6#R(sH%YQT#o>)ym+l>ss$(w0r~dXAR26pHmI!=T;z*|Z4pR+aIyb)As$Q*|B3_=&O|$F#So>f`3A-H^N!O;W#sRZH-et}{Xx zdv#0{JIhtp4`(Yeor~KUhKG`R-|Q88#9*IV+ZE&TT7PIv?~Lr6P5|9;v)F;($>`9% zxVkb}KCcQJK~rylZ*UjuKBXA;rHMTltB!Y=MsS2{P%b~)RWOV%v1R!HPY_=H2qNt7TgPcfYEI*4d5lK&pu^Zl^Q9g#fn7;03w33K_O z86pyP)isovD*V+s6f4?KY4+iudEgMC7(fps;0Eu33@WIDQ}m!n5~!o>fibA}Kq98` zKtC+P2}7hEPCuMgMS?F>;rTfhq{4Ksz>}!)!(t;M`Efk3EE5z;un=d#18b;H%TZQg zs8bC1`-T|6^VFOE7mt1JRbO}vwD(e7l(SGRZ5Sk}(&Ud~jNO z!VsPVi2Z1@0*ZOwX5%of57v8yrv&54Q`es`k!nyz#^dCwK?O*uK3InZ<>PVTK9DfQ z&6qYH1Jn`|%Qqh%h|3`Z-ZE}iGGMZMs-nUvX$IocY&PO2-VQjeyS($1PEd?;Cor{L z&<_qDlSOFT}s$~@iyRM zd%8wqV7twh>WxYwO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z01}?4+eFD|5w@dgSIZZ<}^vFw|Pk0%eoYAp|!SZUe9&3wk6II8rUgyxu=49 zf$!x}e3$VQb)$KTT}`x8tICrv^AJ5juiOG((NIf&z&~#zw=Jt{xV2n8yArSaQ=lXK zcbc>A*PPB?qiJp2Hc+d4mJ9U~w3XYBP%PGbd$%nm8g=yo@m$**uGM>GMWg?_{v?m+ zXvVfrjw&8Y@5Zh&^u6;NL%Q^d?ydIiWS00F_hvpVH-R5zUOBp9Iew)#);7cW82C7(I$`}wjP?%(aXE4wh zK=NTR1RLpL3pR5aa%x88lAWS@6+c<15O)xVm1B>Emt@Ngda*Rr_$#{ z10|S1Xo?wxNi~bGXLuE1R%ky(c*j{o@+Id>Ilr9T>@-Ie<~2 zguEb*+Ut!=VuRssH_nNH(Va$v*rrnC74dFxKZf(%4;N|1Nn;GjZyGzq33-}up>x(K z5IS*z(1{C#PFyNn(?UQFbpC8i63?Tr49HQAZ5C0vLy#(GMFyG`qLJ1_r5H?W;u%~N zlg*_RbGmD0$s5(Z=4w$Lo@JK7afYButPQR*H;B*Vc4LEBOQ`#?#=Jre9wXc*pEe8R zSZdz8Q=`2~Hpmdf>k zgJy+%P3$t=N;3b#tduhifu-UYg{zdWhmKLuQIXfpDlyW0o8r64#SFMP!q{f~_;zTB)rr=CQeo%}3aL zlCePQK*Je}87DDLXRKu0!B{7C;sY%IoaF|VPqO?b%V$|WNAduKps@o!vIoGu9-q;r z2cpgZwUhj`fozM|*3_p{xz`+M>5ytBtM; zJ-DwuF6+ORt~oZ*gC9ttzkwojM(NbY2K43jPhbqkK7-#yPh&4mBbrz=ri&5ZS=2xA zr=q*f#GKOk!kD~hUR;iQIKF4xmBa^SS4HBZ3H2hr|F#KxJnb%J|3S|J1Mf?{eL-&XlsxQabMeZl7E Date: Wed, 17 Aug 2016 10:49:58 -0700 Subject: [PATCH 20/23] Made new scaling functions static --- Utilities/UIUtil.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs index d28ce3d..ee0486c 100644 --- a/Utilities/UIUtil.cs +++ b/Utilities/UIUtil.cs @@ -26,12 +26,12 @@ public class UIUtil /// /// Vector for recording default window position for scaled UI /// - private Vector3 StartPos; + private static Vector3 StartPos; /// /// Used to prevent rescaling the UI after it's already been done /// - private bool firstopen; + private static bool firstopen; /// /// Call this in GetPopupText to handle your UI Window @@ -187,7 +187,7 @@ public static void EscapeUI() /// /// Multiplying factor for the window width /// Allows manual overriding of the window content offset if required - public void ScaleUIWindow(float scalingfactorx, float xoffsetoverride = 0) + public static void ScaleUIWindow(float scalingfactorx, float xoffsetoverride = 0) { if (!firstopen) { @@ -196,9 +196,9 @@ public void ScaleUIWindow(float scalingfactorx, float xoffsetoverride = 0) xoffset = -140 * scalingfactorx; if (xoffsetoverride != 0) xoffset = xoffsetoverride; - this.StartPos = GenericMachinePanelScript.instance.gameObject.transform.localPosition; + StartPos = GenericMachinePanelScript.instance.gameObject.transform.localPosition; GenericMachinePanelScript.instance.gameObject.transform.localScale = new Vector3(scalingfactorx, 1.0f, 1.0f); - GenericMachinePanelScript.instance.gameObject.transform.localPosition = this.StartPos + new Vector3(-xoffset, 0f, 0f); + GenericMachinePanelScript.instance.gameObject.transform.localPosition = StartPos + new Vector3(-xoffset, 0f, 0f); GenericMachinePanelScript.instance.Background_Panel.transform.localScale = new Vector3(scalingfactorx, 1.0f, 1.0f); GenericMachinePanelScript.instance.Label_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); GenericMachinePanelScript.instance.Icon_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); @@ -215,9 +215,9 @@ public void ScaleUIWindow(float scalingfactorx, float xoffsetoverride = 0) /// /// Used in UI window OnClose method to restore default window settings /// - public void RestoreUIScale() + public static void RestoreUIScale() { - GenericMachinePanelScript.instance.gameObject.transform.localPosition = this.StartPos; + GenericMachinePanelScript.instance.gameObject.transform.localPosition = StartPos; GenericMachinePanelScript.instance.gameObject.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); GenericMachinePanelScript.instance.Background_Panel.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); GenericMachinePanelScript.instance.Label_Holder.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); @@ -227,7 +227,7 @@ public void RestoreUIScale() GenericMachinePanelScript.instance.Scroll_Bar.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); GenericMachinePanelScript.instance.Source_Holder.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); GenericMachinePanelScript.instance.Generic_Machine_Title_Label.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); - this.firstopen = false; + firstopen = false; } } } From 691cae22bed353ab1faa6602bb4336f0d9f6c9e1 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 17 Aug 2016 10:50:37 -0700 Subject: [PATCH 21/23] Made new scaling functions static --- bin/FCECommunityTools.dll | Bin 27136 -> 27136 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/FCECommunityTools.dll b/bin/FCECommunityTools.dll index f07565f50773640c6053c338dc4d68c5c31e3cd5..608286f89c2165f2acf103cef2bb4496bf0fca5d 100644 GIT binary patch delta 596 zcmZp;!q{+yaY6@k`r<7UyJZ>qCaw%;+%uVxQJuA=j)6gDvLchtKVYm14uG4urjc07G%1wlFP!xz+l0^AjnY1&A`AS_K%T^&GIuNP>m8uH8&HO`p3k> zp~C@W@*HN0;%0`3F#;9ya_TTKbJvwHFmUBJfrx1!Vmgp$-~t+lCc!j0QA3Iwp|Eap ztGYfTNK|_A1$90k>!F6&WCabj$-j|!BFN&J$f{~Ika@mZFkXQcRFA571ISklTEYe_ z43j~=0s%Bv)oqs3tY%~qYnVJoOKbB9EhZLrK?XJ6%}j!uFX|Pt#ZF^*!NA&wIaFkUK`SJ;)ee15?C;~Zge=;8C7hRokzw+q_;otKm<|V7 z#011LK<_L7#`A&%28N(um*6dTqPFdS*YCJUwNd6>f5g(wdlEPpg`PlT9i;0Yh^;VD hQH=4!=C_H8OcM<_HuI(YVrCLB*esawo^hf9I{=?;ma_l= delta 608 zcmZp;!q{+yaY6@k(}~R!yJZ>0Caw%;JTjS)QJuA?j)6gDvLchtKVYm14uG4urly$7G%1wQqRG}z+l0^AjrT}&CS5TBKD7wi_P*IBT$hNNI5q%nEJ=W z!=b|gWbzzlj^bv4h%o{c^K$Aiv2Zihl`t@Hh8-tdx0Sm*_$&8xfOib0AB{i!VnVH0DCr{JTVr1C7UyGTAosmI}cQX^?=97Ab zY^rSxFZg&kjxjK}gF>Q>L7bV9;RJ)3I+!PMksHKYI62-_I&>{4P#KyTxEO>uPB6fD zsX*RIIIkJVJB6bAG{aV?K2HV@#?vTrXBbXwK5zO~QQ*;^lTRmKuyMv%y`c@(SRKQ3?z{O From 7cbf1eb2a4bb5f4d582934e0c49752c24581bab7 Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 17 Aug 2016 15:57:01 -0700 Subject: [PATCH 22/23] Corrected window offset --- Utilities/UIUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/UIUtil.cs b/Utilities/UIUtil.cs index ee0486c..30f345a 100644 --- a/Utilities/UIUtil.cs +++ b/Utilities/UIUtil.cs @@ -198,7 +198,7 @@ public static void ScaleUIWindow(float scalingfactorx, float xoffsetoverride = 0 xoffset = xoffsetoverride; StartPos = GenericMachinePanelScript.instance.gameObject.transform.localPosition; GenericMachinePanelScript.instance.gameObject.transform.localScale = new Vector3(scalingfactorx, 1.0f, 1.0f); - GenericMachinePanelScript.instance.gameObject.transform.localPosition = StartPos + new Vector3(-xoffset, 0f, 0f); + GenericMachinePanelScript.instance.gameObject.transform.localPosition = StartPos + new Vector3(xoffset, 0f, 0f); GenericMachinePanelScript.instance.Background_Panel.transform.localScale = new Vector3(scalingfactorx, 1.0f, 1.0f); GenericMachinePanelScript.instance.Label_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); GenericMachinePanelScript.instance.Icon_Holder.transform.localScale = new Vector3(1f / scalingfactorx, 1.0f, 1.0f); From 792c4aeb6209de9dea16d3943abd9eb73cdc5fbf Mon Sep 17 00:00:00 2001 From: Steve Date: Wed, 17 Aug 2016 15:57:26 -0700 Subject: [PATCH 23/23] Corrected window offset --- bin/FCECommunityTools.dll | Bin 27136 -> 27136 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/FCECommunityTools.dll b/bin/FCECommunityTools.dll index 608286f89c2165f2acf103cef2bb4496bf0fca5d..3471490c0107b2f6736e0765e9c5ec0f3d3185f9 100644 GIT binary patch delta 90 zcmV-g0Hyzc)B%9h0g#9Si|et9W+njxlkp}K0rHatCxWwxCv*V;0JHokz%CGk#HC6c w8_PtCd5Imq5;nH8%vZb!0*mXDieMTLG_D5EKE3Zqh)W~VYwS}Uv$SAL37$nI)Bpeg delta 90 zcmV-g0Hyzc)B%9h0g#9SXQQ!-W+njylkp}K0rQguCxQWGvxg^i0kixlz%CH>m7CHv wO?yC&LI>|(v{a(A%vZb!0%xO>ieMTLwA@;@zwVDgq9uVG?vGfdv$SAL3DF5C1^@s6