diff --git a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml index 254adef97..0a2f67029 100644 --- a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml +++ b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml @@ -1298,7 +1298,7 @@ - + diff --git a/Assets/Prefabs/Property Label.prefab b/Assets/Prefabs/Property Label.prefab index ad8e5a5ed..a4768187d 100644 --- a/Assets/Prefabs/Property Label.prefab +++ b/Assets/Prefabs/Property Label.prefab @@ -257,13 +257,17 @@ MonoBehaviour: m_EditorClassIdentifier: StateDamping: 10 Fill: {fileID: 8035498868821314605} + Label: {fileID: 0} CurrentState: 0 DisableClickWhenSelected: 1 + DragObject: {fileID: 2677123916507168719} UnselectedColor: {r: 0, g: 0.4180913, b: 1, a: 0.15294118} SelectedColor: {r: 1, g: 0.44583336, b: 0.050000012, a: 0.65882355} HoverColor: {r: 0, g: 0.4180913, b: 1, a: 0.29803923} ClickColor: {r: 0, g: 0.4180913, b: 1, a: 0.7490196} DisabledColor: {r: 0, g: 0, b: 0, a: 0} + EnabledTextColor: {r: 0, g: 0, b: 0, a: 0} + DisabledTextColor: {r: 0, g: 0, b: 0, a: 0} --- !u!114 &2227437186655761277 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Property List 1.prefab b/Assets/Prefabs/Property List 1.prefab index 50af7386f..b2a7c39e8 100644 --- a/Assets/Prefabs/Property List 1.prefab +++ b/Assets/Prefabs/Property List 1.prefab @@ -252,7 +252,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 32 + m_Left: 16 m_Right: 8 m_Top: 40 m_Bottom: -8 @@ -300,6 +300,8 @@ MonoBehaviour: type: 3} ButtonField: {fileID: 6566784227922820057, guid: 6db1feb4cda7b8c419384cd42c85a5c4, type: 3} + IncrementField: {fileID: 5486709585343280439, guid: 9c14c92a1a08b0a4fb4f6aa6f8504082, + type: 3} SelectedChild: {fileID: 0} FoldoutIcon: {fileID: 6485458701090981364} FoldoutRotationDamping: 10 diff --git a/Assets/Prefabs/Property List.prefab b/Assets/Prefabs/Property List.prefab index e2bd3a71d..46cf00f2c 100644 --- a/Assets/Prefabs/Property List.prefab +++ b/Assets/Prefabs/Property List.prefab @@ -252,7 +252,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 32 + m_Left: 16 m_Right: 8 m_Top: 40 m_Bottom: -8 @@ -300,6 +300,8 @@ MonoBehaviour: type: 3} ButtonField: {fileID: 6566784227922820057, guid: 6db1feb4cda7b8c419384cd42c85a5c4, type: 3} + IncrementField: {fileID: 5486709585343280439, guid: 9c14c92a1a08b0a4fb4f6aa6f8504082, + type: 3} SelectedChild: {fileID: 0} FoldoutIcon: {fileID: 6485458701090981364} FoldoutRotationDamping: 10 diff --git a/Assets/Prefabs/Property.prefab b/Assets/Prefabs/Property.prefab index 3c7b29493..285ad6a20 100644 --- a/Assets/Prefabs/Property.prefab +++ b/Assets/Prefabs/Property.prefab @@ -333,13 +333,17 @@ MonoBehaviour: m_EditorClassIdentifier: StateDamping: 10 Fill: {fileID: 3871492197986661902} + Label: {fileID: 0} CurrentState: 0 DisableClickWhenSelected: 1 + DragObject: {fileID: 9159917045172241900} UnselectedColor: {r: 0, g: 0.4180913, b: 1, a: 0.15294118} SelectedColor: {r: 1, g: 0.44583336, b: 0.050000012, a: 0.65882355} HoverColor: {r: 0, g: 0.4180913, b: 1, a: 0.29803923} ClickColor: {r: 0, g: 0.4180913, b: 1, a: 0.7490196} DisabledColor: {r: 0, g: 0, b: 0, a: 0} + EnabledTextColor: {r: 0, g: 0, b: 0, a: 0} + DisabledTextColor: {r: 0, g: 0, b: 0, a: 0} --- !u!114 &9159917045172241898 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 306413b69..4a1872fdf 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -1429,6 +1429,99 @@ MonoBehaviour: m_ChildForceExpandHeight: 1 m_ChildControlWidth: 1 m_ChildControlHeight: 1 +--- !u!1 &153014298 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 153014299} + - component: {fileID: 153014302} + - component: {fileID: 153014301} + - component: {fileID: 153014300} + m_Layer: 5 + m_Name: Right Border + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &153014299 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 153014298} + 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: 1783663792} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 4, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &153014300 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 153014298} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &153014301 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 153014298} + 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.8, g: 0.9333333, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ea8a1213adadb5a4fba6b1785033a34b, 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 +--- !u!222 &153014302 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 153014298} + m_CullTransparentMesh: 0 --- !u!1 &186929811 GameObject: m_ObjectHideFlags: 0 @@ -1537,7 +1630,7 @@ PrefabInstance: - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: -676.704 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -1552,32 +1645,32 @@ PrefabInstance: - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 0.000000059604645 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: -17 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519320, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -1628,7 +1721,7 @@ PrefabInstance: - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_RootOrder - value: 2 + value: 3 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -1648,22 +1741,22 @@ PrefabInstance: - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.x - value: 1274 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.y - value: -457.77698 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 500 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 851.55396 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -1673,7 +1766,7 @@ PrefabInstance: - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -1708,32 +1801,32 @@ PrefabInstance: - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.x - value: 241.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.y - value: -87.42499 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 419 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 110.84997 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -4070,7 +4163,7 @@ PrefabInstance: - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: -676.704 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -4085,32 +4178,32 @@ PrefabInstance: - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 0.000000059604645 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: -17 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519320, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -4181,22 +4274,22 @@ PrefabInstance: - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.x - value: 146 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.y - value: -457.77698 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 500 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 851.55396 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -4206,7 +4299,7 @@ PrefabInstance: - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -4246,32 +4339,32 @@ PrefabInstance: - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.x - value: 241.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.y - value: -87.42499 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 419 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 110.84997 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -4308,6 +4401,12 @@ PrefabInstance: propertyPath: m_textAlignment value: 514 objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 21423695648544140, guid: f353c922a07f02041bdb1694a3faf9b7, + type: 2} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} --- !u!224 &416066983 stripped @@ -9480,7 +9579,7 @@ PrefabInstance: - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: -676.704 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -9495,32 +9594,32 @@ PrefabInstance: - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 0.000000059604645 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: -17 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519320, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -9591,22 +9690,22 @@ PrefabInstance: - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.x - value: 710 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.y - value: -457.77698 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 500 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 851.55396 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -9616,7 +9715,7 @@ PrefabInstance: - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -9656,32 +9755,32 @@ PrefabInstance: - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.x - value: 241.5 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.y - value: -87.42499 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 419 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 110.84997 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -13150,6 +13249,99 @@ MonoBehaviour: m_EditorClassIdentifier: TabGroup: {fileID: 143833105} TabButton: {fileID: 646091942} +--- !u!1 &1237277224 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1237277225} + - component: {fileID: 1237277228} + - component: {fileID: 1237277227} + - component: {fileID: 1237277226} + m_Layer: 5 + m_Name: Left Border + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1237277225 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1237277224} + 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: 1783663792} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 4, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1237277226 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1237277224} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &1237277227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1237277224} + 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.8, g: 0.9333333, b: 1, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: ea8a1213adadb5a4fba6b1785033a34b, 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 +--- !u!222 &1237277228 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1237277224} + m_CullTransparentMesh: 0 --- !u!1 &1243256929 GameObject: m_ObjectHideFlags: 0 @@ -16259,7 +16451,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1565778113 RectTransform: m_ObjectHideFlags: 0 @@ -16299,6 +16491,7 @@ MonoBehaviour: Title: {fileID: 778641168} General: {fileID: 303664031} Inventory: {fileID: 1738416598} + ChildInventory: {fileID: 1783663793} Details: {fileID: 1548865998} ContextMenu: {fileID: 831625851} --- !u!114 &1565778115 @@ -18981,6 +19174,321 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: DragDistance: 25 +--- !u!1001 &1783663791 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1888898928} + m_Modifications: + - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632238049155251, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_ChildForceExpandWidth + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519320, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 9c0448268add8f744b1c3575e1f697a3, + type: 3} + - target: {fileID: 2378632240158519320, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_Type + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519327, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_Name + value: Child Inventory Panel + objectReference: {fileID: 0} + - target: {fileID: 2378632240158519327, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2378632240161980830, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_Value + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2378632240161980830, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_Size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_textInfo.characterCount + value: 5 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_textInfo.spaceCount + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_textInfo.wordCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_textInfo.lineCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_textInfo.pageCount + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_text + value: Child + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_textAlignment + value: 514 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 21423695648544140, guid: f353c922a07f02041bdb1694a3faf9b7, + type: 2} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_enableAutoSizing + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + propertyPath: m_enableWordWrapping + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} +--- !u!224 &1783663792 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + m_PrefabInstance: {fileID: 1783663791} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1783663793 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 2378632238049155148, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + m_PrefabInstance: {fileID: 1783663791} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8c2bf4a7080061d42a87046c37bf0c60, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1783663794 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2378632240158519327, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, + type: 3} + m_PrefabInstance: {fileID: 1783663791} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1783663795 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1783663794} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1679637790, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &1786262497 GameObject: m_ObjectHideFlags: 0 @@ -20343,6 +20851,7 @@ RectTransform: m_Children: - {fileID: 416066983} - {fileID: 849915395} + - {fileID: 1783663792} - {fileID: 188624531} m_Father: {fileID: 1565778113} m_RootOrder: 4 @@ -20370,10 +20879,10 @@ MonoBehaviour: m_Top: 32 m_Bottom: 32 m_ChildAlignment: 4 - m_Spacing: 64 - m_ChildForceExpandWidth: 0 + m_Spacing: 32 + m_ChildForceExpandWidth: 1 m_ChildForceExpandHeight: 1 - m_ChildControlWidth: 0 + m_ChildControlWidth: 1 m_ChildControlHeight: 1 --- !u!1001 &1889382509 PrefabInstance: @@ -22499,7 +23008,7 @@ PrefabInstance: - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: -763.69946 objectReference: {fileID: 0} - target: {fileID: 2378632238049155248, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -22524,12 +23033,12 @@ PrefabInstance: - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 0.9999999 objectReference: {fileID: 0} - target: {fileID: 2378632238144827081, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -22539,17 +23048,17 @@ PrefabInstance: - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.x - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 2378632238683789172, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: -17 objectReference: {fileID: 0} - target: {fileID: 2378632240158519326, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} @@ -22664,37 +23173,37 @@ PrefabInstance: - target: {fileID: 2378632240158519327, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_IsActive - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMin.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 247.5 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_AnchoredPosition.y - value: 0 + value: -124.375 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 463 objectReference: {fileID: 0} - target: {fileID: 5116519198747529736, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} propertyPath: m_SizeDelta.y - value: 0 + value: 184.75 objectReference: {fileID: 0} - target: {fileID: 5116519198747529738, guid: 4fca44e21a27a6d48916d2cc4b6e2df0, type: 3} diff --git a/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs b/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs index da28e54bd..ce07df084 100644 --- a/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs +++ b/Assets/Scripts/ServerShared/Behaviors/Thermotoggle.cs @@ -3,13 +3,13 @@ using System.Linq; using MessagePack; using Newtonsoft.Json; -[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(-22), RuntimeInspectable] +[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), Order(-22)] public class ThermotoggleData : BehaviorData { - [TemperatureInspectable, JsonProperty("targetTemp"), Key(1), RuntimeInspectable] + [TemperatureInspectable, JsonProperty("targetTemp"), Key(1)] public float TargetTemperature; - [InspectableField, JsonProperty("perSecond"), Key(2)] + [InspectableField, JsonProperty("highPass"), Key(2)] public bool HighPass; public override IBehavior CreateInstance(GameContext context, Entity entity, Gear item) diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index 6a97969a9..6ea559ca8 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -83,7 +83,7 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR [IgnoreMember] public float ThermalMass { get; private set; } [IgnoreMember] public float Visibility => VisibilitySources.Values.Sum(); - public class InventoryEvent : IDynamicProperties + public class ChangeEvent : IChangeSource { public event Action OnChanged; @@ -93,9 +93,12 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR } } private bool _cargoChanged; - public InventoryEvent CargoEvent = new InventoryEvent(); + public ChangeEvent CargoEvent = new ChangeEvent(); + private bool _gearChanged; - public InventoryEvent GearEvent = new InventoryEvent(); + public ChangeEvent GearEvent = new ChangeEvent(); + + public ChangeEvent ChildEvent = new ChangeEvent(); public float Capacity { @@ -196,16 +199,24 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR PopulationAssignments.Add(populationAssignment); } - public void Equip(Gear gear, Hardpoint hardpoint) + public void Unequip(Hardpoint hardpoint) { - // Hardpoint is occupied, remove existing item from gear list if (hardpoint.Gear != null) { Gear.Remove(hardpoint.Gear.ID); Cargo.Add(hardpoint.Gear.ID); + hardpoint.Gear = null; _cargoChanged = true; + _gearChanged = true; } - + } + + public void Equip(Gear gear, Hardpoint hardpoint) + { + // Hardpoint is occupied, remove existing item from gear list + if (hardpoint.Gear != null) Unequip(hardpoint); + if (Cargo.Contains(gear.ID)) Cargo.Remove(gear.ID); + hardpoint.Gear = gear; HydrateHardpoint(hardpoint); _gearChanged = true; @@ -307,6 +318,7 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR Data = item.Data, Quantity = quantity }; + Context.Cache.Add(newSimpleCommodity); item.Quantity -= quantity; item = newSimpleCommodity; } @@ -324,6 +336,7 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR Mass += entity.Mass; ThermalMass += entity.ThermalMass; Children.Add(entity.ID); + ChildEvent.Change(); } public void RemoveChild(Entity entity) @@ -331,6 +344,7 @@ public abstract class Entity : DatabaseEntry, IMessagePackSerializationCallbackR Mass -= entity.Mass; ThermalMass -= entity.ThermalMass; Children.Remove(entity.ID); + ChildEvent.Change(); } public Guid Build(BlueprintData blueprint, float quality, string name, bool direct = false) diff --git a/Assets/Scripts/ServerShared/IDynamicProperties.cs b/Assets/Scripts/ServerShared/IChangeSource.cs similarity index 78% rename from Assets/Scripts/ServerShared/IDynamicProperties.cs rename to Assets/Scripts/ServerShared/IChangeSource.cs index 4bdc321e4..da29739f0 100644 --- a/Assets/Scripts/ServerShared/IDynamicProperties.cs +++ b/Assets/Scripts/ServerShared/IChangeSource.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; -public interface IDynamicProperties +public interface IChangeSource { event Action OnChanged; } diff --git a/Assets/Scripts/ServerShared/IDynamicProperties.cs.meta b/Assets/Scripts/ServerShared/IChangeSource.cs.meta similarity index 100% rename from Assets/Scripts/ServerShared/IDynamicProperties.cs.meta rename to Assets/Scripts/ServerShared/IChangeSource.cs.meta diff --git a/Assets/Scripts/ServerShared/ItemInstance.cs b/Assets/Scripts/ServerShared/ItemInstance.cs index ff20b2eba..c967fd939 100644 --- a/Assets/Scripts/ServerShared/ItemInstance.cs +++ b/Assets/Scripts/ServerShared/ItemInstance.cs @@ -55,7 +55,7 @@ public class SimpleCommodity : ItemInstance } [MessagePackObject, JsonObject(MemberSerialization.OptIn)] -public class Gear : CraftedItemInstance, IDynamicProperties +public class Gear : CraftedItemInstance, IChangeSource { [JsonProperty("durability"), Key(7)] public float Durability; diff --git a/Assets/Scripts/UI/ColonyTab.cs b/Assets/Scripts/UI/ColonyTab.cs index cb52d5d87..90ef8adab 100644 --- a/Assets/Scripts/UI/ColonyTab.cs +++ b/Assets/Scripts/UI/ColonyTab.cs @@ -6,12 +6,15 @@ using System.Reflection; using TMPro; using UnityEngine; using UnityEngine.EventSystems; +using Unity.Mathematics; +using static Unity.Mathematics.math; public class ColonyTab : MonoBehaviour { public TextMeshProUGUI Title; public PropertiesPanel General; public PropertiesPanel Inventory; + public PropertiesPanel ChildInventory; public PropertiesPanel Details; public ContextMenu ContextMenu; @@ -24,218 +27,337 @@ public class ColonyTab : MonoBehaviour _context = value; General.Context = value; Inventory.Context = value; + ChildInventory.Context = value; Details.Context = value; } } - private Guid _selectedColony; private GameContext _context; private Hardpoint _selectedHardpoint; - private IDynamicProperties HardpointChange; - private IDynamicProperties CargoChange; - private Action OnHardpointsChanged; - private Action OnCargoChanged; + private Entity _parentEntity; + private Entity _selectedChild; + + private IChangeSource _colonyGearChange; + private IChangeSource _colonyCargoChange; + private Action _onColonyInventoryChanged; + + private IChangeSource _childGearChange; + private IChangeSource _childCargoChange; + private Action _onChildInventoryChanged; public void Open(Guid colony) { - _selectedColony = colony; _selectedHardpoint = null; - var entity = Context.Cache.Get(_selectedColony); + _parentEntity = Context.Cache.Get(colony); - Title.text = entity.Name; + Title.text = _parentEntity.Name; - UpdateGeneral(entity); + UpdateGeneral(_parentEntity); - UpdateInventory(entity); + UpdateInventory(_parentEntity, Inventory); } private void OnDisable() { - HardpointChange.OnChanged -= OnHardpointsChanged; - CargoChange.OnChanged -= OnCargoChanged; + if (_onColonyInventoryChanged == null) + return; + _colonyGearChange.OnChanged -= _onColonyInventoryChanged; + _colonyCargoChange.OnChanged -= _onColonyInventoryChanged; Details.Clear(); + DeselectChild(); + } + + private void DeselectChild() + { + if (_onChildInventoryChanged == null) + return; + _childGearChange.OnChanged -= _onChildInventoryChanged; + _childGearChange.OnChanged -= _onChildInventoryChanged; + ChildInventory.Clear(); } public void UpdateGeneral(Entity entity) { General.Clear(); - General.AddProperty("Capacity", () => $"{entity.OccupiedCapacity}/{entity.Capacity:0}"); - General.AddProperty("Mass", () => $"{entity.Mass.SignificantDigits(Context.GlobalData.SignificantDigits)}"); - General.AddProperty("Temperature", () => $"{entity.Temperature:0}°K"); - General.AddProperty("Energy", () => $"{entity.Energy:0}/{entity.GetBehaviors().First().Capacitance:0}"); + General.AddEntityProperties(entity); General.AddProperty("Assigned Population", () => $"{entity.AssignedPopulation}/{entity.Population}"); + var personalityList = General.AddList("Personality"); foreach (var attribute in entity.Personality.Keys) personalityList.AddPersonalityProperty(Context.Cache.Get(attribute), () => entity.Personality[attribute]); personalityList.SetExpanded(false, true); + + var childList = General.AddList("Children"); + childList.InspectChildren(entity, child => + { + _selectedChild = child; + UpdateInventory(child, ChildInventory); + }); + childList.SetExpanded(false, true); General.RefreshValues(); } - public void UpdateInventory(Entity entity) + public void UpdateInventory(Entity entity, PropertiesPanel panel) { + if (panel == Inventory) + { + _colonyGearChange = entity.GearEvent; + _colonyCargoChange = entity.CargoEvent; + _onColonyInventoryChanged = () => RefreshInventory(entity, panel); + _colonyGearChange.OnChanged += _onColonyInventoryChanged; + _colonyCargoChange.OnChanged += _onColonyInventoryChanged; + RefreshInventory(entity, panel); + } + else + { + DeselectChild(); + _childGearChange = entity.GearEvent; + _childCargoChange = entity.CargoEvent; + _onChildInventoryChanged = () => RefreshInventory(entity, panel, true); + _childGearChange.OnChanged += _onChildInventoryChanged; + _childCargoChange.OnChanged += _onChildInventoryChanged; + RefreshInventory(entity, panel, true); + } + + } + + void RefreshInventory(Entity entity, PropertiesPanel panel, bool child = false) + { + //Debug.Log("Refreshing Inventory!"); var corporation = Context.Cache.Get(entity.Corporation); var blueprints = corporation.UnlockedBlueprints.Select(id => Context.Cache.Get(id)); - var hull = Context.Cache.Get(entity.Hull); - var hullData = Context.Cache.Get(hull.Data); - - OnHardpointsChanged = RefreshInventory; - HardpointChange = entity.GearEvent; - HardpointChange.OnChanged += OnHardpointsChanged; - OnCargoChanged = RefreshInventory; - CargoChange = entity.CargoEvent; - CargoChange.OnChanged += OnCargoChanged; - - RefreshInventory(); - void RefreshInventory() + // Create item data mapping for cargo + var cargoData = entity.Cargo.ToDictionary(id => _context.Cache.Get(id), + id => Context.Cache.Get(_context.Cache.Get(id).Data)); + + panel.Clear(); + + if (child) { - //Debug.Log("Refreshing Inventory!"); + panel.Title.text = entity.Name; + panel.AddSection("General"); + panel.AddEntityProperties(entity); + } + + panel.AddSection("Hardpoints"); + var incompleteGearList = entity.IncompleteGear.Keys + .Select(id => Context.Cache.Get(id)) + .ToList(); + // Skip first hardpoint, that one is always the hull + foreach (var hardpoint in entity.Hardpoints.Skip(1)) + { + // These are the items in the inventory which can be equipped to the current hardpoint + var matchingCargoGear = cargoData + .Where(x => + x.Value is GearData gearData && + gearData.HardpointType == hardpoint.HardpointData.Type) + .Select(x => x.Key as Gear) + .ToArray(); - // Create item data mapping for cargo - var cargoData = entity.Cargo.ToDictionary(id => _context.Cache.Get(id), - id => Context.Cache.Get(_context.Cache.Get(id).Data)); - - Inventory.Clear(); - Inventory.AddSection("Hardpoints"); - var incompleteGearList = entity.IncompleteGear.Keys - .Select(id => Context.Cache.Get(id)) - .ToList(); - // Skip first hardpoint, that one is always the hull - foreach (var hardpoint in entity.Hardpoints.Skip(1)) + // Hardpoint has no gear assigned to it + if (hardpoint.Gear == null) { - // These are the items in the inventory which can be equipped to the current hardpoint - var matchingCargoGear = cargoData - .Where(x => - x.Value is GearData gearData && - gearData.HardpointType == hardpoint.HardpointData.Type) - .Select(x => x.Key as Gear) - .ToArray(); - - // Hardpoint has no gear assigned to it - if (hardpoint.Gear == null) + // Check whether we're currently building some gear for this hardpoint + var incompleteGear = incompleteGearList.FirstOrDefault(g => g.ItemData.HardpointType == hardpoint.HardpointData.Type); + + // We're building something for this hardpoint, show a progress bar! + if (incompleteGear != null) { - // Check whether we're currently building some gear for this hardpoint - var incompleteGear = incompleteGearList.FirstOrDefault(g => g.ItemData.HardpointType == hardpoint.HardpointData.Type); + incompleteGearList.Remove(incompleteGear); + panel.AddProgressField(incompleteGear.Name, () => + { + var productionTime = _context.Cache.Get(incompleteGear.Blueprint).ProductionTime; + return (productionTime - (float) entity.IncompleteGear[incompleteGear.ID]) / productionTime; + }); + } + else // We're not building anything + { + // These are the blueprints we could build onto this hardpoint directly + var matchingBlueprints = blueprints.Where(bp => + bp.FactoryItem == Guid.Empty && + Context.Cache.Get(bp.Item) is GearData gearData && + gearData.HardpointType == hardpoint.HardpointData.Type).ToArray(); - // We're building something for this hardpoint, show a progress bar! - if (incompleteGear != null) - { - incompleteGearList.Remove(incompleteGear); - Inventory.AddProgressField(incompleteGear.Name, () => + Action onClick = null; + if (matchingCargoGear.Any() || matchingBlueprints.Any()) + onClick = data => { - var productionTime = _context.Cache.Get(incompleteGear.Blueprint).ProductionTime; - return (productionTime - (float) entity.IncompleteGear[incompleteGear.ID]) / productionTime; - }); - } - else // We're not building anything - { - // These are the blueprints we could build onto this hardpoint directly - var matchingBlueprints = blueprints.Where(bp => - bp.FactoryItem == Guid.Empty && - Context.Cache.Get(bp.Item) is GearData gearData && - gearData.HardpointType == hardpoint.HardpointData.Type).ToArray(); - - Action onClick = null; - if (matchingCargoGear.Any() || matchingBlueprints.Any()) - onClick = data => + if (data.button == PointerEventData.InputButton.Left) + PopulateDetails(entity, matchingBlueprints); + + else if (data.button == PointerEventData.InputButton.Right) { - if (data.button == PointerEventData.InputButton.Left) - PopulateDetails(entity, matchingBlueprints); - - else if (data.button == PointerEventData.InputButton.Right) - { - ContextMenu.gameObject.SetActive(true); - ContextMenu.Clear(); - if (matchingCargoGear.Any()) - ContextMenu.AddDropdown("Install", matchingCargoGear - .Select(gear => (gear.Name, () => entity.Equip(gear, hardpoint), true))); - if (matchingBlueprints.Any()) - ContextMenu.AddDropdown("Build", matchingBlueprints - .Select(blueprint => - (blueprint.Name, () => - entity.Build(blueprint, 1, _context.Cache.Get(blueprint.Item).Name, true), - entity.GetBlueprintIngredients(blueprint, out _, out _)))); - ContextMenu.Show(); - } - }; - Inventory.AddProperty($"Empty {Enum.GetName(typeof(HardpointType), hardpoint.HardpointData.Type)} Hardpoint", null, onClick, matchingBlueprints.Any()); + ContextMenu.gameObject.SetActive(true); + ContextMenu.Clear(); + if (matchingCargoGear.Any()) + ContextMenu.AddDropdown("Install", matchingCargoGear + .Select(gear => (gear.Name, () => entity.Equip(gear, hardpoint), true))); + if (matchingBlueprints.Any()) + ContextMenu.AddDropdown("Build", matchingBlueprints + .Select(blueprint => + (blueprint.Name, () => + entity.Build(blueprint, 1, _context.Cache.Get(blueprint.Item).Name, true), + entity.GetBlueprintIngredients(blueprint, out _, out _)))); + ContextMenu.Show(); + } + }; + panel.AddProperty($"Empty {Enum.GetName(typeof(HardpointType), hardpoint.HardpointData.Type)} Hardpoint", null, onClick, matchingBlueprints.Any()); + } + } + else + { + var prop = panel.AddProperty(hardpoint.Gear.Name, null, data => + { + if (data.button == PointerEventData.InputButton.Left) + { + if (data.clickCount == 1) + { + _selectedHardpoint = hardpoint; + Details.Inspect(entity, hardpoint); + } + + if (data.clickCount == 2) + { + entity.Unequip(hardpoint); + } } + }, true); + prop.Button.DisableClickWhenSelected = false; + + if (hardpoint == _selectedHardpoint) + { + panel.SelectedChild = prop.Button; + prop.Button.CurrentState = FlatButtonState.Selected; + } + } + } + + if(!entity.Cargo.Any()) + panel.AddSection("No Cargo"); + else + { + panel.AddSection("Cargo"); + foreach (var itemID in entity.Cargo.Where(id => Context.Cache.Get(id) is SimpleCommodity)) + { + var simpleCommodity = Context.Cache.Get(itemID); + var data = simpleCommodity.ItemData; + panel.AddProperty(data.Name, () => simpleCommodity.Quantity.ToString(), eventData => + { + Details.Clear(); + Details.RemoveListener(); + Details.AddItemProperties(entity, simpleCommodity); + Details.RefreshValues(); + }, true).Button.DragSuccess = eventData => + { + Entity targetEntity = null; + if (panel == Inventory && + _selectedChild != null && + ((RectTransform) ChildInventory.transform).ContainsWorldPoint(eventData.position)) + targetEntity = _selectedChild; + else if (panel == ChildInventory && + ((RectTransform) Inventory.transform).ContainsWorldPoint(eventData.position)) + targetEntity = _parentEntity; + + if (targetEntity != null) + { + int quantity = min((int) ((targetEntity.Capacity - targetEntity.OccupiedCapacity) / simpleCommodity.ItemData.Size), simpleCommodity.Quantity); + if (quantity > 0) + { + var newItem = entity.RemoveCargo(simpleCommodity, quantity); + targetEntity.AddCargo(newItem); + return true; + } + } + + return false; + }; + } + + foreach (var group in entity.Cargo + .Select(id => Context.Cache.Get(id)) + .Where(item => item is CraftedItemInstance) + .Cast() + .GroupBy(craftedItem => + { + var corp = "GameCult"; + if (craftedItem.SourceEntity != Guid.Empty) + corp = Context.Cache.Get(Context.Cache.Get(craftedItem.SourceEntity).Corporation).Name; + return (craftedItem.Data, craftedItem.Name, corp) ; + })) + { + Action onClick = (item, data) => + { + if (data.button == PointerEventData.InputButton.Left) + { + if (data.clickCount == 1) + { + Details.Clear(); + Details.RemoveListener(); + Details.AddItemProperties(entity, item); + Details.RefreshValues(); + } + else if (data.clickCount == 2 && item is Gear gear) + { + // Equip Item + entity.Equip(gear.ID, true); + } + } + }; + Func dragSuccess = (data, item) => + { + Entity targetEntity = null; + if (panel == Inventory && + _selectedChild != null && + ((RectTransform) ChildInventory.transform).ContainsWorldPoint(data.position)) + targetEntity = _selectedChild; + else if (panel == ChildInventory && + ((RectTransform) Inventory.transform).ContainsWorldPoint(data.position)) + targetEntity = _parentEntity; + + if (targetEntity != null) + { + if (targetEntity.Capacity - targetEntity.OccupiedCapacity > + Context.Cache.Get(item.Data).Size) + { + entity.RemoveCargo(item); + targetEntity.AddCargo(item); + return true; + } + } + + return false; + }; + if (group.Count() == 1) + { + var item = group.First(); + var button = panel.AddProperty(item.Name, null, eventData => onClick(item, eventData), true).Button; + button.DisableClickWhenSelected = false; + button.DragSuccess = data => dragSuccess(data, item); } else { - var prop = Inventory.AddProperty(hardpoint.Gear.Name, null, _ => + var instanceList = panel.AddList(group.Key.Name); + foreach (var item in group) { - _selectedHardpoint = hardpoint; - Details.Inspect(entity, hardpoint); - }, true); - - if (hardpoint == _selectedHardpoint) - { - Inventory.SelectedChild = prop.Button; - prop.Button.CurrentState = FlatButtonState.Selected; + var button = instanceList.AddProperty(item.Name, null, eventData => onClick(item, eventData), true).Button; + button.DisableClickWhenSelected = false; + button.DragSuccess = data => dragSuccess(data, item); } + instanceList.SetExpanded(false, true); } } - - if(!entity.Cargo.Any()) - Inventory.AddSection("No Cargo"); - else - { - Inventory.AddSection("Cargo"); - foreach (var itemID in entity.Cargo.Where(id => Context.Cache.Get(id) is SimpleCommodity)) - { - var simpleCommodity = Context.Cache.Get(itemID); - var data = simpleCommodity.ItemData; - Inventory.AddProperty(data.Name, () => simpleCommodity.Quantity.ToString(), eventData => - { - Details.Clear(); - Details.AddItemProperties(simpleCommodity); - Details.RefreshValues(); - }); - } - - foreach (var group in entity.Cargo - .Select(id => Context.Cache.Get(id)) - .Where(item => item is CraftedItemInstance) - .Cast() - .GroupBy(craftedItem => (craftedItem.Data, craftedItem.Name, Context.Cache.Get(Context.Cache.Get(craftedItem.SourceEntity).Corporation)))) - { - if (group.Count() == 1) - { - var item = group.First(); - Inventory.AddProperty(item.Name, null, eventData => - { - Details.Clear(); - Details.AddItemProperties(item); - Details.RefreshValues(); - }); - } - else - { - var instanceList = Inventory.AddList(group.Key.Name); - foreach (var item in group) - { - instanceList.AddProperty(item.Name, null, eventData => - { - Details.Clear(); - Details.AddItemProperties(item); - Details.RefreshValues(); - }); - } - instanceList.SetExpanded(false, true); - } - } - } - Inventory.RefreshValues(); } + panel.RefreshValues(); } void PopulateDetails(Entity entity, IEnumerable blueprints) { + Details.RemoveListener(); Details.Clear(); foreach (var blueprint in blueprints) { diff --git a/Assets/Scripts/UI/FlatFlatButton.cs b/Assets/Scripts/UI/FlatFlatButton.cs index 3b4779f60..3d9a174b7 100644 --- a/Assets/Scripts/UI/FlatFlatButton.cs +++ b/Assets/Scripts/UI/FlatFlatButton.cs @@ -6,7 +6,7 @@ using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; -public class FlatFlatButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler +public class FlatFlatButton : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler, IBeginDragHandler, IDragHandler, IEndDragHandler { public event Action OnClick; public float StateDamping; @@ -15,6 +15,7 @@ public class FlatFlatButton : MonoBehaviour, IPointerEnterHandler, IPointerExitH public TextMeshProUGUI Label; public FlatButtonState CurrentState = FlatButtonState.Unselected; public bool DisableClickWhenSelected = true; + public RectTransform DragObject; public Color UnselectedColor; public Color SelectedColor; @@ -24,6 +25,11 @@ public class FlatFlatButton : MonoBehaviour, IPointerEnterHandler, IPointerExitH public Color EnabledTextColor; public Color DisabledTextColor; + public Func DragSuccess; + private int _siblingIndex; + private Transform _dragParent; + private Vector3 _dragPositionOffset; + public void OnPointerEnter(PointerEventData eventData) { if (OnClick != null && CurrentState == FlatButtonState.Unselected) @@ -48,6 +54,40 @@ public class FlatFlatButton : MonoBehaviour, IPointerEnterHandler, IPointerExitH } } + public void OnBeginDrag(PointerEventData eventData) + { + if (DragSuccess == null || DragObject == null) return; + + var canvas = gameObject.FindInParents(); + if (canvas == null) + return; + + _siblingIndex = DragObject.GetSiblingIndex(); + _dragParent = DragObject.parent; + + DragObject.SetParent(canvas.transform, true); + _dragPositionOffset = DragObject.position - (Vector3)eventData.position; + DragObject.SetAsLastSibling(); + } + + public void OnDrag(PointerEventData eventData) + { + var targetPosition = (Vector3)eventData.position + _dragPositionOffset; + //Debug.Log($"Moving drag object to {targetPosition}"); + DragObject.position = targetPosition; + } + + public void OnEndDrag(PointerEventData eventData) + { + if(DragSuccess(eventData)) + Destroy(DragObject.gameObject); + else + { + DragObject.parent = _dragParent; + DragObject.SetSiblingIndex(_siblingIndex); + } + } + private void Update() { Color appearance; diff --git a/Assets/Scripts/UI/PropertiesPanel.cs b/Assets/Scripts/UI/PropertiesPanel.cs index 5e2dca68a..df9871534 100644 --- a/Assets/Scripts/UI/PropertiesPanel.cs +++ b/Assets/Scripts/UI/PropertiesPanel.cs @@ -38,7 +38,7 @@ public class PropertiesPanel : MonoBehaviour protected bool RadioSelection = false; protected event Action OnPropertyAdded; - protected IDynamicProperties ChangeSource; + protected IChangeSource ChangeSource; protected Action OnPropertiesChanged; public void Start() @@ -186,8 +186,6 @@ public class PropertiesPanel : MonoBehaviour if (field.Field.text != s) { field.Field.text = s; - // TODO Find out what's going on with the TMP Input Field - // BODY Setting an input field value causes the text to layout wrong, current workaround is disabling and enabling the gameobject field.gameObject.SetActive(false); Observable.NextFrame().Subscribe(_ => OnPropertyAdded?.Invoke(field.gameObject)); } @@ -202,7 +200,16 @@ public class PropertiesPanel : MonoBehaviour field.Label.text = name; field.Field.contentType = TMP_InputField.ContentType.DecimalNumber; field.Field.onValueChanged.AddListener(val => write(float.Parse(val))); - RefreshPropertyValues += () => field.Field.text = read().ToString(CultureInfo.InvariantCulture); + RefreshPropertyValues += () => + { + var s = read().ToString(CultureInfo.InvariantCulture); + if (field.Field.text != s) + { + field.Field.text = s; + field.gameObject.SetActive(false); + Observable.NextFrame().Subscribe(_ => OnPropertyAdded?.Invoke(field.gameObject)); + } + }; Properties.Add(field.gameObject); OnPropertyAdded?.Invoke(field.gameObject); } @@ -213,7 +220,16 @@ public class PropertiesPanel : MonoBehaviour field.Label.text = name; field.Field.contentType = TMP_InputField.ContentType.IntegerNumber; field.Field.onValueChanged.AddListener(val => write(int.Parse(val))); - RefreshPropertyValues += () => field.Field.text = read().ToString(CultureInfo.InvariantCulture); + RefreshPropertyValues += () => + { + var s = read().ToString(CultureInfo.InvariantCulture); + if (field.Field.text != s) + { + field.Field.text = s; + field.gameObject.SetActive(false); + Observable.NextFrame().Subscribe(_ => OnPropertyAdded?.Invoke(field.gameObject)); + } + }; Properties.Add(field.gameObject); OnPropertyAdded?.Invoke(field.gameObject); } @@ -310,10 +326,14 @@ public class PropertiesPanel : MonoBehaviour OnPropertyAdded?.Invoke(field.gameObject); } - void RemoveListener() + public void RemoveListener() { if (ChangeSource != null) + { ChangeSource.OnChanged -= OnPropertiesChanged; + ChangeSource = null; + OnPropertiesChanged = null; + } } public void Inspect(Entity entity) @@ -328,10 +348,7 @@ public class PropertiesPanel : MonoBehaviour "Platform"); //AddList(hullData.Name).Inspect(hull, entity); //PropertiesPanel.AddProperty("Hull", () => $"{hullData.Name}"); - AddProperty("Capacity", () => $"{entity.OccupiedCapacity}/{entity.Capacity:0}"); - AddProperty("Mass", () => $"{entity.Mass.SignificantDigits(Context.GlobalData.SignificantDigits)}"); - AddProperty("Temperature", () => $"{entity.Temperature:0}°K"); - AddProperty("Energy", () => $"{entity.Energy:0}/{entity.GetBehaviors().First().Capacitance:0}"); + AddEntityProperties(entity); var hardpointList = AddList("Gear"); hardpointList.InspectHardpoints(entity); @@ -384,7 +401,7 @@ public class PropertiesPanel : MonoBehaviour var simpleCommodity = Context.Cache.Get(itemID); var data = simpleCommodity.ItemData; var propertiesList = AddList($"{simpleCommodity.Quantity.ToString()} {data.Name}"); - propertiesList.AddItemProperties(simpleCommodity); + propertiesList.AddItemProperties(entity, simpleCommodity); propertiesList.RefreshValues(); propertiesList.SetExpanded(false, true); } @@ -399,7 +416,7 @@ public class PropertiesPanel : MonoBehaviour { var item = group.First(); var propertiesList = AddList(item.Name); - propertiesList.AddItemProperties(item); + propertiesList.AddItemProperties(entity, item); propertiesList.RefreshValues(); propertiesList.SetExpanded(false, true); } @@ -409,7 +426,7 @@ public class PropertiesPanel : MonoBehaviour foreach (var item in group) { var propertiesList = instanceList.AddList(item.Name); - propertiesList.AddItemProperties(item); + propertiesList.AddItemProperties(entity, item); propertiesList.RefreshValues(); propertiesList.SetExpanded(false, true); } @@ -421,11 +438,32 @@ public class PropertiesPanel : MonoBehaviour } } - public void AddItemProperties(ItemInstance item) + public void AddEntityProperties(Entity entity) + { + AddProperty("Capacity", () => $"{entity.OccupiedCapacity}/{entity.Capacity:0}"); + AddProperty("Mass", () => $"{entity.Mass.SignificantDigits(Context.GlobalData.SignificantDigits)}"); + AddProperty("Temperature", () => $"{entity.Temperature:0}°K"); + AddProperty("Energy", () => $"{entity.Energy:0}/{entity.GetBehavior()?.Capacitance??0:0}"); + } + + public void AddItemProperties(Entity entity, ItemInstance item) { var data = Context.Cache.Get(item.Data); AddProperty("Type", () => data.Name); AddProperty(data.Description).Label.fontStyle = FontStyles.Normal; + if (item is CraftedItemInstance craftedItemInstance) + { + var sourceEntity = Context.Cache.Get(craftedItemInstance.SourceEntity); + if (sourceEntity != null) + { + var corporation = Context.Cache.Get(sourceEntity.Corporation); + AddProperty("Manufacturer", () => corporation.Name); + } + else + { + AddProperty("Manufacturer", () => "GameCult"); + } + } if (item is SimpleCommodity simpleCommodity) AddProperty("Quantity", () => simpleCommodity.Quantity.ToString()); AddProperty("Mass", () => item.Mass.SignificantDigits(Context.GlobalData.SignificantDigits)); @@ -436,20 +474,47 @@ public class PropertiesPanel : MonoBehaviour var gearData = gear.ItemData; AddProperty("Durability", () => $"{gear.Durability.SignificantDigits(Context.GlobalData.SignificantDigits)}/{Context.Evaluate(gearData.Durability, gear).SignificantDigits(Context.GlobalData.SignificantDigits)}"); + foreach (var behavior in gearData.Behaviors) + { + var type = behavior.GetType(); + if (type.GetCustomAttribute(typeof(RuntimeInspectable)) != null) + { + foreach (var field in type.GetFields().Where(f => f.GetCustomAttribute() != null)) + { + var fieldType = field.FieldType; + if (fieldType == typeof(float)) + AddProperty(field.Name, () => $"{((float) field.GetValue(behavior)).SignificantDigits(Context.GlobalData.SignificantDigits)}"); + else if (fieldType == typeof(int)) + AddProperty(field.Name, () => $"{(int) field.GetValue(behavior)}"); + else if (fieldType == typeof(PerformanceStat)) + { + var stat = (PerformanceStat) field.GetValue(behavior); + AddProperty(field.Name, () => $"{Context.Evaluate(stat, gear, entity).SignificantDigits(Context.GlobalData.SignificantDigits)}"); + } + } + } + } } - if (item is CraftedItemInstance craftedItemInstance) + } + + public void InspectChildren(Entity entity, Action onSelect) + { + RemoveListener(); + + ChangeSource = entity.ChildEvent; + OnPropertiesChanged = InspectChildrenInternal; + ChangeSource.OnChanged += OnPropertiesChanged; + InspectChildrenInternal(); + + void InspectChildrenInternal() { - var entity = Context.Cache.Get(craftedItemInstance.SourceEntity); - if (entity != null) + foreach (var child in entity.Children) { - var corporation = Context.Cache.Get(entity.Corporation); - AddProperty("Manufacturer", () => corporation.Name); - } - else - { - AddProperty("Manufacturer", () => "God"); + var childEntity = Context.Cache.Get(child); + AddProperty(childEntity.Name, null, data => onSelect(childEntity), true); } } + } public void Inspect(Entity entity, Hardpoint hardpoint) @@ -465,84 +530,67 @@ public class PropertiesPanel : MonoBehaviour { //Debug.Log($"Refreshing {hardpoint.Gear.Name} properties"); Clear(); - AddItemProperties(hardpoint.Gear); - foreach (var behavior in hardpoint.ItemData.Behaviors) + if (hardpoint.Gear != null) { - var type = behavior.GetType(); - if (type.GetCustomAttribute(typeof(RuntimeInspectable)) != null) - { - foreach (var field in type.GetFields().Where(f => f.GetCustomAttribute() != null)) - { - var fieldType = field.FieldType; - if (fieldType == typeof(float)) - AddProperty(field.Name, () => $"{((float) field.GetValue(behavior)).SignificantDigits(Context.GlobalData.SignificantDigits)}"); - else if (fieldType == typeof(int)) - AddProperty(field.Name, () => $"{(int) field.GetValue(behavior)}"); - else if (fieldType == typeof(PerformanceStat)) - { - var stat = (PerformanceStat) field.GetValue(behavior); - AddProperty(field.Name, () => $"{Context.Evaluate(stat, hardpoint.Gear, entity).SignificantDigits(Context.GlobalData.SignificantDigits)}"); - } - } - } + AddItemProperties(entity, hardpoint.Gear); + foreach (var behavior in hardpoint.Behaviors) + { + if(behavior is IPopulationAssignment populationAssignment) + AddIncrementField("Assigned Population", + () => populationAssignment.AssignedPopulation, + p => populationAssignment.AssignedPopulation = p, + () => 0, () => entity.Population - entity.AssignedPopulation + populationAssignment.AssignedPopulation); + if (behavior is Thermotoggle thermotoggle) + AddField("Target Temperature", () => thermotoggle.TargetTemperature, temp => thermotoggle.TargetTemperature = temp); + if (behavior is Factory factory) + { + AddField("Production Quality", () => factory.ProductionQuality, f => factory.ProductionQuality = f, 0, 1); + var corporation = Context.Cache.Get(entity.Corporation); + var compatibleBlueprints = corporation.UnlockedBlueprints + .Select(id => Context.Cache.Get(id)) + .Where(bp => bp.FactoryItem == hardpoint.ItemData.ID).ToList(); + if (factory.RetoolingTime > 0) + { + AddProgressField("Retooling", () => (factory.ToolingTime - (float) factory.RetoolingTime) / factory.ToolingTime); + } + else + { + AddField("Item", + () => compatibleBlueprints.FindIndex(bp=>bp.ID== factory.Blueprint) + 1, + i => factory.Blueprint = i == 0 ? Guid.Empty : compatibleBlueprints[i - 1].ID, + new []{"None"}.Concat(compatibleBlueprints.Select(bp=>bp.Name)).ToArray()); + AddField("Active", () => factory.Active, active => factory.Active = active); + if (factory.Blueprint != Guid.Empty) + { + if (factory.Active && factory.ItemUnderConstruction != Guid.Empty) + { + AddProgressField("Production", () => + { + if (factory.ItemUnderConstruction == Guid.Empty) return 1; + var itemInstance = Context.Cache.Get(factory.ItemUnderConstruction); + var blueprintData = Context.Cache.Get(itemInstance.Blueprint); + return (blueprintData.ProductionTime - (float) entity.IncompleteCargo[factory.ItemUnderConstruction]) / blueprintData.ProductionTime; + }); + } + else + { + //AddField("Product Name", () => factory.ItemName, name => factory.ItemName = name); + AddField("Product Name", () => factory.ItemName, name => factory.ItemName = name); + var ingredientsList = AddList("Ingredients Needed"); + var blueprintData = Context.Cache.Get(factory.Blueprint); + foreach (var ingredient in blueprintData.Ingredients) + { + var itemData = Context.Cache.Get(ingredient.Key); + ingredientsList.AddProperty(itemData.Name, () => ingredient.Value.ToString()); + } + ingredientsList.SetExpanded(false, true); + ingredientsList.RefreshValues(); + } + } + } + } + } } - foreach (var behavior in hardpoint.Behaviors) - { - if(behavior is IPopulationAssignment populationAssignment) - AddIncrementField("Assigned Population", - () => populationAssignment.AssignedPopulation, - p => populationAssignment.AssignedPopulation = p, - () => 0, () => entity.Population - entity.AssignedPopulation + populationAssignment.AssignedPopulation); - if (behavior is Thermotoggle thermotoggle) - AddField("Target Temperature", () => thermotoggle.TargetTemperature, temp => thermotoggle.TargetTemperature = temp); - if (behavior is Factory factory) - { - AddField("Production Quality", () => factory.ProductionQuality, f => factory.ProductionQuality = f, 0, 1); - var corporation = Context.Cache.Get(entity.Corporation); - var compatibleBlueprints = corporation.UnlockedBlueprints - .Select(id => Context.Cache.Get(id)) - .Where(bp => bp.FactoryItem == hardpoint.ItemData.ID).ToList(); - if (factory.RetoolingTime > 0) - { - AddProgressField("Retooling", () => (factory.ToolingTime - (float) factory.RetoolingTime) / factory.ToolingTime); - } - else - { - AddField("Item", - () => compatibleBlueprints.FindIndex(bp=>bp.ID== factory.Blueprint) + 1, - i => factory.Blueprint = i == 0 ? Guid.Empty : compatibleBlueprints[i - 1].ID, - new []{"None"}.Concat(compatibleBlueprints.Select(bp=>bp.Name)).ToArray()); - AddField("Active", () => factory.Active, active => factory.Active = active); - if (factory.Blueprint != Guid.Empty) - { - if (factory.Active && factory.ItemUnderConstruction != Guid.Empty) - { - AddProgressField("Production", () => - { - if (factory.ItemUnderConstruction == Guid.Empty) return 1; - var itemInstance = Context.Cache.Get(factory.ItemUnderConstruction); - var blueprintData = Context.Cache.Get(itemInstance.Blueprint); - return (blueprintData.ProductionTime - (float) entity.IncompleteCargo[factory.ItemUnderConstruction]) / blueprintData.ProductionTime; - }); - } - else - { - //AddField("Product Name", () => factory.ItemName, name => factory.ItemName = name); - AddField("Product Name", () => factory.ItemName, name => factory.ItemName = name); - var ingredientsList = AddList("Ingredients Needed"); - var blueprintData = Context.Cache.Get(factory.Blueprint); - foreach (var ingredient in blueprintData.Ingredients) - { - var itemData = Context.Cache.Get(ingredient.Key); - ingredientsList.AddProperty(itemData.Name, () => ingredient.Value.ToString()); - } - ingredientsList.SetExpanded(false, true); - ingredientsList.RefreshValues(); - } - } - } - } - } RefreshValues(); } } diff --git a/Assets/Scripts/UnityExtensions.cs b/Assets/Scripts/UnityExtensions.cs index e7700bb41..db08a11de 100644 --- a/Assets/Scripts/UnityExtensions.cs +++ b/Assets/Scripts/UnityExtensions.cs @@ -13,6 +13,29 @@ using static Unity.Mathematics.math; public static class UnityExtensions { + public static T FindInParents(this GameObject go) where T : Component + { + if (go == null) return null; + var comp = go.GetComponent(); + + if (comp != null) + return comp; + + Transform t = go.transform.parent; + while (t != null && comp == null) + { + comp = t.gameObject.GetComponent(); + t = t.parent; + } + return comp; + } + + public static bool ContainsWorldPoint(this RectTransform rectTransform, Vector3 point) + { + Vector2 localMousePosition = rectTransform.InverseTransformPoint(point); + return rectTransform.rect.Contains(localMousePosition); + } + public static void BroadcastAll(string fun, System.Object msg) { GameObject[] gos = (GameObject[])GameObject.FindObjectsOfType(typeof(GameObject)); foreach (GameObject go in gos) { diff --git a/Economy.Shared.Unity.csproj b/Economy.Shared.Unity.csproj index 1de2a4b59..c509fa977 100644 --- a/Economy.Shared.Unity.csproj +++ b/Economy.Shared.Unity.csproj @@ -113,7 +113,7 @@ - +