Browse Source

Semi working editable for loop

master
SWIN\jreason 5 years ago
parent
commit
1980455d86
13 changed files with 478 additions and 40 deletions
  1. +2
    -2
      Assets/Data/Inventory/BaseInventory.asset
  2. +2
    -2
      Assets/Data/Logic Blocks/ForLoop.asset
  3. +0
    -8
      Assets/Plugins.meta
  4. +2
    -1
      Assets/Prefabs/UI/Bag Item.prefab
  5. +293
    -0
      Assets/Prefabs/UI/Player Canvas.prefab
  6. +57
    -10
      Assets/Scenes/Client Scenes/ClientScene.unity
  7. +33
    -4
      Assets/Scripts/Logic/Blocks/CombinedBlock.cs
  8. +10
    -1
      Assets/Scripts/Logic/Blocks/LogicBlock.cs
  9. +2
    -2
      Assets/Scripts/UI/BagItem.cs
  10. +1
    -1
      Assets/Scripts/UI/ILogicElementHolder.cs
  11. +8
    -4
      Assets/Scripts/UI/InventoryCatch.cs
  12. +3
    -3
      Assets/Scripts/UI/LogicElementUI.cs
  13. +65
    -2
      Assets/Scripts/UI/LogicTrayUI.cs

+ 2
- 2
Assets/Data/Inventory/BaseInventory.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:479be56d3de9e28201b00e89d275b36c21fb25244411ae9838f567db460ee1b1
size 979
oid sha256:6e4c66a6bd49ce2a4272d7a654c5f672cace8afca5f31e4902f701fd892b2651
size 1090

+ 2
- 2
Assets/Data/Logic Blocks/ForLoop.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:6e6e8e46d29e12c7793ce76da141fbb3dc619368660efd6d4338052edcafd802
size 787
oid sha256:bedf21a36efd57e309566f8720c0ef1f348713ed8aca032e51b42634e368fb4a
size 712

+ 0
- 8
Assets/Plugins.meta View File

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

+ 2
- 1
Assets/Prefabs/UI/Bag Item.prefab View File

@ -111,6 +111,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d900b6d035606e046acdf763c041a7c9, type: 3} m_Script: {fileID: 11500000, guid: d900b6d035606e046acdf763c041a7c9, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
Priority: -2
LogicElementLocation: {fileID: 5884576982143469529} LogicElementLocation: {fileID: 5884576982143469529}
LogicElementPrefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, LogicElementPrefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2,
type: 3} type: 3}
@ -256,7 +257,7 @@ MonoBehaviour:
lineCount: 0 lineCount: 0
pageCount: 0 pageCount: 0
materialCount: 1 materialCount: 1
m_havePropertiesChanged: 0
m_havePropertiesChanged: 1
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0} m_spriteAnimator: {fileID: 0}

+ 293
- 0
Assets/Prefabs/UI/Player Canvas.prefab View File

@ -360,6 +360,295 @@ MonoBehaviour:
m_FillClockwise: 1 m_FillClockwise: 1
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
--- !u!1 &3854733345615527911
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 463365253886133364}
- component: {fileID: 902273219000936902}
- component: {fileID: 2584547907285081931}
m_Layer: 5
m_Name: TextMeshPro Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &463365253886133364
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3854733345615527911}
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: 2052082028810034629}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &902273219000936902
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3854733345615527911}
m_CullTransparentMesh: 0
--- !u!114 &2584547907285081931
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3854733345615527911}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: '>'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4278190080
m_fontColor: {r: 0, g: 0, b: 0, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 72
m_fontSizeBase: 24.98
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_isAlignmentEnumConverted: 1
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 2584547907285081931}
characterCount: 1
spriteCount: 0
spaceCount: 0
wordCount: 1
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_havePropertiesChanged: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_isInputParsingRequired: 0
m_inputSource: 0
m_hasFontAssetChanged: 0
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &4080157917815310858
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2052082028810034629}
- component: {fileID: 6693883212389319580}
- component: {fileID: 3310961320254260425}
- component: {fileID: 4132265620032504676}
m_Layer: 5
m_Name: Return Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2052082028810034629
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4080157917815310858}
m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 463365253886133364}
m_Father: {fileID: 5195354183101525347}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -70, y: 0}
m_SizeDelta: {x: 100, y: -40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6693883212389319580
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4080157917815310858}
m_CullTransparentMesh: 0
--- !u!114 &3310961320254260425
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4080157917815310858}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.972549, g: 0, b: 0.63497144, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!114 &4132265620032504676
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4080157917815310858}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 3310961320254260425}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_MethodName: OnClick_Play
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!1 &5195354181250555041 --- !u!1 &5195354181250555041
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1204,6 +1493,7 @@ RectTransform:
m_Children: m_Children:
- {fileID: 5195354181250555040} - {fileID: 5195354181250555040}
- {fileID: 5195354183157824117} - {fileID: 5195354183157824117}
- {fileID: 2052082028810034629}
m_Father: {fileID: 5195354182462625304} m_Father: {fileID: 5195354182462625304}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1472,6 +1762,9 @@ MonoBehaviour:
Prefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, type: 3} Prefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, type: 3}
insertIndex: -1 insertIndex: -1
content: {fileID: 5195354181806561359} content: {fileID: 5195354181806561359}
playButton: {fileID: 0}
returnButton: {fileID: 0}
border: {fileID: 0}
maxLength: 6 maxLength: 6
reader: reader:
LogicChain: [] LogicChain: []

