UI health change fix bug

This commit is contained in:
PCBrew
2025-10-30 18:50:02 +07:00
parent 49518212c9
commit 1c9d9b9ec2
21 changed files with 551 additions and 680 deletions
+439
View File
@@ -0,0 +1,439 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1501462210578865223
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6641252726352799703}
- component: {fileID: 6284090637638284902}
- component: {fileID: 9164099005107097488}
- component: {fileID: 2755204087581219746}
m_Layer: 0
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6641252726352799703
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501462210578865223}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1662003704246427283}
- {fileID: 1095203804443106429}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!223 &6284090637638284902
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501462210578865223}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!114 &9164099005107097488
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501462210578865223}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!114 &2755204087581219746
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1501462210578865223}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1001 &5289107387155542773
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 6641252726352799703}
m_Modifications:
- target: {fileID: 4823752405346273106, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_Name
value: HUDPlayer
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_SizeDelta.x
value: 461
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_SizeDelta.y
value: 133
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_AnchoredPosition.x
value: 230.5
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_AnchoredPosition.y
value: -66.5
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 4823752405346273106, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
insertIndex: -1
addedObject: {fileID: 4616316815177720404}
m_SourcePrefab: {fileID: 100100000, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
--- !u!1 &835354389023896999 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4823752405346273106, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
m_PrefabInstance: {fileID: 5289107387155542773}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4616316815177720404
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 835354389023896999}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 706d0ac515335b446be8840000ff0fab, type: 3}
m_Name:
m_EditorClassIdentifier:
healthText: {fileID: 1313768687643874887}
manaText: {fileID: 1737072187259709926}
expText: {fileID: 9091953190536401803}
nameText: {fileID: 6716045574192280964}
levelText: {fileID: 3632374887765724611}
neededExp: 0
--- !u!114 &1313768687643874887 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6583662924878292146, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
m_PrefabInstance: {fileID: 5289107387155542773}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &1662003704246427283 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 6806681442789174374, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
m_PrefabInstance: {fileID: 5289107387155542773}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1737072187259709926 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5872129684784782099, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
m_PrefabInstance: {fileID: 5289107387155542773}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &3632374887765724611 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8867137494968155958, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
m_PrefabInstance: {fileID: 5289107387155542773}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &6716045574192280964 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 1464374634028484465, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
m_PrefabInstance: {fileID: 5289107387155542773}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &9091953190536401803 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 3984476637502251390, guid: 76408ccdbeb4c654291462fcff24a8c5, type: 3}
m_PrefabInstance: {fileID: 5289107387155542773}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &7372182230587498303
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 6641252726352799703}
m_Modifications:
- target: {fileID: 5010991128992349155, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_Name
value: HUDNPC
objectReference: {fileID: 0}
- target: {fileID: 5010991128992349155, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_AnchorMax.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_AnchorMin.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_SizeDelta.x
value: 100
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_SizeDelta.y
value: 100
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_AnchoredPosition.y
value: -44.444458
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9105272519104429228, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: _nameText
value:
objectReference: {fileID: 1381345943878147476}
- target: {fileID: 9105272519104429228, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: _statText
value:
objectReference: {fileID: 146616405799166702}
- target: {fileID: 9105272519104429228, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
propertyPath: _healthText
value:
objectReference: {fileID: 1682912965109359210}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
--- !u!114 &146616405799166702 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7225922753763360209, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
m_PrefabInstance: {fileID: 7372182230587498303}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &1095203804443106429 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 7601428160728630082, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
m_PrefabInstance: {fileID: 7372182230587498303}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1381345943878147476 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8459104239633154731, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
m_PrefabInstance: {fileID: 7372182230587498303}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1682912965109359210 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8148604647689649493, guid: 7130d91d43d72c145a379b373c8c27b0, type: 3}
m_PrefabInstance: {fileID: 7372182230587498303}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 85e1921c890476a48be07e3cc7d5e69d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -125,6 +125,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d072871c8791e284dbad61ce13ba6887, type: 3}
m_Name:
m_EditorClassIdentifier:
_healthText: {fileID: 8148604647689649493}
_nameText: {fileID: 8459104239633154731}
_statText: {fileID: 7225922753763360209}
healthImage: {fileID: 391766345810538963}
--- !u!1 &5230218528339883288
GameObject:
m_ObjectHideFlags: 0
@@ -270,10 +274,10 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 9ef86922851818c4e9e58040f51c491f, type: 3}
m_Type: 0
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillMethod: 0
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
@@ -62,6 +62,8 @@ public class CECNPCMan : IMsgHandler
}
private void OnMsgNPCDisappear(ECMSG Msg)
{
BMLogger.Log("HoangDev : OnMsgNPCDisappear ");
var pCmd = GPDataTypeHelper.FromBytes<cmd_object_disappear>((byte[])Msg.dwParam1);
NPCDisappear(pCmd.id);
}
@@ -225,6 +227,7 @@ public class CECNPCMan : IMsgHandler
return false;
CECNPC pNPC = GetNPC(nid);
EventBus.Publish(new NPCDiedEvent(nid));
if (pNPC && !pNPC.IsAboutToDie())
{
pNPC.Killed(bDelay);
@@ -340,7 +343,7 @@ public class CECNPCMan : IMsgHandler
BMLogger.LogError("HoangDev: NPCMAN NPC_INFO_00");
var buffer = (byte[])msg.dwParam1;
cmd_npc_info_00 pCmd = GPDataTypeHelper.FromBytes<cmd_npc_info_00>(buffer);
//cmd_npc_info_00 pCmd = MemoryMarshal.Read<cmd_npc_info_00>(buffer.AsSpan(0, cmd_npc_info_00.));
CECNPC pNPC = SeekOutNPC(pCmd.idNPC);
if (pNPC)
{
@@ -350,7 +353,10 @@ public class CECNPCMan : IMsgHandler
bp.iCurHP = pCmd.iHP;
ep.bs.max_hp = pCmd.iMaxHP;
pNPC.SetSelectedTarget(pCmd.iTargetID);
EventBus.Publish(new NPCINFO(pNPC.GetName(),pCmd.iHP,pCmd.iMaxHP));
pNPC.SetWorldHealthImage((float)pCmd.iHP , (float)pCmd.iMaxHP);
BMLogger.LogError("HoangDev: publish NPCMAN NPC_INFO_00");
EventBus.Publish(new NPCINFO(pNPC.GetName(),pCmd.iHP,pCmd.iMaxHP, pCmd.idNPC));
}
break;
}
@@ -488,3 +494,11 @@ public class CECNPCMan : IMsgHandler
return pNPC;
}
}
public struct NPCDiedEvent
{
public int NPCID;
public NPCDiedEvent(int npcID)
{
NPCID = npcID;
}
}
@@ -307,8 +307,7 @@ namespace PerfectWorld.Scripts.Managers
{
GameObject ob = GameController.Instance.InitCharacter(info);
EC_ElsePlayer elsePlayer = ob.AddComponent<EC_ElsePlayer>();
elsePlayer.GetComponent<CECHostPlayer>().enabled = false;
//init
elsePlayer.Init(roleInfo, info);
return elsePlayer;
}
@@ -134,6 +134,7 @@ public abstract class CECPlayer : CECObject
m_dwResFlags = 0;
m_iFashionWeaponType = -1;
m_uAttackType = DEFAULT_ACTION_TYPE;
AttachWeapon();
}
@@ -1285,6 +1285,12 @@ public class CECNPC : CECObject
PlayModelAction((int)NPCActionIndex.ACT_NPC_WALK, false);
}
}
public void SetWorldHealthImage(float currenthealth, float maxHealth)
{
m_npcUI.gameObject.SetActive(true);
m_npcUI.SetHealthImage(currenthealth/ maxHealth);
m_npcUI.SetHealthText($"{currenthealth}/{maxHealth}");
}
public void PlayModelAction(int iAction, bool bRestart = false)
{
m_iAction = iAction;
@@ -5,7 +5,9 @@ using CSNetwork;
using CSNetwork.GPDataType;
using CSNetwork.Protocols.RPCData;
using System;
using System.Data;
using UnityEngine;
using static CECNPC;
namespace PerfectWorld.Scripts.Player
{
@@ -32,13 +34,14 @@ namespace PerfectWorld.Scripts.Player
public void Init(RoleInfo roleInfo, info_player_1 Info)
{
BMLogger.Log("HoangDev: EC_ElsePlayer Init " + Info.cid);
m_dwResFlags = (uint)PlayerResourcesReadyFlag.RESFG_ALL;
m_pEPWorkMan = new CECEPWorkMan(this);
m_iProfession = roleInfo.occupation;
m_iGender = roleInfo.gender;
CalcPlayerAABB();
SetPlayerInfor(new INFO(Info.cid, Info.crc_e, Info.crc_c));
SetServerPos(Info.pos);
SetPos(Info.pos);
@@ -58,10 +61,11 @@ namespace PerfectWorld.Scripts.Player
if (TryGetComponent<PlayerVisual>(out var visual))
{
visual.InitHostPlayerEventDoneHandler();
BMLogger.Log("HoangDev: InitPlayerEventDoneHandler");
visual.InitPlayerEventDoneHandler();
}
}
public void MoveTo(cmd_object_move Cmd)
{
BrewMonster.BMLogger.Log("HoangDev : MoveToMoveTo");
@@ -1,15 +1,26 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace BrewMonster
{
public class UINPC : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI _nameText;
[SerializeField] private TextMeshProUGUI _healthText;
[SerializeField] private Image _healthImage;
// Start is called once before the first execution of Update after the MonoBehaviour is created
public void SetName(string name)
{
_nameText.text = name;
}
public void SetHealthImage(float health)
{
_healthImage.fillAmount = health;
}
public void SetHealthText(string healthText)
{
_healthText.text = healthText;
}
}
}
+6
View File
@@ -1,5 +1,6 @@
using TMPro;
using UnityEngine;
using UnityEngine.UI;
namespace BrewMonster
{
@@ -8,6 +9,7 @@ namespace BrewMonster
[SerializeField] private TextMeshProUGUI _healthText;
[SerializeField] private TextMeshProUGUI _nameText;
[SerializeField] private TextMeshProUGUI _statText;
[SerializeField] private Image healthImage;
public void SetText(string healthText, string nameText, string statText)
{
@@ -15,5 +17,9 @@ namespace BrewMonster
_nameText.text = nameText;
_statText.text = statText;
}
public void SetHealthImage(float health)
{
healthImage.fillAmount = health;
}
}
}
+10 -9
View File
@@ -162,7 +162,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4388339715710232169}
m_LocalRotation: {x: -0.002627404, y: 0.9181325, z: 0.3962182, w: 0.0060883234}
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
@@ -264,13 +264,13 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5439308163421125551}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
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: 9096411092800993603}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 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: 3.11}
@@ -387,7 +387,7 @@ GameObject:
- component: {fileID: 4853137806171657030}
- component: {fileID: 3715353156977051930}
m_Layer: 5
m_Name: HealthUIBG
m_Name: HealthUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -440,11 +440,11 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_Sprite: {fileID: 21300000, guid: 9ef86922851818c4e9e58040f51c491f, type: 3}
m_Type: 3
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillMethod: 0
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
@@ -476,8 +476,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6780952369966265306}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: -0.03277403, y: -0.4452644, z: 0.016311517, w: -0.8946505}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -497,6 +497,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_nameText: {fileID: 1823123278494198886}
_healthImage: {fileID: 3715353156977051930}
--- !u!114 &775994425462537197
MonoBehaviour:
m_ObjectHideFlags: 0
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1e7b86c2516571fa81812b77127ba2caeef08f280d26b69313c1e21a52fa43b0
size 532497061
oid sha256:08670fd2509244913ee54a514ac6d22c869766f810574cdc8bff9ab24f244a63
size 532484940
+11 -4
View File
@@ -624,12 +624,10 @@ public class CECHostPlayer : CECPlayer
{
Debug.LogWarning("[Inventory] PICKUP_ITEM: Invalid data length");
}
break;
}
}
}
public void OnMsgHstItemOperation(ECMSG Msg)
{
var data = Msg.dwParam1 as byte[];
@@ -902,6 +900,13 @@ public class CECHostPlayer : CECPlayer
public void InitCharacter(cmd_self_info_1 role)
{
SetUpPlayer();
controller = GetComponent<CharacterController>();
if (!controller)
{
BMLogger.LogError("HostPlayer InitCharacter no CharacterController");
}
parentModel = transform.GetChild(0);
txtName = parentModel.GetComponentInChildren<TextMeshProUGUI>();
string roleName = Encoding.Unicode.GetString(UnityGameSession.Instance.GetRoleInfo().name.ByteArray);
//if (role.name != null && role.name.ByteArray != null)
//{
@@ -919,7 +924,7 @@ public class CECHostPlayer : CECPlayer
EventBus.Subscribe<JoystickPressEvent>(JoystickStartDrag);
if (TryGetComponent<PlayerVisual>(out var visual))
{
visual.InitHostPlayerEventDoneHandler();
visual.InitPlayerEventDoneHandler();
}
m_aabb.Center = GPDataTypeHelper.g_vOrigin;
@@ -1802,12 +1807,14 @@ public struct NPCINFO
public string Name; // Movement properties
public int CurrentHealth;
public int MaxHealth; // Attacking properties
public int IDNPC; // Attacking properties
public NPCINFO(string name, int currentHealth, int maxHealth)
public NPCINFO(string name, int currentHealth, int maxHealth,int idnpc)
{
Name = name;
CurrentHealth = currentHealth;
MaxHealth = maxHealth;
IDNPC = idnpc;
}
};
+10 -1
View File
@@ -12,25 +12,34 @@ public class CECUIManager : MonoSingleton<CECUIManager>
[SerializeField] private HUDNPC npsUI;
[SerializeField] private int currentTargetNPCID;
protected override void Awake()
{
base.Awake();
EventBus.Subscribe<NPCINFO>(ShowUINPC);
//EventBus.Subscribe<NPCDiedEvent>(TryHideUINPC);
}
private void OnDestroy()
{
EventBus.Unsubscribe<NPCINFO>(ShowUINPC);
EventBus.Unsubscribe<NPCDiedEvent>(TryHideUINPC);
}
private void ShowUINPC(NPCINFO obj)
{
BMLogger.LogError("HoangDEv: ShowUINPC");
npsUI.gameObject.SetActive(true);
npsUI.SetText($"{obj.CurrentHealth}/{obj.MaxHealth}",obj.Name,"");
npsUI.SetHealthImage((float)obj.CurrentHealth / (float)obj.MaxHealth);
currentTargetNPCID = obj.IDNPC;
}
private void HideUINPC(NPCINFO obj)
private void TryHideUINPC(NPCDiedEvent obj)
{
if (obj.NPCID != currentTargetNPCID) return;
npsUI.gameObject.SetActive(false);
}
+3 -4
View File
@@ -10,7 +10,7 @@ public class GameController : MonoBehaviour
{
private static GameController instance;
[SerializeField] private CECHostPlayer characterPrefab;
[SerializeField] private GameObject characterPrefab;
[SerializeField] private CECMonster monsterPrefab;
[SerializeField] private CECNPCServer npcServerPrefab;
[SerializeField] private CinemachineCamera cinemachineCamera;
@@ -56,7 +56,7 @@ public class GameController : MonoBehaviour
return;
}
CECPlayer.InitStaticRes();
hostPlayer = Instantiate(characterPrefab, transform);
hostPlayer = Instantiate(characterPrefab, transform).AddComponent<CECHostPlayer>();
hostPlayer.InitCharacter(info);
cinemachineCamera.Follow = hostPlayer.transform;
cinemachineCamera.ForceCameraPosition(hostPlayer.transform.position, Quaternion.identity);
@@ -85,8 +85,7 @@ public class GameController : MonoBehaviour
Debug.LogError("null prefab");
return null;
}
CECHostPlayer character = Instantiate(characterPrefab, transform);
character.InitCharacter(info);
GameObject character = Instantiate(characterPrefab, transform);
return character.gameObject;
}
private void OnDestroy()
+6 -2
View File
@@ -15,6 +15,7 @@ public class PlayerVisual : MonoBehaviour
[SerializeField] private AnimancerState _currentState;
[SerializeField] private Queue<string> _animationQueue = new Queue<string>();
[SerializeField] private bool isHit;
[SerializeField] private int id;
QueueActionEvent queueActionEvent;
@@ -26,12 +27,12 @@ public class PlayerVisual : MonoBehaviour
BMLogger.LogError("HoangDev: PlayActionEventHandler Failed " + @event.AnimationName);
}
}
public void InitHostPlayerEventDoneHandler()
public void InitPlayerEventDoneHandler()
{
namedAnimancer = GetComponentInChildren<NamedAnimancerComponent>();
if (namedAnimancer == null)
{
BrewMonster.BMLogger.LogError("animancer == null");
BrewMonster.BMLogger.LogError("InitPlayerEventDoneHandler animancer == null");
return;
}
var player = GetComponentInParent<CECPlayer>();
@@ -40,7 +41,10 @@ public class PlayerVisual : MonoBehaviour
BrewMonster.BMLogger.LogError("player == null");
return;
}
BrewMonster.BMLogger.LogError("HoangDev: player:"+ player);
_playerInfo = player.GetPlayInfo();
id = _playerInfo.cid;
EventBus.SubscribeChannel<PlayActionEvent>(_playerInfo.cid, PlayActionEventHandler);
EventBus.SubscribeChannelClass<QueueActionEvent>(_playerInfo.cid, QueueActionEventHandler);
EventBus.SubscribeChannel<CleearComActFlagAllRankNodesEvent>(_playerInfo.cid, CleearComActFlagAllRankNodesEventHandler);
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -82,7 +82,7 @@ PlayerSettings:
androidApplicationEntry: 2
defaultIsNativeResolution: 1
macRetinaSupport: 1
runInBackground: 0
runInBackground: 1
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Force IOS Speakers When Recording: 0