From 38348f8e10cfa3a10129c68628bf0d558f33c6e4 Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Mon, 5 Jan 2026 09:27:00 +0700 Subject: [PATCH] add and show mining progress run with real time --- Assets/PerfectWorld/Prefab/UI/General.meta | 8 + .../Prefab/UI/General/DlgHost.prefab | 50 ++ .../Prefab/UI/General/DlgHost.prefab.meta | 7 + .../Prefab/UI/General/Win_Prgs2.prefab | 541 ++++++++++++++++++ .../Prefab/UI/General/Win_Prgs2.prefab.meta | 7 + .../UI/DialogScriptTableObject.asset | 4 + .../Scripts/UI/Dialogs/AUIDialog.cs | 10 + .../Scripts/UI/Dialogs/DlgHost.cs | 123 ++++ .../Scripts/UI/Dialogs/DlgHost.cs.meta | 2 + .../Scripts/UI/Dialogs/DlgWinPrgs2.cs | 30 + .../Scripts/UI/Dialogs/DlgWinPrgs2.cs.meta | 2 + Assets/Scripts/CECHostPlayer.cs | 170 +++++- Assets/Scripts/CECUIManager.cs | 2 + 13 files changed, 949 insertions(+), 7 deletions(-) create mode 100644 Assets/PerfectWorld/Prefab/UI/General.meta create mode 100644 Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab create mode 100644 Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab.meta create mode 100644 Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab create mode 100644 Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab.meta create mode 100644 Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs create mode 100644 Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs.meta create mode 100644 Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs create mode 100644 Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs.meta diff --git a/Assets/PerfectWorld/Prefab/UI/General.meta b/Assets/PerfectWorld/Prefab/UI/General.meta new file mode 100644 index 0000000000..0c53028c91 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/General.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 116ed3d1e0ef6f040acab9378fbe4fad +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab b/Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab new file mode 100644 index 0000000000..6d46bbdb7e --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab @@ -0,0 +1,50 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6032603119232429246 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8719383145939716431} + - component: {fileID: 3570251765210904899} + m_Layer: 5 + m_Name: DlgHost + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8719383145939716431 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6032603119232429246} + 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: 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 &3570251765210904899 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6032603119232429246} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 11e80692643c0ff4ca58d76679b26327, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab.meta b/Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab.meta new file mode 100644 index 0000000000..cebf627654 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/General/DlgHost.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8350aa55906d08448bb47e10a473ca61 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab b/Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab new file mode 100644 index 0000000000..1e5b7cc902 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab @@ -0,0 +1,541 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &874343250186730391 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2000867345168672731} + m_Layer: 5 + m_Name: Fill Area + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2000867345168672731 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 874343250186730391} + 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: 6818571886471270641} + m_Father: {fileID: 6752023868063132973} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: -5, y: 0} + m_SizeDelta: {x: -20, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &977375840943150650 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9117663038715356283} + - component: {fileID: 7167547738905977378} + m_Layer: 5 + m_Name: Win_Prgs2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9117663038715356283 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 977375840943150650} + 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: 4072511356465673856} + m_Father: {fileID: 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 &7167547738905977378 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 977375840943150650} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 57d74d19ef3b2c44fbb72ec587caa705, type: 3} + m_Name: + m_EditorClassIdentifier: + progressSlider: {fileID: 4511831382827661534} + progressText: {fileID: 4983346202533902944} +--- !u!1 &1594317373880026392 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1037508319488102731} + - component: {fileID: 4978542109480888980} + - component: {fileID: 8027776737710957383} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1037508319488102731 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1594317373880026392} + 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: 6752023868063132973} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.25} + m_AnchorMax: {x: 1, y: 0.75} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4978542109480888980 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1594317373880026392} + m_CullTransparentMesh: 1 +--- !u!114 &8027776737710957383 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1594317373880026392} + 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: 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!1 &4972412303353532354 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4072511356465673856} + - component: {fileID: 2367954143517714233} + - component: {fileID: 8929200823718496348} + m_Layer: 5 + m_Name: BG + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4072511356465673856 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4972412303353532354} + 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: 6752023868063132973} + m_Father: {fileID: 9117663038715356283} + 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!222 &2367954143517714233 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4972412303353532354} + m_CullTransparentMesh: 1 +--- !u!114 &8929200823718496348 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4972412303353532354} + m_Enabled: 0 + 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: 0 + 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!1 &5268483250871520365 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6818571886471270641} + - component: {fileID: 208921228956184917} + - component: {fileID: 7529183553295306538} + m_Layer: 5 + m_Name: Fill + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6818571886471270641 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5268483250871520365} + 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: 2000867345168672731} + 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: 10, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &208921228956184917 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5268483250871520365} + m_CullTransparentMesh: 1 +--- !u!114 &7529183553295306538 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5268483250871520365} + 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: 10905, 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!1 &6184127327699476220 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2731797878088259642} + - component: {fileID: 1112745610285620432} + - component: {fileID: 4983346202533902944} + m_Layer: 5 + m_Name: ProgressLabel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2731797878088259642 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6184127327699476220} + 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: 6752023868063132973} + 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.000091552734} + m_SizeDelta: {x: 0, y: -12.2774} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1112745610285620432 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6184127327699476220} + m_CullTransparentMesh: 1 +--- !u!114 &4983346202533902944 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6184127327699476220} + 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: New 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: 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: 6.9 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 3.9 + 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: 1 + 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 &6667873410386005838 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6752023868063132973} + - component: {fileID: 4511831382827661534} + m_Layer: 5 + m_Name: Slider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6752023868063132973 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6667873410386005838} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 3.095, y: 3.095, z: 3.095} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1037508319488102731} + - {fileID: 2000867345168672731} + - {fileID: 2731797878088259642} + m_Father: {fileID: 4072511356465673856} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 82} + m_SizeDelta: {x: 160, y: 20} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &4511831382827661534 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6667873410386005838} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 67db9e8f0e2ae9c40bc1e2b64352a6b4, 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: 0 + m_TargetGraphic: {fileID: 0} + m_FillRect: {fileID: 6818571886471270641} + m_HandleRect: {fileID: 0} + m_Direction: 0 + m_MinValue: 0 + m_MaxValue: 1 + m_WholeNumbers: 0 + m_Value: 0 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab.meta b/Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab.meta new file mode 100644 index 0000000000..219d2f3eb7 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/UI/General/Win_Prgs2.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 51bad2e6d1ec69a4683135ce85288faa +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index 31f1cdb26a..415919ac8c 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -23,3 +23,7 @@ MonoBehaviour: prefab: {fileID: 6999114045547682248, guid: 8027cada0ef5e4a9f827001b4747174d, type: 3} - id: Win_SkillSubAction prefab: {fileID: 111271885693053298, guid: eb88919320b4229459c83b6b1f8f1e7b, type: 3} + - id: Win_Prgs2 + prefab: {fileID: 977375840943150650, guid: 51bad2e6d1ec69a4683135ce85288faa, type: 3} + - id: Win_Hpmpxp + prefab: {fileID: 6032603119232429246, guid: 8350aa55906d08448bb47e10a473ca61, type: 3} diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs index e437bf2489..58717de5d1 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs @@ -100,9 +100,19 @@ namespace BrewMonster.UI { } + + public virtual void Update() + { + Render(); + } public virtual void OnShowDialogue() { } + + public virtual bool Render() + { + return false; + } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs new file mode 100644 index 0000000000..ef364fe45f --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs @@ -0,0 +1,123 @@ +using UnityEngine; + +namespace BrewMonster.UI +{ + //Win_Hpmpxp + public class DlgHost : AUIDialog + { + public const int AUIPROGRESS_MAX = 100; + private DlgWinPrgs2 _dlgWinPrgs; + private CECHostPlayer _pHost; + + public override bool Render() + { + // if( m_szName == "Win_Hpmpxp" ) + // RefreshHostStats(); + // else if (m_szName == "Win_HideHP") + // { + // a_LogOutput(1,"[Dat Mine] Win_HideHP"); + RefreshStatusBar(); + // } + + return base.Render(); + } + + public void RefreshStatusBar() + { + bool bActive = true; + // if( GetGameUIMan()->GetActiveDialog() && + // GetGameUIMan()->GetActiveDialog()->GetFocus() && + // GetGameUIMan()->GetActiveDialog()->GetFocus()->GetType() == AUIOBJECT_TYPE_EDITBOX ) + // bActive = false; + // + // // Flight bar. + // RefreshFlightBar(bActive); + // + // // Oxigen bar. + // RefreshOxigenBar(bActive); + + // Gather bar. + RefreshGatherBar(bActive); + + // // group these bars, show only one at one time + // bool bShow = false; + // // Power bar. + // bShow |= RefreshPowerBar(bShow, bActive); + // // Array bar. + // bShow |= RefreshArrayBar(bShow, bActive); + // // Incant bar. + // bShow |= RefreshIncantBar(bShow, bActive); + // + // if (GetHostPlayer()->GetCurSkill() && !bShow) + // { + // // ´«Ë͵ȷ½Ê½µ¼ÖÂλÖÃÇл»¡¢¼¼ÄÜ£¨Õó¼¼ÄÜ£©ÈÔÈ»ÔÚÊÍ·Å״̬ + // // + // GetGameSession()->c2s_CmdCancelAction(); + // } + // + // // AutoHP bar. + // RefreshAutoHPBar(bActive); + // + // // AutoMP bar. + // RefreshAutoMPBar(bActive); + // + // // pet status + // RefreshPetStatus(); + // + // //ELF status + // RefreshElfStatus(); + } + + private bool RefreshGatherBar(bool bActive) + { + if (_dlgWinPrgs == null) + { + var pDlg = GetGameUIMan().GetDialog("Win_Prgs2"); + if (pDlg == null) + { + BMLogger.LogError("Null Win_Prgs2"); + return false; + } + + if (pDlg is not DlgWinPrgs2 dlgWinPrgs) + { + BMLogger.LogError("Can not cast Win_Prgs2"); + return false; + } + _dlgWinPrgs = dlgWinPrgs; + } + + if (_pHost == null) + { + _pHost = GetHostPlayer(); + if (_pHost == null) return false; + } + + CECCounter counter = _pHost.GetGatherCnt(); + if (_pHost.IsGathering()) + { + Debug.LogError($"Counter: {counter.GetCounter()}"); + int nCur = (int)counter.GetCounter(); + int nMax = Mathf.Max((int)counter.GetPeriod(), 1); + + if (!_dlgWinPrgs.IsShow()) + _dlgWinPrgs.Show(bActive);//true, false, bActive + + // PAUIPROGRESS pProgress = (PAUIPROGRESS)pDlg.GetDlgItem("Prgs"); + // PAUILABEL pLabel = (PAUILABEL)pDlg.GetDlgItem("1"); + + var percent = AUIPROGRESS_MAX * nCur / nMax; + _dlgWinPrgs.SetProgressAndText(percent,$"{percent}%"); + // pLabel.SetText(percent); + // pProgress.SetProgress(AUIPROGRESS_MAX * nCur / nMax); + } + else + { + if (_dlgWinPrgs.IsShow()) + _dlgWinPrgs.Show(false); + } + + return _dlgWinPrgs.IsShow(); + } + } +} diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs.meta b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs.meta new file mode 100644 index 0000000000..7734322bc1 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgHost.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 11e80692643c0ff4ca58d76679b26327 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs new file mode 100644 index 0000000000..d610c727aa --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace BrewMonster.UI +{ + //Win_Prgs2 + public class DlgWinPrgs2 : AUIDialog + { + [SerializeField] private Slider progressSlider; // Slider bar + [SerializeField] private TMPro.TextMeshProUGUI progressText; // Progress text + + /// + /// Set the slider's value and text at the same time + /// + /// Progress percentage (0~1) + /// + public void SetProgressAndText(float value, string text) + { + if (progressSlider != null) + { + progressSlider.value = Mathf.Clamp01(value); + } + + if (progressText != null) + { + progressText.text = text; + } + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs.meta b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs.meta new file mode 100644 index 0000000000..d9d7fec844 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgWinPrgs2.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 57d74d19ef3b2c44fbb72ec587caa705 \ No newline at end of file diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 5636f0de10..cf29575b9a 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -320,6 +320,8 @@ namespace BrewMonster // track status of Task TickTask(); + // Update timers + UpdateTimers(Time.deltaTime); m_pWorkMan?.Tick(Time.deltaTime); @@ -5031,15 +5033,13 @@ namespace BrewMonster } // Is gathering resources - bool IsGathering() + public bool IsGathering() { + if(m_pWorkMan == null) return false; + CECHPWork pWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_PICKUP); + if (pWork != null) + return ((EC_HPWorkPick)pWork).IsGather(); return false; - // TODO: fix later - //CECHPWork pWork = m_pWorkMan.GetRunningWork(Host_work_ID.WORK_PICKUP); - //if (pWork != null) - // return (pWork as CECHPWorkPick).IsGather(); - //else - // return false; } // Is using item ? @@ -5616,5 +5616,161 @@ namespace BrewMonster } } } + public CECCounter GetGatherCnt() { return m_GatherCnt; } + // Update time counters + private void UpdateTimers(float dwDeltaTime) + { + // // Get real time tick of this frame + var iRealTime = EC_Game.GetRealTickTime(); + // + // // Update flysword time + // if (IsFlying() && GetRushFlyFlag()) + // { + // CECIvtrItem* pItem = m_pEquipPack->GetItem(EQUIPIVTR_FLYSWORD); + // ASSERT(pItem); + // + // if (pItem->GetClassID() == CECIvtrItem::ICID_FLYSWORD) + // { + // CECIvtrFlySword* pFlySword = (CECIvtrFlySword*)pItem; + // pFlySword->TimePass(iRealTime); + // } + // } + // + // int i; + // + // // Update skills + // for (i=0; i < m_aPtSkills.GetSize(); i++) + // m_aPtSkills[i]->Tick(); + // + // for (i=0; i < m_aPsSkills.GetSize(); i++) + // m_aPsSkills[i]->Tick(); + // + // for (i=0; i < m_aGoblinSkills.GetSize(); i++) + // m_aGoblinSkills[i]->Tick(); + // + // for (i=0; i < m_aEquipSkills.GetSize(); i++) + // m_aEquipSkills[i]->Tick(); + // + // if(m_pTargetItemSkill) + // m_pTargetItemSkill->Tick(); + // + // CECComboSkillState::Instance().Tick(); + // + // // Update cool times + // for (i=0; i < GP_CT_MAX; i++) + // m_aCoolTimes[i].Update(iRealTime); + // + // for (SkillCoolTime::iterator it = m_skillCoolTime.begin(); it != m_skillCoolTime.end(); ++ it) + // it->second.Update(iRealTime); + + // Gather time counter + if (m_GatherCnt.IncCounter(Time.deltaTime)) + m_GatherCnt.Reset(true); + // Debug.LogError("Gather counter: "+m_GatherCnt.GetCounter()); + + // // Incant time counter + // if (m_IncantCnt.IncCounter(iRealTime)) + // m_IncantCnt.Reset(true); + // + // // Bind command cool counter + // if (m_BindCmdCoolCnt.IncCounter(iRealTime)) + // m_BindCmdCoolCnt.Reset(true); + // + // // Auto fashion time counter + // if (m_bAutoFashion && GetBoothState() != 2 && !IsShapeChanged()) + // { + // if(m_AutoFashionCnt.IncCounter(iRealTime)) + // { + // if(!CheckAutoFashionCondition()) + // { + // while(!EquipFashionBySuitID( (m_iCurFashionSuitID+1) % GetMaxFashionSuitNum() )) + // m_iCurFashionSuitID++; + // + // m_AutoFashionCnt.Reset(); + // } + // } + // } + // + // // ×Ô¶¯×ª»»ÍêÃÀ񿮱 + // if( m_AutoYinpiao.open ) + // { + // if( m_AutoYinpiao.cnt.IncCounter(iRealTime) ) + // { + // ExchangeYinpiao(); + // m_AutoYinpiao.cnt.Reset(); + // } + // } + // + // // Control the dialog of the target item + // m_TargetItemDlgCtrl.Update(iRealTime); + // + // // For some reasons on server, sometimes friend list couldn't be got + // // successfully. Try to get it again every 20s if this case really happen + // if (m_pFriendMan && !m_pFriendMan->CheckInit()) + // { + // m_iGetFriendCnt -= iRealTime; + // if (m_iGetFriendCnt < 0) + // { + // g_pGame->GetGameSession()->friend_GetList(); + // m_iGetFriendCnt = 60000; + // } + // } + // + // // Duel stopping time counter + // if (m_pvp.iDuelState == DUEL_ST_PREPARE) + // { + // m_pvp.iDuelTimeCnt -= iRealTime; + // if (m_pvp.iDuelTimeCnt < 0) + // m_pvp.iDuelTimeCnt = 0; + // } + // else if (m_pvp.iDuelState == DUEL_ST_INDUEL) + // { + // m_pvp.iDuelTimeCnt += iRealTime; + // } + // else if (m_pvp.iDuelState == DUEL_ST_STOPPING) + // { + // m_pvp.iDuelTimeCnt -= iRealTime; + // if (m_pvp.iDuelTimeCnt < 0) + // { + // m_pvp.iDuelTimeCnt = 0; + // m_pvp.iDuelState = DUEL_ST_NONE; + // m_pvp.idDuelOpp = 0; + // } + // } + // + // // Update pariah time counter + // if (m_dwPariahTime) + // { + // if (m_dwPariahTime > (DWORD)iRealTime) + // m_dwPariahTime -= (DWORD)iRealTime; + // else + // m_dwPariahTime = 0; + // } + // + // // Update pet operation time counter + // m_PetOptCnt.IncCounter(iRealTime); + // + // // Update battle result time counter + // if (IsInBattle() && !IsInFortress() && m_BattleInfo.iResult && m_BattleInfo.iResultCnt) + // { + // if ((m_BattleInfo.iResultCnt -= iRealTime) < 0) + // m_BattleInfo.iResultCnt = 0; + // } + // + // // Update pet corral + // if (m_pPetCorral) + // m_pPetCorral->Tick((DWORD)iRealTime); + // + // // Update the related people + // abase::hash_map::iterator itP = m_RelatedPlayer.begin(); + // while( itP != m_RelatedPlayer.end() ) + // { + // itP->second -= iRealTime; + // if( itP->second <= 0 ) + // itP = m_RelatedPlayer.erase(itP); + // else + // ++itP; + // } + } } } \ No newline at end of file diff --git a/Assets/Scripts/CECUIManager.cs b/Assets/Scripts/CECUIManager.cs index 95533002af..d783fe314c 100644 --- a/Assets/Scripts/CECUIManager.cs +++ b/Assets/Scripts/CECUIManager.cs @@ -39,6 +39,8 @@ public class CECUIManager : MonoSingleton { btnSecondClick.onClick.AddListener(OnSecondClickButtonClicked); } + + ShowUI("Win_Hpmpxp"); } private void OnDestroy()