+ 57
- 10
Assets/Scenes/Client Scenes/ClientScene.unity View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@ -112,6 +112,18 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &70099146 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 5195354181250555041, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
m_PrefabInstance: {fileID: 5195354181466942481}
m_PrefabAsset: {fileID: 0}
--- !u!1 &136803099 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4080157917815310858, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
m_PrefabInstance: {fileID: 5195354181466942481}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1254212986 --- !u!1 &1254212986
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -203,9 +215,24 @@ MonoBehaviour:
Prefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, type: 3} Prefab: {fileID: 6973439230367005604, guid: f1daf3f500b22a048bbbad4287c2fcb2, type: 3}
insertIndex: -1 insertIndex: -1
content: {fileID: 1704581577} content: {fileID: 1704581577}
playButton: {fileID: 70099146}
returnButton: {fileID: 136803099}
border: {fileID: 1324620582}
maxLength: 6 maxLength: 6
reader: reader:
LogicChain: [] LogicChain: []
--- !u!114 &1324620582 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
m_PrefabInstance: {fileID: 5195354181466942481}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1324620580}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1352513146 --- !u!1 &1352513146
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -656,6 +683,26 @@ PrefabInstance:
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 2584547907285081931, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_isInputParsingRequired
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4132265620032504676, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 1324620581}
- target: {fileID: 4132265620032504676, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: OnClick_Return
objectReference: {fileID: 0}
- target: {fileID: 4080157917815310858, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625300, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354182462625300, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name
@ -674,7 +721,7 @@ PrefabInstance:
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0.000008220466
value: 0.0000076293945
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
@ -935,17 +982,17 @@ PrefabInstance:
- target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_Color.r propertyPath: m_Color.r
value: 0.882353
value: 0.8862745
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_Color.g propertyPath: m_Color.g
value: 0.8862746
value: 0.884576
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_Color.b propertyPath: m_Color.b
value: 0.882353
value: 0.88235295
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354183101525349, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
@ -960,7 +1007,7 @@ PrefabInstance:
- target: {fileID: 5195354183101525346, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354183101525346, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_AspectRatio propertyPath: m_AspectRatio
value: 41.85203
value: 12.0465555
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5195354183134146559, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354183134146559, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
@ -1005,12 +1052,12 @@ PrefabInstance:
- target: {fileID: 2665231841929910945, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 2665231841929910945, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_havePropertiesChanged propertyPath: m_havePropertiesChanged
value: 0
value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2665231841929910945, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 2665231841929910945, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_isInputParsingRequired propertyPath: m_isInputParsingRequired
value: 0
value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2665231841929910945, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 2665231841929910945, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
@ -1040,12 +1087,12 @@ PrefabInstance:
- target: {fileID: 5195354181796512270, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354181796512270, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_havePropertiesChanged propertyPath: m_havePropertiesChanged
value: 0
value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5195354181796512270, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354181796512270, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}
propertyPath: m_isInputParsingRequired propertyPath: m_isInputParsingRequired
value: 0
value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5195354182925078847, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, - target: {fileID: 5195354182925078847, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3} type: 3}

+ 33
- 4
Assets/Scripts/Logic/Blocks/CombinedBlock.cs View File

@ -9,15 +9,25 @@ public class CombinedBlock : LogicBlock
#region Inspector Variables #region Inspector Variables
[SerializeField] [SerializeField]
[Tooltip("Is this block editable")] [Tooltip("Is this block editable")]
protected bool isEditable = false;
public bool isEditable = false;
[SerializeField] [SerializeField]
[Tooltip("Blocks this will run through")] [Tooltip("Blocks this will run through")]
protected BlockReader blockReader;
public BlockReader blockReader = new BlockReader();
#endregion Inspector Variables #endregion Inspector Variables
#region Private Variables #region Private Variables
public override int Size()
{
if (!isEditable)
return 1;
int retVal = 1;
foreach(LogicBlock block in blockReader.LogicChain)
retVal += block.Size();
return retVal;
}
#endregion Private Variables #endregion Private Variables
@ -60,10 +70,29 @@ public class CombinedBlock : LogicBlock
blockReader.Reset(); blockReader.Reset();
} }
public override LogicBlock[] GetAllBlocks()
{
if (!isEditable)
return new LogicBlock[] { this };
List<LogicBlock> retVal = new List<LogicBlock>();
retVal.Add(this);
foreach (LogicBlock block in blockReader.LogicChain)
retVal.AddRange(block.GetAllBlocks());
public override void OnDoubleClick()
return retVal.ToArray();
}
public override LogicBlock Clone()
{ {
base.OnDoubleClick();
CombinedBlock retVal = base.Clone() as CombinedBlock;
retVal.blockReader = new BlockReader();
foreach (LogicBlock block in blockReader.LogicChain)
retVal.blockReader.Add(block.Clone());
return retVal;
} }
#region Serialisation Functions #region Serialisation Functions

+ 10
- 1
Assets/Scripts/Logic/Blocks/LogicBlock.cs View File

@ -154,11 +154,20 @@ public abstract class LogicBlock : ScriptableObject
&& string.Equals(name, otherLogic.name); && string.Equals(name, otherLogic.name);
} }
public virtual void OnDoubleClick()
public virtual LogicBlock Clone()
{ {
LogicBlock retVal = Instantiate(this);
retVal.name = this.name;
return retVal;
} }
public virtual LogicBlock[] GetAllBlocks()
{
return new LogicBlock[] { this };
}
#endregion Class Functions #endregion Class Functions
} }

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

