diff --git a/Assets/Scripts/Components.meta b/Assets/Scripts/Components.meta new file mode 100644 index 0000000..5a95b09 --- /dev/null +++ b/Assets/Scripts/Components.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8d7394d70ec233849a60a26da5f23b75 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/BagItem.cs b/Assets/Scripts/UI/BagItem.cs index f5607f1..8f54453 100644 --- a/Assets/Scripts/UI/BagItem.cs +++ b/Assets/Scripts/UI/BagItem.cs @@ -38,7 +38,7 @@ public class BagItem : LogicElementHolder LogicElementUI logicElement = Instantiate(LogicElementPrefab.gameObject, LogicElementLocation).GetComponent(); - logicElement.Initialise(data.element, this); + logicElement.Initialise(data.element, this,true); UpdateUI(); } @@ -81,7 +81,7 @@ public class BagItem : LogicElementHolder Destroy(element.gameObject); LogicElementUI logicElement = Instantiate(LogicElementPrefab.gameObject, LogicElementLocation).GetComponent(); - logicElement.Initialise(InventoryData.element, this); + logicElement.Initialise(InventoryData.element, this,true); UpdateUI(); diff --git a/Assets/Scripts/UI/LogicElementUI.cs b/Assets/Scripts/UI/LogicElementUI.cs index 8d184f5..4f38598 100644 --- a/Assets/Scripts/UI/LogicElementUI.cs +++ b/Assets/Scripts/UI/LogicElementUI.cs @@ -67,9 +67,12 @@ public class LogicElementUI : Dragable } } - public virtual void Initialise(LogicBlock LogicElement, LogicElementHolder Holder) + public virtual void Initialise(LogicBlock LogicElement, LogicElementHolder Holder,bool copy) { - this.LogicElement = LogicElement.Clone(); + if (copy) + this.LogicElement = LogicElement.Clone(); + else + this.LogicElement = LogicElement; currentHolder = Holder; } #endregion Class Implementation diff --git a/Assets/Scripts/UI/LogicTrayUI.cs b/Assets/Scripts/UI/LogicTrayUI.cs index ef93f4a..e288b00 100644 --- a/Assets/Scripts/UI/LogicTrayUI.cs +++ b/Assets/Scripts/UI/LogicTrayUI.cs @@ -77,12 +77,12 @@ public class LogicTrayUI : LogicElementHolder QueueData lastData = readerQueue[readerQueue.Count - 1]; readerQueue.RemoveAt(readerQueue.Count - 1); - lastData.block.blockReader.LogicChain = new List(lastData.reader.LogicChain); + //lastData.block.blockReader.LogicChain = new List(lastData.reader.LogicChain); border.color = readerQueue[readerQueue.Count - 1].color; - readerQueue[readerQueue.Count - 1].reader.LogicChain = new List(reader.LogicChain); + // readerQueue[readerQueue.Count - 1].reader.LogicChain = new List(reader.LogicChain); SetBlockReader(readerQueue[readerQueue.Count - 1].reader); @@ -105,7 +105,7 @@ public class LogicTrayUI : LogicElementHolder foreach (LogicBlock element in reader.LogicChain) { LogicElementUI elementUI = Instantiate(Prefab.gameObject, content).GetComponent(); - elementUI.Initialise(element, this); + elementUI.Initialise(element, this,false); } //Add insertIndex object if needed @@ -210,7 +210,7 @@ public class LogicTrayUI : LogicElementHolder if (block == null || !block.isEditable) return; - readerQueue.Add(new QueueData(block,reader,block.Color)); + readerQueue.Add(new QueueData(block,block.blockReader,block.Color)); border.color = block.Color; SetBlockReader(block.blockReader);