This commit is contained in:
PCBrew
2025-11-03 18:56:26 +07:00
parent 61775198c6
commit 5ee9a27ac8
9 changed files with 494 additions and 71 deletions
+19 -2
View File
@@ -9,11 +9,16 @@ using PerfectWorld.Scripts.Player;
using System;
using System.Collections.Generic;
using System.Xml.Linq;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.SceneManagement;
public abstract class CECPlayer : CECObject
{
[SerializeField] protected Transform parentModel;
[SerializeField] protected TextMeshProUGUI txtName;
private static PLAYER_ACTION[] _default_actions;
private static PLAYER_ACTION[] _turning_actions;
PLAYER_ACTION[] m_PlayerActions;
@@ -128,7 +133,18 @@ public abstract class CECPlayer : CECObject
m_aEquips = new int[(int)IndexOfIteminEquipmentInventory.SIZE_ALL_EQUIPIVTR];
queueActionEvent = new QueueActionEvent("", null, false, null);
}
public void SetModelHostPlayer()
{
parentModel = transform.GetChild(0);
txtName = parentModel.GetComponentInChildren<TextMeshProUGUI>();
_pPlayerModel = NPCManager.Instance.GetModelPlayer();
Scene scene = SceneManager.GetSceneByName("a61");
SceneManager.MoveGameObjectToScene(_pPlayerModel, scene);
_pPlayerModel.transform.SetParent(parentModel);
_pPlayerModel.transform.localPosition = Vector3.zero;
_pPlayerModel.SetActive(true);
}
public virtual void SetUpPlayer()
{
m_dwResFlags = 0;
@@ -592,9 +608,10 @@ public abstract class CECPlayer : CECObject
if (GetMoveEnv() == (int)MoveEnvironment.MOVEENV_GROUND)
{
// “起” 动作(挥起)
szAct = EC_Utility.BuildActionName(action, 0, "Æð");
szAct = EC_Utility.BuildActionName(action, weapon_type, "Æð");
BMLogger.LogError("PlayAttackAction PlayActionEvent: " + szAct);
EventBus.PublishChannel(m_PlayerInfo.cid, new PlayActionEvent(szAct));
szAct = EC_Utility.BuildActionName(action, 0, "Âä");
szAct = EC_Utility.BuildActionName(action, weapon_type, "Âä");
queueActionEvent.SetData(szAct, SetApplyDamage, true, attackEvent);
EventBus.PublishChannelClass(m_PlayerInfo.cid, queueActionEvent);
//PlayNonSkillActionWithName(iAction, szAct, true, 200, true, ref pActFlag, COMACT_FLAG_MODE_ONCE_MULTIIGNOREGFX);gagága
@@ -37,6 +37,7 @@ public class CECMonster : CECNPC
// If NPC doesn't have specific name, use the name in database
if ((info.state & (int)PlayerNPCState.GP_STATE_NPC_NAME) == 0)
{
//m_strName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes<ushort>(m_pDBEssence.name));
m_strName = Encoding.Unicode.GetString(MemoryMarshal.AsBytes<ushort>(m_pDBEssence.name));
m_npcUI.SetName(m_strName);
}
@@ -1,11 +1,13 @@
using BrewMonster;
using BrewMonster.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts;
using CSNetwork;
using CSNetwork.GPDataType;
using CSNetwork.Protocols.RPCData;
using System;
using System.Data;
using System.Text;
using UnityEngine;
using static CECNPC;
@@ -45,6 +47,10 @@ namespace PerfectWorld.Scripts.Player
SetServerPos(Info.pos);
SetPos(Info.pos);
SetModelHostPlayer();
string roleName = Encoding.Unicode.GetString(UnityGameSession.Instance.GetRoleInfo().name.ByteArray);
if (txtName != null) txtName.text = roleName;
m_cdr.fStepHeight = m_MoveConst.fStepHei;
m_cdr.vExts = m_aabbServer.Extents;
m_cdr.vVelocity.Clear();
+3 -39
View File
@@ -103,7 +103,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3356314488807061436}
m_LocalRotation: {x: -0.002627404, y: 0.9181325, z: 0.3962182, w: 0.0060883234}
m_LocalRotation: {x: 8.102368e-16, y: 1, z: 0.000000046460137, w: -0.000000017439397}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -283,7 +283,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6417286913550183034}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0.015501263, y: 0.89470863, z: -0.031145941, w: -0.4452933}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -418,7 +418,6 @@ GameObject:
m_Component:
- component: {fileID: 5695237227048099898}
- component: {fileID: 2967440448469171042}
- component: {fileID: 2038764726549499828}
- component: {fileID: 6892195500068497589}
m_Layer: 3
m_Name: HostPlayer
@@ -469,42 +468,6 @@ CharacterController:
m_SkinWidth: 0.02
m_MinMoveDistance: 0.001
m_Center: {x: 0, y: 0.9, z: 0}
--- !u!114 &2038764726549499828
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6513559496054861882}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0911af06fee458459c86236ea21b716, type: 3}
m_Name:
m_EditorClassIdentifier:
m_PlayerInfo:
cid: 0
crc_c: 0
crc_e: 0
m_iMoveEnv: 0
m_bWalkRun: 0
m_iProfession: 0
m_fScaleBySkill: 0
m_iGender: 0
m_bShowWeapon: 0
txtName: {fileID: 810521971385613747}
controller: {fileID: 2967440448469171042}
joystick: {fileID: 0}
btnJump: {fileID: 0}
btnRun: {fileID: 0}
parentModel: {fileID: 78581589932911603}
m_bPrepareFight: 0
m_fVertSpeed: 0
extraGroundDistance: 0.05
radiusEpsilon: 0.005
groundMask:
serializedVersion: 2
m_Bits: 0
slopeToleranceDeg: 2
--- !u!114 &6892195500068497589
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -523,6 +486,7 @@ MonoBehaviour:
crc_c: 0
crc_e: 0
isHit: 0
id: 0
--- !u!1 &7854944069823046156
GameObject:
m_ObjectHideFlags: 0
+2 -1
View File
@@ -476,7 +476,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6780952369966265306}
serializedVersion: 2
m_LocalRotation: {x: -0.03277403, y: -0.4452644, z: 0.016311517, w: -0.8946505}
m_LocalRotation: {x: 0.017608283, y: 0.65204406, z: -0.015150423, w: 0.75782526}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@@ -497,6 +497,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_nameText: {fileID: 1823123278494198886}
_healthText: {fileID: 1023145116209524756}
_healthImage: {fileID: 3715353156977051930}
--- !u!114 &775994425462537197
MonoBehaviour:
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:68ca9467e615cbe49f5a293c85be002ab71745181674fe8395cb9e65d1a57b84
size 32996450
oid sha256:a2f2874de75b6144fd921c9dd6aebe4328a5014a23ca4d2f40e2ae722233aa4c
size 33045353
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08670fd2509244913ee54a514ac6d22c869766f810574cdc8bff9ab24f244a63
size 532484940
oid sha256:6bd12aa2ef944f5b258d55990cbd00b45cf412147f5ac0fd569065972fb65936
size 532484918
+2 -15
View File
@@ -27,13 +27,11 @@ using Scene = UnityEngine.SceneManagement.Scene;
public class CECHostPlayer : CECPlayer
{
[SerializeField] private TextMeshProUGUI txtName;
[SerializeField] private CharacterController controller;
[SerializeField] private Joystick joystick;
[SerializeField] private Button btnJump;
[SerializeField] private Button btnRun;
[SerializeField] private Transform parentModel;
PlayerStateMachine _playerStateMachine;
PlayerMoveState _moveState;
@@ -104,16 +102,6 @@ public class CECHostPlayer : CECPlayer
RoleInfo RoleInfo = UnityGameSession.Instance.GetRoleInfo();
}
public void SetModelHostPlayer()
{
_pPlayerModel = NPCManager.Instance.GetModelPlayer();
Scene scene = SceneManager.GetSceneByName("a61");
SceneManager.MoveGameObjectToScene(_pPlayerModel, scene);
_pPlayerModel.transform.SetParent(parentModel);
_pPlayerModel.transform.localPosition = Vector3.zero;
_pPlayerModel.SetActive(true);
}
private void Start()
{
mainCam = Camera.main;
@@ -905,15 +893,14 @@ public class CECHostPlayer : CECPlayer
{
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)
//{
// roleName = Encoding.UTF8.GetString(role.name.ByteArray, 0, role.name.Length);
//}
SetPlayerInfor(new INFO(role.cid, role.crc_e, role.crc_c));
Vector3 pos = new Vector3(role.pos.x, role.pos.y, role.pos.z);
string roleName = Encoding.Unicode.GetString(UnityGameSession.Instance.GetRoleInfo().name.ByteArray);
if (txtName != null) txtName.text = roleName;
EventBus.Publish(new InfoHostPlayer(roleName));
transform.position = pos;
File diff suppressed because one or more lines are too long