Added Unit Tooltip (#6)

Affiche un Tooltip d'une unité quand on hover sur l'unité
Inclus description et stats de l'unité

Co-authored-by: Ader Alisma 01 <adeder22@hotmail.com>
Reviewed-on: #6
Reviewed-by: EliaGingras1 <william-gin1@hotmail.com>
This commit is contained in:
Ader_Alisma 2025-05-30 19:05:03 +00:00
parent cf1df05d6d
commit 8ec062892a
25 changed files with 962 additions and 10 deletions

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 0
_food: 0
_cooldownInSeconds: 2
_tooltipString:

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 350
_food: 0
_cooldownInSeconds: 30
_tooltipString:

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 0
_food: 0
_cooldownInSeconds: 0
_tooltipString:

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 0
_food: 10
_cooldownInSeconds: 0
_tooltipString:

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 0
_food: 20
_cooldownInSeconds: 1
_tooltipString: Agressive farmer's association MOB

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 0
_food: 0
_cooldownInSeconds: 1
_tooltipString:

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 0
_food: 100
_cooldownInSeconds: 15
_tooltipString:

View File

@ -16,3 +16,4 @@ MonoBehaviour:
_rock: 0
_food: 0
_cooldownInSeconds: 30
_tooltipString:

View File

@ -549,10 +549,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_lifeBar: {fileID: 5840466301071226527}
_hp: 0
_hp: 1
_speed: 0
_attack_damage: 0
_attack_interval: 0
_enemy: {fileID: 0}
_harvesterResourcePairs:
- _harvesterPrefab: {fileID: 5157279992115123224, guid: 85534a2d6c2add54d864073914646192, type: 3}
_resource: 2

View File

@ -1237,10 +1237,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_lifeBar: {fileID: 2537148645254917234}
_hp: 0
_hp: 1
_speed: 0
_attack_damage: 0
_attack_interval: 0
_enemy: {fileID: 0}
_harvesterResourcePairs:
- _harvesterPrefab: {fileID: 5157279992115123224, guid: 85534a2d6c2add54d864073914646192, type: 3}
_resource: 2

View File

@ -443,7 +443,7 @@ Rigidbody2D:
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 1
m_Mass: 1000000
m_LinearDrag: 0
m_AngularDrag: 0.05
m_GravityScale: 0
@ -491,10 +491,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_lifeBar: {fileID: 2921647257831789607}
_hp: 0
_hp: 1
_speed: 0
_attack_damage: 0
_attack_interval: 0
_enemy: {fileID: 0}
_harvesterResourcePairs:
- _harvesterPrefab: {fileID: 5157279992115123224}
_resource: 2

View File

@ -634,10 +634,11 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_lifeBar: {fileID: 7890345829581758539}
_hp: 0
_hp: 1
_speed: 0
_attack_damage: 0
_attack_interval: 0
_enemy: {fileID: 0}
_harvesterResourcePairs:
- _harvesterPrefab: {fileID: 5157279992115123224, guid: 85534a2d6c2add54d864073914646192, type: 3}
_resource: 2

View File

@ -2600,6 +2600,62 @@ Canvas:
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &921843856
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 921843857}
- component: {fileID: 921843858}
m_Layer: 5
m_Name: TooltipGUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &921843857
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 921843856}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1.5391, y: 1.5391, z: 1.5391}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1750497990}
- {fileID: 979791170}
m_Father: {fileID: 1092900232}
m_RootOrder: 9
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: -681, y: -223}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &921843858
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 921843856}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3c61083f9f8ea6441afcccd38ee6428e, type: 3}
m_Name:
m_EditorClassIdentifier:
_tooltipPanel: {fileID: 1750497989}
_tooltipDescription: {fileID: 1661484071}
_tooltipHp: {fileID: 1968535036}
_tooltipDmg: {fileID: 1811362476}
_tooltipAttackSpeed: {fileID: 1562415857}
--- !u!1 &978587365
GameObject:
m_ObjectHideFlags: 0
@ -2746,6 +2802,73 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 978587365}
m_CullTransparentMesh: 1
--- !u!1 &979791169
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 979791170}
- component: {fileID: 979791171}
m_Layer: 5
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &979791170
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 979791169}
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1661484070}
- {fileID: 1968535035}
- {fileID: 1811362475}
- {fileID: 1562415856}
m_Father: {fileID: 921843857}
m_RootOrder: 1
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: -87, y: 86}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &979791171
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 979791169}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 5
m_Right: 5
m_Top: 5
m_Bottom: 5
m_ChildAlignment: 0
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &1092900228
GameObject:
m_ObjectHideFlags: 0
@ -2847,6 +2970,7 @@ RectTransform:
- {fileID: 115274809}
- {fileID: 588460020}
- {fileID: 179679298}
- {fileID: 921843857}
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -3968,6 +4092,141 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b116bc5489ed8524da52c4dbc835640e, type: 3}
--- !u!1 &1562415855
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1562415856}
- component: {fileID: 1562415858}
- component: {fileID: 1562415857}
m_Layer: 5
m_Name: TooltipAttackSpeed
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1562415856
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1562415855}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 979791170}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1562415857
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1562415855}
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:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
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: 0
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 &1562415858
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1562415855}
m_CullTransparentMesh: 1
--- !u!1 &1622690417
GameObject:
m_ObjectHideFlags: 0
@ -4046,6 +4305,141 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1661484069
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1661484070}
- component: {fileID: 1661484072}
- component: {fileID: 1661484071}
m_Layer: 5
m_Name: TooltipDescription
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1661484070
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661484069}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 979791170}
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: 273.4146, y: 78.0236}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1661484071
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661484069}
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:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
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: 0
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 &1661484072
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1661484069}
m_CullTransparentMesh: 1
--- !u!1 &1709530843
GameObject:
m_ObjectHideFlags: 0
@ -4179,6 +4573,82 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1709530843}
m_CullTransparentMesh: 1
--- !u!1 &1750497989
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1750497990}
- component: {fileID: 1750497992}
- component: {fileID: 1750497991}
m_Layer: 5
m_Name: TooltipPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1750497990
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1750497989}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3.0415, y: 3.0415, z: 3.0415}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 921843857}
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 &1750497991
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1750497989}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1750497992
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1750497989}
m_CullTransparentMesh: 1
--- !u!114 &1760532843
MonoBehaviour:
m_ObjectHideFlags: 0
@ -4328,6 +4798,276 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1761692192}
m_CullTransparentMesh: 1
--- !u!1 &1811362474
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1811362475}
- component: {fileID: 1811362477}
- component: {fileID: 1811362476}
m_Layer: 5
m_Name: TooltipDamage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1811362475
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1811362474}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 979791170}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1811362476
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1811362474}
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:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
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: 0
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 &1811362477
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1811362474}
m_CullTransparentMesh: 1
--- !u!1 &1968535034
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1968535035}
- component: {fileID: 1968535037}
- component: {fileID: 1968535036}
m_Layer: 5
m_Name: TooltipHp
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1968535035
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1968535034}
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 979791170}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 200, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1968535036
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1968535034}
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:
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 20
m_fontSizeBase: 20
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
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: 0
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 &1968535037
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1968535034}
m_CullTransparentMesh: 1
--- !u!1 &2019202046
GameObject:
m_ObjectHideFlags: 0

