Browse Source

Actually have for loops ui working now

master
Joshua Reason 5 years ago
parent
commit
a768a2f314
4 changed files with 19 additions and 8 deletions
  1. +8
    -0
      Assets/Scripts/Components.meta
  2. +2
    -2
      Assets/Scripts/UI/BagItem.cs
  3. +5
    -2
      Assets/Scripts/UI/LogicElementUI.cs
  4. +4
    -4
      Assets/Scripts/UI/LogicTrayUI.cs

+ 8
- 0
Assets/Scripts/Components.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8d7394d70ec233849a60a26da5f23b75
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 2
Assets/Scripts/UI/BagItem.cs View File

@ -38,7 +38,7 @@ public class BagItem : LogicElementHolder
LogicElementUI logicElement = Instantiate(LogicElementPrefab.gameObject, LogicElementLocation).GetComponent<LogicElementUI>();
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<LogicElementUI>();
logicElement.Initialise(InventoryData.element, this);
logicElement.Initialise(InventoryData.element, this,true);
UpdateUI();

+ 5
- 2
Assets/Scripts/UI/LogicElementUI.cs View File

@ -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

+ 4
- 4
Assets/Scripts/UI/LogicTrayUI.cs View File

@ -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<LogicBlock>(lastData.reader.LogicChain);
//lastData.block.blockReader.LogicChain = new List<LogicBlock>(lastData.reader.LogicChain);
border.color = readerQueue[readerQueue.Count - 1].color;
readerQueue[readerQueue.Count - 1].reader.LogicChain = new List<LogicBlock>(reader.LogicChain);
// readerQueue[readerQueue.Count - 1].reader.LogicChain = new List<LogicBlock>(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<LogicElementUI>();
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);

Loading…
Cancel
Save