Browse Source

Initial commit

jamesperet 2 years ago
commit
98ceb3d680

+ 71 - 0
.gitignore

@@ -0,0 +1,71 @@
+# This .gitignore file should be placed at the root of your Unity project directory
+#
+# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
+#
+/[Ll]ibrary/
+/[Tt]emp/
+/[Oo]bj/
+/[Bb]uild/
+/[Bb]uilds/
+/[Ll]ogs/
+/[Uu]ser[Ss]ettings/
+
+# MemoryCaptures can get excessive in size.
+# They also could contain extremely sensitive data
+/[Mm]emoryCaptures/
+
+# Asset meta data should only be ignored when the corresponding asset is also ignored
+!/[Aa]ssets/**/*.meta
+
+# Uncomment this line if you wish to ignore the asset store tools plugin
+# /[Aa]ssets/AssetStoreTools*
+
+# Autogenerated Jetbrains Rider plugin
+/[Aa]ssets/Plugins/Editor/JetBrains*
+
+# Visual Studio cache directory
+.vs/
+
+# Gradle cache directory
+.gradle/
+
+# Autogenerated VS/MD/Consulo solution and project files
+ExportedObj/
+.consulo/
+*.csproj
+*.unityproj
+*.sln
+*.suo
+*.tmp
+*.user
+*.userprefs
+*.pidb
+*.booproj
+*.svd
+*.pdb
+*.mdb
+*.opendb
+*.VC.db
+
+# Unity3D generated meta files
+*.pidb.meta
+*.pdb.meta
+*.mdb.meta
+
+# Unity3D generated file on crash reports
+sysinfo.txt
+
+# Builds
+*.apk
+*.aab
+*.unitypackage
+
+# Crashlytics generated file
+crashlytics-build.properties
+
+# Packed Addressables
+/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
+
+# Temporary auto-generated Android Assets
+/[Aa]ssets/[Ss]treamingAssets/aa.meta
+/[Aa]ssets/[Ss]treamingAssets/aa/*

+ 7 - 0
ChangeLog.md

@@ -0,0 +1,7 @@
+# KairoEngine.Stockpiles Change Log
+
+### v0.1.0
+
+- Created the package. *06/23/21 - 01:37*
+
+

+ 7 - 0
ChangeLog.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 128a83d6d2ae00347bcdb5dcbfd528e7
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Prefabs.meta

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

+ 268 - 0
Prefabs/StockpileGroupView.prefab

@@ -0,0 +1,268 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &3975132069269969372
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 3975132069269969373}
+  - component: {fileID: 3975132069269969369}
+  - component: {fileID: 3975132069269969368}
+  - component: {fileID: 3975132069269969371}
+  - component: {fileID: 3975132069269969370}
+  m_Layer: 0
+  m_Name: Panel
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &3975132069269969373
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132069269969372}
+  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: 3975132070124166837}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 15, y: -2}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0, y: 1}
+--- !u!222 &3975132069269969369
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132069269969372}
+  m_CullTransparentMesh: 0
+--- !u!114 &3975132069269969368
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132069269969372}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 1, g: 1, b: 1, a: 0.392}
+  m_RaycastTarget: 1
+  m_Maskable: 0
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_Sprite: {fileID: 957167685102309111, guid: 8b0a07687424b6545b3245182e673d31, type: 3}
+  m_Type: 1
+  m_PreserveAspect: 0
+  m_FillCenter: 1
+  m_FillMethod: 4
+  m_FillAmount: 1
+  m_FillClockwise: 1
+  m_FillOrigin: 0
+  m_UseSpriteMesh: 0
+  m_PixelsPerUnitMultiplier: 1
+--- !u!114 &3975132069269969371
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132069269969372}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Padding:
+    m_Left: 40
+    m_Right: 45
+    m_Top: 48
+    m_Bottom: 45
+  m_ChildAlignment: 0
+  m_Spacing: 15
+  m_ChildForceExpandWidth: 1
+  m_ChildForceExpandHeight: 1
+  m_ChildControlWidth: 0
+  m_ChildControlHeight: 0
+  m_ChildScaleWidth: 0
+  m_ChildScaleHeight: 0
+--- !u!114 &3975132069269969370
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132069269969372}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_HorizontalFit: 2
+  m_VerticalFit: 2
+--- !u!1 &3975132069534836407
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 3975132069534836404}
+  - component: {fileID: 3975132069534836405}
+  m_Layer: 0
+  m_Name: StockpileGroupView
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &3975132069534836404
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132069534836407}
+  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:
+  - {fileID: 3975132070124166837}
+  m_Father: {fileID: 0}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &3975132069534836405
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132069534836407}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 7cb3ca524e67f4b4a9f8814cd429dc4d, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  viewName: StockpileGroupView
+  manager: {fileID: 0}
+  owner: Player
+  stockpileViewPrefab: {fileID: 1178659451737117344, guid: f75eb077435899548ab3123e92cfb778,
+    type: 3}
+  uiPanel: {fileID: 3975132069269969372}
+  container: {fileID: 3975132069269969373}
+  contentSizeFitter: {fileID: 3975132069269969370}
+--- !u!1 &3975132070124166836
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 3975132070124166837}
+  - component: {fileID: 3975132070124166832}
+  - component: {fileID: 3975132070124166835}
+  - component: {fileID: 3975132070124166834}
+  m_Layer: 0
+  m_Name: Canvas
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &3975132070124166837
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132070124166836}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 0, y: 0, z: 0}
+  m_Children:
+  - {fileID: 3975132069269969373}
+  m_Father: {fileID: 3975132069534836404}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0, y: 0}
+--- !u!223 &3975132070124166832
+Canvas:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132070124166836}
+  m_Enabled: 1
+  serializedVersion: 3
+  m_RenderMode: 0
+  m_Camera: {fileID: 0}
+  m_PlaneDistance: 100
+  m_PixelPerfect: 0
+  m_ReceivesEvents: 1
+  m_OverrideSorting: 0
+  m_OverridePixelPerfect: 0
+  m_SortingBucketNormalizedSize: 0
+  m_AdditionalShaderChannelsFlag: 25
+  m_SortingLayerID: 0
+  m_SortingOrder: 0
+  m_TargetDisplay: 0
+--- !u!114 &3975132070124166835
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132070124166836}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_UiScaleMode: 0
+  m_ReferencePixelsPerUnit: 100
+  m_ScaleFactor: 1
+  m_ReferenceResolution: {x: 800, y: 600}
+  m_ScreenMatchMode: 0
+  m_MatchWidthOrHeight: 0
+  m_PhysicalUnit: 3
+  m_FallbackScreenDPI: 96
+  m_DefaultSpriteDPI: 96
+  m_DynamicPixelsPerUnit: 1
+--- !u!114 &3975132070124166834
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3975132070124166836}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_IgnoreReversedGraphics: 1
+  m_BlockingObjects: 0
+  m_BlockingMask:
+    serializedVersion: 2
+    m_Bits: 4294967295

+ 7 - 0
Prefabs/StockpileGroupView.prefab.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 403a6c4b971a88544b31234acf81e063
+PrefabImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 612 - 0
Prefabs/StockpileViewTemplate.prefab

@@ -0,0 +1,612 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &1178659450985040018
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1178659450985040017}
+  - component: {fileID: 1178659450985040023}
+  - component: {fileID: 1178659450985040016}
+  m_Layer: 5
+  m_Name: CurrentValueText
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &1178659450985040017
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659450985040018}
+  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: 1178659451737117351}
+  m_RootOrder: 1
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &1178659450985040023
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659450985040018}
+  m_CullTransparentMesh: 0
+--- !u!114 &1178659450985040016
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659450985040018}
+  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_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_text: 0
+  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: 4294967295
+  m_fontColor: {r: 1, g: 1, b: 1, 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_StyleSheet: {fileID: 0}
+  m_TextStyleHashCode: -1183493901
+  m_overrideHtmlColors: 0
+  m_faceColor:
+    serializedVersion: 2
+    rgba: 4294967295
+  m_fontSize: 24
+  m_fontSizeBase: 24
+  m_fontWeight: 400
+  m_enableAutoSizing: 0
+  m_fontSizeMin: 18
+  m_fontSizeMax: 72
+  m_fontStyle: 0
+  m_HorizontalAlignment: 1
+  m_VerticalAlignment: 512
+  m_textAlignment: 65535
+  m_characterSpacing: 0
+  m_wordSpacing: 0
+  m_lineSpacing: 0
+  m_lineSpacingMax: 0
+  m_paragraphSpacing: 0
+  m_charWidthMaxAdj: 0
+  m_enableWordWrapping: 0
+  m_wordWrappingRatios: 0.4
+  m_overflowMode: 0
+  m_linkedTextComponent: {fileID: 0}
+  parentLinkedComponent: {fileID: 0}
+  m_enableKerning: 1
+  m_enableExtraPadding: 0
+  checkPaddingRequired: 0
+  m_isRichText: 1
+  m_parseCtrlCharacters: 1
+  m_isOrthographic: 1
+  m_isCullingEnabled: 0
+  m_horizontalMapping: 0
+  m_verticalMapping: 0
+  m_uvLineOffset: 0
+  m_geometrySortingOrder: 0
+  m_IsTextObjectScaleStatic: 0
+  m_VertexBufferAutoSizeReduction: 1
+  m_useMaxVisibleDescender: 1
+  m_pageToDisplay: 1
+  m_margin: {x: 5, y: 4, z: 5, w: 5}
+  m_isUsingLegacyAnimationComponent: 0
+  m_isVolumetricText: 0
+  m_hasFontAssetChanged: 0
+  m_baseMaterial: {fileID: 0}
+  m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+--- !u!1 &1178659451737117344
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1178659451737117351}
+  - component: {fileID: 1178659451737117355}
+  - component: {fileID: 1178659451737117348}
+  - component: {fileID: 1178659451737117349}
+  - component: {fileID: 1178659451737117350}
+  - component: {fileID: 1033739751900905722}
+  m_Layer: 0
+  m_Name: StockpileViewTemplate
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &1178659451737117351
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659451737117344}
+  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:
+  - {fileID: 9057357384907926289}
+  - {fileID: 1178659450985040017}
+  - {fileID: 1178659452418720468}
+  - {fileID: 1178659452580996183}
+  m_Father: {fileID: 0}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 94.08, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &1178659451737117355
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659451737117344}
+  m_CullTransparentMesh: 0
+--- !u!114 &1178659451737117348
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659451737117344}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 1, g: 1, b: 1, a: 0.07058824}
+  m_RaycastTarget: 1
+  m_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_Sprite: {fileID: 0}
+  m_Type: 0
+  m_PreserveAspect: 0
+  m_FillCenter: 1
+  m_FillMethod: 4
+  m_FillAmount: 1
+  m_FillClockwise: 1
+  m_FillOrigin: 0
+  m_UseSpriteMesh: 0
+  m_PixelsPerUnitMultiplier: 1
+--- !u!114 &1178659451737117349
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659451737117344}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Padding:
+    m_Left: 0
+    m_Right: 2
+    m_Top: 0
+    m_Bottom: 0
+  m_ChildAlignment: 0
+  m_Spacing: 0
+  m_ChildForceExpandWidth: 0
+  m_ChildForceExpandHeight: 0
+  m_ChildControlWidth: 1
+  m_ChildControlHeight: 1
+  m_ChildScaleWidth: 0
+  m_ChildScaleHeight: 0
+--- !u!114 &1178659451737117350
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659451737117344}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_HorizontalFit: 2
+  m_VerticalFit: 2
+--- !u!114 &1033739751900905722
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659451737117344}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: e3222fbddb716a74ba030d6a30223a50, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  iconImage: {fileID: 693818625506981979}
+  ammoutText: {fileID: 1178659450985040016}
+  capacityText: {fileID: 1178659452580996182}
+  viewManager: {fileID: 0}
+  stockpilePreset: {fileID: 0}
+--- !u!1 &1178659452418720469
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1178659452418720468}
+  - component: {fileID: 1178659452418720474}
+  - component: {fileID: 1178659452418720475}
+  m_Layer: 5
+  m_Name: Separator
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &1178659452418720468
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659452418720469}
+  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: 1178659451737117351}
+  m_RootOrder: 2
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &1178659452418720474
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659452418720469}
+  m_CullTransparentMesh: 0
+--- !u!114 &1178659452418720475
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659452418720469}
+  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_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  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: 4289572269
+  m_fontColor: {r: 0.6792453, g: 0.6792453, b: 0.6792453, 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_StyleSheet: {fileID: 0}
+  m_TextStyleHashCode: -1183493901
+  m_overrideHtmlColors: 0
+  m_faceColor:
+    serializedVersion: 2
+    rgba: 4294967295
+  m_fontSize: 14
+  m_fontSizeBase: 14
+  m_fontWeight: 400
+  m_enableAutoSizing: 0
+  m_fontSizeMin: 18
+  m_fontSizeMax: 72
+  m_fontStyle: 0
+  m_HorizontalAlignment: 1
+  m_VerticalAlignment: 512
+  m_textAlignment: 65535
+  m_characterSpacing: 0
+  m_wordSpacing: 0
+  m_lineSpacing: 0
+  m_lineSpacingMax: 0
+  m_paragraphSpacing: 0
+  m_charWidthMaxAdj: 0
+  m_enableWordWrapping: 0
+  m_wordWrappingRatios: 0.4
+  m_overflowMode: 0
+  m_linkedTextComponent: {fileID: 0}
+  parentLinkedComponent: {fileID: 0}
+  m_enableKerning: 1
+  m_enableExtraPadding: 0
+  checkPaddingRequired: 0
+  m_isRichText: 1
+  m_parseCtrlCharacters: 1
+  m_isOrthographic: 1
+  m_isCullingEnabled: 0
+  m_horizontalMapping: 0
+  m_verticalMapping: 0
+  m_uvLineOffset: 0
+  m_geometrySortingOrder: 0
+  m_IsTextObjectScaleStatic: 0
+  m_VertexBufferAutoSizeReduction: 1
+  m_useMaxVisibleDescender: 1
+  m_pageToDisplay: 1
+  m_margin: {x: 0, y: 12, z: 5, w: 5}
+  m_isUsingLegacyAnimationComponent: 0
+  m_isVolumetricText: 0
+  m_hasFontAssetChanged: 0
+  m_baseMaterial: {fileID: 0}
+  m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+--- !u!1 &1178659452580996176
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 1178659452580996183}
+  - component: {fileID: 1178659452580996181}
+  - component: {fileID: 1178659452580996182}
+  m_Layer: 5
+  m_Name: CapacityValueText
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &1178659452580996183
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659452580996176}
+  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: 1178659451737117351}
+  m_RootOrder: 3
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &1178659452580996181
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659452580996176}
+  m_CullTransparentMesh: 0
+--- !u!114 &1178659452580996182
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1178659452580996176}
+  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_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_text: 0
+  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: 4289572269
+  m_fontColor: {r: 0.6792453, g: 0.6792453, b: 0.6792453, 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_StyleSheet: {fileID: 0}
+  m_TextStyleHashCode: -1183493901
+  m_overrideHtmlColors: 0
+  m_faceColor:
+    serializedVersion: 2
+    rgba: 4294967295
+  m_fontSize: 14
+  m_fontSizeBase: 14
+  m_fontWeight: 400
+  m_enableAutoSizing: 0
+  m_fontSizeMin: 18
+  m_fontSizeMax: 72
+  m_fontStyle: 0
+  m_HorizontalAlignment: 1
+  m_VerticalAlignment: 512
+  m_textAlignment: 65535
+  m_characterSpacing: 0
+  m_wordSpacing: 0
+  m_lineSpacing: 0
+  m_lineSpacingMax: 0
+  m_paragraphSpacing: 0
+  m_charWidthMaxAdj: 0
+  m_enableWordWrapping: 0
+  m_wordWrappingRatios: 0.4
+  m_overflowMode: 0
+  m_linkedTextComponent: {fileID: 0}
+  parentLinkedComponent: {fileID: 0}
+  m_enableKerning: 1
+  m_enableExtraPadding: 0
+  checkPaddingRequired: 0
+  m_isRichText: 1
+  m_parseCtrlCharacters: 1
+  m_isOrthographic: 1
+  m_isCullingEnabled: 0
+  m_horizontalMapping: 0
+  m_verticalMapping: 0
+  m_uvLineOffset: 0
+  m_geometrySortingOrder: 0
+  m_IsTextObjectScaleStatic: 0
+  m_VertexBufferAutoSizeReduction: 1
+  m_useMaxVisibleDescender: 1
+  m_pageToDisplay: 1
+  m_margin: {x: 0, y: 12, z: 5, w: 5}
+  m_isUsingLegacyAnimationComponent: 0
+  m_isVolumetricText: 0
+  m_hasFontAssetChanged: 0
+  m_baseMaterial: {fileID: 0}
+  m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+--- !u!1 &7203393663714903730
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 9057357384907926289}
+  - component: {fileID: 7230785701039214631}
+  - component: {fileID: 693818625506981979}
+  m_Layer: 0
+  m_Name: Image
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &9057357384907926289
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7203393663714903730}
+  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: 1178659451737117351}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 0}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &7230785701039214631
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7203393663714903730}
+  m_CullTransparentMesh: 0
+--- !u!114 &693818625506981979
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 7203393663714903730}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 1, g: 1, b: 1, a: 1}
+  m_RaycastTarget: 1
+  m_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_Sprite: {fileID: 21300000, guid: 575d3fe48ed2b3c4f888c895b2d1e46d, type: 3}
+  m_Type: 0
+  m_PreserveAspect: 0
+  m_FillCenter: 1
+  m_FillMethod: 4
+  m_FillAmount: 1
+  m_FillClockwise: 1
+  m_FillOrigin: 0
+  m_UseSpriteMesh: 0
+  m_PixelsPerUnitMultiplier: 1

+ 7 - 0
Prefabs/StockpileViewTemplate.prefab.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: f75eb077435899548ab3123e92cfb778
+PrefabImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 3 - 0
Readme.md

@@ -0,0 +1,3 @@
+# 📦 KairoEngine.Stockpiles v0.1.1
+
+Stockpiles represent resources in strategy games. They can represent currency in other games. The Stockpiles library adds tools to manage multiple stockpiles during gameplay, a stockpile preset to create different types of resources and an API to comunicate with this system.

+ 7 - 0
Readme.md.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 72bcc268cd9defa47b94bc1d418da746
+TextScriptImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Runtime.meta

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

+ 8 - 0
Runtime/GameActions.meta

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

+ 103 - 0
Runtime/GameActions/StockpileChangeValueGameAction.cs

@@ -0,0 +1,103 @@
+using System;
+using System.Collections;
+using System.Linq;
+using System.Collections.Generic;
+using UnityEngine;
+using Sirenix.OdinInspector;
+using KairoEngine.Core.GameActions;
+using KairoEngine.Stockpiles;
+
+namespace KairoEngine.Stockpile.GameActions
+{
+
+    [System.Serializable, HideReferenceObjectPicker]
+    public class StockpileChangeValueGameAction : GameActionBase
+    {
+        #region DefaultVariables
+        public override string name { get => $"Change {stockpileOwner}'s \'{(stockpileName)}\'stockpile by {ammount}/{capacity}"; }
+
+        public override GameActionsController controller { 
+            get => _controller; 
+            set 
+            {
+                _controller = value;
+                typeName = "StockpileChangeValueGameAction";
+            }
+        }
+        public override string GetTypeName() => "StockpileChangeValueGameAction";
+        public override string GetActionName() => "Stockpile Change Value";
+
+        #endregion
+
+        #region ActionVariables
+
+        [FoldoutGroup("@name")] public string stockpileOwner;
+        [FoldoutGroup("@name")] public string stockpileName;
+        [FoldoutGroup("@name")] public int ammount = 0;
+        [FoldoutGroup("@name")] public int capacity = 0;
+        
+        #endregion
+
+        #region ActionFunctions
+
+        public StockpileChangeValueGameAction(GameActionsController controller) : base(controller)
+        {
+            this.controller = controller;
+            className =  this.GetType().AssemblyQualifiedName;
+        }
+
+        #endregion
+
+        #region Flow
+
+        public override void Start()
+        {
+            if(string.IsNullOrEmpty(stockpileName))
+            {
+                Debug.LogError("No StockpileName set in StockpileGameAction");
+            }
+            else if(StockpileManager.instance != null)
+            {
+                StockpileManager.instance.AddToStockpileCapacity(stockpileOwner, stockpileName, capacity);
+                StockpileManager.instance.AddToStockpileAmmout(stockpileOwner, stockpileName, ammount);
+            }
+            else Debug.LogError("StockpileManager.instance could not be found");
+            _done = true;
+            _started = true;
+        }
+
+        public override void Update() { }
+
+        public override void Restart()
+        {
+            _done = false;
+            _started = false;
+        }
+
+        #endregion
+
+        #region utilities
+
+        private StockpileChangeValueGameAction Duplicate(GameActionsController controller = null)
+        {
+            StockpileChangeValueGameAction action = new StockpileChangeValueGameAction(controller == null ? this.controller : controller);
+            action.controller = controller;
+            return action;
+        }
+
+        #endregion
+
+        #region Serialization
+
+        public static StockpileChangeValueGameAction JSONToStockpileChangeValueGameAction(string data)
+        {
+            return JsonUtility.FromJson<StockpileChangeValueGameAction>(data);
+        }
+
+        public override void OnBeforeSerialize(GameActionObjectSerializer serializer, int n, int depth) { }
+        public override void OnBeforeDeserialize(GameActionObjectSerializer serializer, int n, int depth) { }
+
+        #endregion
+    }
+}
+

+ 11 - 0
Runtime/GameActions/StockpileChangeValueGameAction.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 007867428962d444caab64f7624d2da1
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 21 - 0
Runtime/KairoEngine.Stockpiles.asmdef

@@ -0,0 +1,21 @@
+{
+    "name": "KairoEngine.Stockpiles",
+    "references": [
+        "GUID:7e5ae6a38d1532248b4c890eca668b06",
+        "GUID:bc1ac81aedfa56c4083dea5332ed3810",
+        "GUID:142285d3db5e7e849b02ea3a75bc2de7",
+        "GUID:5f03fc37b95cb644599751ca563336b2",
+        "GUID:6055be8ebefd69e48b49212b09b47b2f"
+    ],
+    "includePlatforms": [],
+    "excludePlatforms": [
+        "WebGL"
+    ],
+    "allowUnsafeCode": false,
+    "overrideReferences": false,
+    "precompiledReferences": [],
+    "autoReferenced": true,
+    "defineConstraints": [],
+    "versionDefines": [],
+    "noEngineReferences": false
+}

+ 7 - 0
Runtime/KairoEngine.Stockpiles.asmdef.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: b5398ac4f2218bd4ba186b0baff7fb21
+AssemblyDefinitionImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 19 - 0
Runtime/Stockpile.cs

@@ -0,0 +1,19 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using Sirenix.OdinInspector;
+
+namespace KairoEngine.Stockpiles
+{
+    [System.Serializable]
+    public class Stockpile
+    {
+        [HorizontalGroup("data", 0.15f), HideLabel, Tooltip("Quantity containined in this stockpile")] 
+        public int ammount = 0;
+
+        [HorizontalGroup("data", 0.15f), HideLabel, Tooltip("The total that this stockpile can hold")] 
+        public int capacity = 0;
+        [HorizontalGroup("data", 0.7f), HideLabel] public StockpilePreset stockpileType;
+    }
+}
+

+ 11 - 0
Runtime/Stockpile.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 17b83370ef6c40a4880efa5033256493
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 49 - 0
Runtime/StockpileGroup.cs

@@ -0,0 +1,49 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using KairoEngine.Stats;
+using Sirenix.OdinInspector;
+
+namespace KairoEngine.Stockpiles
+{
+    [System.Serializable]
+    public class StockpileGroup
+    {
+        [FoldoutGroup("@groupName"), PropertySpace(4,4)] public string owner;
+        public string groupName { get { return $"{owner} Resources"; }}
+
+        [FoldoutGroup("@groupName"), HideIf("@stats.statGroup != null")]
+        public List<Stockpile> initialStockpiles = new List<Stockpile>();
+
+        [FoldoutGroup("@groupName"), InlineProperty, HideLabel, HideIf("@stats.statGroup == null"), PropertySpace(4,2)] 
+        public StatsController stats = new StatsController();
+
+        public void Initialize(List<StockpilePreset> resourceTypes)
+        {
+            StatGroup statGroup = (StatGroup)ScriptableObject.CreateInstance("StatGroup");
+            StatTemplate statTemplateSource = (StatTemplate)ScriptableObject.CreateInstance("StatTemplate");
+            for (int i = 0; i < resourceTypes.Count; i++)
+            {
+                StatTemplate statTemplate = ScriptableObject.Instantiate(statTemplateSource);
+                statTemplate.minValue = 0;
+                statTemplate.maxValue = 0;
+                statTemplate.initialValue = 0;
+                statTemplate.title = resourceTypes[i].title;
+                statTemplate.minValue = resourceTypes[i].minValue;
+                statTemplate.maxValue = resourceTypes[i].maxValue;
+                statTemplate.initialValue = resourceTypes[i].initialValue;
+                for (int v = 0; v < initialStockpiles.Count; v++)
+                {
+                    if(initialStockpiles[v].stockpileType.title == resourceTypes[i].title)
+                    {
+                        statTemplate.initialValue += initialStockpiles[v].ammount;
+                        statTemplate.maxValue += initialStockpiles[v].capacity;
+                    }
+                }
+                statGroup.statTemplates.Add(statTemplate);
+            }
+            stats.statGroup = statGroup;
+            stats.Initialize();
+        }
+    }
+}

+ 11 - 0
Runtime/StockpileGroup.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: a8e958c0c74de3e4da57ef34fbf33b53
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 123 - 0
Runtime/StockpileManager.cs

@@ -0,0 +1,123 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using KairoEngine.Stats;
+using Sirenix.OdinInspector;
+
+namespace KairoEngine.Stockpiles
+{
+    [HideMonoScript]
+    public class StockpileManager : MonoBehaviour
+    {
+        public static StockpileManager instance;
+        public List<StockpileGroup> groups = new List<StockpileGroup>();
+        [HideIf("@initialized")] public List<StockpilePreset> resourceTypes = new List<StockpilePreset>();
+        private bool initialized = false;
+
+        private void Awake()
+        {
+            if(instance == null) instance = this;
+            else 
+            {
+                Debug.LogError("A instance of StockpileManager already exists, destroying new one.", instance.gameObject);
+                Destroy(this.gameObject);
+            }
+        }
+
+        private void Start()
+        {
+            for (int i = 0; i < groups.Count; i++) groups[i].Initialize(resourceTypes);
+            initialized = true;
+        }
+
+        public Stat GetStockpileStat(string owner, string stockpileName)
+        {
+            for (int i = 0; i < groups.Count; i++)
+            {
+                if(groups[i].owner == owner)
+                {
+                    return groups[i].stats.GetStat(stockpileName);
+                }
+            }
+            return null;
+        }
+
+        public int GetStockpileAmmount(string owner, string stockpileName)
+        {
+            var stat = GetStockpileStat(owner, stockpileName);
+            return stat != null ? stat.value : 0;
+        }
+
+        public int GetStockpileCapacity(string owner, string stockpileName)
+        {
+            var stat = GetStockpileStat(owner, stockpileName);
+            return stat != null ? stat.maxValue : 0;
+        }
+
+        public void AddToStockpileAmmout(string owner, string stockpileName, int ammount)
+        {
+            var stat = GetStockpileStat(owner, stockpileName);
+            if(stat != null) stat.value += ammount;
+        }
+
+        public void AddToStockpileCapacity(string owner, string stockpileName, int capacity)
+        {
+            var stat = GetStockpileStat(owner, stockpileName);
+            if(stat != null) stat.maxValue += capacity;
+        }
+
+        public bool HasResources(string stockpileOwner, List<Stockpile> costList)
+        {
+            for (int i = 0; i < costList.Count; i++)
+            {
+                var ammount = GetStockpileAmmount(stockpileOwner, costList[i].stockpileType.title);
+                if(ammount < costList[i].ammount) return false;
+            }
+            return true;
+        }
+
+        public bool HasResource(string stockpileOwner, Stockpile cost)
+        {
+            var ammount = GetStockpileAmmount(stockpileOwner, cost.stockpileType.title);
+            if(ammount < cost.ammount) return false;
+            else return true;
+        }
+
+        public void RemoveResources(string stockpileOwner, List<Stockpile> costList)
+        {
+            for (int i = 0; i < costList.Count; i++)
+            {
+                var stat = GetStockpileStat(stockpileOwner, costList[i].stockpileType.title);
+                if(stat != null) stat.value -= costList[i].ammount;
+            }
+        }
+
+        public void SetStockpile(string owner, string stockpileName, int ammount, int capacity)
+        {
+            var stat = GetStockpileStat(owner, stockpileName);
+            if(stat != null)
+            {
+                stat.maxValue = capacity;
+                stat.value = ammount;
+            }
+            else Debug.LogError($"Could not find stockpile stat named {stockpileName} owned by {owner}");
+        }
+
+        public void ResetStockpiles(string owner)
+        {
+            for (int i = 0; i < groups.Count; i++)
+            {
+                if(groups[i].owner == owner)
+                {
+                    for (int a = 0; a < groups[i].stats.stats.Count; a++)
+                    {
+                         groups[i].stats.stats[a].value =  groups[i].stats.stats[a].minValue;
+                         groups[i].stats.stats[a].maxValue =  groups[i].stats.stats[a].minValue;
+                    }
+                }
+            }
+        }
+
+    }
+}
+

+ 11 - 0
Runtime/StockpileManager.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b41c38ef1c7467a4aa9b5f97935474e7
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 21 - 0
Runtime/StockpilePreset.cs

@@ -0,0 +1,21 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using Sirenix.OdinInspector;
+
+namespace KairoEngine.Stockpiles
+{
+    [CreateAssetMenu(fileName = "Stockpile", menuName = "KairoEngine/Misc/Stockpile")]
+    [HideMonoScript]
+    public class StockpilePreset : ScriptableObject
+    {
+        public string title = "New Stockpile";
+
+        public Sprite icon;
+        public int minValue = 0;
+        public int maxValue = 100;
+        public int initialValue = 0;
+        public string spriteText = "<sprite name=\"minerals\">";
+    }
+}
+

+ 11 - 0
Runtime/StockpilePreset.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 311b79f8b06b28142b786e9f02d34586
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Runtime/UI.meta

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

+ 82 - 0
Runtime/UI/StockpileGroupView.cs

@@ -0,0 +1,82 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+using KairoEngine.Stockpiles;
+using KairoEngine.UI;
+
+namespace KairoEngine.Stockpiles.UI 
+{
+    public class StockpileGroupView : MonoBehaviour, IUiSystemElement
+    {
+        public string viewName = "StockpileGroupView";
+        public StockpileManager manager;
+        public string owner = "Player";
+
+        public GameObject stockpileViewPrefab;
+        public GameObject uiPanel;
+        public Transform container;
+        public Canvas canvas;
+        public ContentSizeFitter contentSizeFitter;
+        public bool startVisible = false;
+        private bool isVisible = true;
+
+        public void Hide()
+        {
+            if(canvas != null) 
+            {
+                canvas.gameObject.SetActive(false);
+                isVisible = false;
+            }
+        }
+
+        public void Show()
+        {
+            if(canvas != null) 
+            {
+                canvas.gameObject.SetActive(true);
+                isVisible = true;
+            }
+        }
+
+        public bool IsVisible() => isVisible;
+
+        private void OnEnable() => UiManager.RegisterElement(viewName, this, this.transform, isVisible);
+        private void OnDisable() => UiManager.UnregisterElement(this);
+
+        private void Start()
+        {
+            if(startVisible) UiManager.ShowElement(this);
+            else UiManager.HideElement(this);
+            if(this.manager == null && StockpileManager.instance != null) manager = StockpileManager.instance;
+            CreateStockpileViews();
+            contentSizeFitter.enabled = false;
+        }
+
+        private void Update()
+        {
+            contentSizeFitter.enabled = true;
+        }
+
+        private void CreateStockpileViews()
+        {
+            if(stockpileViewPrefab == null)
+            {
+                Debug.LogError("Missing stockpileViewPrefab in StockpileGroupView component", this.gameObject);
+                return;
+            }
+            for (int i = 0; i < manager.resourceTypes.Count; i++)
+            {
+                var obj = GameObject.Instantiate(stockpileViewPrefab, container);
+                var stockpileView = obj.GetComponent<StockpileView>();
+                if(stockpileView == null)
+                {
+                    Debug.LogError($"The prefab \"{stockpileViewPrefab.name}\" doesn't have a StockpileView component! Aborting...", this.gameObject);
+                    return;
+                }
+                stockpileView.Setup(this, manager.resourceTypes[i]);
+            }
+        }
+    }
+}
+

+ 11 - 0
Runtime/UI/StockpileGroupView.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7cb3ca524e67f4b4a9f8814cd429dc4d
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 49 - 0
Runtime/UI/StockpileView.cs

@@ -0,0 +1,49 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+using TMPro;
+using KairoEngine.Stockpiles;
+
+namespace KairoEngine.Stockpiles.UI 
+{
+    public class StockpileView : MonoBehaviour
+    {
+        public Image iconImage;
+        public TextMeshProUGUI ammoutText;
+        public TextMeshProUGUI capacityText;
+
+        public StockpileGroupView viewManager;
+        public StockpilePreset stockpilePreset;
+
+        private int ammount, previousAmmout, capacity, previousCapacity;
+
+        private void Update()
+        {
+            UpdateValues();
+        }
+
+        public void Setup(StockpileGroupView viewManager, StockpilePreset stockpilePreset)
+        {
+            this.viewManager = viewManager;
+            this.stockpilePreset = stockpilePreset;
+            iconImage.sprite = this.stockpilePreset.icon;
+            UpdateValues();
+        }
+
+        private void UpdateValues()
+        {
+            ammount = viewManager.manager.GetStockpileAmmount(viewManager.owner, stockpilePreset.title);
+            capacity = viewManager.manager.GetStockpileCapacity(viewManager.owner, stockpilePreset.title);
+            if(ammount != previousAmmout || capacity != previousCapacity)
+            {
+                ammoutText.text = ammount.ToString();
+                capacityText.text = capacity.ToString();
+                viewManager.contentSizeFitter.enabled = false;
+            }
+            previousAmmout = ammount;
+            previousCapacity = capacity;
+        }
+    }
+}
+

+ 11 - 0
Runtime/UI/StockpileView.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: e3222fbddb716a74ba030d6a30223a50
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 19 - 0
package.json

@@ -0,0 +1,19 @@
+{
+    "name": "at.kairoscope.kairoengine.stockpiles",
+    "displayName": "KairoEngine Stockpiles",
+    "version": "0.1.1",
+    "unity": "2020.3",
+    "description": "Kairoengine stockpiles library.",
+    "dependencies": {
+        "at.kairoscope.thirdparty.tmpro":"1.0.0",
+        "at.kairoscope.thirdparty.sirenix":"1.0.0",
+        "at.kairoscope.kairoengine.core":"0.1.6",
+        "at.kairoscope.kairoengine.ui":"0.1.2",
+        "at.kairoscope.kairoengine.stats":"0.1.1"
+    },
+    "repository": {
+      "type": "git",
+      "url": "https://git.kairoscope.net/kairoengine/stockpiles.git"
+    },
+    "author": "Kairoscope"
+  }