Trade Menu
Implemented Trade Menu Item Filtering by size, hardpoint, behavior Buying from trade menu on double click
This commit is contained in:
parent
8036585ebc
commit
f4ee26e96c
22 changed files with 631 additions and 73 deletions
|
|
@ -66,6 +66,7 @@
|
|||
</e>
|
||||
</e>
|
||||
<e p="HoverCursorChange.cs" t="Include" />
|
||||
<e p="ItemFilter.cs" t="Include" />
|
||||
<e p="Plugins" t="Include">
|
||||
<e p="AsyncAwaitUtil" t="Include">
|
||||
<e p="Source" t="Include">
|
||||
|
|
|
|||
|
|
@ -718,6 +718,7 @@
|
|||
<Compile Include="Assets\Scripts\SpreadsheetColumnHeader.cs" />
|
||||
<Compile Include="Assets\Scripts\SpreadsheetRow.cs" />
|
||||
<Compile Include="Assets\HoverCursorChange.cs" />
|
||||
<Compile Include="Assets\ItemFilter.cs" />
|
||||
<None Include="Assets\com.unity.uiextensions\Runtime\Resources\Shaders\UIAdditive.shader" />
|
||||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro.cginc" />
|
||||
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF-Mobile Overlay.shader" />
|
||||
|
|
|
|||
24
Assets/ItemFilter.cs
Normal file
24
Assets/ItemFilter.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ItemFilter : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI Label;
|
||||
public Button DisableButton;
|
||||
|
||||
public event Action OnDisable;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
DisableButton.onClick.AddListener(() =>
|
||||
{
|
||||
GetComponent<Prototype>().ReturnToPool();
|
||||
OnDisable?.Invoke();
|
||||
OnDisable = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
11
Assets/ItemFilter.cs.meta
Normal file
11
Assets/ItemFilter.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 84b08c807fa72e340b5b57841640ec13
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -86,7 +86,7 @@ Material:
|
|||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _Scale: 0.5
|
||||
- _Scale: 3.2540116
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2147126713262799487}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
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:
|
||||
|
|
@ -95,6 +95,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
|
|
@ -138,7 +139,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: 32
|
||||
m_MinHeight: 16
|
||||
m_PreferredWidth: -1
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
|
|
@ -266,8 +267,8 @@ MonoBehaviour:
|
|||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 16
|
||||
m_fontSizeBase: 16
|
||||
m_fontSize: 9
|
||||
m_fontSizeBase: 9
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 0
|
||||
m_fontSizeMin: 12
|
||||
|
|
@ -362,8 +363,8 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 0.5}
|
||||
m_AnchorMax: {x: 1, y: 0.5}
|
||||
m_AnchoredPosition: {x: -2, y: 0}
|
||||
m_SizeDelta: {x: 16, y: 16}
|
||||
m_AnchoredPosition: {x: -4, y: 0}
|
||||
m_SizeDelta: {x: 10, y: 16}
|
||||
m_Pivot: {x: 1, y: 0.5}
|
||||
--- !u!222 &1986380382041583511
|
||||
CanvasRenderer:
|
||||
|
|
@ -395,7 +396,7 @@ MonoBehaviour:
|
|||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: ef87bbaa6e6f6824fa1b758cc93393d5, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
|
|
|
|||
|
|
@ -102,8 +102,8 @@ MonoBehaviour:
|
|||
ForceDirectionRight: 0
|
||||
ForcePosition: {x: 0, y: 0, z: 0}
|
||||
ContentRoot: {fileID: 3452408986885472817}
|
||||
OptionHeight: 34
|
||||
PaddingHeight: 16
|
||||
OptionHeight: 17
|
||||
PaddingHeight: 10
|
||||
--- !u!1 &3452408986885472816
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
|||
|
|
@ -1160,6 +1160,141 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 121030072}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &125165634
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 125165635}
|
||||
- component: {fileID: 125165637}
|
||||
- component: {fileID: 125165636}
|
||||
m_Layer: 5
|
||||
m_Name: Target
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &125165635
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 125165634}
|
||||
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: 1914914798}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 1, y: 1}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -8, y: -8}
|
||||
m_SizeDelta: {x: 160, y: 24}
|
||||
m_Pivot: {x: 1, y: 1}
|
||||
--- !u!114 &125165636
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 125165634}
|
||||
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_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: Docking Bay
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 53555f7a2d5e745428813f1b1118734f, type: 2}
|
||||
m_sharedMaterial: {fileID: -2804126062856497447, guid: 53555f7a2d5e745428813f1b1118734f,
|
||||
type: 2}
|
||||
m_fontSharedMaterials: []
|
||||
m_fontMaterial: {fileID: 0}
|
||||
m_fontMaterials: []
|
||||
m_fontColor32:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_enableVertexGradient: 0
|
||||
m_colorMode: 3
|
||||
m_fontColorGradient:
|
||||
topLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
topRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
|
||||
bottomRight: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_fontColorGradientPreset: {fileID: 0}
|
||||
m_spriteAsset: {fileID: 0}
|
||||
m_tintAllSprites: 0
|
||||
m_StyleSheet: {fileID: 0}
|
||||
m_TextStyleHashCode: -1183493901
|
||||
m_overrideHtmlColors: 0
|
||||
m_faceColor:
|
||||
serializedVersion: 2
|
||||
rgba: 4294967295
|
||||
m_fontSize: 21.4
|
||||
m_fontSizeBase: 24
|
||||
m_fontWeight: 400
|
||||
m_enableAutoSizing: 1
|
||||
m_fontSizeMin: 18
|
||||
m_fontSizeMax: 72
|
||||
m_fontStyle: 0
|
||||
m_HorizontalAlignment: 1
|
||||
m_VerticalAlignment: 512
|
||||
m_textAlignment: 65535
|
||||
m_characterSpacing: 0
|
||||
m_wordSpacing: 0
|
||||
m_lineSpacing: 0
|
||||
m_lineSpacingMax: 0
|
||||
m_paragraphSpacing: 0
|
||||
m_charWidthMaxAdj: 0
|
||||
m_enableWordWrapping: 1
|
||||
m_wordWrappingRatios: 0.4
|
||||
m_overflowMode: 0
|
||||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
m_parseCtrlCharacters: 1
|
||||
m_isOrthographic: 1
|
||||
m_isCullingEnabled: 0
|
||||
m_horizontalMapping: 0
|
||||
m_verticalMapping: 0
|
||||
m_uvLineOffset: 0
|
||||
m_geometrySortingOrder: 0
|
||||
m_IsTextObjectScaleStatic: 0
|
||||
m_VertexBufferAutoSizeReduction: 1
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!222 &125165637
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 125165634}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &125191966
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -2866,7 +3001,7 @@ RectTransform:
|
|||
- {fileID: 831892784}
|
||||
- {fileID: 461264098}
|
||||
m_Father: {fileID: 1914914798}
|
||||
m_RootOrder: 2
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
|
|
@ -2910,7 +3045,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &236872710
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -5264,6 +5399,162 @@ MonoBehaviour:
|
|||
CellHitPulseTime: 0.5
|
||||
CellBackgroundColor: {r: 0, g: 0, b: 0, a: 0.75}
|
||||
EmptyCells: []
|
||||
--- !u!1 &425104907
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 425104908}
|
||||
- component: {fileID: 425104913}
|
||||
- component: {fileID: 425104912}
|
||||
- component: {fileID: 425104911}
|
||||
- component: {fileID: 425104910}
|
||||
- component: {fileID: 425104909}
|
||||
m_Layer: 5
|
||||
m_Name: Foldout
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &425104908
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425104907}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0.7071068, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1914914798}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90}
|
||||
m_AnchorMin: {x: 0, y: 1}
|
||||
m_AnchorMax: {x: 0, y: 1}
|
||||
m_AnchoredPosition: {x: 640, y: -20}
|
||||
m_SizeDelta: {x: 16, y: 16}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &425104909
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425104907}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_WrapAround: 0
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 425104912}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &425104910
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425104907}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: 16
|
||||
m_PreferredHeight: -1
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &425104911
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425104907}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 86710e43de46f6f4bac7c8e50813a599, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_AspectMode: 1
|
||||
m_AspectRatio: 1
|
||||
--- !u!114 &425104912
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425104907}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: ef87bbaa6e6f6824fa1b758cc93393d5, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!222 &425104913
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 425104907}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &425375562
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -6631,13 +6922,15 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
GameManager: {fileID: 1009503729}
|
||||
Dropdown: {fileID: 178733681}
|
||||
ContextMenu: {fileID: 1157981993}
|
||||
NewFilterButton: {fileID: 114477922027825946}
|
||||
FilterPrototype: {fileID: 2505679758530842354}
|
||||
MinimumSizeFilter: {fileID: 1714353021}
|
||||
MaximumSizeFilter: {fileID: 236872711}
|
||||
ItemList: {fileID: 256526622}
|
||||
Properties: {fileID: 655315361}
|
||||
Spreadsheet: {fileID: 234374935}
|
||||
TargetCargoLabel: {fileID: 125165636}
|
||||
FoldoutButton: {fileID: 425104909}
|
||||
--- !u!222 &522642870
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -8417,7 +8710,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -4, y: 0}
|
||||
m_SizeDelta: {x: 126.48, y: -8}
|
||||
m_SizeDelta: {x: 32, y: -8}
|
||||
m_Pivot: {x: 1, y: 0.5}
|
||||
--- !u!114 &719842152
|
||||
MonoBehaviour:
|
||||
|
|
@ -9343,7 +9636,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -4, y: 0}
|
||||
m_SizeDelta: {x: 126.48, y: -8}
|
||||
m_SizeDelta: {x: 32, y: -8}
|
||||
m_Pivot: {x: 1, y: 0.5}
|
||||
--- !u!114 &783543866
|
||||
MonoBehaviour:
|
||||
|
|
@ -13430,8 +13723,8 @@ MonoBehaviour:
|
|||
ForceDirectionRight: 0
|
||||
ForcePosition: {x: 0, y: 0, z: 0}
|
||||
ContentRoot: {fileID: 1741914910}
|
||||
OptionHeight: 34
|
||||
PaddingHeight: 16
|
||||
OptionHeight: 17
|
||||
PaddingHeight: 10
|
||||
--- !u!114 &1157981994
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -14782,7 +15075,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 1, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: -4, y: 0}
|
||||
m_SizeDelta: {x: 126.48, y: -8}
|
||||
m_SizeDelta: {x: 32, y: -8}
|
||||
m_Pivot: {x: 1, y: 0.5}
|
||||
--- !u!114 &1355213458
|
||||
MonoBehaviour:
|
||||
|
|
@ -18618,7 +18911,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!224 &1714353020
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -20557,6 +20850,8 @@ RectTransform:
|
|||
m_Children:
|
||||
- {fileID: 479699686}
|
||||
- {fileID: 1010025669}
|
||||
- {fileID: 425104908}
|
||||
- {fileID: 125165635}
|
||||
- {fileID: 234374934}
|
||||
m_Father: {fileID: 522642868}
|
||||
m_RootOrder: 1
|
||||
|
|
@ -25760,6 +26055,8 @@ GameObject:
|
|||
- component: {fileID: 7608517819157717889}
|
||||
- component: {fileID: 1114036057222416212}
|
||||
- component: {fileID: 2505679758530842352}
|
||||
- component: {fileID: 2505679758530842354}
|
||||
- component: {fileID: 2505679758530842353}
|
||||
m_Layer: 5
|
||||
m_Name: Type Filter
|
||||
m_TagString: Untagged
|
||||
|
|
@ -25787,6 +26084,32 @@ MonoBehaviour:
|
|||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!114 &2505679758530842353
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2505679758530842351}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 84b08c807fa72e340b5b57841640ec13, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Label: {fileID: 2505679758219563907}
|
||||
DisableButton: {fileID: 783543866}
|
||||
--- !u!114 &2505679758530842354
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2505679758530842351}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1281fe44325f9b548aa42dc331b17266, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!224 &2851244030680155772
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -26208,7 +26531,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 4, y: 0}
|
||||
m_SizeDelta: {x: -8, y: -449}
|
||||
m_SizeDelta: {x: -8, y: -517}
|
||||
m_Pivot: {x: 0, y: 1}
|
||||
--- !u!1 &3255828831356619721
|
||||
GameObject:
|
||||
|
|
|
|||
|
|
@ -51,12 +51,14 @@ public class ActionGameManager : MonoBehaviour
|
|||
private AetheriaInput _input;
|
||||
private int _zoomLevelIndex;
|
||||
private Ship _currentShip;
|
||||
|
||||
// private ShipInput _shipInput;
|
||||
private float2 _shipYawPitch;
|
||||
private float3 _viewDirection;
|
||||
private (HardpointData[] hardpoints, Transform[] barrels, PlaceUIElementWorldspace crosshair)[] ArticulationGroups;
|
||||
private (TargetLock targetLock, PlaceUIElementWorldspace indicator, Rotate spin)[] LockingIndicators;
|
||||
public List<Ship> PlayerShips { get; } = new List<Ship>();
|
||||
public EquippedDockingBay DockingBay { get; private set; }
|
||||
|
||||
public Ship CurrentShip
|
||||
{
|
||||
|
|
@ -531,6 +533,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
var bay = entity.TryDock(_currentShip);
|
||||
if (bay != null)
|
||||
{
|
||||
DockingBay = bay;
|
||||
DockCamera.enabled = true;
|
||||
FollowCamera.enabled = false;
|
||||
_currentShip.Active = false;
|
||||
|
|
@ -576,6 +579,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
else if (_currentShip.Parent.TryUndock(_currentShip))
|
||||
{
|
||||
Menu.gameObject.SetActive(false);
|
||||
DockingBay = null;
|
||||
_currentShip.Active = true;
|
||||
//_shipInput = new ShipInput(_input.Player, _currentShip);
|
||||
DockCamera.enabled = false;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ public class GuidedProjectileManager : MonoBehaviour
|
|||
p.LiftCurve = data.LiftCurve.ToCurve();
|
||||
p.ThrustCurve = data.ThrustCurve.ToCurve();
|
||||
p.Thrust = source.Entity.ItemManager.Evaluate(data.Thrust, item.EquippableItem, source.Entity);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(data.MissileSpeed, item.EquippableItem, source.Entity);
|
||||
p.TopSpeed = source.Entity.ItemManager.Evaluate(data.Velocity, item.EquippableItem, source.Entity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using Newtonsoft.Json;
|
|||
public class EnergyDrawData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("draw"), Key(1), RuntimeInspectable]
|
||||
public PerformanceStat Draw = new PerformanceStat();
|
||||
public PerformanceStat EnergyDraw = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("perSecond"), Key(2)]
|
||||
public bool PerSecond;
|
||||
|
|
@ -42,7 +42,7 @@ public class EnergyDraw : IBehavior
|
|||
|
||||
public bool Execute(float delta)
|
||||
{
|
||||
Entity.Energy -= Context.Evaluate(_data.Draw, Item.EquippableItem, Entity) * (_data.PerSecond ? delta : 1);
|
||||
Entity.Energy -= Context.Evaluate(_data.EnergyDraw, Item.EquippableItem, Entity) * (_data.PerSecond ? delta : 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -27,8 +27,8 @@ public class LauncherData : InstantWeaponData
|
|||
[InspectableField, JsonProperty("launchSpeed"), Key(14)]
|
||||
public PerformanceStat LaunchSpeed = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("missileSpeed"), Key(15)]
|
||||
public PerformanceStat MissileSpeed = new PerformanceStat();
|
||||
[InspectableField, JsonProperty("missileSpeed"), Key(15), RuntimeInspectable]
|
||||
public PerformanceStat Velocity = new PerformanceStat();
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ using Newtonsoft.Json;
|
|||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
public class ProjectileWeaponData : InstantWeaponData
|
||||
{
|
||||
[InspectableField, JsonProperty("spread"), Key(9)]
|
||||
[InspectableField, JsonProperty("spread"), Key(9), RuntimeInspectable]
|
||||
public PerformanceStat Spread = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("bulletInherit"), Key(10)]
|
||||
public float Inherit;
|
||||
|
||||
[InspectableField, JsonProperty("bulletVelocity"), Key(11)]
|
||||
[InspectableField, JsonProperty("bulletVelocity"), Key(11), RuntimeInspectable]
|
||||
public PerformanceStat Velocity = new PerformanceStat();
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
|
|
|
|||
|
|
@ -12,18 +12,18 @@ using static Unity.Mathematics.math;
|
|||
public class TargetLockData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("speed"), Key(1), RuntimeInspectable]
|
||||
public PerformanceStat Speed = new PerformanceStat();
|
||||
public PerformanceStat LockSpeed = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("sensorImpact"), Key(2), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("sensorImpact"), Key(2)]
|
||||
public PerformanceStat SensorImpact = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("threshold"), Key(3), RuntimeInspectable]
|
||||
public PerformanceStat Threshold = new PerformanceStat();
|
||||
public PerformanceStat LockAngle = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("directionImpact"), Key(4), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("directionImpact"), Key(4)]
|
||||
public PerformanceStat DirectionImpact = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("decay"), Key(5), RuntimeInspectable]
|
||||
[InspectableField, JsonProperty("decay"), Key(5)]
|
||||
public PerformanceStat Decay = new PerformanceStat();
|
||||
|
||||
public override IBehavior CreateInstance(ItemManager context, Entity entity, EquippedItem item)
|
||||
|
|
@ -75,9 +75,9 @@ public class TargetLock : IBehavior, IAlwaysUpdatedBehavior
|
|||
}
|
||||
if (Entity.Target.Value != null)
|
||||
{
|
||||
Speed = Context.Evaluate(_data.Speed, Item.EquippableItem, Entity);
|
||||
Speed = Context.Evaluate(_data.LockSpeed, Item.EquippableItem, Entity);
|
||||
SensorImpact = Context.Evaluate(_data.SensorImpact, Item.EquippableItem, Entity);
|
||||
Threshold = Context.Evaluate(_data.Threshold, Item.EquippableItem, Entity);
|
||||
Threshold = Context.Evaluate(_data.LockAngle, Item.EquippableItem, Entity);
|
||||
DirectionImpact = Context.Evaluate(_data.DirectionImpact, Item.EquippableItem, Entity);
|
||||
Decay = Context.Evaluate(_data.Decay, Item.EquippableItem, Entity);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,10 +13,10 @@ public class ThrusterData : BehaviorData
|
|||
[InspectableField, JsonProperty("thrust"), Key(1), RuntimeInspectable]
|
||||
public PerformanceStat Thrust = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("visibility"), Key(2)]
|
||||
[InspectableField, JsonProperty("visibility"), Key(2), RuntimeInspectable]
|
||||
public PerformanceStat Visibility = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("heat"), Key(3)]
|
||||
[InspectableField, JsonProperty("heat"), Key(3), RuntimeInspectable]
|
||||
public PerformanceStat Heat = new PerformanceStat();
|
||||
|
||||
[InspectablePrefab, JsonProperty("Particles"), Key(4)]
|
||||
|
|
|
|||
|
|
@ -8,32 +8,32 @@ using Newtonsoft.Json;
|
|||
|
||||
[Union(0, typeof(ProjectileWeaponData)),
|
||||
Union(1, typeof(LauncherData)),
|
||||
Union(2, typeof(ConstantWeaponData))]
|
||||
Union(2, typeof(ConstantWeaponData)), RuntimeInspectable]
|
||||
public abstract class WeaponData : BehaviorData
|
||||
{
|
||||
[InspectableField, JsonProperty("damageType"), Key(1)]
|
||||
[InspectableField, JsonProperty("damageType"), Key(1), RuntimeInspectable]
|
||||
public DamageType DamageType;
|
||||
|
||||
[InspectableField, JsonProperty("damage"), Key(2)]
|
||||
[InspectableField, JsonProperty("damage"), Key(2), RuntimeInspectable]
|
||||
public PerformanceStat Damage = new PerformanceStat();
|
||||
|
||||
[RangedFloatInspectable(0,1), JsonProperty("penetration"), Key(3)]
|
||||
[RangedFloatInspectable(0,1), JsonProperty("penetration"), Key(3), RuntimeInspectable]
|
||||
public PerformanceStat Penetration = new PerformanceStat();
|
||||
|
||||
[RangedFloatInspectable(0,1), JsonProperty("damageSpread"), Key(4)]
|
||||
public PerformanceStat DamageSpread = new PerformanceStat();
|
||||
|
||||
[InspectableField, JsonProperty("range"), Key(5)]
|
||||
[InspectableField, JsonProperty("range"), Key(5), RuntimeInspectable]
|
||||
public PerformanceStat Range = new PerformanceStat();
|
||||
|
||||
[InspectablePrefab, JsonProperty("effect"), Key(6)]
|
||||
public string EffectPrefab;
|
||||
}
|
||||
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
[InspectableField, MessagePackObject, JsonObject(MemberSerialization.OptIn), RuntimeInspectable]
|
||||
public abstract class InstantWeaponData : WeaponData
|
||||
{
|
||||
[InspectableField, JsonProperty("burstCount"), Key(7)]
|
||||
[InspectableField, JsonProperty("burstCount"), Key(7), RuntimeInspectable]
|
||||
public int BurstCount;
|
||||
|
||||
[InspectableField, JsonProperty("burstTime"), Key(8)]
|
||||
|
|
|
|||
|
|
@ -109,14 +109,22 @@ public static class Extensions
|
|||
);
|
||||
}
|
||||
|
||||
public static string FormatTypeName(this string typeName)
|
||||
{
|
||||
return (typeName.EndsWith("Data")
|
||||
? typeName.Substring(0, typeName.Length - 4)
|
||||
: typeName).SplitCamelCase();
|
||||
}
|
||||
|
||||
public static string SignificantDigits(this float d, int digits=10)
|
||||
{
|
||||
int magnitude = (d == 0.0f) ? 0 : (int)Math.Floor(Math.Log10(Math.Abs(d))) + 1;
|
||||
int magnitude = d == 0.0f ? 0 : (int)Math.Floor(Math.Log10(Math.Abs(d))) + 1;
|
||||
digits -= magnitude;
|
||||
if (digits < 0)
|
||||
digits = 0;
|
||||
string fmt = "f" + digits.ToString();
|
||||
return d.ToString(fmt);
|
||||
string fmt = "f" + digits;
|
||||
string strdec = d.ToString(fmt);
|
||||
return strdec.Contains(".") ? strdec.TrimEnd('0').TrimEnd('.') : strdec;
|
||||
}
|
||||
|
||||
private static Random? _random;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
|
|
@ -9,9 +10,17 @@ public class SizeFilter : MonoBehaviour
|
|||
public TMP_InputField Width;
|
||||
public TMP_InputField Height;
|
||||
public Button DisableButton;
|
||||
|
||||
public event Action OnDisable;
|
||||
|
||||
void Start()
|
||||
{
|
||||
DisableButton.onClick.AddListener(() => gameObject.SetActive(false));
|
||||
DisableButton.onClick.AddListener(() =>
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
OnDisable?.Invoke();
|
||||
OnDisable = null;
|
||||
});
|
||||
//gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,52 +2,221 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Contexts;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class TradeMenu : MonoBehaviour
|
||||
{
|
||||
public ActionGameManager GameManager;
|
||||
public DropdownMenu Dropdown;
|
||||
public ContextMenu ContextMenu;
|
||||
public Button NewFilterButton;
|
||||
public Prototype FilterPrototype;
|
||||
public SizeFilter MinimumSizeFilter;
|
||||
public SizeFilter MaximumSizeFilter;
|
||||
public RectTransform ItemList;
|
||||
public PropertiesPanel Properties;
|
||||
public Spreadsheet Spreadsheet;
|
||||
public TextMeshProUGUI TargetCargoLabel;
|
||||
public Button FoldoutButton;
|
||||
|
||||
private EquippedCargoBay _targetCargo;
|
||||
private (ItemFilter filter, HardpointType type) _hardpointFilter;
|
||||
private List<(ItemFilter filter, Type type)> _behaviorFilters = new List<(ItemFilter filter, Type type)>();
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
_targetCargo = GameManager.DockingBay;
|
||||
TargetCargoLabel.text = "Docking Bay";
|
||||
Properties.Context = GameManager.ItemManager;
|
||||
Spreadsheet.ShowData(
|
||||
new[] {"Name", "Mass"},
|
||||
new[] {2, 1},
|
||||
GameManager.ItemManager.ItemData.GetAll<ItemData>().Select(i => new SpreadsheetEntryRow
|
||||
{
|
||||
Columns = new[]
|
||||
MinimumSizeFilter.Width.onEndEdit.AddListener(_ => Populate());
|
||||
MinimumSizeFilter.Height.onEndEdit.AddListener(_ => Populate());
|
||||
MaximumSizeFilter.Width.onEndEdit.AddListener(_ => Populate());
|
||||
MaximumSizeFilter.Height.onEndEdit.AddListener(_ => Populate());
|
||||
NewFilterButton.onClick.AddListener(() =>
|
||||
{
|
||||
ContextMenu.Clear();
|
||||
IEnumerable<HardpointType> hardpointTypes = (HardpointType[]) Enum.GetValues(typeof(HardpointType));
|
||||
if (_hardpointFilter.filter != null)
|
||||
hardpointTypes = hardpointTypes.Where(x => x != _hardpointFilter.type);
|
||||
ContextMenu.AddDropdown("Item Type", hardpointTypes
|
||||
.Select<HardpointType, (string, Action, bool)>(x => (Enum.GetName(typeof(HardpointType), x), () =>
|
||||
{
|
||||
new SpreadsheetEntryColumn
|
||||
if (_hardpointFilter.filter == null)
|
||||
{
|
||||
Output = () => i.Name,
|
||||
SortKey = i.Name
|
||||
},
|
||||
new SpreadsheetEntryColumn
|
||||
_hardpointFilter.filter = FilterPrototype.Instantiate<ItemFilter>();
|
||||
_hardpointFilter.filter.OnDisable += () =>
|
||||
{
|
||||
_hardpointFilter.filter = null;
|
||||
Populate();
|
||||
};
|
||||
}
|
||||
|
||||
_hardpointFilter.filter.Label.text = $"Hardpoint: {Enum.GetName(typeof(HardpointType), x)}";
|
||||
_hardpointFilter.type = x;
|
||||
Populate();
|
||||
}, true)));
|
||||
ContextMenu.AddDropdown("Item Behavior", typeof(BehaviorData).GetAllChildClasses()
|
||||
.Where(x=> x.GetCustomAttribute<RuntimeInspectable>() != null && _behaviorFilters.All(f => f.type != x))
|
||||
.Select<Type, (string, Action, bool)>(x=> (x.Name.FormatTypeName(), () =>
|
||||
{
|
||||
var matchingType = _behaviorFilters.FirstOrDefault(y => y.type.IsAssignableFrom(x) || x.IsAssignableFrom(y.type));
|
||||
if (matchingType.filter != null) matchingType.filter.DisableButton.onClick.Invoke();
|
||||
var filter = FilterPrototype.Instantiate<ItemFilter>();
|
||||
filter.Label.text = x.Name.FormatTypeName();
|
||||
filter.OnDisable += () =>
|
||||
{
|
||||
Output = () => i.Mass.SignificantDigits(3),
|
||||
SortKey = i.Mass
|
||||
},
|
||||
},
|
||||
_behaviorFilters.Remove((filter, x));
|
||||
Populate();
|
||||
};
|
||||
_behaviorFilters.Add((filter, x));
|
||||
Populate();
|
||||
}, true)));
|
||||
if(!MinimumSizeFilter.gameObject.activeSelf)
|
||||
ContextMenu.AddOption("Minimum Size",
|
||||
() =>
|
||||
{
|
||||
MinimumSizeFilter.gameObject.SetActive(true);
|
||||
MinimumSizeFilter.OnDisable += () => Populate();
|
||||
});
|
||||
if(!MaximumSizeFilter.gameObject.activeSelf)
|
||||
ContextMenu.AddOption("Maximum Size",
|
||||
() =>
|
||||
{
|
||||
MaximumSizeFilter.gameObject.SetActive(true);
|
||||
MaximumSizeFilter.OnDisable += () => Populate();
|
||||
});
|
||||
ContextMenu.Show();
|
||||
});
|
||||
Populate();
|
||||
}
|
||||
|
||||
void Populate()
|
||||
{
|
||||
var columns = new List<(string name, int size, Func<EquippableItemData, Func<string>> output, Func<EquippableItemData, IComparable> sortKey)>();
|
||||
|
||||
columns.Add(("Name", 3,
|
||||
data => () => data.Name,
|
||||
data => data.Name));
|
||||
if(_hardpointFilter.filter==null)
|
||||
columns.Add(("Type", 2,
|
||||
data => () => Enum.GetName(typeof(HardpointType), data.HardpointType),
|
||||
data => data.HardpointType));
|
||||
columns.Add(("Mass", 1,
|
||||
data => () => data.Mass.SignificantDigits(3),
|
||||
data => data.Mass));
|
||||
columns.Add(("Size", 1,
|
||||
data => () => $"{data.Shape.Width}x{data.Shape.Height}",
|
||||
data => data.Shape.Width*data.Shape.Height));
|
||||
|
||||
var items = GameManager.ItemManager.ItemData.GetAll<EquippableItemData>();
|
||||
|
||||
if (MinimumSizeFilter.gameObject.activeSelf)
|
||||
items = items.Where(i =>
|
||||
!(MinimumSizeFilter.Width.text.Length > 0 && i.Shape.Width < int.Parse(MinimumSizeFilter.Width.text) ||
|
||||
MinimumSizeFilter.Height.text.Length > 0 && i.Shape.Height < int.Parse(MinimumSizeFilter.Height.text)));
|
||||
|
||||
if (MaximumSizeFilter.gameObject.activeSelf)
|
||||
items = items.Where(i =>
|
||||
!(MaximumSizeFilter.Width.text.Length > 0 && i.Shape.Width > int.Parse(MaximumSizeFilter.Width.text) ||
|
||||
MaximumSizeFilter.Height.text.Length > 0 && i.Shape.Height > int.Parse(MaximumSizeFilter.Height.text)));
|
||||
|
||||
if (_hardpointFilter.filter != null)
|
||||
items = items.Where(i => i.HardpointType == _hardpointFilter.type);
|
||||
|
||||
foreach (var (_, type) in _behaviorFilters)
|
||||
{
|
||||
items = items.Where(i => i.Behaviors.Any(b => type.IsInstanceOfType(b)));
|
||||
|
||||
foreach (var field in type.GetFields().Where(f => f.GetCustomAttribute<RuntimeInspectable>() != null))
|
||||
{
|
||||
var fieldType = field.FieldType;
|
||||
if (fieldType == typeof(float))
|
||||
columns.Add((field.Name, 1, data =>
|
||||
{
|
||||
var behavior = data.Behaviors.FirstOrDefault(b => type.IsInstanceOfType(b));
|
||||
return () => ((float) field.GetValue(behavior)).SignificantDigits(3);
|
||||
}, data =>
|
||||
{
|
||||
var behavior = data.Behaviors.FirstOrDefault(b => type.IsInstanceOfType(b));
|
||||
return (float) field.GetValue(behavior);
|
||||
}));
|
||||
else if (fieldType == typeof(int))
|
||||
columns.Add((field.Name, 1, data =>
|
||||
{
|
||||
var behavior = data.Behaviors.FirstOrDefault(b => type.IsInstanceOfType(b));
|
||||
return () => ((int) field.GetValue(behavior)).ToString();
|
||||
}, data =>
|
||||
{
|
||||
var behavior = data.Behaviors.FirstOrDefault(b => type.IsInstanceOfType(b));
|
||||
return (int) field.GetValue(behavior);
|
||||
}));
|
||||
else if (fieldType == typeof(PerformanceStat))
|
||||
{
|
||||
columns.Add((field.Name, 1, data =>
|
||||
{
|
||||
var behavior = data.Behaviors.FirstOrDefault(b => type.IsInstanceOfType(b));
|
||||
return () => ((PerformanceStat) field.GetValue(behavior)).Max.SignificantDigits(3);
|
||||
}, data =>
|
||||
{
|
||||
var behavior = data.Behaviors.FirstOrDefault(b => type.IsInstanceOfType(b));
|
||||
return ((PerformanceStat) field.GetValue(behavior)).Max;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
columns.Add(("Owned", 1,
|
||||
data => () => (_targetCargo.ItemsOfType.ContainsKey(data.ID) ? _targetCargo.ItemsOfType[data.ID].Count : 0).ToString(),
|
||||
data => _targetCargo.ItemsOfType.ContainsKey(data.ID) ? _targetCargo.ItemsOfType[data.ID].Count : 0));
|
||||
|
||||
Spreadsheet.ShowData(
|
||||
columns.Select(x => x.name).ToArray(),
|
||||
columns.Select(x => x.size).ToArray(),
|
||||
items.Select(i => new SpreadsheetEntryRow
|
||||
{
|
||||
Columns = columns.Select(x => new SpreadsheetEntryColumn
|
||||
{
|
||||
Output = x.output(i),
|
||||
SortKey = x.sortKey(i)
|
||||
}).ToArray(),
|
||||
OnClick = () =>
|
||||
{
|
||||
Properties.Clear();
|
||||
Properties.AddItemDataProperties(i);
|
||||
},
|
||||
OnDoubleClick = () =>
|
||||
{
|
||||
_targetCargo.TryStore(GameManager.ItemManager.CreateInstance(i, .1f, 1));
|
||||
Populate();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
|
||||
FoldoutButton.onClick.AddListener(() =>
|
||||
{
|
||||
ContextMenu.Clear();
|
||||
if(_targetCargo != GameManager.DockingBay)
|
||||
ContextMenu.AddOption("Docking Bay",
|
||||
() =>
|
||||
{
|
||||
_targetCargo = GameManager.DockingBay;
|
||||
TargetCargoLabel.text = "Docking Bay";
|
||||
});
|
||||
foreach (var ship in GameManager.CurrentShip.Parent.Children.Where(GameManager.PlayerShips.Contains))
|
||||
{
|
||||
foreach (var bay in ship.CargoBays.Select((bay, index) => (bay, index)))
|
||||
ContextMenu.AddOption($"{ship.Name} Bay {bay.index}",
|
||||
() =>
|
||||
{
|
||||
_targetCargo = bay.bay;
|
||||
TargetCargoLabel.text = $"{ship.Name} Bay {bay.index}";
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Update()
|
||||
|
|
|
|||
|
|
@ -120,10 +120,12 @@ public class ContextMenu : MonoBehaviour
|
|||
pivot.x = mousePosition.x > Screen.width - rect.sizeDelta.x * canvas.scaleFactor ? 1 : 0;
|
||||
var scaleFactor = canvas.scaleFactor;
|
||||
_dropdownRight = mousePosition.x < Screen.width - rect.sizeDelta.x * scaleFactor * 2;
|
||||
var pivotTop = (Parent==null ? mousePosition.y : ForcePosition.y) > (PaddingHeight + _options.Count * OptionHeight) * scaleFactor;
|
||||
pivot.y = pivotTop ? 1 : 0;
|
||||
var pos = Parent==null ? mousePosition.y : ForcePosition.y;
|
||||
var space = (PaddingHeight + _options.Count * OptionHeight) * scaleFactor;
|
||||
var deltaY = pos < space ? space - pos : PaddingHeight / 2 * scaleFactor;
|
||||
pivot.y = 1;//pivotTop ? 1 : 0;
|
||||
rect.pivot = pivot;
|
||||
rect.position = Parent!=null ? ForcePosition - (pivotTop ? Vector3.zero : Vector3.up * (OptionHeight * scaleFactor)) : (Vector3)mousePosition;
|
||||
rect.position = (Parent != null ? ForcePosition : (Vector3) mousePosition) + Vector3.up * deltaY;
|
||||
if (Parent==null)
|
||||
CancelClickCatcher.gameObject.SetActive(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,10 +94,8 @@ public class InventoryPanel : MonoBehaviour
|
|||
else ContextMenu.AddOption(ship.Name, () => Display(ship));
|
||||
}
|
||||
|
||||
foreach (var bay in GameManager.AvailableCargoBays())
|
||||
{
|
||||
ContextMenu.AddOption(bay.Name, () => Display(bay));
|
||||
}
|
||||
if(GameManager.DockingBay!=null)
|
||||
ContextMenu.AddOption(GameManager.DockingBay.Name, () => Display(GameManager.DockingBay));
|
||||
|
||||
ContextMenu.Show();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -403,6 +403,13 @@ public class PropertiesPanel : MonoBehaviour
|
|||
AddProperty("Durability", () => gearData.Durability.SignificantDigits(Context.GameplaySettings.SignificantDigits));
|
||||
foreach (var behavior in gearData.Behaviors)
|
||||
{
|
||||
if (behavior is StatModifierData statMod)
|
||||
{
|
||||
if(Math.Abs(statMod.Modifier.Min - statMod.Modifier.Max) < .001f)
|
||||
AddProperty("Stat Mod", () => $"{statMod.Stat.Target}:{statMod.Stat.Stat}{(statMod.Type == StatModifierType.Constant ? "+" : "x")}{statMod.Modifier.Min.SignificantDigits(Context.GameplaySettings.SignificantDigits)}");
|
||||
else
|
||||
AddProperty("Stat Mod", () => $"{statMod.Stat.Target}:{statMod.Stat.Stat}{(statMod.Type == StatModifierType.Constant ? "+" : "x")}{statMod.Modifier.Min.SignificantDigits(Context.GameplaySettings.SignificantDigits)}-{statMod.Modifier.Max.SignificantDigits(Context.GameplaySettings.SignificantDigits)}");
|
||||
}
|
||||
var type = behavior.GetType();
|
||||
if (type.GetCustomAttribute(typeof(RuntimeInspectable)) != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue