From 61f4660dba7c9894f4ec856a87c62580cf7050bc Mon Sep 17 00:00:00 2001 From: VDH Date: Mon, 12 Jan 2026 19:07:37 +0700 Subject: [PATCH] done flow learn skill --- .../PerfectWorld/Prefab/UI/MessageBox.prefab | 627 ++++++++++++++++++ .../Prefab/UI/MessageBox.prefab.meta | 7 + .../UI/DialogScriptTableObject.asset | 2 + .../Scripts/Managers/CECManager.cs | 1 + Assets/PerfectWorld/Scripts/Move/CECPlayer.cs | 49 +- .../CSNetwork/C2SCommand/C2SCommand.cs | 5 + .../CSNetwork/C2SCommand/C2SCommandFactory.cs | 14 + .../Scripts/Network/CSNetwork/GameSession.cs | 10 + .../Scripts/Network/UnityGameSession.cs | 5 +- .../Scripts/Skills/EC_HostSkillModel.cs | 38 ++ .../Scripts/Skills/ElementSkill.cs | 87 ++- .../Scripts/Skills/SkillWrapper.cs | 38 ++ Assets/PerfectWorld/Scripts/Skills/skill.cs | 594 +++++++++-------- Assets/PerfectWorld/Scripts/Skills/skill7.cs | 1 + Assets/PerfectWorld/Scripts/Skills/skill8.cs | 1 + Assets/PerfectWorld/Scripts/Skills/skill9.cs | 1 + Assets/PerfectWorld/Scripts/UI/AUIManager.cs | 2 +- .../PerfectWorld/Scripts/UI/CDlgMessageBox.cs | 28 + .../Scripts/UI/CDlgMessageBox.cs.meta | 2 + .../Scripts/UI/Dialogs/AUIDialog.cs | 25 +- .../GamePlay/SkillUI/CDlgSkillSubListItem.cs | 106 ++- Assets/Scripts/CECHostPlayer.cs | 209 +++++- Assets/Scripts/CECUIManager.cs | 91 ++- Assets/Scripts/DialogBoxCommandIDs.cs | 19 + Assets/Scripts/DialogBoxCommandIDs.cs.meta | 2 + Assets/Scripts/EC_GPDataType.cs | 8 + 26 files changed, 1633 insertions(+), 339 deletions(-) create mode 100644 Assets/PerfectWorld/Prefab/UI/MessageBox.prefab create mode 100644 Assets/PerfectWorld/Prefab/UI/MessageBox.prefab.meta create mode 100644 Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs create mode 100644 Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs.meta create mode 100644 Assets/Scripts/DialogBoxCommandIDs.cs create mode 100644 Assets/Scripts/DialogBoxCommandIDs.cs.meta diff --git a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab new file mode 100644 index 0000000000..0749cd0ca4 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab @@ -0,0 +1,627 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1448650841350251410 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1931146730219979515} + - component: {fileID: 7931617368933511578} + - component: {fileID: 5031655611580643013} + m_Layer: 5 + m_Name: TitileText (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1931146730219979515 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1448650841350251410} + 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: 8578995796031649400} + 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: 84} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7931617368933511578 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1448650841350251410} + m_CullTransparentMesh: 1 +--- !u!114 &5031655611580643013 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1448650841350251410} + 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: MessageBox + 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: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, 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: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + 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_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 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!1 &3318234767486795022 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7677644201189461152} + - component: {fileID: 5808684862484431307} + - component: {fileID: 6436262686944836630} + 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 &7677644201189461152 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3318234767486795022} + 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: 7906706137011413807} + 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: -81} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5808684862484431307 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3318234767486795022} + m_CullTransparentMesh: 1 +--- !u!114 &6436262686944836630 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3318234767486795022} + 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: OK + 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: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, 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: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + 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_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 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!1 &4839074738306786208 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7906706137011413807} + - component: {fileID: 8280971203118505009} + - component: {fileID: 8250962023850685786} + - component: {fileID: 7766051278568089760} + m_Layer: 5 + m_Name: ButtonExit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7906706137011413807 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + 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: 7677644201189461152} + m_Father: {fileID: 8578995796031649400} + 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: 0} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8280971203118505009 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + m_CullTransparentMesh: 1 +--- !u!114 &8250962023850685786 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + 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: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &7766051278568089760 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4839074738306786208} + 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: 8250962023850685786} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &5199518178703117250 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6428994832978992641} + - component: {fileID: 655909173274991632} + - component: {fileID: 7448521238108099750} + m_Layer: 5 + m_Name: MessageText (TMP) (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6428994832978992641 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5199518178703117250} + 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: 8578995796031649400} + 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: 3} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &655909173274991632 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5199518178703117250} + m_CullTransparentMesh: 1 +--- !u!114 &7448521238108099750 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5199518178703117250} + 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: 'Content + +' + 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: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, 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: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + 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_TextWrappingMode: 0 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 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!1 &5492547392745930423 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8578995796031649400} + - component: {fileID: 2243330050876855902} + - component: {fileID: 3372223705930781376} + - component: {fileID: 8056968728849250909} + m_Layer: 5 + m_Name: MessageBox + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8578995796031649400 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + 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: 7906706137011413807} + - {fileID: 1931146730219979515} + - {fileID: 6428994832978992641} + m_Father: {fileID: 0} + 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: 30.6318} + m_SizeDelta: {x: 434.6896, y: 248.9211} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2243330050876855902 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + m_CullTransparentMesh: 1 +--- !u!114 &3372223705930781376 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + 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: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8056968728849250909 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5492547392745930423} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7397a97ad381b754689dee54c66ed470, type: 3} + m_Name: + m_EditorClassIdentifier: + titleText: {fileID: 5031655611580643013} + messageText: {fileID: 7448521238108099750} + okButton: {fileID: 7766051278568089760} diff --git a/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab.meta b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab.meta new file mode 100644 index 0000000000..48a73f22ed --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/MessageBox.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 54cccb2c6a758a24183474cd385ccb2c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index 415919ac8c..62ea994ad9 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -27,3 +27,5 @@ MonoBehaviour: prefab: {fileID: 977375840943150650, guid: 51bad2e6d1ec69a4683135ce85288faa, type: 3} - id: Win_Hpmpxp prefab: {fileID: 6032603119232429246, guid: 8350aa55906d08448bb47e10a473ca61, type: 3} + - id: DlgMessageBox + prefab: {fileID: 5492547392745930423, guid: 54cccb2c6a758a24183474cd385ccb2c, type: 3} diff --git a/Assets/PerfectWorld/Scripts/Managers/CECManager.cs b/Assets/PerfectWorld/Scripts/Managers/CECManager.cs index a7934f88fe..ef918b4c7f 100644 --- a/Assets/PerfectWorld/Scripts/Managers/CECManager.cs +++ b/Assets/PerfectWorld/Scripts/Managers/CECManager.cs @@ -162,5 +162,6 @@ namespace BrewMonster.Managers + diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs index fed3d7f048..046ae5ba1b 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs @@ -1138,6 +1138,9 @@ namespace BrewMonster return false; } + public CECSkill GetCurSkill() { return m_pCurSkill; } + public bool IsHangerOn() { return m_bHangerOn; } + public bool PlaySkillCastActionWithName(int idSkill, string szActName, bool bNoFX/* =false */) { return m_pActionController != null @@ -1573,31 +1576,31 @@ namespace BrewMonster { bool bRet = false; - /* if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) - bRet = true; - else if (vPos.y < fWaterHei && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) - bRet = true; - */ - // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf - m_aabb.Extents.y) - // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f) + /* if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) + bRet = true; + else if (vPos.y < fWaterHei && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) + bRet = true; + */ + // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf - m_aabb.Extents.y) + // if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f) - /* - if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) - bRet = true; - else if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) - bRet = true; - */ + /* + if (vPos.y < fWaterHei - m_MoveConst.fShoreDepth) + bRet = true; + else if (vPos.y < fWaterHei - m_MoveConst.fWaterSurf + 0.01f && fWaterHei - fGndHei > m_MoveConst.fShoreDepth) + bRet = true; + */ - //@note : modify the water test. By Kuiwu[12/10/2005] - if (vPos.y + m_aabbServer.Extents.y= 0.2f ) - else if (vPos.y + m_aabbServer.Extents.y= 0.01f ) - { - bRet = true; - } + //@note : modify the water test. By Kuiwu[12/10/2005] + if (vPos.y + m_aabbServer.Extents.y < fWaterHei - m_MoveConst.fWaterSurf - 0.001f) + { + bRet = true; + } + //else if (vPos.y + m_aabb.Extents.y < fWaterHei- m_MoveConst.fWaterSurf + 1E-4f && vPos.y - fGndHei >= 0.2f ) + else if (vPos.y + m_aabbServer.Extents.y < fWaterHei - m_MoveConst.fWaterSurf + 1E-4f && vPos.y - fGndHei >= 0.01f) + { + bRet = true; + } return bRet; diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs index 5a40aa0491..672000405b 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommand.cs @@ -1446,6 +1446,11 @@ namespace CSNetwork.S2CCommand public int idTask; } + public struct SevLearnSkillCONTENT + { + public int idSkill; + } + public struct cmd_sevnpc_serve2 { public int service_type; diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs index f7b832c87c..c834b6ff48 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs @@ -617,6 +617,20 @@ namespace CSNetwork.C2SCommand return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content); } + public static Octets CreateNPCSevLearnSkillCmd(int idSkill) + { + var cmd = new cmd_sevnpc_serve + { + service_type = NPC_service_type.GP_NPCSEV_LEARN, + len = (uint)Marshal.SizeOf() + }; + SevLearnSkillCONTENT content = new SevLearnSkillCONTENT() + { + idSkill = idSkill + }; + return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content); + } + public static Octets CreateNPCSevBuyCmd(int itemNum, CSNetwork.C2SCommand.npc_trade_item[] items) { if (itemNum <= 0 || items == null || items.Length < itemNum) diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index fc9da43662..c276f3b8e2 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -787,6 +787,9 @@ namespace CSNetwork case CommandID.COOLTIME_DATA: EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_COOLTIMEDATA, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); break; + case CommandID.LEARN_SKILL: + EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_LEARNSKILL, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); + break; } } @@ -1305,6 +1308,13 @@ namespace CSNetwork SendProtocol(gamedatasend); } + public void c2s_SendCmdNPCSevLearnSkill(int idSkill) + { + gamedatasend gamedatasend = new gamedatasend(); + gamedatasend.Data = C2SCommandFactory.CreateNPCSevLearnSkillCmd(idSkill); + SendProtocol(gamedatasend); + } + public void c2s_SendCmdNPCSevBuy(int itemNum, C2SCommand.npc_trade_item[] items) { if (itemNum <= 0 || items == null || items.Length < itemNum) diff --git a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs index ad015aee76..cc173509ac 100644 --- a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs @@ -262,7 +262,10 @@ namespace BrewMonster.Network RequestInventoryAsync(p, onOneDone); } } - + public static void c2s_SendCmdNPCSevLearnSkill(int idSkill) + { + Instance._gameSession.c2s_SendCmdNPCSevLearnSkill(idSkill); + } public static void c2s_CmdNPCSevHello(int nid) { Instance._gameSession.c2s_SendCmdNPCSevHello(nid); diff --git a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs index e214b02efd..0bade0a08b 100644 --- a/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs +++ b/Assets/PerfectWorld/Scripts/Skills/EC_HostSkillModel.cs @@ -232,6 +232,10 @@ namespace BrewMonster.Scripts.Skills return enumSkillFitLevelState.SKILL_FIT_LEVEL; } + public int CheckLearnCondition(int skillID) + { + return CECGameRun.Instance.GetHostPlayer().CheckSkillLearnCondition(skillID, true); + } public int GetRequiredBook(int skillID, int level) { int itemId = ElementSkill.GetRequiredBook((uint)skillID, level); @@ -559,6 +563,40 @@ namespace BrewMonster.Scripts.Skills } return GetSkillCurrentLevel(skillID) >= level; } + + // Called when a skill is learned / 当学习新技能后调用 + public void OnLearnSkill(int skillID, int skillLevel) + { + if (!m_allProfSkills.ContainsKey(skillID)) + { + return; + } + + // 检查学习新技能后是否有技能被覆盖 / Check if any skills are overridden after learning the new skill + bool newOverridden = false; + var juniors = GetJunior(skillID); + if (juniors.Count > 0) + { + newOverridden = true; + } + + if (newOverridden) + { + CECSkillPanelChange change = new CECSkillPanelChange( + CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_OVERRIDDEN, + skillID, + skillLevel); + EventBus.PublishClass(change); + } + else + { + CECSkillPanelChange change = new CECSkillPanelChange( + CECSkillPanelChange.enumChangeMask.CHANGE_SKILL_LEVEL_UP, + skillID, + skillLevel); + EventBus.PublishClass(change); + } + } } public enum enumSkillFitLevelState diff --git a/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs b/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs index 0923269390..23e62eecf5 100644 --- a/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs +++ b/Assets/PerfectWorld/Scripts/Skills/ElementSkill.cs @@ -248,7 +248,10 @@ namespace BrewMonster.Scripts.Skills public virtual int GetShowOrder() { return 0; } // ���ü��ܼ��� public virtual int SetLevel(int level) { return 0; } - // ������󼶱�? + public static int SetLevel(uint id, int level) + { + return SkillWrapper.Instance.SetLevel(id, level); + } public virtual int GetMaxLevel() { return 0; } public static byte GetType(uint id) { @@ -339,5 +342,87 @@ namespace BrewMonster.Scripts.Skills int ret = skill.GetRequiredMoney(); return ret; } + + // 学习技能条件检查 // Learning skill condition check + // 返回值 // Return values: + // 0: 成功 // Success + // 1: 技能点不够 // Not enough skill points + // 2: 等级不够 // Level not enough + // 3: 错误 // Error + // 4: 职业不匹配 // Profession mismatch + // 5: 技能ID // Skill ID error + // 6: 钱不够 // Not enough money + // 7: 阶级不符 // Rank mismatch + // 9: 前置技能级别不够 // Prerequisite skill level not enough + // 10: 熟练度不够 // Ability not enough + // 11: 被覆盖 // Overridden + // 12: 境界等级不够 // Realm level not enough + public static int LearnCondition(uint id, LearnRequirement info, int ilevel) + { + skill = Skill.Create(id, ilevel); + if (skill == null) + return 5; + + int ret = 0; + SkillWrapper wrapper = SkillWrapper.Instance; + + if (wrapper.IsOverridden(id)) + return 11; + + int srank, prank; + srank = skill.GetRank(); + prank = info.rank; + if (srank > prank) + ret = 7; + else + { + srank = (int)(srank * 0.1); + prank = (int)(prank * 0.1); + if (srank != prank && srank != 0) + ret = 7; + } + + if (ilevel < 1 || ilevel > skill.GetMaxLevel()) + ret = 3; + else if (info.profession != skill.GetCls() && skill.GetCls() != 255) + ret = 4; + else if (info.level < skill.GetRequiredLevel()) + ret = 2; + + if (ret != 0) + { + return ret; + } + + if (info.sp < skill.GetRequiredSp()) + ret = 1; + else if (info.money < skill.GetRequiredMoney()) + ret = 6; + + var pre_skills = skill.GetRequiredSkill(); + foreach (var kvp in pre_skills) + { + uint pre_id = kvp.Key; + int pre_level = kvp.Value; + if (pre_id > 0 && wrapper.GetLevel(pre_id) < pre_level && !wrapper.IsOverridden(pre_id)) + { + ret = 9; + break; + } + } + + if (ilevel > 1) + { + skill.SetLevel(ilevel - 1); + int ability = skill.GetMaxability(); + if (ability > 0 && wrapper.GetAbility(id) < ability) + ret = 10; + } + + if (info.realm_level < skill.GetRequiredRealmLevel()) + ret = 12; + + return ret; + } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs b/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs index 3950be8ad4..2118f3882d 100644 --- a/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs +++ b/Assets/PerfectWorld/Scripts/Skills/SkillWrapper.cs @@ -56,5 +56,43 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.Skills } return false; } + + public int GetLevel(uint id) + { + if (map.TryGetValue(id, out PersistentData data)) + return data.level; + return 0; + } + + public int GetAbility(uint id) + { + if (map.TryGetValue(id, out PersistentData data)) + return data.ability; + return 0; + } + + public int SetAbility(uint id, int ability) + { + if (map.TryGetValue(id, out PersistentData data)) + { + int old = data.ability; + data.ability = ability; + map[id] = data; + return old; + } + return 0; + } + + public int SetLevel(uint id, int level) + { + if (map.TryGetValue(id, out PersistentData data)) + { + int old = data.level; + data.level = level; + map[id] = data; + return old; + } + return 0; + } } } diff --git a/Assets/PerfectWorld/Scripts/Skills/skill.cs b/Assets/PerfectWorld/Scripts/Skills/skill.cs index b6dd534e45..0f4f7da32c 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill.cs @@ -1,296 +1,300 @@ -using System.Collections.Generic; -using UnityEngine; - -namespace BrewMonster.Scripts.Skills -{ - public class Range - { - /// 0=point 1=line 2=self sphere 3=target sphere 4=cone 5=self - public byte type; // 0�� 1�� 2������ 3Ŀ���� 4Բ׶�� 5���� - - public bool IsPoint() { return type == 0; } - public bool IsLine() { return type == 1; } - public bool IsSelfBall() { return type == 2; } - public bool IsTargetBall() { return type == 3; } - public bool IsSector() { return type == 4; } - public bool IsSelf() { return type == 5; } - public bool NoTarget() { return type == 2 || type == 5; } - - } - - // ռλ������ // Placeholder Skill class - public class Skill : ElementSkill - { - protected SkillStub stub; - protected PlayerWrapper player; - - protected uint id; - protected uint level; - - Skill(uint i, SkillStub s) - { - id = i; - stub = s; - player = new PlayerWrapper(); - } - public static Skill Create(uint id, int n) - { - SkillStub stub = SkillStub.GetStub(id); - if (stub == null) - return null; - Skill skill = new Skill(id, stub); - int max = skill.GetMaxLevel(); - if (n > max) - skill.SetLevel(max); - else - skill.SetLevel(n); - return skill; - } - public override int GetMaxLevel() { return stub.GetMaxLevel(); } - public override int SetLevel(int l) - { - uint tmp = level; - level = (uint)l; - return (int)tmp; - } - public override int GetItemCost() { return stub.itemcost; } - - public int GetLevel() { return (int)level; } - public PlayerWrapper GetPlayer() - { - return player; - } - public override int GetRank() { return stub.rank; } - public override bool IsInstant() { return stub.time_type == 1; } - - public override int GetCls() - { - return stub.GetCls(); - } - public override Dictionary GetJunior() - { - return stub.is_senior != 0 ? stub.pre_skills : new Dictionary(); - } - public override int GetRangeType() { return stub.GetRange().type; } - - public override int GetTargetType() - { - if (stub.restrict_corpse == 1) - return 2; - if (stub.restrict_corpse == 2) - return 3; - if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) - return 1; - if (stub.type == (int)skill_type.TYPE_BLESSPET) - return 4; - if (stub.GetRange().NoTarget()) - return 0; - return 1; - } - public override byte GetType() { return stub.type; } - public override int GetCommonCoolDown() { return stub.commoncooldown; } - - public override string GetIcon() - { - return stub.GetIcon(); - } - public override string GetName() { return stub.GetName(); } - public override float GetPrayRange(float range, float prayplus) - { - player.SetRange(range); - player.SetPrayrangeplus(prayplus); - if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) - { - if (stub.auto_attack) - { - float r = 0.3f * stub.GetPraydistance(this); - - if (r >= 1.0) - return stub.GetPraydistance(this) - 1.0f; - else - return (float)0.7 * stub.GetPraydistance(this); - } - else - return stub.GetPraydistance(this); - } - if (stub.type == (int)skill_type.TYPE_JUMP) - return stub.GetPraydistance(this); - if (stub.GetRange().NoTarget()) - return -1; - else - return stub.GetPraydistance(this); - } - public override int GetCoolingTime() { return stub.GetCoolingtime(this); } - public int GetRequiredSp() { return stub.GetRequiredSp(this); } - public int GetRequiredMoney() { return stub.GetRequiredMoney(this); } - public override Dictionary GetRequiredSkill() { return stub.pre_skills; } - - } - - - public abstract class SkillStub - { - public const int MIN_LEVEL = 1; - public const int MAX_LEVEL = 10; - - // Base info - public uint id; // Ψһ���ֱ�ʶ // Unique identifier - public int cls; // ְҵ // Class/Profession - public string name; // �������� // Skill name - public string nativename; // ������ // Native name - public string icon; // ����ͼ�� // Skill icon - public int max_level; // ������󼶱�? // Maximum level - public byte type; // �������? 1�������� 2�������� 3�����ٻ� 4���� 5���� // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other - - // Execute condition - public bool allow_ride; // ������? // Allow while riding - public short attr; // ����������, 1������2��3ľ��4ˮ��5��6�� ��ѡһ Ĭ�ϣ������� // Attribute: 1-Metal 2-Earth 3-Wood 4-Water 5-Fire 6-Special (Choose one, default none) - public int rank; // ���漶�� // Rank - public int eventflag; // Event flag - public byte is_senior; // Senior flag - public bool is_inherent; // �������ܣ�����ѧ������ // Inherent skill, cannot be learned - public bool is_movingcast; // �ƶ�ʩ�� // Can cast while moving - public int npcdelay; // NPC delay - public int showorder; // Display order - public byte allow_forms; // Allowed forms - public int apcost; // AP cost - public int apgain; // AP gain - public byte doenchant; // Do enchant - public byte dobless; // Do bless - public int arrowcost; // Arrow cost - public Dictionary pre_skills; - - // Execute condition - public bool allow_land; // ½����Ч // Effective on land - public bool allow_air; // ������Ч // Effective in air - public bool allow_water; // ˮ����Ч // Effective in water - public bool notuse_in_combat; // ս��״̬������ // Cannot use in combat state - public int restrict_corpse; // ֻ��ʬ����Ч // Only effective on corpses - public bool restrict_change; // �Ƿ���Ա��� // Whether can transform - public bool restrict_attach; // �Ƿ���Ը��� // Whether can possess - public bool auto_attack; // ʹ�ú��Ƿ��Զ����� // Whether to auto attack after use - public byte time_type; // ˲������ // Instant cast type - public byte long_range; - public byte posdouble; // λ��ѡ�� // Position selection - public int clslimit; // ְҵ���� // Class restriction - - public int commoncooldown; // ������ȴmask bit0-4 ������ȴ0-4 bit5-9 ��Ʒ��ȴ0-4 - // Common cooldown mask bit0-4 skill cooldown 0-4 bit5-9 item cooldown 0-4 - public int commoncooldowntime; // ��ȴʱ�䣬��λ���� // Cooldown time in milliseconds - - public int itemcost; // �ͷ�ʱ������Ʒ >0��Ч // Item cost when casting, effective if >0 - - // ������� // Combo related - public int combosk_preskill; - public int combosk_interval; - public int combosk_nobreak; - - public string effect; - public string aerial_effect; - - public Range range; - public bool has_stateattack; - - public List restrict_weapons = new List(); - public static Dictionary map = new Dictionary(); - public static Dictionary GetMap() => map; - public static Dictionary> comboSkillMap = new Dictionary>(); - public static Dictionary> GetComboSkMap() => comboSkillMap; - - public static Dictionary> inheritSkillMap = new Dictionary>(); - - /*#if UNITY_EDITOR - [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] - private static void OnPlay() - { - BMLogger.LogError("SkillStub OnPlay Reset"); - map = new Dictionary(); - comboSkillMap = new Dictionary>(); - inheritSkillMap = new Dictionary>(); - } - #endif*/ - public SkillStub(uint i) - { - id = i; - is_inherent = (false); - is_movingcast = (false); - itemcost = (0); - combosk_preskill = (0); - combosk_interval = (0); - combosk_nobreak = (0); - if (GetStub(id) == null) - { - GetMap().Add(id, this); - } - } - public static List GetInherentSkillList(uint cls) - { - return inheritSkillMap[cls]; - } - - public static SkillStub GetStub(uint i) - { - return GetMap().TryGetValue(i, out var stub) ? stub : null; - } - public int GetItemCost() { return itemcost; } - public static void InitStaticData() - { - var map = GetMap(); - foreach (var skill in map) - { - SkillStub sk = skill.Value; - if (sk.is_inherent) GetInherentSkillList((uint)sk.cls).Add(sk.id); - if (sk.combosk_preskill > 0) GetComboSkMap()[(uint)sk.combosk_preskill].Add(sk.id); - } - } - - public List GetPostComboSkill(uint id) - { - var m = GetComboSkMap(); - if (m.TryGetValue(id, out var list)) return list; - return null; - } - - // ����Ϊ��C++ת���Ľӿ� // The following methods are converted from C++ - public uint GetId() { return id; } - public int GetCls() { return cls; } - public string GetName() { return name; } - public string GetIcon() { return icon; } - public int GetMaxLevel() { return max_level; } - public Range GetRange() { return range; } - public bool IsMovingSkill() { return is_movingcast; } - public byte GetType() { return type; } // ����System.Object.GetType // Hide System.Object.GetType - - // ����ʱ����麯�� // Runtime-related virtual functions - public virtual int GetCoolingtime(Skill skill) { return 5000; } - public virtual int GetRequiredSp(Skill skill) { return 0; } - public virtual int GetRequiredLevel(Skill skill) { return 0; } - public virtual int GetMaxAbility(Skill skill) { return 0; } - public virtual int GetRequiredItem(Skill skill) { return 0; } - public virtual int GetRequiredMoney(Skill skill) { return 0; } - public virtual int GetRequiredRealmLevel(Skill skill) { return 0; } - public virtual float GetPraydistance(Skill skill) { return 0f; } - public virtual float GetMpcost(Skill skill) { return 0f; } - public virtual int GetExecutetime(Skill skill) { return 1000; } - public virtual bool CheckHpCondition(int hp, int max_hp) { return true; } - public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; } - public virtual int GetIntroduction(Skill skill, ushort[] descBuffer, int descBufferLen, ushort[] titleBuffer) { return 0; } - - // ������Ч�Լ�� // Validate weapon restriction - public bool ValidWeapon(int weapon) - { - if (restrict_weapons != null) - { - int i; - for (i = 0; i < restrict_weapons.Count; i++) - { - if (weapon == restrict_weapons[i]) - return true; - } - if (i > 0 && i >= restrict_weapons.Count) - return false; - } - return true; - } - } +using System.Collections.Generic; +using UnityEngine; + +namespace BrewMonster.Scripts.Skills +{ + public class Range + { + /// 0=point 1=line 2=self sphere 3=target sphere 4=cone 5=self + public byte type; // 0�� 1�� 2������ 3Ŀ���� 4Բ׶�� 5���� + + public bool IsPoint() { return type == 0; } + public bool IsLine() { return type == 1; } + public bool IsSelfBall() { return type == 2; } + public bool IsTargetBall() { return type == 3; } + public bool IsSector() { return type == 4; } + public bool IsSelf() { return type == 5; } + public bool NoTarget() { return type == 2 || type == 5; } + + } + + // ռλ������ // Placeholder Skill class + public class Skill : ElementSkill + { + protected SkillStub stub; + protected PlayerWrapper player; + + protected uint id; + protected uint level; + + Skill(uint i, SkillStub s) + { + id = i; + stub = s; + player = new PlayerWrapper(); + } + public static Skill Create(uint id, int n) + { + SkillStub stub = SkillStub.GetStub(id); + if (stub == null) + return null; + Skill skill = new Skill(id, stub); + int max = skill.GetMaxLevel(); + if (n > max) + skill.SetLevel(max); + else + skill.SetLevel(n); + return skill; + } + public override int GetMaxLevel() { return stub.GetMaxLevel(); } + public override int SetLevel(int l) + { + uint tmp = level; + level = (uint)l; + return (int)tmp; + } + public override int GetItemCost() { return stub.itemcost; } + + public int GetLevel() { return (int)level; } + public PlayerWrapper GetPlayer() + { + return player; + } + public override int GetRank() { return stub.rank; } + public override bool IsInstant() { return stub.time_type == 1; } + + public override int GetCls() + { + return stub.GetCls(); + } + public override Dictionary GetJunior() + { + return stub.is_senior != 0 ? stub.pre_skills : new Dictionary(); + } + public override int GetRangeType() { return stub.GetRange().type; } + public override int GetRequiredLevel() { return stub.GetRequiredLevel(this); } + + public override int GetTargetType() + { + if (stub.restrict_corpse == 1) + return 2; + if (stub.restrict_corpse == 2) + return 3; + if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) + return 1; + if (stub.type == (int)skill_type.TYPE_BLESSPET) + return 4; + if (stub.GetRange().NoTarget()) + return 0; + return 1; + } + public override byte GetType() { return stub.type; } + public override int GetCommonCoolDown() { return stub.commoncooldown; } + + public override string GetIcon() + { + return stub.GetIcon(); + } + public override string GetName() { return stub.GetName(); } + public override float GetPrayRange(float range, float prayplus) + { + player.SetRange(range); + player.SetPrayrangeplus(prayplus); + if (stub.type == (int)skill_type.TYPE_ATTACK || stub.type == (int)skill_type.TYPE_CURSE) + { + if (stub.auto_attack) + { + float r = 0.3f * stub.GetPraydistance(this); + + if (r >= 1.0) + return stub.GetPraydistance(this) - 1.0f; + else + return (float)0.7 * stub.GetPraydistance(this); + } + else + return stub.GetPraydistance(this); + } + if (stub.type == (int)skill_type.TYPE_JUMP) + return stub.GetPraydistance(this); + if (stub.GetRange().NoTarget()) + return -1; + else + return stub.GetPraydistance(this); + } + public override int GetCoolingTime() { return stub.GetCoolingtime(this); } + public int GetRequiredSp() { return stub.GetRequiredSp(this); } + public int GetRequiredMoney() { return stub.GetRequiredMoney(this); } + public override Dictionary GetRequiredSkill() { return stub.pre_skills; } + public int GetRequiredRealmLevel() { return stub.GetRequiredRealmLevel(this); } + public int GetMaxability() { return stub.GetMaxAbility(this); } + public uint GetId() { return id; } + + } + + + public abstract class SkillStub + { + public const int MIN_LEVEL = 1; + public const int MAX_LEVEL = 10; + + // Base info + public uint id; // Ψһ���ֱ�ʶ // Unique identifier + public int cls; // ְҵ // Class/Profession + public string name; // �������� // Skill name + public string nativename; // ������ // Native name + public string icon; // ����ͼ�� // Skill icon + public int max_level; // ������󼶱�? // Maximum level + public byte type; // �������? 1�������� 2�������� 3�����ٻ� 4���� 5���� // Skill type: 1-Normal 2-Special 3-Partner 4-Mount 5-Other + + // Execute condition + public bool allow_ride; // ������? // Allow while riding + public short attr; // ����������, 1������2��3ľ��4ˮ��5��6�� ��ѡһ Ĭ�ϣ������� // Attribute: 1-Metal 2-Earth 3-Wood 4-Water 5-Fire 6-Special (Choose one, default none) + public int rank; // ���漶�� // Rank + public int eventflag; // Event flag + public byte is_senior; // Senior flag + public bool is_inherent; // �������ܣ�����ѧ������ // Inherent skill, cannot be learned + public bool is_movingcast; // �ƶ�ʩ�� // Can cast while moving + public int npcdelay; // NPC delay + public int showorder; // Display order + public byte allow_forms; // Allowed forms + public int apcost; // AP cost + public int apgain; // AP gain + public byte doenchant; // Do enchant + public byte dobless; // Do bless + public int arrowcost; // Arrow cost + public Dictionary pre_skills; + + // Execute condition + public bool allow_land; // ½����Ч // Effective on land + public bool allow_air; // ������Ч // Effective in air + public bool allow_water; // ˮ����Ч // Effective in water + public bool notuse_in_combat; // ս��״̬������ // Cannot use in combat state + public int restrict_corpse; // ֻ��ʬ����Ч // Only effective on corpses + public bool restrict_change; // �Ƿ���Ա��� // Whether can transform + public bool restrict_attach; // �Ƿ���Ը��� // Whether can possess + public bool auto_attack; // ʹ�ú��Ƿ��Զ����� // Whether to auto attack after use + public byte time_type; // ˲������ // Instant cast type + public byte long_range; + public byte posdouble; // λ��ѡ�� // Position selection + public int clslimit; // ְҵ���� // Class restriction + + public int commoncooldown; // ������ȴmask bit0-4 ������ȴ0-4 bit5-9 ��Ʒ��ȴ0-4 + // Common cooldown mask bit0-4 skill cooldown 0-4 bit5-9 item cooldown 0-4 + public int commoncooldowntime; // ��ȴʱ�䣬��λ���� // Cooldown time in milliseconds + + public int itemcost; // �ͷ�ʱ������Ʒ >0��Ч // Item cost when casting, effective if >0 + + // ������� // Combo related + public int combosk_preskill; + public int combosk_interval; + public int combosk_nobreak; + + public string effect; + public string aerial_effect; + + public Range range; + public bool has_stateattack; + + public List restrict_weapons = new List(); + public static Dictionary map = new Dictionary(); + public static Dictionary GetMap() => map; + public static Dictionary> comboSkillMap = new Dictionary>(); + public static Dictionary> GetComboSkMap() => comboSkillMap; + + public static Dictionary> inheritSkillMap = new Dictionary>(); + + /*#if UNITY_EDITOR + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] + private static void OnPlay() + { + BMLogger.LogError("SkillStub OnPlay Reset"); + map = new Dictionary(); + comboSkillMap = new Dictionary>(); + inheritSkillMap = new Dictionary>(); + } + #endif*/ + public SkillStub(uint i) + { + id = i; + is_inherent = (false); + is_movingcast = (false); + itemcost = (0); + combosk_preskill = (0); + combosk_interval = (0); + combosk_nobreak = (0); + if (GetStub(id) == null) + { + GetMap().Add(id, this); + } + } + public static List GetInherentSkillList(uint cls) + { + return inheritSkillMap[cls]; + } + + public static SkillStub GetStub(uint i) + { + return GetMap().TryGetValue(i, out var stub) ? stub : null; + } + public int GetItemCost() { return itemcost; } + public static void InitStaticData() + { + var map = GetMap(); + foreach (var skill in map) + { + SkillStub sk = skill.Value; + if (sk.is_inherent) GetInherentSkillList((uint)sk.cls).Add(sk.id); + if (sk.combosk_preskill > 0) GetComboSkMap()[(uint)sk.combosk_preskill].Add(sk.id); + } + } + + public List GetPostComboSkill(uint id) + { + var m = GetComboSkMap(); + if (m.TryGetValue(id, out var list)) return list; + return null; + } + + // ����Ϊ��C++ת���Ľӿ� // The following methods are converted from C++ + public uint GetId() { return id; } + public int GetCls() { return cls; } + public string GetName() { return name; } + public string GetIcon() { return icon; } + public int GetMaxLevel() { return max_level; } + public Range GetRange() { return range; } + public bool IsMovingSkill() { return is_movingcast; } + public byte GetType() { return type; } // ����System.Object.GetType // Hide System.Object.GetType + + // ����ʱ����麯�� // Runtime-related virtual functions + public virtual int GetCoolingtime(Skill skill) { return 5000; } + public virtual int GetRequiredSp(Skill skill) { return 0; } + public virtual int GetRequiredLevel(Skill skill) { return 0; } + public virtual int GetMaxAbility(Skill skill) { return 0; } + public virtual int GetRequiredItem(Skill skill) { return 0; } + public virtual int GetRequiredMoney(Skill skill) { return 0; } + public virtual int GetRequiredRealmLevel(Skill skill) { return 0; } + public virtual float GetPraydistance(Skill skill) { return 0f; } + public virtual float GetMpcost(Skill skill) { return 0f; } + public virtual int GetExecutetime(Skill skill) { return 1000; } + public virtual bool CheckHpCondition(int hp, int max_hp) { return true; } + public virtual bool CheckComboSkExtraCondition(Skill skill) { return true; } + public virtual int GetIntroduction(Skill skill, ushort[] descBuffer, int descBufferLen, ushort[] titleBuffer) { return 0; } + + // ������Ч�Լ�� // Validate weapon restriction + public bool ValidWeapon(int weapon) + { + if (restrict_weapons != null) + { + int i; + for (i = 0; i < restrict_weapons.Count; i++) + { + if (weapon == restrict_weapons[i]) + return true; + } + if (i > 0 && i >= restrict_weapons.Count) + return false; + } + return true; + } + } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Skills/skill7.cs b/Assets/PerfectWorld/Scripts/Skills/skill7.cs index e97f7e5a02..c5803e8f7c 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill7.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill7.cs @@ -168,3 +168,4 @@ namespace BrewMonster + diff --git a/Assets/PerfectWorld/Scripts/Skills/skill8.cs b/Assets/PerfectWorld/Scripts/Skills/skill8.cs index e931bdad75..4e1c5570c5 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill8.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill8.cs @@ -169,3 +169,4 @@ namespace BrewMonster + diff --git a/Assets/PerfectWorld/Scripts/Skills/skill9.cs b/Assets/PerfectWorld/Scripts/Skills/skill9.cs index dd045552dd..8b6b383d92 100644 --- a/Assets/PerfectWorld/Scripts/Skills/skill9.cs +++ b/Assets/PerfectWorld/Scripts/Skills/skill9.cs @@ -100,3 +100,4 @@ namespace BrewMonster + diff --git a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs index 496220c2dc..d3b94653b2 100644 --- a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs +++ b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs @@ -14,7 +14,7 @@ namespace BrewMonster.UI protected Canvas m_canvas; protected Dictionary m_StringTable = new Dictionary(); protected Dictionary m_auiDialog_stringTable = new Dictionary(); - protected Dictionary m_DlgName = new Dictionary(); + public Dictionary m_DlgName = new Dictionary(); public string GetStringFromTable(int idString) { diff --git a/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs new file mode 100644 index 0000000000..48861f76a9 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs @@ -0,0 +1,28 @@ +using BrewMonster.UI; +using UnityEngine; +using static CECUIManager; + +namespace BrewMonster +{ + public class CDlgMessageBox : AUIDialog + { + [SerializeField] private TMPro.TextMeshProUGUI titleText; + [SerializeField] private TMPro.TextMeshProUGUI messageText; + [SerializeField] private UnityEngine.UI.Button okButton; + private void Awake() + { + okButton.onClick.AddListener(OnOkClicked); + } + private void OnOkClicked() + { + EventBus.Publish(new MessageBoxEvent(1,this)); + Show(false); + } + public void ShowMessageBox(string title, string message) + { + SetName(title); + messageText.text = message; + Show(true); + } + } +} diff --git a/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs.meta b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs.meta new file mode 100644 index 0000000000..f8c0de59e3 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/CDlgMessageBox.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 6672523dc3dacfa46b2104f504acdb6e \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs index 58717de5d1..18b072a9ef 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs @@ -13,13 +13,28 @@ namespace BrewMonster.UI protected uint m_dwData; protected object m_pvData; protected AUIManager m_pAUIManager = null; + string m_szName; public virtual void Show(bool value) { gameObject.SetActive(value); OnShowDialogue(); } + public string GetName() + { + return m_szName; + } + public bool SetName(string pszName) + { + if (m_pAUIManager.m_DlgName[pszName]) + return false; + m_pAUIManager.m_DlgName.Remove(m_szName); + m_szName = pszName; + m_pAUIManager.m_DlgName[m_szName] = this; + + return true; + } public void SetData(uint dwData, string strName) { m_strDataName = strName; @@ -83,22 +98,22 @@ namespace BrewMonster.UI public virtual void OnEnable() { - + } public virtual void OnDisable() { - + } public virtual void Awake() { - + } public virtual void Start() { - + } public virtual void Update() @@ -107,7 +122,7 @@ namespace BrewMonster.UI } public virtual void OnShowDialogue() { - + } public virtual bool Render() diff --git a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs index e47f8b773f..319c21665d 100644 --- a/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs +++ b/Assets/PerfectWorld/Scripts/UI/GamePlay/SkillUI/CDlgSkillSubListItem.cs @@ -1,4 +1,5 @@ using BrewMonster.Scripts.Skills; +using BrewMonster.UI; using System; using TMPro; using UnityEngine; @@ -23,6 +24,95 @@ namespace BrewMonster private const string l_colorRed = ""; private const string l_colorClose = ""; + private void Awake() + { + m_upgradeBtn.onClick.AddListener(OnCommand_Upgrade); + + } + + private void OnCommand_Upgrade() + { + CECHostPlayer player = GetHostPlayer(); + + if (player == null) + { + return; + } + var uiManager = CECUIManager.Instance; + var gameUIMan = uiManager.GetInGameUIMan(); + if (player.IsDead() || + player.IsSitting() || + player.IsChangingFace() || + player.IsTrading() || + player.GetBoothState() != 0 || + player.IsRooting() || + player.IsHangerOn() || + player.GetCurSkill() != null || + player.IsFighting()) + { + uiManager.ShowMessageBox("MessageBox", gameUIMan.GetStringFromTable(11327)); + } + + int nCondition = CECHostSkillModel.Instance.CheckLearnCondition(m_skillID); + int nCheckCode = 0; + if (1 == nCondition) + { + nCheckCode = 270; + } + else if (6 == nCondition) + { + nCheckCode = 527; + } + else if (7 == nCondition) + { + nCheckCode = 541; + } + else if (8 == nCondition) + { + nCheckCode = 271; + } + else if (9 == nCondition) + { + nCheckCode = 556; + } + else if (10 == nCondition) + { + nCheckCode = 557; + } + else if (12 == nCondition) + { + nCheckCode = 11168; + } + else + { + BMLogger.LogError("CheckLearnCondition: " + (nCheckCode == 0)); + } + if (nCheckCode == 0) + { + int needMoney = CECHostSkillModel.Instance.GetSkillMoney(m_skillID, m_curLevel + 1); + int needSp = CECHostSkillModel.Instance.GetSkillSp(m_skillID, m_curLevel + 1); + + string str = string.Format(GetStringFromTable(11326), needMoney, needSp); + + uiManager.ShowMessageBox("Game_LearnSkill", str); + //GetGameUIMan()->MessageBox("Game_LearnSkill", str, //GetGameUIMan()->GetStringFromTable(231), + // MB_OKCANCEL, A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox); + //pMsgBox->SetData(m_skillID); + + // ����򿪶Ի���ʱ��NPC���͵�Hello��Ϣû���յ��ظ������ٴη��� + /* if (!gameUIMan.m_pDlgSkillAction.IsReceivedNPCGreeting()) + { + CECHostSkillModel::Instance().SendHelloToSkillLearnNPC(); + }*/ + } + else + { + /* GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(nCheckCode), MB_OK, + A3DCOLORRGBA(255, 255, 255, 160), &pMsgBox); + pMsgBox->SetLife(3);*/ + } + } + public void UpdateSkill(int skillID) { CECHostSkillModel model = CECHostSkillModel.Instance; @@ -46,15 +136,15 @@ namespace BrewMonster if (enumSkillLearnedState.SKILL_NOT_LEARNED == learnedState) { skillIcon.color = Color.gray; - /* skillDsc = model.GetSkillDescription(m_skillID, 1); - reqLevel = GNET::ElementSkill::GetRequiredLevel(m_skillID, 1); - reqRealmLevel = GNET::ElementSkill::GetRequiredRealmLevel(m_skillID, 1);*/ + /* skillDsc = model.GetSkillDescription(m_skillID, 1); + reqLevel = GNET::ElementSkill::GetRequiredLevel(m_skillID, 1); + reqRealmLevel = GNET::ElementSkill::GetRequiredRealmLevel(m_skillID, 1);*/ } else { - /* skillDsc = model.GetSkillDescription(m_skillID, m_curLevel); - reqLevel = GNET::ElementSkill::GetRequiredLevel(m_skillID, m_curLevel); - reqRealmLevel = GNET::ElementSkill::GetRequiredRealmLevel(m_skillID, m_curLevel);*/ + /* skillDsc = model.GetSkillDescription(m_skillID, m_curLevel); + reqLevel = GNET::ElementSkill::GetRequiredLevel(m_skillID, m_curLevel); + reqRealmLevel = GNET::ElementSkill::GetRequiredRealmLevel(m_skillID, m_curLevel);*/ } string skillName = model.GetSkillName(m_skillID); @@ -108,11 +198,11 @@ namespace BrewMonster if (spOK && moneyOK && preSkillOK) { - m_upgradeBtn.interactable = true; + m_upgradeBtn.interactable = true; } else { - m_upgradeBtn.interactable = (false); + m_upgradeBtn.interactable = (false); } /*string strSp; diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 42635d392b..e30af6116b 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -502,6 +502,8 @@ namespace BrewMonster case int value when value == EC_MsgDef.MSG_PM_PLAYERGATHER: OnMsgPlayerGather(Msg); break; case int value when value == EC_MsgDef.MSG_HST_COOLTIMEDATA: OnMsgHstCoolTimeData(Msg); break; case int value when value == EC_MsgDef.MSG_HST_SETCOOLTIME: OnMsgHstSetCoolTime(Msg); break; + case int value when value == EC_MsgDef.MSG_HST_LEARNSKILL: OnMsgHstLearnSkill(Msg); break; + } @@ -525,6 +527,53 @@ namespace BrewMonster }*/ } + private void OnMsgHstLearnSkill(ECMSG Msg) + { + BMLogger.LogError("OnMsgHstLearnSkill"); + cmd_learn_skill pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); + + CECSkill pSkill = GetNormalSkill(pCmd.skill_id); + if (pSkill != null) + { + if (pCmd.skill_level > 0) + { + pSkill.LevelUp(); + ElementSkill.SetLevel((uint)pCmd.skill_id, pCmd.skill_level); + } + else + { + RemoveNormalSkill(pCmd.skill_id); + } + } + else if (pCmd.skill_level > 0) + { + pSkill = new CECSkill(pCmd.skill_id, pCmd.skill_level); + if (pSkill == null) + { + Debug.Assert(pSkill != null); + return; + } + + if (!pSkill.GetJunior().Empty()) + { + ReplaceJuniorSkill(pSkill); + } + else + { + if (pSkill.GetType() != (int)CECSkill.SkillType.TYPE_PASSIVE && + pSkill.GetType() != (int)CECSkill.SkillType.TYPE_PRODUCE && + pSkill.GetType() != (int)CECSkill.SkillType.TYPE_LIVE) + m_aPtSkills.Add(pSkill); + else + m_aPsSkills.Add(pSkill); + } + + ElementSkill.SetLevel((uint)pCmd.skill_id, pCmd.skill_level); + } + + CECHostSkillModel.Instance.OnLearnSkill(pCmd.skill_id, pCmd.skill_level); + } + private void OnMsgHstSetCoolTime(ECMSG Msg) { BMLogger.LogError("HoangDev : OnMsgHstSetCoolTime "); @@ -5080,7 +5129,7 @@ namespace BrewMonster // } // UpdateMonsterSpiritGfx(dwDeltaTime); } - public byte GetRealmLevel(){ return m_RealmLevel; } + public byte GetRealmLevel() { return m_RealmLevel; } // Level up public void LevelUp() @@ -5292,7 +5341,7 @@ namespace BrewMonster } // Can jump or take off in water ? - bool IsSitting() + public bool IsSitting() { return (m_dwStates & PlayerNPCState.GP_STATE_SITDOWN) != 0 ? true : false; } @@ -6133,5 +6182,161 @@ namespace BrewMonster } } } + + // Remove skill reference / 删除技能引用 + void RemoveSkillReference(int idSkill) + { + if (idSkill <= 0) return; + + // Remove reference to self skill / 删除对技能的引用 + if (m_pPrepSkill != null && m_pPrepSkill.GetSkillID() == idSkill) + m_pPrepSkill = null; + + if (m_pCurSkill != null && m_pCurSkill.GetSkillID() == idSkill) + m_pCurSkill = null; + + if (m_pComboSkill != null && m_pComboSkill.FindSkillID(idSkill)) + ClearComboSkill(); + + if (m_pWorkMan != null) + { + CECHPWork pWork = m_pWorkMan.GetWork(CECHPWork.Host_work_ID.WORK_TRACEOBJECT); + if (pWork != null) + { + CECHPWorkTrace pWorkTrace = pWork as CECHPWorkTrace; + if (pWorkTrace != null && + pWorkTrace.GetTraceReason() == CECHPWorkTrace.Trace_reason.TRACE_SPELL && + pWorkTrace.GetPrepSkill() != null && + pWorkTrace.GetPrepSkill().GetSkillID() == idSkill) + pWorkTrace.Reset(); + } + } + + int i; + + for (i = 0; i < HostCfgConstants.NUM_HOSTSCSETS1; i++) + { + if (m_aSCSets1[i] != null) + m_aSCSets1[i].RemoveSkillShortcut(idSkill); + } + for (i = 0; i < HostCfgConstants.NUM_HOSTSCSETS2; i++) + { + if (m_aSCSets2[i] != null) + m_aSCSets2[i].RemoveSkillShortcut(idSkill); + } + } + + // Remove skill / 删除技能 + void RemoveNormalSkill(int idSkill) + { + // Delete equipped skills / 删除装备技能 + + if (idSkill <= 0) return; + + RemoveSkillReference(idSkill); + + // Delete skill list pointer / 删除技能列表指针 + int i; + + for (i = 0; i < m_aPtSkills.Count; i++) + { + if (m_aPtSkills[i].GetSkillID() == idSkill) + { + m_aPtSkills.RemoveAt(i); + return; + } + } + + for (i = 0; i < m_aPsSkills.Count; i++) + { + if (m_aPsSkills[i].GetSkillID() == idSkill) + { + m_aPsSkills.RemoveAt(i); + return; + } + } + + for (i = 0; i < m_aGoblinSkills.Count; i++) + { + if (m_aGoblinSkills[i].GetSkillID() == idSkill) + { + m_aGoblinSkills.RemoveAt(i); + return; + } + } + } + + // Clear combo skill / 清除连击技能 + void ClearComboSkill() + { + if (m_pComboSkill != null) + { + m_pComboSkill = null; + } + } + + // Replace specified skill with it's senior skill / 用高级技能替换指定的低级技能 + void ReplaceJuniorSkill(CECSkill pSeniorSkill) + { + if (pSeniorSkill == null) + { + Debug.Assert(pSeniorSkill != null); + return; + } + SkillArrayWrapper juniorArray = pSeniorSkill.GetJunior(); + if (juniorArray.Empty()) + { + Debug.Assert(false); + return; + } + + int i; + + // Update shortcuts ... / 更新快捷方式... + for (i = 0; i < HostCfgConstants.NUM_HOSTSCSETS1; i++) + { + if (m_aSCSets1[i] != null) + m_aSCSets1[i].ReplaceSkillID(juniorArray, pSeniorSkill); + } + + for (i = 0; i < HostCfgConstants.NUM_HOSTSCSETS2; i++) + { + if (m_aSCSets2[i] != null) + m_aSCSets2[i].ReplaceSkillID(juniorArray, pSeniorSkill); + } + + // Update skill groups ... / 更新技能组... + // Note: Combo skill update logic may need to be added here + // Original C++ code had EC_VIDEO_SETTING and combo skill group logic + } + + public int CheckSkillLearnCondition(int idSkill, bool bCheckBook) + { + int iLevel = 1; + CECSkill pSkill = GetNormalSkill(idSkill); + if (pSkill !=null) + iLevel = pSkill.GetSkillLevel() + 1; + + if (iLevel == 1 && bCheckBook) + { + // Do we have the skill book ? + int idBook = ElementSkill.GetRequiredBook((uint)idSkill, iLevel); + if (idBook != 0 /*&& m_pPack.FindItem(idBook) < 0*/) + return 8; + } + + // Build player information + LearnRequirement Info; + + Info.level = GetMaxLevelSofar(); + Info.sp = m_BasicProps.iSP; + Info.money = m_iMoneyCnt; + Info.profession = m_iProfession; + Info.rank = m_BasicProps.iLevel2; + Info.realm_level = GetRealmLevel(); + + return ElementSkill.LearnCondition((uint)idSkill, Info, iLevel); + } } + } diff --git a/Assets/Scripts/CECUIManager.cs b/Assets/Scripts/CECUIManager.cs index d8ce95727f..bd8c3cc58b 100644 --- a/Assets/Scripts/CECUIManager.cs +++ b/Assets/Scripts/CECUIManager.cs @@ -1,10 +1,12 @@ -using System; -using System.Collections.Generic; using BrewMonster; using BrewMonster.Network; using BrewMonster.UI; +using CSNetwork; +using System; +using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; +using UnityEngine.UIElements; public class CECUIManager : MonoSingleton { @@ -22,14 +24,16 @@ public class CECUIManager : MonoSingleton [SerializeField] private Canvas canvasDlg; [SerializeField] private CDlgQuickBar cDlgQuickBar; - [SerializeField] private Button btnSecondClick; + [SerializeField] private UnityEngine.UI.Button btnSecondClick; [SerializeField] CDlgQuickBar m_pDlgQuickBar1; + CDlgMessageBox m_pDlgMessageBox; protected override void Awake() { base.Awake(); EventBus.Subscribe(ShowUINPC); EventBus.Subscribe(TryHideUINPC); + EventBus.Subscribe(OnMessageBox); gameUI = new CECGameUIMan(); gameUI.SetDependency(dialogResouce, canvasDlg); @@ -97,6 +101,77 @@ public class CECUIManager : MonoSingleton Debug.LogWarning($"Không tìm thấy UI {componentName} đã spawn trong canvasDlg. Type found: {(type != null ? type.FullName : "null")}"); } + public void ShowMessageBox(string title, string message) + { + var msgBox = GetInGameUIMan().GetDialog("DlgMessageBox") as CDlgMessageBox; + if (msgBox != null) + { + msgBox.ShowMessageBox(title, message); + } + else + { + Debug.LogError("DlgMessageBox not found in InGameUIMan"); + } + } + + private void OnMessageBox(MessageBoxEvent messageBoxEvent) + { + int iRetVal = messageBoxEvent.iRetVal; + AUIDialog pDlg = messageBoxEvent.pDlg; + + if (pDlg == m_pDlgMessageBox) + { + OnNewMessageBox(iRetVal); + return; + } + + UnityGameSession pSession = UnityGameSession.Instance; + CECHostPlayer pHost = CECGameRun.Instance.GetHostPlayer(); + + if (string.Equals(pDlg.GetName(), "Game_Quit", StringComparison.OrdinalIgnoreCase)) + { + + } + else if ((string.Equals(pDlg.GetName(), "Game_TeachSkill", StringComparison.OrdinalIgnoreCase) && DialogBoxCommandIDs.IDOK == iRetVal) || + (string.Equals(pDlg.GetName(), "Game_LearnSkill", StringComparison.OrdinalIgnoreCase) && DialogBoxCommandIDs.IDOK == iRetVal)) + { + if (string.Equals(pDlg.GetName(), "Game_TeachSkill", StringComparison.OrdinalIgnoreCase)) + { + + } + + else if (string.Equals(pDlg.GetName(), "Game_LearnSkill", StringComparison.OrdinalIgnoreCase)) + { + int skillID = (int)pDlg.GetData(); + int nCondition = pHost.CheckSkillLearnCondition(skillID, true); + + if (0 == nCondition) + { + UnityGameSession.c2s_SendCmdNPCSevLearnSkill(skillID); + } + /*else if (1 == nCondition) + AddChatMessage(GetStringFromTable(270), GP_CHAT_MISC); + else if (6 == nCondition) + AddChatMessage(GetStringFromTable(527), GP_CHAT_MISC); + else if (7 == nCondition) + AddChatMessage(GetStringFromTable(541), GP_CHAT_MISC); + else if (8 == nCondition) + AddChatMessage(GetStringFromTable(271), GP_CHAT_MISC); + else if (9 == nCondition) + AddChatMessage(GetStringFromTable(556), GP_CHAT_MISC); + else if (10 == nCondition) + AddChatMessage(GetStringFromTable(557), GP_CHAT_MISC); + else if (12 == nCondition) + AddChatMessage(GetStringFromTable(11168), GP_CHAT_MISC);*/ + } + + } + } + + private bool OnNewMessageBox(int iRetVal) + { + return true; + } private System.Type FindTypeByName(string componentName) { @@ -270,4 +345,14 @@ public class CECUIManager : MonoSingleton } } } + public struct MessageBoxEvent + { + public int iRetVal; + public AUIDialog pDlg; + public MessageBoxEvent(int retVal, AUIDialog dlg) + { + iRetVal = retVal; + pDlg = dlg; + } + } } \ No newline at end of file diff --git a/Assets/Scripts/DialogBoxCommandIDs.cs b/Assets/Scripts/DialogBoxCommandIDs.cs new file mode 100644 index 0000000000..d4a5323173 --- /dev/null +++ b/Assets/Scripts/DialogBoxCommandIDs.cs @@ -0,0 +1,19 @@ +/* + * Dialog Box Command IDs + * Converted from Windows API definitions + */ +public static class DialogBoxCommandIDs +{ + public const int IDOK = 1; + public const int IDCANCEL = 2; + public const int IDABORT = 3; + public const int IDRETRY = 4; + public const int IDIGNORE = 5; + public const int IDYES = 6; + public const int IDNO = 7; + public const int IDCLOSE = 8; + public const int IDHELP = 9; + public const int IDTRYAGAIN = 10; + public const int IDCONTINUE = 11; + public const int IDTIMEOUT = 32000; +} diff --git a/Assets/Scripts/DialogBoxCommandIDs.cs.meta b/Assets/Scripts/DialogBoxCommandIDs.cs.meta new file mode 100644 index 0000000000..39f567a7b4 --- /dev/null +++ b/Assets/Scripts/DialogBoxCommandIDs.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d1c0dbd48a553e9498f6b0d391ec9707 \ No newline at end of file diff --git a/Assets/Scripts/EC_GPDataType.cs b/Assets/Scripts/EC_GPDataType.cs index 708096795b..55f15a70eb 100644 --- a/Assets/Scripts/EC_GPDataType.cs +++ b/Assets/Scripts/EC_GPDataType.cs @@ -120,5 +120,13 @@ namespace BrewMonster offset += size; } } + + // Learn skill command / 学习技能命令 + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_learn_skill + { + public int skill_id; // Skill ID / 技能ID + public int skill_level; // Skill level / 技能等级 + } }