View File

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

View File

@ -0,0 +1,58 @@
using GatherAndDefend.Events;
using System;
using System.Diagnostics;
public class TooltipManager : Singleton<TooltipManager>
{
private string _description;
public string Description { get { return _description; } }
private string _hp;
public string Hp { get { return _hp; } }
private string _damage;
public string Damage { get { return _damage; } }
private string _attackSpeed;
public string AttackSpeed { get { return _attackSpeed; } }
private bool _tooltipVisibility;
public bool TooltipVisibility { get { return _tooltipVisibility; } }
public void ShowTooltip(UnitCard unitCard, string hp, string dmg, string atkSpeed, bool isNotTile = true)
{
string description = DescriptionManager(unitCard);
_tooltipVisibility = true;
_description = description;
if (hp.Equals("0") && isNotTile)
{
_hp = "1";
} else
{
_hp = hp;
}
_damage = dmg;
_attackSpeed = atkSpeed;
EventAggregator.Instance.GetEvent<TooltipChangedEvent>().Invoke();
}
public void HideToolTip()
{
_tooltipVisibility = false;
EventAggregator.Instance.GetEvent<TooltipChangedEvent>().Invoke();
}
private string DescriptionManager(UnitCard unitCard)
{
if (unitCard != null)
{
string tooltipDescription;
if (unitCard.TooltipString != null && unitCard.TooltipString.Length > 0)
{
tooltipDescription = unitCard.TooltipString;
}
else
{
tooltipDescription = "Exemple de description d'unité pour " + unitCard.name.ToLower();
}
return tooltipDescription;
}
return null;
}
}

View File

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

View File

