diff --git a/Assets/Data/Inventory/BaseInventory.asset b/Assets/Data/Inventory/BaseInventory.asset
index 423f7ed..dd184bf 100644
--- a/Assets/Data/Inventory/BaseInventory.asset
+++ b/Assets/Data/Inventory/BaseInventory.asset
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:1d0672a6b3709593b57d6964e247a9ccf9ecc89b29d7cc88a1bbf5de996e3296
+oid sha256:479be56d3de9e28201b00e89d275b36c21fb25244411ae9838f567db460ee1b1
size 979
diff --git a/Assets/Models.meta b/Assets/Models.meta
new file mode 100644
index 0000000..5346456
--- /dev/null
+++ b/Assets/Models.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 296bd90e667df1f4697823a0aa45acf0
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Plugins/IngameDebugConsole/Android.meta b/Assets/Plugins/IngameDebugConsole/Android.meta
new file mode 100644
index 0000000..12049b6
--- /dev/null
+++ b/Assets/Plugins/IngameDebugConsole/Android.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3d7d7a61a5341904eb3c65af025b1d86
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Plugins/IngameDebugConsole/Prefabs.meta b/Assets/Plugins/IngameDebugConsole/Prefabs.meta
new file mode 100644
index 0000000..6aa8bf2
--- /dev/null
+++ b/Assets/Plugins/IngameDebugConsole/Prefabs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7dbc36665bc0d684db9a4447e27a7a4b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Plugins/IngameDebugConsole/Scripts.meta b/Assets/Plugins/IngameDebugConsole/Scripts.meta
new file mode 100644
index 0000000..72dcaac
--- /dev/null
+++ b/Assets/Plugins/IngameDebugConsole/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 860c08388401a6d4e858fe4910ea9337
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Plugins/IngameDebugConsole/Sprites/Unused.meta b/Assets/Plugins/IngameDebugConsole/Sprites/Unused.meta
new file mode 100644
index 0000000..f3769b1
--- /dev/null
+++ b/Assets/Plugins/IngameDebugConsole/Sprites/Unused.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f6caae32d463529478f2186f47c2e3fe
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Prefabs/UI/Player Canvas.prefab b/Assets/Prefabs/UI/Player Canvas.prefab
index b10060f..dbecfdf 100644
--- a/Assets/Prefabs/UI/Player Canvas.prefab
+++ b/Assets/Prefabs/UI/Player Canvas.prefab
@@ -1,5 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &2513432637800871259
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 9187876604664920423}
+ - component: {fileID: 7314421917572336346}
+ m_Layer: 5
+ m_Name: InventoryCatch
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &9187876604664920423
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2513432637800871259}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 5195354182462625304}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 100, y: 100}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &7314421917572336346
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2513432637800871259}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: c47170bdc5fe12f40b903940535b2e1e, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Priority: -1
+ InventoryUI: {fileID: 5195354183134146528}
--- !u!1 &2665231841929910951
GameObject:
m_ObjectHideFlags: 0
@@ -191,7 +241,7 @@ RectTransform:
m_Children:
- {fileID: 2665231842684883354}
m_Father: {fileID: 5195354182462625304}
- m_RootOrder: 2
+ m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
@@ -722,7 +772,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
- m_AnchoredPosition: {x: -0.000052183314, y: -0.0000076293945}
+ m_AnchoredPosition: {x: -0.000052183314, y: -0.000015258789}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 1}
--- !u!114 &5195354181806561393
@@ -793,6 +843,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
+ - {fileID: 9187876604664920423}
- {fileID: 5195354183083441315}
- {fileID: 5195354183134146556}
- {fileID: 2665231842396078511}
@@ -884,6 +935,7 @@ MonoBehaviour:
TimeText: {fileID: 0}
Title: {fileID: 2665231842396078511}
TotalTime: 30
+ isTimePaused: 0
--- !u!1 &5195354182925078845
GameObject:
m_ObjectHideFlags: 0
@@ -1023,7 +1075,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5195354182462625304}
- m_RootOrder: 0
+ m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@@ -1153,7 +1205,7 @@ RectTransform:
- {fileID: 5195354181250555040}
- {fileID: 5195354183157824117}
m_Father: {fileID: 5195354182462625304}
- m_RootOrder: 3
+ m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
@@ -1243,7 +1295,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5195354182462625304}
- m_RootOrder: 1
+ m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
@@ -1323,7 +1375,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 36cc4df775c8e8b46a89972d8008d56d, type: 3}
m_Name:
m_EditorClassIdentifier:
- inventory: {fileID: 11400000, guid: b6fa892e4c159bf46a2c4cda19627e97, type: 2}
+ inventory: {fileID: 11400000, guid: 9f2bac6895147d444858493b9609d026, type: 2}
ItemPrefab: {fileID: 1021368708357542995, guid: f846db1cf36a645479ce131a2e0cf72f,
type: 3}
Parent: {fileID: 5195354183134146556}
@@ -1416,9 +1468,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 140e56929e1450a48b2f7716511bb327, type: 3}
m_Name:
m_EditorClassIdentifier:
+ Priority: 0
Prefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, type: 3}
insertIndex: -1
content: {fileID: 5195354181806561359}
+ maxLength: 6
reader:
LogicChain: []
--- !u!114 &5195354183157824121
diff --git a/Assets/Scenes/Client Scenes/ClientScene.unity b/Assets/Scenes/Client Scenes/ClientScene.unity
index 1f2ecd2..d5d58dd 100644
--- a/Assets/Scenes/Client Scenes/ClientScene.unity
+++ b/Assets/Scenes/Client Scenes/ClientScene.unity
@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
- m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1}
+ m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.57481706, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
@@ -199,9 +199,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 140e56929e1450a48b2f7716511bb327, type: 3}
m_Name:
m_EditorClassIdentifier:
+ Priority: 0
Prefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, type: 3}
insertIndex: -1
content: {fileID: 1704581577}
+ maxLength: 6
reader:
LogicChain: []
--- !u!1 &1352513146
@@ -672,7 +674,7 @@ PrefabInstance:
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchoredPosition.y
- value: 5.547437e-10
+ value: -0.000048249298
objectReference: {fileID: 0}
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
@@ -682,7 +684,7 @@ PrefabInstance:
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchoredPosition.x
- value: -0.00002576159
+ value: -0.000075660755
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
@@ -808,7 +810,7 @@ PrefabInstance:
type: 3}
propertyPath: inventory
value:
- objectReference: {fileID: 11400000, guid: 9f2bac6895147d444858493b9609d026,
+ objectReference: {fileID: 11400000, guid: eea1505cebc20b64b8c421ba71e10781,
type: 2}
- target: {fileID: 2665231842396078511, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
@@ -958,7 +960,7 @@ PrefabInstance:
- target: {fileID: 5195354183101525346, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AspectRatio
- value: 8.548341
+ value: 41.85203
objectReference: {fileID: 0}
- target: {fileID: 5195354183134146559, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
@@ -1070,6 +1072,51 @@ PrefabInstance:
propertyPath: m_Sprite
value:
objectReference: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0}
+ - target: {fileID: 2665231842684883354, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_AnchoredPosition.y
+ value: -16.199997
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_AnchorMin.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_AnchorMin.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_AnchorMax.x
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_AnchorMax.y
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_SizeDelta.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_SizeDelta.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_AnchoredPosition.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 9187876604664920423, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
+ type: 3}
+ propertyPath: m_AnchoredPosition.y
+ value: 0
+ objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 5195354182462625307, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3}
- {fileID: 5195354183157824118, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3}
diff --git a/Assets/Scripts/Logic/BlockReader.cs b/Assets/Scripts/Logic/BlockReader.cs
index d348530..8dd5dca 100644
--- a/Assets/Scripts/Logic/BlockReader.cs
+++ b/Assets/Scripts/Logic/BlockReader.cs
@@ -31,6 +31,11 @@ public class BlockReader
///
public LogicBlock CurrentBlock { get { return ((currentBlockIndex < LogicChain.Count) ? LogicChain[currentBlockIndex] : null); } }
+ ///
+ /// Sum of size of all Blocks in the chain
+ ///
+ public int Length { get { int retVal = 0; LogicChain.ForEach(p => retVal += p.Size()); return retVal; } }
+
#endregion Read-only Variables
#region Private Variables
diff --git a/Assets/Scripts/LogicBlocks.meta b/Assets/Scripts/LogicBlocks.meta
new file mode 100644
index 0000000..98af9d1
--- /dev/null
+++ b/Assets/Scripts/LogicBlocks.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8936b441d7647f74884c94f97bfb8931
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/UI/BagItem.cs b/Assets/Scripts/UI/BagItem.cs
index 17aff16..9fb2b8d 100644
--- a/Assets/Scripts/UI/BagItem.cs
+++ b/Assets/Scripts/UI/BagItem.cs
@@ -20,6 +20,10 @@ public class BagItem : LogicElementHolder
private TextMeshProUGUI CountText;
#endregion Private Variables
+ #region Read Only
+
+ #endregion Read Only
+
#region Class Functionality
public void Initialise(Inventory.Data data)
@@ -82,6 +86,16 @@ public class BagItem : LogicElementHolder
}
+ ///
+ /// Called to check if this holder can hold the provided element;
+ ///
+ /// element to check if it can hold
+ /// returns true if this can hold the element
+ public override bool canHold(LogicElementUI element)
+ {
+ return element.logicElement.isSameType(InventoryData.element);
+ }
+
///
/// Called when an element in this holder is double clicked
///
diff --git a/Assets/Scripts/UI/ILogicElementHolder.cs b/Assets/Scripts/UI/ILogicElementHolder.cs
index fa88155..dfefe7e 100644
--- a/Assets/Scripts/UI/ILogicElementHolder.cs
+++ b/Assets/Scripts/UI/ILogicElementHolder.cs
@@ -14,6 +14,10 @@ public abstract class LogicElementHolder : MonoBehaviour
///
private static List EnabledHolders = new List();
+ [Tooltip("An Element with a higher priority will be used if two object overlap")]
+ public int Priority = 0;
+
+
#region Unity Functions
protected virtual void OnEnable()
{
@@ -64,6 +68,14 @@ public abstract class LogicElementHolder : MonoBehaviour
public abstract void OnDoubleClick(LogicElementUI element);
+ ///
+ /// Called to check if this holder can hold the provided element;
+ ///
+ /// element to check if it can hold
+ /// returns true if this can hold the element
+ public virtual bool canHold(LogicElementUI element) { return true; }
+
+
#endregion Class Funtions
#region Static Functions
diff --git a/Assets/Scripts/UI/InventoryCatch.cs b/Assets/Scripts/UI/InventoryCatch.cs
new file mode 100644
index 0000000..28be0eb
--- /dev/null
+++ b/Assets/Scripts/UI/InventoryCatch.cs
@@ -0,0 +1,30 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using UnityEngine;
+
+public class InventoryCatch : LogicElementHolder
+{
+ [SerializeField]
+ private InventoryUI InventoryUI;
+
+ public override void OnAdd(LogicElementUI element)
+ {
+ BagItem item = InventoryUI.content.FirstOrDefault(p => p.canHold(element));
+
+ if (item != default)
+ item.OnAdd(element);
+
+ Destroy(element.gameObject);
+ }
+
+ public override void OnDoubleClick(LogicElementUI element)
+ {
+ //DoNothing
+ }
+
+ public override void OnRemove(LogicElementUI element)
+ {
+ //DoNothing
+ }
+}
diff --git a/Assets/Scripts/UI/InventoryCatch.cs.meta b/Assets/Scripts/UI/InventoryCatch.cs.meta
new file mode 100644
index 0000000..ebd197d
--- /dev/null
+++ b/Assets/Scripts/UI/InventoryCatch.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c47170bdc5fe12f40b903940535b2e1e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scripts/UI/InventoryUI.cs b/Assets/Scripts/UI/InventoryUI.cs
index 30cc418..350a354 100644
--- a/Assets/Scripts/UI/InventoryUI.cs
+++ b/Assets/Scripts/UI/InventoryUI.cs
@@ -13,6 +13,9 @@ public class InventoryUI : MonoBehaviour
[SerializeField]
private Transform Parent;
+ public List content { get; private set; }
+
+
private void Start()
{
UpdateUI();
@@ -34,10 +37,13 @@ public class InventoryUI : MonoBehaviour
foreach(Transform child in Parent)
Destroy(child.gameObject);
+ content = new List();
+
foreach (Inventory.Data data in inventory.BagItems)
{
BagItem item = Instantiate(ItemPrefab.gameObject, Parent).GetComponent();
item.Initialise(data);
+ content.Add(item);
}
}
diff --git a/Assets/Scripts/UI/LogicElementUI.cs b/Assets/Scripts/UI/LogicElementUI.cs
index ea7e057..e478116 100644
--- a/Assets/Scripts/UI/LogicElementUI.cs
+++ b/Assets/Scripts/UI/LogicElementUI.cs
@@ -117,12 +117,19 @@ public class LogicElementUI : Dragable
//Call OnHoverStop to each element we are hovering over
lastHover.ForEach(p => p.OnHoverEnd(this));
+
+ //order the UIHolders by priority and get the first which will accept this
+ lastHover = lastHover.OrderByDescending(p => p.Priority).ToList();
+
+ lastHover.ForEach(p => Debug.Log(p.gameObject.name));
+ LogicElementHolder holderToAdd = lastHover.FirstOrDefault(p => p.canHold(this));
+
//If we are still hovering over anything add this to it
//Else add it back to where it came from
- if (lastHover.Count > 0)
+ if (holderToAdd != default)
{
- lastHover[0].OnAdd(this);
- currentHolder = lastHover[0];
+ holderToAdd.OnAdd(this);
+ currentHolder = holderToAdd;
}
else
currentHolder.OnAdd(this);
diff --git a/Assets/Scripts/UI/LogicTrayUI.cs b/Assets/Scripts/UI/LogicTrayUI.cs
index e6a2845..d9793d5 100644
--- a/Assets/Scripts/UI/LogicTrayUI.cs
+++ b/Assets/Scripts/UI/LogicTrayUI.cs
@@ -15,6 +15,8 @@ public class LogicTrayUI : LogicElementHolder
protected int insertIndex = -1;
[SerializeField]
private Transform content;
+ [SerializeField]
+ private int maxLength = 6;
[SerializeField]
public BlockReader reader;
@@ -72,8 +74,17 @@ public class LogicTrayUI : LogicElementHolder
if (insertIndex != -1)
{
GameObject elementObject = Instantiate(Prefab.gameObject, content);
- elementObject.GetComponentInChildren().text = "insert";
- elementObject.GetComponentInChildren().color = new Color(0.5f, 0.5f, 0.5f, 0.25f);
+
+ if (reader.Length < maxLength)
+ {
+ elementObject.GetComponentInChildren().text = "insert";
+ elementObject.GetComponentInChildren().color = new Color(0.5f, 0.5f, 0.5f, 0.25f);
+ }
+ else
+ {
+ elementObject.GetComponentInChildren().text = "X";
+ elementObject.GetComponentInChildren().color = new Color(1.0f, 0.25f, 0.25f, 0.5f);
+ }
//Set sibling index to where we want it in list + add destroyedCount since technically they are still here
elementObject.transform.SetSiblingIndex(destroyedCount + insertIndex);
@@ -91,8 +102,8 @@ public class LogicTrayUI : LogicElementHolder
/// Element which is being dragged
public override void OnRemove(LogicElementUI element)
{
- Vector2 offset = new Vector2(element.rectTransform.rect.width/2, 0);
- int index = GetInsertIndex(element.rectTransform,offset);
+ Vector2 offset = new Vector2(element.rectTransform.rect.width / 2, 0);
+ int index = GetInsertIndex(element.rectTransform, offset);
if (index >= reader.LogicChain.Count)
index = reader.LogicChain.Count - 1;
reader.LogicChain.RemoveAt(index);
@@ -142,7 +153,6 @@ public class LogicTrayUI : LogicElementHolder
insertIndex = -1;
UpdateDisplay();
}
- #endregion LogicElementHolder Implementation
///
/// Called when an element in this holder is double clicked
@@ -153,6 +163,20 @@ public class LogicTrayUI : LogicElementHolder
throw new System.NotImplementedException();
}
+ ///
+ /// Called to check if this holder can hold the provided element;
+ ///
+ /// element to check if it can hold
+ /// returns true if this can hold the element
+ public override bool canHold(LogicElementUI element)
+ {
+ return reader.Length < maxLength;
+ }
+
+ #endregion LogicElementHolder Implementation
+
+
+
#region Helper Functions
public int GetInsertIndex(RectTransform rt, Vector2 offset)
@@ -175,7 +199,6 @@ public class LogicTrayUI : LogicElementHolder
return GetInsertIndex(rt, Vector2.zero);
}
-
#endregion Helper Functions
}