diff --git a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
index af501f4ba..6d20e2694 100644
--- a/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
+++ b/.idea/.idea.Aetheria-Economy/.idea/contentModel.xml
@@ -74,42 +74,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1341,6 +1305,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1739,6 +1739,7 @@
+
diff --git a/Aetheria-Economy.sln.DotSettings b/Aetheria-Economy.sln.DotSettings
index 3c5b52c62..6fe2fe3f8 100644
--- a/Aetheria-Economy.sln.DotSettings
+++ b/Aetheria-Economy.sln.DotSettings
@@ -1,4 +1,5 @@
True
True
+ True
True
\ No newline at end of file
diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj
index c1bcb0e89..b1ae0e930 100644
--- a/Assembly-CSharp.csproj
+++ b/Assembly-CSharp.csproj
@@ -67,37 +67,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -903,6 +872,7 @@
+
@@ -950,7 +920,6 @@
-
diff --git a/Assets/Prefabs/Context Menu Option.prefab b/Assets/Prefabs/Context Menu Option.prefab
new file mode 100644
index 000000000..7d8646be3
--- /dev/null
+++ b/Assets/Prefabs/Context Menu Option.prefab
@@ -0,0 +1,314 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &4271092340480064605
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 4271092340480064602}
+ - component: {fileID: 4271092340480064598}
+ - component: {fileID: 4271092340480064601}
+ - component: {fileID: 4271092340480064600}
+ - component: {fileID: 4271092340480064603}
+ m_Layer: 5
+ m_Name: Button 1
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &4271092340480064602
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092340480064605}
+ 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: 4271092341023254464}
+ 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: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &4271092340480064598
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092340480064605}
+ m_CullTransparentMesh: 0
+--- !u!114 &4271092340480064601
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092340480064605}
+ 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, g: 0.4180913, b: 1, a: 0.5019608}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: ea8a1213adadb5a4fba6b1785033a34b, 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
+--- !u!114 &4271092340480064600
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092340480064605}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Navigation:
+ m_Mode: 3
+ m_SelectOnUp: {fileID: 0}
+ m_SelectOnDown: {fileID: 0}
+ m_SelectOnLeft: {fileID: 0}
+ m_SelectOnRight: {fileID: 0}
+ m_Transition: 1
+ m_Colors:
+ m_NormalColor: {r: 0.413, g: 0.413, b: 0.413, a: 1}
+ m_HighlightedColor: {r: 0.699, g: 0.699, b: 0.699, a: 1}
+ m_PressedColor: {r: 1, g: 1, b: 1, a: 1}
+ m_DisabledColor: {r: 0.301, g: 0.301, b: 0.301, a: 0.5019608}
+ m_ColorMultiplier: 1
+ m_FadeDuration: 0.1
+ m_SpriteState:
+ m_HighlightedSprite: {fileID: 0}
+ m_PressedSprite: {fileID: 0}
+ m_DisabledSprite: {fileID: 0}
+ m_AnimationTriggers:
+ m_NormalTrigger: Normal
+ m_HighlightedTrigger: Highlighted
+ m_PressedTrigger: Pressed
+ m_DisabledTrigger: Disabled
+ m_Interactable: 1
+ m_TargetGraphic: {fileID: 4271092340480064601}
+ m_OnClick:
+ m_PersistentCalls:
+ m_Calls: []
+--- !u!114 &4271092340480064603
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092340480064605}
+ 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: 32
+ m_PreferredWidth: -1
+ m_PreferredHeight: -1
+ m_FlexibleWidth: -1
+ m_FlexibleHeight: -1
+ m_LayoutPriority: 1
+--- !u!1 &4271092341023254467
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 4271092341023254464}
+ - component: {fileID: 4271092341023254495}
+ - component: {fileID: 4271092341023254494}
+ - component: {fileID: 4271092341023254465}
+ m_Layer: 5
+ m_Name: Text (TMP)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &4271092341023254464
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092341023254467}
+ 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: 4271092340480064602}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 4, y: 0}
+ m_SizeDelta: {x: -24, y: -8}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &4271092341023254495
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092341023254467}
+ m_CullTransparentMesh: 0
+--- !u!114 &4271092341023254494
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092341023254467}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_text: Context Option
+ m_isRightToLeft: 0
+ m_fontAsset: {fileID: 11400000, guid: 9dcd07b95faae7641a3ff6fccab43c32, type: 2}
+ m_sharedMaterial: {fileID: 21906973755630180, guid: 9dcd07b95faae7641a3ff6fccab43c32,
+ type: 2}
+ m_fontSharedMaterials: []
+ m_fontMaterial: {fileID: 0}
+ m_fontMaterials: []
+ m_fontColor32:
+ serializedVersion: 2
+ rgba: 4294962636
+ m_fontColor: {r: 0.8, g: 0.9333333, 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_overrideHtmlColors: 0
+ m_faceColor:
+ serializedVersion: 2
+ rgba: 4294967295
+ m_outlineColor:
+ serializedVersion: 2
+ rgba: 4278190080
+ m_fontSize: 21.4
+ m_fontSizeBase: 20
+ m_fontWeight: 400
+ m_enableAutoSizing: 1
+ m_fontSizeMin: 12
+ m_fontSizeMax: 22
+ m_fontStyle: 0
+ m_textAlignment: 513
+ m_characterSpacing: 0
+ m_wordSpacing: 0
+ m_lineSpacing: 0
+ m_lineSpacingMax: 0
+ m_paragraphSpacing: 0
+ m_charWidthMaxAdj: 0
+ m_enableWordWrapping: 1
+ m_wordWrappingRatios: 0.4
+ m_overflowMode: 0
+ m_firstOverflowCharacterIndex: -1
+ m_linkedTextComponent: {fileID: 0}
+ m_isLinkedTextComponent: 0
+ m_isTextTruncated: 0
+ m_enableKerning: 1
+ m_enableExtraPadding: 0
+ checkPaddingRequired: 0
+ m_isRichText: 1
+ m_parseCtrlCharacters: 1
+ m_isOrthographic: 1
+ m_isCullingEnabled: 0
+ m_ignoreRectMaskCulling: 0
+ m_ignoreCulling: 1
+ m_horizontalMapping: 0
+ m_verticalMapping: 0
+ m_uvLineOffset: 0
+ m_geometrySortingOrder: 0
+ m_VertexBufferAutoSizeReduction: 1
+ m_firstVisibleCharacter: 0
+ m_useMaxVisibleDescender: 1
+ m_pageToDisplay: 1
+ m_margin: {x: 0, y: 0, z: 0, w: 0}
+ m_textInfo:
+ textComponent: {fileID: 4271092341023254494}
+ characterCount: 14
+ spriteCount: 0
+ spaceCount: 1
+ wordCount: 2
+ linkCount: 0
+ lineCount: 1
+ pageCount: 1
+ materialCount: 1
+ m_isUsingLegacyAnimationComponent: 0
+ m_isVolumetricText: 0
+ m_spriteAnimator: {fileID: 0}
+ m_hasFontAssetChanged: 0
+ m_subTextObjects:
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ - {fileID: 0}
+ m_baseMaterial: {fileID: 0}
+ m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
+--- !u!114 &4271092341023254465
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 4271092341023254467}
+ 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
diff --git a/Assets/Prefabs/Context Menu Option.prefab.meta b/Assets/Prefabs/Context Menu Option.prefab.meta
new file mode 100644
index 000000000..870f1e536
--- /dev/null
+++ b/Assets/Prefabs/Context Menu Option.prefab.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 8cabdd9c2f8e4be45b917debb4762707
+PrefabImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity
index 227350831..5b9e16248 100644
--- a/Assets/Scenes/Main.unity
+++ b/Assets/Scenes/Main.unity
@@ -307,17 +307,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
- value: -26
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -327,7 +327,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
- value: 44
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -5012,17 +5012,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
- value: -26
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -5032,7 +5032,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
- value: 44
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -5769,17 +5769,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
- value: -26
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -5789,7 +5789,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
- value: 44
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -6971,6 +6971,7 @@ RectTransform:
- {fileID: 143833100}
- {fileID: 1723832127}
- {fileID: 1059548285}
+ - {fileID: 831625848}
m_Father: {fileID: 323746067}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -7377,6 +7378,176 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 825838188}
m_CullTransparentMesh: 0
+--- !u!1 &831625847
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 831625848}
+ - component: {fileID: 831625850}
+ - component: {fileID: 831625849}
+ - component: {fileID: 831625851}
+ m_Layer: 5
+ m_Name: Context Menu
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!224 &831625848
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 831625847}
+ 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: 1553979212}
+ - {fileID: 843504455}
+ - {fileID: 1713239318}
+ m_Father: {fileID: 784574043}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: -35.87}
+ m_SizeDelta: {x: 250, y: 10}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &831625849
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 831625847}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Padding:
+ m_Left: 2
+ m_Right: 2
+ m_Top: 2
+ m_Bottom: 2
+ m_ChildAlignment: 0
+ m_Spacing: 0
+ m_ChildForceExpandWidth: 1
+ m_ChildForceExpandHeight: 1
+ m_ChildControlWidth: 1
+ m_ChildControlHeight: 1
+--- !u!114 &831625850
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 831625847}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_HorizontalFit: 0
+ m_VerticalFit: 2
+--- !u!114 &831625851
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 831625847}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: f50aaf220f9a82a4a817fa3164bcd62b, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ Canvas: {fileID: 323746066}
+ OptionPrefab: {fileID: 4271092340480064602, guid: 8cabdd9c2f8e4be45b917debb4762707,
+ type: 3}
+ ContentRoot: {fileID: 843504455}
+ OptionHeight: 34
+ PaddingHeight: 16
+--- !u!1 &843504454
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 843504455}
+ - component: {fileID: 843504457}
+ - component: {fileID: 843504456}
+ m_Layer: 5
+ m_Name: Content
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &843504455
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 843504454}
+ 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: 831625848}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 1}
+ m_AnchorMax: {x: 0, y: 1}
+ m_AnchoredPosition: {x: 125, y: -5}
+ m_SizeDelta: {x: 246, y: 6}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &843504456
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 843504454}
+ m_Enabled: 0
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1741964061, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_HorizontalFit: 0
+ m_VerticalFit: 1
+--- !u!114 &843504457
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 843504454}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Padding:
+ m_Left: 0
+ m_Right: 0
+ m_Top: 3
+ m_Bottom: 3
+ m_ChildAlignment: 0
+ m_Spacing: 1
+ m_ChildForceExpandWidth: 1
+ m_ChildForceExpandHeight: 1
+ m_ChildControlWidth: 1
+ m_ChildControlHeight: 1
--- !u!1 &845612105
GameObject:
m_ObjectHideFlags: 0
@@ -10195,6 +10366,7 @@ MonoBehaviour:
ZoneBoundary: {fileID: 548600404}
ClickRaycaster: {fileID: 1771592283}
PropertiesPanel: {fileID: 944413853}
+ ContextMenu: {fileID: 831625851}
PrimaryTabGroup: {fileID: 143833105}
GalaxyTabButton: {fileID: 646091942}
ZoneTabButton: {fileID: 618245060}
@@ -10885,17 +11057,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
- value: -26
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -10905,7 +11077,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
- value: 44
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -13363,6 +13535,99 @@ MonoBehaviour:
ViewContainer: {fileID: 907710630}
LogTextArea: {fileID: 1101630448}
Scroll: {fileID: 1663644542}
+--- !u!1 &1553979211
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1553979212}
+ - component: {fileID: 1553979215}
+ - component: {fileID: 1553979214}
+ - component: {fileID: 1553979213}
+ m_Layer: 5
+ m_Name: Fill
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1553979212
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1553979211}
+ 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: 831625848}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1553979213
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1553979211}
+ 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 &1553979214
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1553979211}
+ 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, g: 0.041666675, b: 0.1, a: 0.79607844}
+ m_RaycastTarget: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: d43f9691259ed984fa09c853c5cda7f0, 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
+--- !u!222 &1553979215
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1553979211}
+ m_CullTransparentMesh: 0
--- !u!1 &1556827356
GameObject:
m_ObjectHideFlags: 0
@@ -14977,6 +15242,99 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4ec4ae0999e1b814cbb86e167df3c039, type: 3}
m_Name:
m_EditorClassIdentifier:
+--- !u!1 &1713239317
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1713239318}
+ - component: {fileID: 1713239321}
+ - component: {fileID: 1713239320}
+ - component: {fileID: 1713239319}
+ m_Layer: 5
+ m_Name: Outline
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &1713239318
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1713239317}
+ 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: 831625848}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 1, y: 1}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 0, y: 0}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &1713239319
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1713239317}
+ 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 &1713239320
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1713239317}
+ 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: 0
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Sprite: {fileID: 21300000, guid: f86ca8785ddc5524d9f125ad626ffcf8, type: 3}
+ m_Type: 1
+ m_PreserveAspect: 0
+ m_FillCenter: 0
+ m_FillMethod: 4
+ m_FillAmount: 1
+ m_FillClockwise: 1
+ m_FillOrigin: 0
+ m_UseSpriteMesh: 0
+--- !u!222 &1713239321
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1713239317}
+ m_CullTransparentMesh: 0
--- !u!1 &1723832126
GameObject:
m_ObjectHideFlags: 0
@@ -17232,17 +17590,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
- value: -26
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -17252,7 +17610,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
- value: 44
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -19247,17 +19605,17 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMin.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchorMax.y
- value: 1
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_AnchoredPosition.y
- value: -26
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
@@ -19267,7 +19625,7 @@ PrefabInstance:
- target: {fileID: 6493174789768221420, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
propertyPath: m_SizeDelta.y
- value: 44
+ value: 0
objectReference: {fileID: 0}
- target: {fileID: 7200536746924797989, guid: b93e36d73a071274d8e9225e077ce92a,
type: 3}
diff --git a/Assets/Scripts/Editor/DatabaseInspector.cs b/Assets/Scripts/Editor/DatabaseInspector.cs
index ad24ffee9..3c7306cd1 100644
--- a/Assets/Scripts/Editor/DatabaseInspector.cs
+++ b/Assets/Scripts/Editor/DatabaseInspector.cs
@@ -176,6 +176,8 @@ public class DatabaseInspector : EditorWindow
{
if(inspectable is InspectablePrefabAttribute)
field.SetValue(obj, InspectGameObject(field.Name.SplitCamelCase(), (string) value));
+ else if(inspectable is InspectableTextureAttribute)
+ field.SetValue(obj, InspectTexture(field.Name.SplitCamelCase(), (string) value));
else
field.SetValue(obj, Inspect(field.Name.SplitCamelCase(), (string) value, inspectable is InspectableTextAttribute));
}
@@ -269,7 +271,7 @@ public class DatabaseInspector : EditorWindow
using (var h = new HorizontalScope(_list.ListItemStyle))
{
- GUILayout.Label($"Add new Stat Effect", GUILayout.ExpandWidth(true));
+ GUILayout.Label("Add new Stat Effect", GUILayout.ExpandWidth(true));
var rect = GetControlRect(false, GUILayout.Width(EditorGUIUtility.singleLineHeight));
GUI.DrawTexture(rect, Icons.Instance.plus, ScaleMode.StretchToFill, true, 1, LabelColor, 0, 0);
if (GUI.Button(rect, GUIContent.none, GUIStyle.none))
@@ -554,13 +556,11 @@ public class DatabaseInspector : EditorWindow
return value;
}
- else
+
+ using (var h = new HorizontalScope())
{
- using (var h = new HorizontalScope())
- {
- GUILayout.Label(label, GUILayout.Width(width));
- return Popup(value, enumOptions);
- }
+ GUILayout.Label(label, GUILayout.Width(width));
+ return Popup(value, enumOptions);
}
}
@@ -573,6 +573,15 @@ public class DatabaseInspector : EditorWindow
}
}
+ public string InspectTexture(string label, string value)
+ {
+ using (var h = new HorizontalScope())
+ {
+ GUILayout.Label(label, GUILayout.Width(width));
+ return AssetDatabase.GetAssetPath(ObjectField(AssetDatabase.LoadAssetAtPath(value), typeof(Texture2D), false));
+ }
+ }
+
public GameObject Inspect(string label, GameObject value)
{
using (var h = new HorizontalScope())
@@ -977,117 +986,115 @@ public class DatabaseInspector : EditorWindow
}
#endregion
- // #region Loadout
- // var loadout = entry as LoadoutData;
- // if (loadout != null)
- // {
- // EditorGUILayout.Space();
- // EditorGUILayout.LabelField("Loadout Hull", EditorStyles.boldLabel);
- //
- // var loadoutHull = Database.Get(loadout.Hull) as HullData;
- //
- // if (loadoutHull != null)
- // {
- // // Reserve slots in the loadout for all equippable (non-hull) hardpoints
- // var hardpoints = loadoutHull.Hardpoints.Where(h => h.Type != HardpointType.Hull).ToArray();
- // if (loadout.Items.Count < hardpoints.Length)
- // loadout.Items.AddRange(Enumerable.Repeat(Guid.Empty, hardpoints.Length - loadout.Items.Count));
- //
- // // EditorGUILayout.Space();
- // // using (var h = new EditorGUILayout.HorizontalScope())
- // // {
- // // GUILayout.Label($"Equipped Items: {loadout.Items.Sum(i=>((ItemData) Database.Get(i))?.Data.Size ?? 0)}/{loadoutHull.Capacity.Min}", EditorStyles.boldLabel);
- // // GUILayout.Label($"Mass: {loadout.Items.Sum(i=>((ItemData) Database.Get(i))?.Data.Mass ?? 0)}", EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
- // // }
- //
- // int itemIndex = 0;
- // using (var v = new EditorGUILayout.VerticalScope(GUI.skin.box))
- // {
- // for (; itemIndex < hardpoints.Length; itemIndex++)
- // {
- // var hp = hardpoints[itemIndex];
- //
- // var loadoutItem = Database.Get(loadout.Items[itemIndex]) as EquippableItemData;
- //
- // if (loadoutItem != null && loadoutItem.HardpointType != hp.Type)
- // {
- // loadout.Items[itemIndex] = Guid.Empty;
- // Debug.Log($"Invalid Item \"{loadoutItem.Name}\" in {Enum.GetName(typeof(HardpointType),hp.Type)} hardpoint for loadout \"{loadout.Name}\"");
- // Database.Save(entry);
- // }
- //
- // using (var h = new EditorGUILayout.HorizontalScope(_list.ListItemStyle))
- // {
- // if (h.rect.Contains(current.mousePosition) &&
- // (currentEventType == EventType.DragUpdated || currentEventType == EventType.DragPerform))
- // {
- // var guid = (Guid) DragAndDrop.GetGenericData("Item");
- // var draggedEquippable = Database.Get(guid) as EquippableItemData;
- // var good = draggedEquippable != null && draggedEquippable.HardpointType == hp.Type;
- // if (currentEventType == EventType.DragUpdated)
- // DragAndDrop.visualMode = good ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected;
- // else if (currentEventType == EventType.DragPerform && good)
- // {
- // DragAndDrop.AcceptDrag();
- // loadout.Items[itemIndex] = guid;
- //
- // Database.Save(entry);
- // }
- // }
- //
- // GUILayout.Label(Enum.GetName(typeof(HardpointType), hp.Type));
- // if (loadoutItem == null || loadoutItem.HardpointType != hp.Type)
- // GUILayout.Label("Empty Hardpoint", GUILayout.ExpandWidth(false));
- // else
- // {
- // GUILayout.Label(loadoutItem.Name, GUILayout.ExpandWidth(false));
- // var rect = EditorGUILayout.GetControlRect(false, GUILayout.Width(EditorGUIUtility.singleLineHeight));
- // GUI.DrawTexture(rect, Icons.Instance.minus, ScaleMode.StretchToFill, true, 1, Color.black, 0, 0);
- // if (GUI.Button(rect, GUIContent.none, GUIStyle.none))
- // loadout.Items[itemIndex] = Guid.Empty;
- // }
- // }
- // }
- // }
- //
- // EditorGUILayout.Space();
- // EditorGUILayout.LabelField("Cargo", EditorStyles.boldLabel);
- //
- // using (var v = new EditorGUILayout.VerticalScope(GUI.skin.box))
- // {
- // if (v.rect.Contains(current.mousePosition) &&
- // (currentEventType == EventType.DragUpdated || currentEventType == EventType.DragPerform))
- // {
- // var guid = (Guid) DragAndDrop.GetGenericData("Item");
- // var dragItem = Database.Get(guid) as ItemData;
- // if (currentEventType == EventType.DragUpdated)
- // DragAndDrop.visualMode = dragItem != null ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected;
- // else if (currentEventType == EventType.DragPerform && dragItem != null)
- // {
- // DragAndDrop.AcceptDrag();
- //
- // loadout.Items.Add(guid);
- // Database.Save(entry);
- // }
- // }
- // if(itemIndex == loadout.Items.Count)
- // GUILayout.Label("Nothing Here!");
- // for (; itemIndex < loadout.Items.Count; itemIndex++)
- // {
- // var loadoutItem = Database.Get(loadout.Items[itemIndex]) as ItemData;
- // using (var h = new EditorGUILayout.HorizontalScope(_list.ListItemStyle))
- // {
- // GUILayout.Label(loadoutItem?.Name ?? "Invalid Item");
- // var rect = EditorGUILayout.GetControlRect(false, GUILayout.Width(EditorGUIUtility.singleLineHeight));
- // GUI.DrawTexture(rect, Icons.Instance.minus, ScaleMode.StretchToFill, true, 1, Color.black, 0, 0);
- // if (GUI.Button(rect, GUIContent.none, GUIStyle.none))
- // loadout.Items.RemoveAt(itemIndex--);
- // }
- // }
- // }
- // }
- // }
- // #endregion
+ #region Loadout
+ var loadout = entry as LoadoutData;
+ if (loadout != null)
+ {
+ Space();
+ LabelField("Loadout Hull", EditorStyles.boldLabel);
+
+ if (DatabaseCache.Get(loadout.Hull) is HullData loadoutHull)
+ {
+ // Reserve slots in the loadout for all equippable (non-hull) hardpoints
+ var hardpoints = loadoutHull.Hardpoints.Where(h => h.Type != HardpointType.Hull).ToArray();
+ if (loadout.Items.Count < hardpoints.Length)
+ loadout.Items.AddRange(Enumerable.Repeat(Guid.Empty, hardpoints.Length - loadout.Items.Count));
+
+ Space();
+ using (var h = new HorizontalScope())
+ {
+ GUILayout.Label($"Equipped Items: {loadout.Items.Sum(i=>((ItemData) DatabaseCache.Get(i))?.Size ?? 0)}/{loadoutHull.Capacity.Min}", EditorStyles.boldLabel);
+ GUILayout.Label($"Mass: {loadout.Items.Sum(i=>((ItemData) DatabaseCache.Get(i))?.Mass ?? 0)}", EditorStyles.boldLabel, GUILayout.ExpandWidth(false));
+ }
+
+ int itemIndex = 0;
+ using (var v = new VerticalScope(GUI.skin.box))
+ {
+ for (; itemIndex < hardpoints.Length; itemIndex++)
+ {
+ var hp = hardpoints[itemIndex];
+
+ var loadoutItem = DatabaseCache.Get(loadout.Items[itemIndex]) as EquippableItemData;
+
+ if (loadoutItem != null && loadoutItem.HardpointType != hp.Type)
+ {
+ loadout.Items[itemIndex] = Guid.Empty;
+ Debug.Log($"Invalid Item \"{loadoutItem.Name}\" in {Enum.GetName(typeof(HardpointType),hp.Type)} hardpoint for loadout \"{loadout.Name}\"");
+ GUI.changed = true;
+ }
+
+ using (var h = new HorizontalScope(_list.ListItemStyle))
+ {
+ if (h.rect.Contains(current.mousePosition) &&
+ (currentEventType == EventType.DragUpdated || currentEventType == EventType.DragPerform))
+ {
+ var guid = (Guid) DragAndDrop.GetGenericData("Item");
+ var draggedEquippable = DatabaseCache.Get(guid) as EquippableItemData;
+ var good = draggedEquippable != null && draggedEquippable.HardpointType == hp.Type;
+ if (currentEventType == EventType.DragUpdated)
+ DragAndDrop.visualMode = good ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected;
+ else if (currentEventType == EventType.DragPerform && good)
+ {
+ DragAndDrop.AcceptDrag();
+ loadout.Items[itemIndex] = guid;
+
+ GUI.changed = true;
+ }
+ }
+
+ GUILayout.Label(Enum.GetName(typeof(HardpointType), hp.Type));
+ if (loadoutItem == null || loadoutItem.HardpointType != hp.Type)
+ GUILayout.Label("Empty Hardpoint", GUILayout.ExpandWidth(false));
+ else
+ {
+ GUILayout.Label(loadoutItem.Name, GUILayout.ExpandWidth(false));
+ var rect = GetControlRect(false, GUILayout.Width(EditorGUIUtility.singleLineHeight));
+ GUI.DrawTexture(rect, Icons.Instance.minus, ScaleMode.StretchToFill, true, 1, Color.black, 0, 0);
+ if (GUI.Button(rect, GUIContent.none, GUIStyle.none))
+ loadout.Items[itemIndex] = Guid.Empty;
+ }
+ }
+ }
+ }
+
+ Space();
+ LabelField("Cargo", EditorStyles.boldLabel);
+
+ using (var v = new VerticalScope(GUI.skin.box))
+ {
+ if (v.rect.Contains(current.mousePosition) &&
+ (currentEventType == EventType.DragUpdated || currentEventType == EventType.DragPerform))
+ {
+ var guid = (Guid) DragAndDrop.GetGenericData("Item");
+ var dragItem = DatabaseCache.Get(guid) as ItemData;
+ if (currentEventType == EventType.DragUpdated)
+ DragAndDrop.visualMode = dragItem != null ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected;
+ else if (currentEventType == EventType.DragPerform && dragItem != null)
+ {
+ DragAndDrop.AcceptDrag();
+
+ loadout.Items.Add(guid);
+ GUI.changed = true;
+ }
+ }
+ if(itemIndex == loadout.Items.Count)
+ GUILayout.Label("Nothing Here!");
+ for (; itemIndex < loadout.Items.Count; itemIndex++)
+ {
+ var loadoutItem = DatabaseCache.Get(loadout.Items[itemIndex]) as ItemData;
+ using (var h = new HorizontalScope(_list.ListItemStyle))
+ {
+ GUILayout.Label(loadoutItem?.Name ?? "Invalid Item");
+ var rect = GetControlRect(false, GUILayout.Width(EditorGUIUtility.singleLineHeight));
+ GUI.DrawTexture(rect, Icons.Instance.minus, ScaleMode.StretchToFill, true, 1, Color.black, 0, 0);
+ if (GUI.Button(rect, GUIContent.none, GUIStyle.none))
+ loadout.Items.RemoveAt(itemIndex--);
+ }
+ }
+ }
+ }
+ }
+ #endregion
if (EditorGUI.EndChangeCheck())
{
diff --git a/Assets/Scripts/Editor/DatabaseView.cs b/Assets/Scripts/Editor/DatabaseView.cs
index 4cd242c06..a6e67eaf7 100644
--- a/Assets/Scripts/Editor/DatabaseView.cs
+++ b/Assets/Scripts/Editor/DatabaseView.cs
@@ -17,7 +17,6 @@ public class DatabaseListView : EditorWindow
public GUIStyle SelectedStyle;
public static RethinkDB R = RethinkDB.R;
- private Connection _connection;
private DatabaseCache _databaseCache;
private bool[] _gearFoldouts;
@@ -36,6 +35,7 @@ public class DatabaseListView : EditorWindow
private string _connectionString;
private const float LineHeight = 20;
private Vector2 _view;
+ private RethinkQueryStatus _queryStatus;
public Color LabelColor => EditorGUIUtility.isProSkin ? Color.white : Color.black;
@@ -143,7 +143,7 @@ public class DatabaseListView : EditorWindow
if (GUILayout.Button("Connect"))
{
EditorPrefs.SetString("RethinkDB.URL", _connectionString);
- _connection = RethinkConnection.RethinkConnect(_databaseCache, _connectionString);
+ _queryStatus = RethinkConnection.RethinkConnect(_databaseCache, _connectionString);
}
}
using (var h = new HorizontalScope())
@@ -151,7 +151,7 @@ public class DatabaseListView : EditorWindow
if (GUILayout.Button("Connect All"))
{
EditorPrefs.SetString("RethinkDB.URL", _connectionString);
- _connection = RethinkConnection.RethinkConnect(_databaseCache, _connectionString, true, false);
+ _queryStatus = RethinkConnection.RethinkConnect(_databaseCache, _connectionString, true, false);
}
if (GUILayout.Button("Save"))
@@ -159,7 +159,16 @@ public class DatabaseListView : EditorWindow
_databaseCache.Save(new DirectoryInfo(Application.dataPath).Parent.FullName);
}
}
+
+ if (_queryStatus != null && _queryStatus.RetrievedItems < _queryStatus.GalaxyEntries + _queryStatus.ItemsEntries)
+ {
+ var progressRect = GetControlRect(false, 20);
+ EditorGUI.ProgressBar(progressRect, (float)_queryStatus.RetrievedItems/(_queryStatus.GalaxyEntries + _queryStatus.ItemsEntries), "Sync Progress");
+ }
GUILayout.Space(5);
+
+ // if(GUILayout.Button("Log Cache Count"))
+ // Debug.Log($"Cache contains {_databaseCache.AllEntries.Count()} elements");
Action select = item =>
{
diff --git a/Assets/Scripts/RethinkConnection.cs b/Assets/Scripts/RethinkConnection.cs
index 6744ab65e..5e304c536 100644
--- a/Assets/Scripts/RethinkConnection.cs
+++ b/Assets/Scripts/RethinkConnection.cs
@@ -14,7 +14,7 @@ public static class RethinkConnection
{
public static RethinkDB R = RethinkDB.R;
- public static Connection RethinkConnect(DatabaseCache cache, string connectionString, bool syncLocalChanges = true, bool filterGalaxyData = true)
+ public static RethinkQueryStatus RethinkConnect(DatabaseCache cache, string connectionString, bool syncLocalChanges = true, bool filterGalaxyData = true)
{
// Add Unity.Mathematics serialization support to RethinkDB Driver
//Converter.Serializer.Converters.Add(new MathJsonConverter());
@@ -72,9 +72,16 @@ public static class RethinkConnection
};
}
+ var status = new RethinkQueryStatus();
+
// Get all item data from RethinkDB
Task.Run(async () =>
{
+ status.ItemsEntries = R
+ .Db("Aetheria")
+ .Table("Items")
+ .Count().RunAtom(connection);
+
var result = await R
.Db("Aetheria")
.Table("Items")
@@ -82,8 +89,9 @@ public static class RethinkConnection
while (await result.MoveNextAsync())
{
var entry = result.Current;
- Debug.Log($"Received Items entry from RethinkDB: {entry.GetType()} {(entry as INamedEntry)?.EntryName ?? ""}:{entry.ID}");
+ //Debug.Log($"Received Items entry from RethinkDB: {entry.GetType()} {(entry as INamedEntry)?.EntryName ?? ""}:{entry.ID}");
cache.Add(entry, true);
+ status.RetrievedItems++;
}
}).WrapErrors();
@@ -94,15 +102,24 @@ public static class RethinkConnection
.Db("Aetheria")
.Table("Galaxy");
if (filterGalaxyData)
- operation = ((Table)operation).Filter(o =>
- o["$type"] == typeof(GalaxyMapLayerData).Name || o["$type"] == typeof(GlobalData).Name);
+ {
+ var filter = ((Table) operation).Filter(o =>
+ o["$type"] == typeof(GalaxyMapLayerData).Name ||
+ o["$type"] == typeof(GlobalData).Name ||
+ o["$type"] == typeof(MegaCorporation).Name);
+ status.GalaxyEntries = filter.Count().RunAtom(connection);
+ operation = filter;
+ }
+ else status.GalaxyEntries = ((Table) operation).Count().RunAtom(connection);
+
var result = await operation
.RunCursorAsync(connection);
while (await result.MoveNextAsync())
{
var entry = result.Current;
- Debug.Log($"Received Galaxy entry from RethinkDB: {entry.GetType()} {(entry as INamedEntry)?.EntryName ?? ""}:{entry.ID}");
+ //Debug.Log($"Received Galaxy entry from RethinkDB: {entry.GetType()} {(entry as INamedEntry)?.EntryName ?? ""}:{entry.ID}");
cache.Add(entry, true);
+ status.RetrievedItems++;
}
}).WrapErrors();
@@ -132,6 +149,13 @@ public static class RethinkConnection
Debug.Log(R.Now().Run(connection).ToString() as string);
});
- return connection;
+ return status;
}
}
+
+public class RethinkQueryStatus
+{
+ public int RetrievedItems;
+ public int GalaxyEntries;
+ public int ItemsEntries;
+}
\ No newline at end of file
diff --git a/Assets/Scripts/ServerShared/Agents/AgentTask.cs b/Assets/Scripts/ServerShared/Agents/AgentTask.cs
index 71567b062..e6830122a 100644
--- a/Assets/Scripts/ServerShared/Agents/AgentTask.cs
+++ b/Assets/Scripts/ServerShared/Agents/AgentTask.cs
@@ -17,7 +17,7 @@ public abstract class AgentTask : DatabaseEntry
[JsonProperty("zone"), Key(2)]
public Guid Zone;
- [JsonProperty("assignedEntity"), Key(3)]
+ [JsonProperty("reserved"), Key(3)]
public bool Reserved;
[IgnoreMember] public abstract TaskType Type { get; }
diff --git a/Assets/Scripts/ServerShared/Agents/StationTowing.cs b/Assets/Scripts/ServerShared/Agents/StationTowing.cs
index 5d87fd95a..5f3071b44 100644
--- a/Assets/Scripts/ServerShared/Agents/StationTowing.cs
+++ b/Assets/Scripts/ServerShared/Agents/StationTowing.cs
@@ -12,15 +12,19 @@ public class StationTowing : AgentTask
[IgnoreMember] public override TaskType Type => TaskType.Tow;
[JsonProperty("station"), Key(4)]
- private Guid _station;
+ public Guid Station;
- [JsonProperty("targetOrbit"), Key(5)]
- private Guid _targetOrbit;
+ [JsonProperty("orbitParent"), Key(5)]
+ public Guid OrbitParent;
+
+ [JsonProperty("orbitDistance"), Key(6)]
+ public float OrbitDistance;
- public StationTowing(Guid zone, Guid station, Guid targetOrbit)
+ public StationTowing(Guid zone, Guid station, Guid orbitParent, float orbitDistance)
{
Zone = zone;
- _station = station;
- _targetOrbit = targetOrbit;
+ Station = station;
+ OrbitParent = orbitParent;
+ OrbitDistance = orbitDistance;
}
}
diff --git a/Assets/Scripts/ServerShared/Agents/VelocityMatch.cs b/Assets/Scripts/ServerShared/Agents/VelocityMatch.cs
index 620201449..c3fbfd426 100644
--- a/Assets/Scripts/ServerShared/Agents/VelocityMatch.cs
+++ b/Assets/Scripts/ServerShared/Agents/VelocityMatch.cs
@@ -8,7 +8,7 @@ using static Unity.Mathematics.math;
public class VelocityMatch : AgentBehavior
{
public event Action OnMatch;
- public Guid TargetOrbit;
+ public float2 TargetVelocity;
private Thruster _thrust;
private Turning _turning;
private const float TargetThreshold = .1f;
@@ -21,12 +21,17 @@ public class VelocityMatch : AgentBehavior
_thrust = Entity.Axes.Keys.FirstOrDefault(x => x is Thruster) as Thruster;
_turning = Entity.Axes.Keys.FirstOrDefault(x => x is Turning) as Turning;
}
+
+ public void Clear()
+ {
+ OnMatch = null;
+ }
public override void Update(float delta)
{
- if (TargetOrbit != Guid.Empty && _thrust != null && _turning != null)
+ if (_thrust != null && _turning != null)
{
- var deltaV = _context.GetOrbitVelocity(TargetOrbit) - Entity.Velocity;
+ var deltaV = TargetVelocity - Entity.Velocity;
if(length(deltaV) < TargetThreshold)
OnMatch?.Invoke();
Entity.Axes[_turning] = TurningInput(deltaV);
@@ -39,7 +44,7 @@ public class VelocityMatch : AgentBehavior
get
{
var velocity = length(Entity.Velocity);
- var deltaV = _context.GetOrbitVelocity(TargetOrbit) - Entity.Velocity;
+ var deltaV = TargetVelocity - Entity.Velocity;
var stoppingTime = length(deltaV) / (_thrust.Thrust / Entity.Mass);
var stoppingDistance = stoppingTime * (velocity / 2);
diff --git a/Assets/Scripts/ServerShared/Attributes.cs b/Assets/Scripts/ServerShared/Attributes.cs
index ac5fc91be..c960c226f 100644
--- a/Assets/Scripts/ServerShared/Attributes.cs
+++ b/Assets/Scripts/ServerShared/Attributes.cs
@@ -53,6 +53,9 @@ public class InspectableTextAttribute : InspectableFieldAttribute { }
[AttributeUsage(AttributeTargets.Field)]
public class InspectablePrefabAttribute : InspectableFieldAttribute { }
+[AttributeUsage(AttributeTargets.Field)]
+public class InspectableTextureAttribute : InspectableFieldAttribute { }
+
[AttributeUsage(AttributeTargets.Field)]
public class TemperatureInspectableAttribute : InspectableFieldAttribute { }
diff --git a/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs b/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs
index b9a218898..fc97e1fc8 100644
--- a/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs
+++ b/Assets/Scripts/ServerShared/Behaviors/Behaviors.cs
@@ -36,8 +36,9 @@ public interface IPersistentBehavior// where T : IBehavior
public interface IController
{
bool Available { get; }
- TaskType JobType { get; }
- void AssignTask(Guid task);
+ TaskType TaskType { get; }
+ Guid Zone { get; }
+ void AssignTask(Guid task, List path);
}
[MessagePackObject,
diff --git a/Assets/Scripts/ServerShared/Behaviors/Controller.cs b/Assets/Scripts/ServerShared/Behaviors/Controller.cs
index 0742da808..c5abbd484 100644
--- a/Assets/Scripts/ServerShared/Behaviors/Controller.cs
+++ b/Assets/Scripts/ServerShared/Behaviors/Controller.cs
@@ -1,4 +1,5 @@
-using System.Collections;
+using System;
+using System.Collections;
using System.Collections.Generic;
using MessagePack;
using Newtonsoft.Json;
@@ -19,7 +20,25 @@ public abstract class ControllerData : BehaviorData
public float TangentSensitivity = 4;
}
-// public abstract class Controller
+// public abstract class Controller : IController
// {
+// public abstract bool Available { get; }
+// public abstract TaskType TaskType { get; }
+// public Guid Zone { get; }
//
+// private GameContext _context;
+// private Entity _entity;
+// private Guid _task;
+// private List _path;
+//
+// public Controller(GameContext context, Entity entity)
+// {
+//
+// }
+//
+// public void AssignTask(Guid task, List path)
+// {
+// _task = task;
+// _path = path;
+// }
// }
diff --git a/Assets/Scripts/ServerShared/Behaviors/PatrolController.cs b/Assets/Scripts/ServerShared/Behaviors/PatrolController.cs
index f9a2d925f..17adefbbc 100644
--- a/Assets/Scripts/ServerShared/Behaviors/PatrolController.cs
+++ b/Assets/Scripts/ServerShared/Behaviors/PatrolController.cs
@@ -20,8 +20,9 @@ public class PatrolControllerData : ControllerData
public class PatrolController : IBehavior, IController
{
- public TaskType JobType => TaskType.Tow;
+ public TaskType TaskType => TaskType.Tow;
public bool Available => false;
+ public Guid Zone => _entity.Zone;
public BehaviorData Data => _data;
private PatrolControllerData _data;
@@ -55,7 +56,7 @@ public class PatrolController : IBehavior, IController
RandomTarget();
}
- public void AssignTask(Guid task)
+ public void AssignTask(Guid task, List path)
{
throw new NotImplementedException();
}
diff --git a/Assets/Scripts/ServerShared/Behaviors/TowingController.cs b/Assets/Scripts/ServerShared/Behaviors/TowingController.cs
index c24c10de8..1e60bc02c 100644
--- a/Assets/Scripts/ServerShared/Behaviors/TowingController.cs
+++ b/Assets/Scripts/ServerShared/Behaviors/TowingController.cs
@@ -1,8 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using MessagePack;
using Newtonsoft.Json;
+using Unity.Mathematics;
+using static Unity.Mathematics.math;
[MessagePackObject, JsonObject(MemberSerialization.OptIn), EntityTypeRestriction(HullType.Ship)]
public class TowingControllerData : ControllerData
@@ -15,8 +18,9 @@ public class TowingControllerData : ControllerData
public class TowingController : IBehavior, IPersistentBehavior, IController
{
- public TaskType JobType => TaskType.Tow;
+ public TaskType TaskType => TaskType.Tow;
public bool Available => _towingTask != Guid.Empty;
+ public Guid Zone => _entity.Zone;
public BehaviorData Data => _data;
private TowingControllerData _data;
@@ -24,6 +28,11 @@ public class TowingController : IBehavior, IPersistentBehavior, IController
private Entity _entity;
private Gear _item;
private Guid _towingTask;
+ private List _path;
+ private TowingPhase _towingPhase = TowingPhase.Pickup;
+ private MovementPhase _movementPhase = MovementPhase.Locomotion;
+ private Locomotion _locomotion;
+ private VelocityMatch _velocityMatch;
public TowingController(GameContext context, TowingControllerData data, Entity entity, Gear item)
{
@@ -35,11 +44,81 @@ public class TowingController : IBehavior, IPersistentBehavior, IController
public void Initialize()
{
-
+ _locomotion = new Locomotion(_context, _entity, _data);
+ _velocityMatch = new VelocityMatch(_context, _entity, _data);
}
public void Update(float delta)
{
+ if (_path.Any())
+ {
+ _locomotion.Update(delta);
+
+ if (length(_entity.Position - _locomotion.Objective) < _context.GlobalData.WarpDistance)
+ {
+ _context.Warp(_entity, _path[0].ZoneID);
+ _path.RemoveAt(0);
+ if(_path.Any())
+ SetWormholeDestination();
+ }
+ }
+ else
+ {
+ var towingTask = _context.Cache.Get(_towingTask);
+ var destination = float2(0);
+ var velocity = float2(0);
+ if (_towingPhase == TowingPhase.Pickup)
+ {
+ destination = _context.ZoneEntities[_entity.Zone][towingTask.Station].Position;
+ velocity = _context.ZoneEntities[_entity.Zone][towingTask.Station].Velocity;
+ }
+ else
+ {
+ var orbitParent = _context.GetOrbitPosition(towingTask.OrbitParent);
+ var parentToUs = _entity.Position - orbitParent;
+ var nearestPointInOrbit = orbitParent + normalize(parentToUs) * towingTask.OrbitDistance;
+ destination = nearestPointInOrbit;
+ velocity = _context.GetOrbitVelocity(towingTask.OrbitParent);
+ }
+
+ _velocityMatch.TargetVelocity = velocity;
+ if (_movementPhase == MovementPhase.Locomotion)
+ {
+ var matchDistanceTime = _velocityMatch.MatchDistanceTime;
+ _locomotion.Objective = destination + velocity * matchDistanceTime.y;
+ _locomotion.Update(delta);
+
+ var distance = length(destination - _entity.Position);
+ if (distance < matchDistanceTime.x)
+ {
+ _movementPhase = MovementPhase.Slowdown;
+ _velocityMatch.Clear();
+ if (_towingPhase == TowingPhase.Pickup)
+ _velocityMatch.OnMatch += () =>
+ {
+ var target = _context.ZoneEntities[_entity.Zone][towingTask.Station];
+ _entity.Children.Add(towingTask.Station);
+ target.Parent = _entity.ID;
+ _towingPhase = TowingPhase.Delivery;
+ _movementPhase = MovementPhase.Locomotion;
+ };
+ else
+ _velocityMatch.OnMatch += () =>
+ {
+ var orbit = _context.CreateOrbit(towingTask.OrbitParent, _entity.Position);
+
+ var target = _context.ZoneEntities[_entity.Zone][towingTask.Station] as OrbitalEntity;
+ _entity.Children.Remove(towingTask.Station);
+ target.Parent = Guid.Empty;
+ target.OrbitData = orbit.ID;
+ };
+ }
+ }
+ else
+ {
+ _velocityMatch.Update(delta);
+ }
+ }
}
public PersistentBehaviorData Store()
@@ -56,9 +135,18 @@ public class TowingController : IBehavior, IPersistentBehavior, IController
_towingTask = towingControllerPersistence.TowingTask;
}
- public void AssignTask(Guid task)
+ public void AssignTask(Guid task, List path)
{
_towingTask = task;
+ _path = path;
+ _path.RemoveAt(0);
+ if(_path.Any())
+ SetWormholeDestination();
+ }
+
+ private void SetWormholeDestination()
+ {
+ _locomotion.Objective = _context.WormholePosition(_entity.Zone, _path[0].ZoneID);
}
}
@@ -67,3 +155,15 @@ public class TowingControllerPersistence : PersistentBehaviorData
[JsonProperty("towingTask"), Key(0)]
public Guid TowingTask;
}
+
+public enum TowingPhase
+{
+ Pickup,
+ Delivery
+}
+
+public enum MovementPhase
+{
+ Locomotion,
+ Slowdown
+}
\ No newline at end of file
diff --git a/Assets/Scripts/ServerShared/DatabaseItems.cs b/Assets/Scripts/ServerShared/DatabaseItems.cs
index 4f6363990..23e9375aa 100644
--- a/Assets/Scripts/ServerShared/DatabaseItems.cs
+++ b/Assets/Scripts/ServerShared/DatabaseItems.cs
@@ -31,13 +31,13 @@ public interface INamedEntry
Union(10, typeof(ZoneData)),
Union(11, typeof(Player)),
Union(12, typeof(Corporation)),
- Union(13, typeof(ShipData)),
+ Union(13, typeof(MegaCorporation)),
Union(14, typeof(StationData)),
Union(15, typeof(OrbitData)),
Union(16, typeof(PlanetData)),
Union(17, typeof(PersonalityAttribute)),
Union(18, typeof(AgentTask)),
- // Union(17, typeof(ShipData)),
+ Union(19, typeof(LoadoutData)),
JsonObject(MemberSerialization.OptIn), JsonConverter(typeof(JsonKnownTypesConverter))]
//[Union(21, typeof(ContractData))]
//[Union(22, typeof(Station))]
@@ -81,8 +81,43 @@ public class Corporation : DatabaseEntry, INamedEntry
}
}
-[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
-public class ShipData : DatabaseEntry
+[RethinkTable("Galaxy"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
+public class MegaCorporation : DatabaseEntry, INamedEntry
{
+ [InspectableField, JsonProperty("name"), Key(1)]
+ public string Name;
+ [InspectableTexture, JsonProperty("logo"), Key(2)]
+ public string Logo;
+
+ [InspectableDatabaseLink(typeof(PersonalityAttribute)), JsonProperty("initialFleet"), Key(3)]
+ public Dictionary Personality = new Dictionary();
+
+ [InspectableDatabaseLink(typeof(LoadoutData)), JsonProperty("initialFleet"), Key(4)]
+ public Dictionary InitialFleet = new Dictionary();
+
+ [IgnoreMember] public string EntryName
+ {
+ get => Name;
+ set => Name = value;
+ }
+}
+
+[RethinkTable("Items"), Inspectable, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
+public class LoadoutData : DatabaseEntry, INamedEntry
+{
+ [InspectableField, JsonProperty("name"), Key(1)]
+ public string Name;
+
+ [InspectableDatabaseLink(typeof(HullData)), JsonProperty("hull"), Key(2)]
+ public Guid Hull;
+
+ [JsonProperty("items"), Key(3)]
+ public List Items = new List();
+
+ [IgnoreMember] public string EntryName
+ {
+ get => Name;
+ set => Name = value;
+ }
}
\ No newline at end of file
diff --git a/Assets/Scripts/ServerShared/GameContext.cs b/Assets/Scripts/ServerShared/GameContext.cs
index 0f367ec06..a27963475 100644
--- a/Assets/Scripts/ServerShared/GameContext.cs
+++ b/Assets/Scripts/ServerShared/GameContext.cs
@@ -6,6 +6,7 @@ using Unity.Mathematics;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
using Random = Unity.Mathematics.Random;
+using JM.LinqFaster;
public class GameContext
{
@@ -14,6 +15,7 @@ public class GameContext
public Dictionary> ZoneEntities = new Dictionary>();
public Dictionary MapLayers = new Dictionary();
public Dictionary> CorporationControllers = new Dictionary>();
+ public Dictionary GalaxyZones;
private Action _logger;
@@ -23,14 +25,29 @@ public class GameContext
private double _time;
private float _deltaTime;
private GlobalData _globalData;
+ private HashSet _loadedZones = new HashSet();
private HashSet _orbits = new HashSet();
private Dictionary _orbitVelocities = new Dictionary();
private Dictionary _orbitPositions = new Dictionary();
private Dictionary _previousOrbitPositions = new Dictionary();
+ private Guid _forceLoadZone;
public GlobalData GlobalData => _globalData ?? (_globalData = Cache.GetAll().FirstOrDefault());
public DatabaseCache Cache { get; }
+ public Guid ForceLoadZone
+ {
+ get => _forceLoadZone;
+ set
+ {
+ if(_forceLoadZone != Guid.Empty && ZoneEntities[_forceLoadZone].Count == 0)
+ UnloadZone(_forceLoadZone);
+ _forceLoadZone = value;
+ if(!_loadedZones.Contains(_forceLoadZone))
+ LoadZone(_forceLoadZone);
+ }
+ }
+
public double Time
{
get => _time;
@@ -68,24 +85,6 @@ public class GameContext
_logger(s);
}
- public IEnumerable GetEntities(Guid zone)
- {
- return ZoneEntities[zone].Values;
- }
-
- public void InitializeZone(Guid zoneID)
- {
- var zoneData = Cache.Get(zoneID);
-
- foreach (var orbit in zoneData.Orbits) _orbits.Add(orbit);
-
- // TODO: Associate planets with stored entities for planetary colonies
- ZonePlanets[zoneID] = zoneData.Planets;
-
- // TODO: Load stored entities
- ZoneEntities[zoneID] = new Dictionary();
- }
-
public void Update()
{
_previousOrbitPositions = _orbitPositions;
@@ -101,22 +100,33 @@ public class GameContext
foreach (var corporation in Cache.GetAll())
{
- foreach (var taskController in corporation.Tasks
+ foreach (var tasks in corporation.Tasks
.Select(id => Cache.Get(id)) // Fetch the tasks from the database cache
- .Where(task => task.Reserved == false) // Filter out tasks that have already been reserved
- .GroupBy(task => task.Type) // Group tasks by job type
- .Where(grouping =>
- CorporationControllers[corporation.ID] // Filter out groupings with no available controller
- .Any(controller => controller.Available && controller.JobType == grouping.Key))
- .Select(grouping => grouping // Pair each task in remaining groupings with available controllers
- .OrderByDescending(task => task.Priority) // Sort by priority, highest first
- .Zip(CorporationControllers[corporation.ID]
- .Where(controller => controller.Available && controller.JobType == grouping.Key),
- (task, controller) => new {task, controller}))
- .SelectMany(x => x)) // Flatten groupings
+ .Where(task => !task.Reserved) // Filter out tasks that have already been reserved
+ .GroupBy(task => task.Type)) // Group tasks by type
{
- taskController.task.Reserved = true;
- taskController.controller.AssignTask(taskController.task.ID);
+ // Create a list of available controllers for this task type
+ var availableControllers = CorporationControllers[corporation.ID]
+ .Where(controller => controller.TaskType == tasks.Key && controller.Available).ToList();
+
+ // Iterate over the highest priority tasks for which controllers are available
+ foreach (var task in tasks.OrderByDescending(task => task.Priority).Take(availableControllers.Count))
+ {
+ // Find the nearest controller for this task
+ IController nearestController = availableControllers[0];
+ List nearestControllerPath = FindPath(GalaxyZones[availableControllers.First().Zone], GalaxyZones[task.Zone], true);
+ foreach (var controller in availableControllers.Skip(1))
+ {
+ var path = FindPath(GalaxyZones[controller.Zone], GalaxyZones[task.Zone], true);
+ if (path.Count < nearestControllerPath.Count)
+ {
+ nearestControllerPath = path;
+ nearestController = controller;
+ }
+ }
+ task.Reserved = true;
+ nearestController.AssignTask(task.ID, nearestControllerPath);
+ }
}
}
@@ -127,11 +137,57 @@ public class GameContext
}
}
+ public IEnumerable GetEntities(Guid zone)
+ {
+ return ZoneEntities[zone].Values;
+ }
+
+ public void LoadZone(Guid zone)
+ {
+ var zoneData = Cache.Get(zone);
+
+ _loadedZones.Add(zone);
+
+ foreach (var orbit in zoneData.Orbits) _orbits.Add(orbit);
+
+ // TODO: Associate planets with stored entities for planetary colonies
+ ZonePlanets[zone] = zoneData.Planets;
+
+ // TODO: Load stored entities
+ ZoneEntities[zone] = new Dictionary();
+ }
+
public void UnloadZone(Guid zone)
{
var zoneData = Cache.Get(zone);
- foreach (var orbit in zoneData.Orbits) _orbits.Remove(orbit);
+
+ _loadedZones.Remove(zone);
ZoneEntities.Remove(zone);
+ ZonePlanets.Remove(zone);
+ foreach (var orbit in zoneData.Orbits) _orbits.Remove(orbit);
+ }
+
+ public void Warp(Entity entity, Guid targetZone)
+ {
+ if (length(entity.Position - WormholePosition(entity.Zone, targetZone)) < GlobalData.WarpDistance)
+ {
+ var sourceZone = entity.Zone;
+
+ // Remove entity from source zone
+ ZoneEntities[sourceZone].Remove(entity.ID);
+
+ // Unload source zone if empty and unobserved
+ if(ForceLoadZone != sourceZone && ZoneEntities[sourceZone].Count == 0)
+ UnloadZone(sourceZone);
+
+ // Load target zone if not yet loaded
+ if(!_loadedZones.Contains(targetZone))
+ LoadZone(targetZone);
+
+ entity.Zone = targetZone;
+ entity.Position = WormholePosition(targetZone, sourceZone);
+ ZoneEntities[targetZone][entity.ID] = entity;
+ }
}
// Determine orbital position recursively, caching parent positions to avoid repeated calculations
@@ -145,7 +201,7 @@ public class GameContext
{
var orbitData = Cache.Get(orbit);
_orbitPositions[orbit] = GetOrbitPosition(orbitData.Parent) + (orbitData.Period < .01f ? float2.zero :
- OrbitData.Evaluate((float) (Time / -orbitData.Period * GlobalData.OrbitSpeedMultiplier + orbitData.Phase)) *
+ OrbitData.Evaluate((float) frac(Time / -orbitData.Period * GlobalData.OrbitSpeedMultiplier + orbitData.Phase)) *
orbitData.Distance);
}
@@ -162,6 +218,35 @@ public class GameContext
{
return _orbitVelocities.ContainsKey(orbit) ? _orbitVelocities[orbit] : float2.zero;
}
+
+ public OrbitData CreateOrbit(Guid parent, float2 position)
+ {
+ var parentOrbit = Cache.Get(parent);
+ var parentPosition = GetOrbitPosition(parent);
+ var delta = position - parentPosition;
+ var distance = length(delta);
+ var period = OrbitalPeriod(distance);
+ var phase = atan2(delta.y, delta.x) / (PI * 2);
+ var storedPhase = (float) frac(Time / -period * GlobalData.OrbitSpeedMultiplier - phase);
+
+ var orbit = new OrbitData
+ {
+ Context = this,
+ Distance = distance,
+ ID = Guid.NewGuid(),
+ Parent = parent,
+ Period = period,
+ Phase = storedPhase,
+ Zone = parentOrbit.Zone
+ };
+ Cache.Add(orbit);
+ return orbit;
+ }
+
+ public float OrbitalPeriod(float distance)
+ {
+ return pow(distance, GlobalData.OrbitPeriodExponent) * GlobalData.OrbitPeriodMultiplier;
+ }
// public int ItemTier(CraftedItemData itemData)
// {
@@ -389,4 +474,37 @@ public class GameContext
Cache.Add(newCommodity);
return newCommodity;
}
+
+ class DijkstraNode
+ {
+ public float Cost;
+ public DijkstraNode Parent;
+ public SimplifiedZoneData Zone;
+ }
+
+ public List FindPath(SimplifiedZoneData source, SimplifiedZoneData target, bool bestFirst = false)
+ {
+ SortedList members = new SortedList{{0,new DijkstraNode{Zone = source}}};
+ List searched = new List();
+ while (true)
+ {
+ var s = members.FirstOrDefault(m => !searched.Contains(m.Value)).Value; // Lowest cost unsearched node
+ if (s == null) return null; // No vertices left unsearched
+ if (s.Zone == target) // We found the path
+ {
+ Stack path = new Stack(); // Since we start at the end, use a LIFO collection
+ path.Push(s);
+ while(path.Peek().Parent!=null) // Keep pushing until we reach the start, which has no parent
+ path.Push(path.Peek().Parent);
+ return path.Select(dv => dv.Zone).ToList();
+ }
+ // For each adjacent star (filter already visited zones unless heuristic is in use)
+ foreach (var dijkstraStar in s.Zone.Links.WhereSelectF(i => !bestFirst || members.All(m => m.Value.Zone != GalaxyZones[i]),
+ // Cost is parent cost plus distance
+ i => new DijkstraNode {Parent = s, Zone = GalaxyZones[i], Cost = s.Cost + length(s.Zone.Position - GalaxyZones[i].Position)}))
+ // Add new member to list, sorted by cost plus optional heuristic
+ members.Add(bestFirst ? dijkstraStar.Cost + length(dijkstraStar.Zone.Position - target.Position) : dijkstraStar.Cost, dijkstraStar);
+ searched.Add(s);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/Scripts/ServerShared/Messages.cs b/Assets/Scripts/ServerShared/Messages.cs
index 247eb420c..d5f29dd7f 100644
--- a/Assets/Scripts/ServerShared/Messages.cs
+++ b/Assets/Scripts/ServerShared/Messages.cs
@@ -94,13 +94,13 @@ public class GalaxyRequestMessage : Message
[MessagePackObject]
public class GalaxyResponseMessage : Message
{
- [Key(0)] public GalaxyResponseZone[] Zones;
+ [Key(0)] public SimplifiedZoneData[] Zones;
[Key(1)] public GalaxyMapLayerData StarDensity;
[Key(2)] public GlobalData GlobalData;
}
[MessagePackObject]
-public class GalaxyResponseZone
+public class SimplifiedZoneData
{
[Key(0)] public Guid ZoneID;
[Key(1)] public Guid[] Links;
diff --git a/Assets/Scripts/NIH/LinqFaster.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster.meta
similarity index 77%
rename from Assets/Scripts/NIH/LinqFaster.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster.meta
index b40a18050..4ed731785 100644
--- a/Assets/Scripts/NIH/LinqFaster.meta
+++ b/Assets/Scripts/ServerShared/NIH/LinqFaster.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: f577b52edee2c39429e13166dc0fddc2
+guid: 8a827381b8571114091cd0fc9c0ebd1f
folderAsset: yes
DefaultImporter:
externalObjects: {}
diff --git a/Assets/Scripts/NIH/LinqFaster/Aggregate.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Aggregate.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Aggregate.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Aggregate.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Aggregate.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Aggregate.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Aggregate.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Aggregate.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/AnyAll.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/AnyAll.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/AnyAll.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/AnyAll.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/AnyAll.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/AnyAll.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/AnyAll.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/AnyAll.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Average.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Average.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Average.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Average.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Average.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Average.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Average.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Average.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Contains.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Contains.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Contains.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Contains.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Contains.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Contains.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Contains.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Contains.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Count.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Count.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Count.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Count.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Count.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Count.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Count.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Count.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Distinct.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Distinct.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Distinct.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Distinct.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Distinct.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Distinct.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Distinct.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Distinct.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/First.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/First.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/First.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/First.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/First.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/First.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/First.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/First.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Last.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Last.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Last.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Last.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Last.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Last.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Last.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Last.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Max.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Max.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Max.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Max.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Max.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Max.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Max.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Max.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Min.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Min.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Min.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Min.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Min.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Min.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Min.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Min.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/OrderBy.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/OrderBy.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/OrderBy.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/OrderBy.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/OrderBy.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/OrderBy.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/OrderBy.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/OrderBy.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Range.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Range.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Range.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Range.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Range.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Range.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Range.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Range.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Repeat.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Repeat.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Repeat.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Repeat.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Repeat.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Repeat.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Repeat.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Repeat.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Reverse.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Reverse.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Reverse.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Reverse.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Reverse.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Reverse.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Reverse.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Reverse.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Select.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Select.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Select.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Select.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Select.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Select.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Select.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Select.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/SelectMany.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/SelectMany.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/SelectMany.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/SelectMany.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/SelectMany.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/SelectMany.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/SelectMany.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/SelectMany.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/SelectWhere.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/SelectWhere.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/SelectWhere.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/SelectWhere.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/SelectWhere.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/SelectWhere.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/SelectWhere.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/SelectWhere.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/SequenceEqual.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/SequenceEqual.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/SequenceEqual.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/SequenceEqual.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/SequenceEqual.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/SequenceEqual.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/SequenceEqual.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/SequenceEqual.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Single.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Single.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Single.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Single.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Single.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Single.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Single.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Single.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Skip.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Skip.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Skip.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Skip.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Skip.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Skip.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Skip.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Skip.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Sum.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Sum.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Sum.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Sum.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Sum.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Sum.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Sum.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Sum.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Take.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Take.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Take.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Take.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Take.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Take.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Take.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Take.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/ComparerMagic.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/ComparerMagic.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/ComparerMagic.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/ComparerMagic.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/ComparerMagic.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/ComparerMagic.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/ComparerMagic.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/ComparerMagic.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/CustomPartition.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/CustomPartition.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/CustomPartition.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/CustomPartition.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/CustomPartition.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/CustomPartition.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/CustomPartition.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/CustomPartition.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/Error.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/Error.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/Error.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/Error.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/Error.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/Error.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/Error.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/Error.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/GenericOperators.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/GenericOperators.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/GenericOperators.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/GenericOperators.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Utils/GenericOperators.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/GenericOperators.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Utils/GenericOperators.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Utils/GenericOperators.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Where.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Where.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Where.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Where.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Where.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Where.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Where.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Where.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/WhereAggregate.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/WhereAggregate.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/WhereAggregate.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/WhereAggregate.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/WhereAggregate.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/WhereAggregate.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/WhereAggregate.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/WhereAggregate.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/WhereSelect.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSelect.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/WhereSelect.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSelect.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/WhereSelect.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSelect.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/WhereSelect.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSelect.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/WhereSum.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSum.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/WhereSum.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSum.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/WhereSum.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSum.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/WhereSum.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/WhereSum.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/Zip.cs b/Assets/Scripts/ServerShared/NIH/LinqFaster/Zip.cs
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Zip.cs
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Zip.cs
diff --git a/Assets/Scripts/NIH/LinqFaster/Zip.cs.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/Zip.cs.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/Zip.cs.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/Zip.cs.meta
diff --git a/Assets/Scripts/NIH/LinqFaster/readme.txt b/Assets/Scripts/ServerShared/NIH/LinqFaster/readme.txt
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/readme.txt
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/readme.txt
diff --git a/Assets/Scripts/NIH/LinqFaster/readme.txt.meta b/Assets/Scripts/ServerShared/NIH/LinqFaster/readme.txt.meta
similarity index 100%
rename from Assets/Scripts/NIH/LinqFaster/readme.txt.meta
rename to Assets/Scripts/ServerShared/NIH/LinqFaster/readme.txt.meta
diff --git a/Assets/Scripts/ServerShared/OrbitalEntity.cs b/Assets/Scripts/ServerShared/OrbitalEntity.cs
index 8e895c7a3..f4f9b41ae 100644
--- a/Assets/Scripts/ServerShared/OrbitalEntity.cs
+++ b/Assets/Scripts/ServerShared/OrbitalEntity.cs
@@ -7,18 +7,21 @@ using float2 = Unity.Mathematics.float2;
public class OrbitalEntity : Entity
{
- private Guid _orbitData;
+ public Guid OrbitData;
public OrbitalEntity(GameContext context, Guid hull, IEnumerable items, IEnumerable cargo, Guid orbit, Guid zone) : base(context, hull, items, cargo, zone)
{
- _orbitData = orbit;
+ OrbitData = orbit;
}
public override void Update(float delta)
{
- var newPosition = Context.GetOrbitPosition(_orbitData);
- Velocity = (newPosition - Position) / delta;
- Position = newPosition;
+ if (OrbitData != Guid.Empty)
+ {
+ Velocity = Context.GetOrbitVelocity(OrbitData);
+ Position = Context.GetOrbitPosition(OrbitData);
+ }
+
base.Update(delta);
}
}
diff --git a/Assets/Scripts/ServerShared/ZoneData.cs b/Assets/Scripts/ServerShared/ZoneData.cs
index 9af7fdac2..da117345b 100644
--- a/Assets/Scripts/ServerShared/ZoneData.cs
+++ b/Assets/Scripts/ServerShared/ZoneData.cs
@@ -123,7 +123,7 @@ public class OrbitData : DatabaseEntry
public static float2 Evaluate(float phase)
{
- phase *= (PI * 2);
+ phase *= PI * 2;
return new float2(sin(phase), cos(phase));
}
}
\ No newline at end of file
diff --git a/Assets/Scripts/ServerShared/ZoneGenerator.cs b/Assets/Scripts/ServerShared/ZoneGenerator.cs
index ea19a16e6..ef27fb07e 100644
--- a/Assets/Scripts/ServerShared/ZoneGenerator.cs
+++ b/Assets/Scripts/ServerShared/ZoneGenerator.cs
@@ -274,7 +274,7 @@ public class Planet
ChildDistanceMaximum = (i % 2 == 0 ? p0ChildDist : p1ChildDist)
};
child.ChildDistanceMinimum = Context.GlobalData.PlanetRadius(child.Mass) * 2;
- child.Period = pow(child.Distance, Context.GlobalData.OrbitPeriodExponent) * Context.GlobalData.OrbitPeriodMultiplier;
+ child.Period = Context.OrbitalPeriod(child.Distance);
Children.Add(child);
}
@@ -335,7 +335,7 @@ public class Planet
Distance = distances[i],
Phase = Context.Random.NextFloat()
};
- child.Period = pow(child.Distance, Context.GlobalData.OrbitPeriodExponent) * Context.GlobalData.OrbitPeriodMultiplier;
+ child.Period = Context.OrbitalPeriod(child.Distance);
child.ChildDistanceMinimum = Context.GlobalData.PlanetRadius(child.Mass) * 2;
// Maximum child distance of child is the smallest distance to either of its neighbors
child.ChildDistanceMaximum = min(i == 0 ? child.Distance - ChildDistanceMinimum : child.Distance - distances[i - 1],
diff --git a/Assets/Scripts/StrategyGameManager.cs b/Assets/Scripts/StrategyGameManager.cs
index d8ca28d76..341f76e5d 100644
--- a/Assets/Scripts/StrategyGameManager.cs
+++ b/Assets/Scripts/StrategyGameManager.cs
@@ -8,6 +8,7 @@ using RethinkDb.Driver.Net;
using TMPro;
using UnityEngine;
using Unity.Mathematics;
+using UnityEngine.EventSystems;
using static Unity.Mathematics.math;
using float2 = Unity.Mathematics.float2;
using Random = UnityEngine.Random;
@@ -25,6 +26,7 @@ public class StrategyGameManager : MonoBehaviour
public MeshRenderer ZoneBoundary;
public ClickRaycaster ClickRaycaster;
public ReadOnlyPropertiesPanel PropertiesPanel;
+ public ContextMenu ContextMenu;
[Section("Tab Links")]
public TabGroup PrimaryTabGroup;
@@ -65,7 +67,6 @@ public class StrategyGameManager : MonoBehaviour
private Guid _populatedZone;
private Guid _selectedZone;
private GalaxyZone _selectedGalaxyZone;
- private Dictionary _galaxyResponseZones;
private Dictionary _galaxyZoneObjects = new Dictionary();
private Dictionary _zoneObjects = new Dictionary(); // Key is Orbit
private Dictionary _zoneBelts = new Dictionary();
@@ -90,8 +91,8 @@ public class StrategyGameManager : MonoBehaviour
_context = new GameContext(_cache, Debug.Log);
TechTree.Context = _context;
_context.MapLayers = _cache.GetAll().ToDictionary(ml => ml.Name);
- _galaxyResponseZones = _cache.GetAll()
- .ToDictionary(z => z.ID, z => new GalaxyResponseZone
+ _context.GalaxyZones = _cache.GetAll()
+ .ToDictionary(z => z.ID, z => new SimplifiedZoneData
{
Links = z.Wormholes.ToArray(),
Name = z.Name,
@@ -110,7 +111,7 @@ public class StrategyGameManager : MonoBehaviour
// Listen for the server's galaxy description
CultClient.AddMessageListener(galaxy =>
{
- _galaxyResponseZones = galaxy.Zones.ToDictionary(z => z.ZoneID);
+ _context.GalaxyZones = galaxy.Zones.ToDictionary(z => z.ZoneID);
_cache.Add(galaxy.GlobalData, true);
_context = new GameContext(_cache, Debug.Log);
TechTree.Context = _context;
@@ -178,6 +179,7 @@ public class StrategyGameManager : MonoBehaviour
ClickRaycaster.OnClickMiss += () =>
{
+ ContextMenu.gameObject.SetActive(false);
if (_currentTab == GalaxyTabButton) PopulateGalaxyProperties();
else if (_currentTab == ZoneTabButton) PopulateZoneProperties(_populatedZone);
else if (_currentTab == TechTabButton) PopulateTechProperties();
@@ -189,7 +191,7 @@ public class StrategyGameManager : MonoBehaviour
PropertiesPanel.Clear();
PropertiesPanel.Title.text = _context.GlobalData.GalaxyName;
PropertiesPanel.AddSection("Galaxy");
- PropertiesPanel.AddProperty("Sectors", $"{_galaxyResponseZones.Count}");
+ PropertiesPanel.AddProperty("Sectors", $"{_context.GalaxyZones.Count}");
}
private void PopulateZoneProperties(Guid zone)
@@ -281,7 +283,7 @@ public class StrategyGameManager : MonoBehaviour
// var zones = _galaxyResponse.Zones.ToDictionary(z=>z.ZoneID);
var linkedZones = new List();
- foreach (var zone in _galaxyResponseZones.Values)
+ foreach (var zone in _context.GalaxyZones.Values)
{
linkedZones.Add(zone.ZoneID);
var instance = GalaxyZonePrototype.Instantiate();
@@ -314,7 +316,7 @@ public class StrategyGameManager : MonoBehaviour
foreach (var linkedZone in zone.Links.Where(l=>!linkedZones.Contains(l)))
{
var link = GalaxyZoneLinkPrototype.Instantiate();
- var diff = _galaxyResponseZones[linkedZone].Position - zone.Position;
+ var diff = _context.GalaxyZones[linkedZone].Position - zone.Position;
link.position = instance.position + Vector3.forward*.1f;
link.rotation = Quaternion.Euler(0,0,atan2(diff.y, diff.x) * Mathf.Rad2Deg);
link.localScale = new Vector3(length(diff) * GalaxyScale, 1, 1);
@@ -356,9 +358,6 @@ public class StrategyGameManager : MonoBehaviour
_zoneBelts.Clear();
foreach (var ship in _zoneShips.Values) Destroy(ship.gameObject);
_zoneShips.Clear();
-
- if(_populatedZone!=Guid.Empty)
- _context.UnloadZone(_populatedZone);
_populatedZone = _selectedZone;
@@ -368,8 +367,8 @@ public class StrategyGameManager : MonoBehaviour
{
GenerateZone(_populatedZone);
}
-
- _context.InitializeZone(_populatedZone);
+
+ _context.ForceLoadZone = _populatedZone;
float zoneDepth = 0;
@@ -396,18 +395,29 @@ public class StrategyGameManager : MonoBehaviour
PlanetoidSprite);
planetObject.Icon.GetComponent().OnClick += (collider, data) =>
{
- PropertiesPanel.Clear();
- PropertiesPanel.Title.text = planetData.Name;
- PropertiesPanel.AddSection(planetData.Mass > _context.GlobalData.SunMass ? "Star" :
- planetData.Mass > _context.GlobalData.GasGiantMass ? "Gas Giant" :
- planetData.Mass > _context.GlobalData.PlanetMass ? "Planet" :
- "Planetoid");
- PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
- PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
+ if (data.button == PointerEventData.InputButton.Left)
{
- var itemData = _context.Cache.Get(resource.Key);
- return new Tuple(itemData.Name, $"{resource.Value:0}");
- }));
+ PropertiesPanel.Clear();
+ PropertiesPanel.Title.text = planetData.Name;
+ PropertiesPanel.AddSection(planetData.Mass > _context.GlobalData.SunMass ? "Star" :
+ planetData.Mass > _context.GlobalData.GasGiantMass ? "Gas Giant" :
+ planetData.Mass > _context.GlobalData.PlanetMass ? "Planet" :
+ "Planetoid");
+ PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
+ PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
+ {
+ var itemData = _context.Cache.Get(resource.Key);
+ return new Tuple(itemData.Name, $"{resource.Value:0}");
+ }));
+ }
+ else if (data.button == PointerEventData.InputButton.Right)
+ {
+ ContextMenu.gameObject.SetActive(true);
+ ContextMenu.SetOptions(new []
+ {
+ ("Test Option", (Action) (() => Debug.Log("Test Option Selected")))
+ });
+ }
};
}
else
@@ -418,15 +428,22 @@ public class StrategyGameManager : MonoBehaviour
_zoneBelts[_cache.Get(planetData.Orbit).Parent] = belt;
beltObject.GetComponent().OnClick += (_, data) =>
{
- PropertiesPanel.Clear();
- PropertiesPanel.Title.text = planetData.Name;
- PropertiesPanel.AddSection("Asteroid Belt");
- PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
- PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
+ if (data.button == PointerEventData.InputButton.Left)
{
- var itemData = _context.Cache.Get(resource.Key);
- return new Tuple(itemData.Name, $"{resource.Value:0}");
- }));
+ PropertiesPanel.Clear();
+ PropertiesPanel.Title.text = planetData.Name;
+ PropertiesPanel.AddSection("Asteroid Belt");
+ PropertiesPanel.AddProperty("Mass", $"{planetData.Mass}");
+ PropertiesPanel.AddList("Resources", planetData.Resources.Select(resource =>
+ {
+ var itemData = _context.Cache.Get(resource.Key);
+ return new Tuple(itemData.Name, $"{resource.Value:0}");
+ }));
+ }
+ else if (data.button == PointerEventData.InputButton.Right)
+ {
+
+ }
};
}
}
@@ -438,7 +455,7 @@ public class StrategyGameManager : MonoBehaviour
foreach (var wormhole in zoneData.Wormholes)
{
- var otherZone = _galaxyResponseZones[wormhole];
+ var otherZone = _context.GalaxyZones[wormhole];
var wormholeObject = Instantiate(ZoneObjectPrefab, ZoneRoot);
_wormholes.Add(wormholeObject);
wormholeObject.transform.position = (Vector2) (_context.WormholePosition(zoneData.ID, wormhole) * ZoneSizeScale);
@@ -548,7 +565,7 @@ public class StrategyGameManager : MonoBehaviour
if(_populatedZone!=Guid.Empty)
_context.UnloadZone(_populatedZone);
_cache.Delete(zoneData);
- _galaxyResponseZones.Remove(zoneData.ID);
+ _context.GalaxyZones.Remove(zoneData.ID);
var newZone = zoneData.Copy();
newZone.ID = Guid.NewGuid();
@@ -563,7 +580,7 @@ public class StrategyGameManager : MonoBehaviour
}
newZone.Wormholes = linkedZones.Select(z => z.ID).ToList();
- var zone = _galaxyResponseZones[newZone.ID] = new GalaxyResponseZone
+ var zone = _context.GalaxyZones[newZone.ID] = new SimplifiedZoneData
{
Links = newZone.Wormholes.ToArray(),
Name = newZone.Name,
@@ -675,8 +692,8 @@ public class AsteroidBelt
{
var rotation = Quaternion.Euler(0, 0, (float) (_context.Time * _data.Asteroids[i].w % 360.0));
var position = (Vector3) (Vector2)
- OrbitData.Evaluate((float) (_context.Time / -pow(_data.Asteroids[i].x, _context.GlobalData.OrbitPeriodExponent) * _context.GlobalData.OrbitPeriodMultiplier) *
- _context.GlobalData.OrbitSpeedMultiplier + _data.Asteroids[i].y) * (_data.Asteroids[i].x * _zoneScale);
+ OrbitData.Evaluate((float) frac(_context.Time / -_context.OrbitalPeriod(_data.Asteroids[i].x) *
+ _context.GlobalData.OrbitSpeedMultiplier + _data.Asteroids[i].y)) * (_data.Asteroids[i].x * _zoneScale);
_vertices[i * 4] = rotation * new Vector3(-_data.Asteroids[i].z,-_data.Asteroids[i].z,0) + position;
_vertices[i * 4 + 1] = rotation * new Vector3(-_data.Asteroids[i].z,_data.Asteroids[i].z,0) + position;
_vertices[i * 4 + 2] = rotation * new Vector3(_data.Asteroids[i].z,_data.Asteroids[i].z,0) + position;
diff --git a/Assets/Scripts/UI/ContextMenu.cs b/Assets/Scripts/UI/ContextMenu.cs
new file mode 100644
index 000000000..e623d3de3
--- /dev/null
+++ b/Assets/Scripts/UI/ContextMenu.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using TMPro;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class ContextMenu : MonoBehaviour
+{
+ public Canvas Canvas;
+ public RectTransform OptionPrefab;
+
+ public RectTransform ContentRoot;
+
+ public float OptionHeight;
+ public float PaddingHeight;
+
+ private List _options = new List();
+
+ public void SetOptions(IEnumerable<(string text, Action action)> options)
+ {
+ var rect = transform as RectTransform;
+ var pivot = rect.pivot;
+ pivot.x = Input.mousePosition.x > Screen.width - rect.sizeDelta.x * Canvas.scaleFactor ? 1 : 0;
+ pivot.y = Input.mousePosition.y < (PaddingHeight + options.Count() * OptionHeight) * Canvas.scaleFactor ? 0 : 1;
+ rect.pivot = pivot;
+ rect.position = Input.mousePosition;
+
+ // Destroy previous options
+ foreach(var option in _options)
+ Destroy(option);
+ _options.Clear();
+
+ foreach (var option in options)
+ {
+ var optionButton = Instantiate(OptionPrefab, ContentRoot);
+ optionButton.GetComponentInChildren().text = option.text;
+ optionButton.GetComponent