@ -93,9 +93,9 @@ public class BagItem : LogicElementHolder
/// </summary> /// </summary>
/// <param name="element">element to check if it can hold</param> /// <param name="element">element to check if it can hold</param>
/// <returns>returns true if this can hold the element </returns> /// <returns>returns true if this can hold the element </returns>
public override bool canHold(LogicElementUI element)
public override bool canHold(LogicBlock element)
{ {
return element.logicElement.isSameType(InventoryData.element);
return element.isSameType(InventoryData.element);
} }
/// <summary> /// <summary>

+ 1
- 1
Assets/Scripts/UI/ILogicElementHolder.cs View File

@ -73,7 +73,7 @@ public abstract class LogicElementHolder : MonoBehaviour
/// </summary> /// </summary>
/// <param name="element">element to check if it can hold</param> /// <param name="element">element to check if it can hold</param>
/// <returns>returns true if this can hold the element </returns> /// <returns>returns true if this can hold the element </returns>
public virtual bool canHold(LogicElementUI element) { return true; }
public virtual bool canHold(LogicBlock element) { return true; }
#endregion Class Funtions #endregion Class Funtions

+ 8
- 4
Assets/Scripts/UI/InventoryCatch.cs View File

@ -10,12 +10,16 @@ public class InventoryCatch : LogicElementHolder
public override void OnAdd(LogicElementUI element) public override void OnAdd(LogicElementUI element)
{ {
BagItem item = InventoryUI.content.FirstOrDefault(p => p.canHold(element));
foreach (LogicBlock block in element.logicElement.GetAllBlocks())
{
if (item != default)
item.OnAdd(element);
BagItem item = InventoryUI.content.FirstOrDefault(p => p.canHold(block));
Destroy(element.gameObject);
if (item != default)
item.OnAdd(element);
Destroy(element.gameObject);
}
} }
public override void OnDoubleClick(LogicElementUI element) public override void OnDoubleClick(LogicElementUI element)

+ 3
- 3
Assets/Scripts/UI/LogicElementUI.cs View File