@ -0,0 +1,45 @@
using GatherAndDefend.Events;
using TMPro;
using UnityEngine;
public class TooltipText : MonoBehaviour
{
private TooltipManager _tooltipManager;
[SerializeField]
private GameObject _tooltipPanel;
[SerializeField]
private TextMeshProUGUI _tooltipDescription;
[SerializeField]
private TextMeshProUGUI _tooltipHp;
[SerializeField]
private TextMeshProUGUI _tooltipDmg;
[SerializeField]
private TextMeshProUGUI _tooltipAttackSpeed;
private const string EMPTY_STRING = "";
private void Start()
{
_tooltipManager = TooltipManager.Instance;
EventAggregator.Instance.GetEvent<TooltipChangedEvent>().Attach(OnEventUpdate);
}
// Update is called once per frame
private void OnEventUpdate()
{
if (_tooltipManager.TooltipVisibility)
{
_tooltipPanel.SetActive(true);
_tooltipDescription.text = _tooltipManager.Description;
_tooltipHp.text = (_tooltipManager.Hp.Equals("0") ? ("Intouchable") : "Points de vie: " + _tooltipManager.Hp);
_tooltipDmg.text = (_tooltipManager.Damage.Equals("0") ? "Ne peut pas attaquer" : "Dommage: " + _tooltipManager.Damage);
_tooltipAttackSpeed.text = (_tooltipManager.Damage.Equals("0") ? EMPTY_STRING : "Vitesse d'attaque: " + _tooltipManager.AttackSpeed);
}
else
{
_tooltipPanel.SetActive(false);
_tooltipDescription.text = EMPTY_STRING;
_tooltipHp.text = EMPTY_STRING;
_tooltipDmg.text = EMPTY_STRING;
_tooltipAttackSpeed.text = EMPTY_STRING;
}
}
}

View File

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

View File

@ -2,6 +2,7 @@
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
public class GameObjectPlacementButton : UnitPlacementButton
{
@ -81,4 +82,16 @@ public class GameObjectPlacementButton : UnitPlacementButton
detection.transform.localPosition = detectionRect.position;
detection.transform.localScale = detectionRect.size;
}
public override void OnPointerEnter(PointerEventData eventData)
{
Ally allyObj = _prefab.GetComponent<Ally>();
TooltipManager.Instance.ShowTooltip(_unitCardInformation, allyObj.Hp.ToString(), allyObj.AttackDamage.ToString(), allyObj.AttackInterval.ToString());
}
public override void OnPointerExit(PointerEventData eventData)
{
base.OnPointerExit(eventData);
TooltipManager.Instance.HideToolTip();
}
}

View File

@ -1,13 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class TilePlacementButton : UnitPlacementButton
{
public LevelTile tile;
const string NULL = "0";
protected override bool CanPlace()
{
{
return ResourceManager.Instance.EnoughFor(_unitCardInformation.Rock, _unitCardInformation.Wood, _unitCardInformation.Food) && base.CanPlace();
}
@ -23,4 +23,14 @@ public class TilePlacementButton : UnitPlacementButton
rend.sortingOrder = 2;
return placeholder;
}
public override void OnPointerEnter(PointerEventData eventData)
{
TooltipManager.Instance.ShowTooltip(_unitCardInformation, NULL, NULL, NULL, false);
}
public override void OnPointerExit(PointerEventData eventData)
{
TooltipManager.Instance.HideToolTip();
}
}

View File

@ -11,9 +11,12 @@ public class UnitCard : ScriptableObject
protected int _food;
[SerializeField]
protected int _cooldownInSeconds = 3;
[SerializeField, TextArea(10, 100)]
protected string _tooltipString;
public int Wood => _wood;
public int Rock => _rock;
public int Food => _food;
public int CooldownInSeconds => _cooldownInSeconds;
public string TooltipString => _tooltipString;
}

View File

@ -5,7 +5,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public abstract class UnitPlacementButton : PlacementButton
public abstract class UnitPlacementButton : PlacementButton, IPointerEnterHandler, IPointerExitHandler
{
[SerializeField]
protected Sprite _detectionRangeSprite;
@ -24,6 +24,11 @@ public abstract class UnitPlacementButton : PlacementButton
protected Image _cooldownIndicator;
protected bool _lockedByCooldown;
protected override void Start()
{
base.Start();
}
protected override void Update()
{
base.Update();
@ -77,4 +82,8 @@ public abstract class UnitPlacementButton : PlacementButton
{
return base.CanPlace() && !_lockedByCooldown;
}
public virtual void OnPointerEnter(PointerEventData eventData){}
public virtual void OnPointerExit(PointerEventData eventData){}
}

View File

@ -0,0 +1,5 @@
using GatherAndDefend.Events;
public class TooltipChangedEvent : EventBase
{
}

View File

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

View File

@ -4,7 +4,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler
public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
{
private Button _button;
@ -77,6 +77,7 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler
resourceManager.Remove(_unitCardInformation.Rock, _unitCardInformation.Wood, _unitCardInformation.Food);
Destroy(_unitGameObject);
Destroy(_buttonContainer);
HideTooltip();
}
}
@ -93,4 +94,19 @@ public class UpgradePlacementButton : MonoBehaviour, IPointerClickHandler
_canvas = canvas;
_unitArt.sprite = unitUpgrade.UpgradeCardArt;
}
public void OnPointerEnter(PointerEventData eventData)
{
Ally allyObj = _prefab.GetComponent<Ally>();
TooltipManager.Instance.ShowTooltip(_unitCardInformation, allyObj.Hp.ToString(), allyObj.AttackDamage.ToString(), allyObj.AttackInterval.ToString());
}
public void OnPointerExit(PointerEventData eventData)
{
HideTooltip();
}
private void HideTooltip()
{
TooltipManager.Instance.HideToolTip();
}
}