@ -69,7 +69,7 @@ public class LogicElementUI : Dragable
public virtual void Initialise(LogicBlock LogicElement, LogicElementHolder Holder) public virtual void Initialise(LogicBlock LogicElement, LogicElementHolder Holder)
{ {
this.LogicElement = LogicElement;
this.LogicElement = LogicElement.Clone();
currentHolder = Holder; currentHolder = Holder;
} }
#endregion Class Implementation #endregion Class Implementation
@ -120,9 +120,9 @@ public class LogicElementUI : Dragable
//order the UIHolders by priority and get the first which will accept this //order the UIHolders by priority and get the first which will accept this
lastHover = lastHover.OrderByDescending(p => p.Priority).ToList(); lastHover = lastHover.OrderByDescending(p => p.Priority).ToList();
lastHover.ForEach(p => Debug.Log(p.gameObject.name)); lastHover.ForEach(p => Debug.Log(p.gameObject.name));
LogicElementHolder holderToAdd = lastHover.FirstOrDefault(p => p.canHold(this));
LogicElementHolder holderToAdd = lastHover.FirstOrDefault(p => p.canHold(LogicElement));
//If we are still hovering over anything add this to it //If we are still hovering over anything add this to it
//Else add it back to where it came from //Else add it back to where it came from

+ 65
- 2
Assets/Scripts/UI/LogicTrayUI.cs View File

@ -15,21 +15,38 @@ public class LogicTrayUI : LogicElementHolder
protected int insertIndex = -1; protected int insertIndex = -1;
[SerializeField] [SerializeField]
private Transform content; private Transform content;
[SerializeField]
private GameObject playButton;
[SerializeField]
private GameObject returnButton;
[SerializeField]
private Image border;
[SerializeField] [SerializeField]
private int maxLength = 6; private int maxLength = 6;
[SerializeField] [SerializeField]
public BlockReader reader; public BlockReader reader;
[SerializeField]
private List<QueueData> readerQueue = new List<QueueData>();
#region Unity Functions #region Unity Functions
public void Start() public void Start()
{ {
readerQueue.Add(new QueueData(null, reader, border.color));
UpdateDisplay(); UpdateDisplay();
} }
protected override void OnEnable() protected override void OnEnable()
{ {
base.OnEnable(); base.OnEnable();
if (reader != null) if (reader != null)
reader.OnUpdate += UpdateDisplay; reader.OnUpdate += UpdateDisplay;
} }
@ -52,6 +69,27 @@ public class LogicTrayUI : LogicElementHolder
UpdateDisplay(); UpdateDisplay();
} }
public void OnClick_Return()
{
if (readerQueue.Count <= 1)
return;
QueueData lastData = readerQueue[readerQueue.Count - 1];
readerQueue.RemoveAt(readerQueue.Count - 1);
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);
SetBlockReader(readerQueue[readerQueue.Count - 1].reader);
UpdateDisplay();
}
[ContextMenu("Update Display")] [ContextMenu("Update Display")]
public void UpdateDisplay() public void UpdateDisplay()
{ {
@ -90,6 +128,9 @@ public class LogicTrayUI : LogicElementHolder
elementObject.transform.SetSiblingIndex(destroyedCount + insertIndex); elementObject.transform.SetSiblingIndex(destroyedCount + insertIndex);
} }
playButton.SetActive(readerQueue.Count <= 1);
returnButton.SetActive(readerQueue.Count > 1);
} }
@ -165,7 +206,14 @@ public class LogicTrayUI : LogicElementHolder
/// <param name="element">element which was double clicked</param> /// <param name="element">element which was double clicked</param>
public override void OnDoubleClick(LogicElementUI element) public override void OnDoubleClick(LogicElementUI element)
{ {
throw new System.NotImplementedException();
CombinedBlock block = element.logicElement as CombinedBlock;
if (block == null || !block.isEditable)
return;
readerQueue.Add(new QueueData(block,reader,block.Color));
border.color = block.Color;
SetBlockReader(block.blockReader);
} }
/// <summary> /// <summary>
@ -173,7 +221,7 @@ public class LogicTrayUI : LogicElementHolder
/// </summary> /// </summary>
/// <param name="element">element to check if it can hold</param> /// <param name="element">element to check if it can hold</param>
/// <returns>returns true if this can hold the element </returns> /// <returns>returns true if this can hold the element </returns>
public override bool canHold(LogicElementUI element)
public override bool canHold(LogicBlock element)
{ {
return reader.Length < maxLength; return reader.Length < maxLength;
} }
@ -212,4 +260,19 @@ public class LogicTrayUI : LogicElementHolder
#endregion Helper Functions #endregion Helper Functions
[System.Serializable]
public class QueueData
{
public Color color;
public BlockReader reader;
public CombinedBlock block;
public QueueData(CombinedBlock block, BlockReader reader, Color color)
{
this.color = color;
this.reader = reader;
this.block = block;
}
}
} }

Loading…
Cancel
Save