From a60057af16ee8981abc3e6bcddd6a0122f09eb63 Mon Sep 17 00:00:00 2001 From: Le Duc Anh Date: Wed, 29 Apr 2026 16:04:15 +0700 Subject: [PATCH] push ho a dac --- .vscode/launch.json | 2 +- .../ModelRenderer/Art/Shaders/Water/Water.mat | 4 +- .../Common/DataProcess/globaldataman.cs | 33 +++++++ .../Scripts/Managers/NPCManager.cs | 2 +- .../Scripts/Players/PlayerModelPreview.cs | 3 + .../PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs | 17 ++-- .../Scripts/UI/WorldMap/DlgWorldMap.cs | 85 ++++++++++++++++++- Assets/Scripts/CECHostPlayer.World.cs | 54 ++---------- 8 files changed, 142 insertions(+), 58 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1a1c874bd4..70d21c4f37 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ { "name": "Attach to Unity", "type": "vstuc", - "request": "attach" + "request": "attach", } ] } \ No newline at end of file diff --git a/Assets/ModelRenderer/Art/Shaders/Water/Water.mat b/Assets/ModelRenderer/Art/Shaders/Water/Water.mat index 93dccce4a4..ff8f798f92 100644 --- a/Assets/ModelRenderer/Art/Shaders/Water/Water.mat +++ b/Assets/ModelRenderer/Art/Shaders/Water/Water.mat @@ -131,13 +131,13 @@ Material: m_Colors: - _BaseColor: {r: 0, g: 1, b: 0.9534545, a: 0.8509804} - _Color: {r: 0, g: 0.5, b: 1, a: 0.8} - - _DeepColor: {r: 0, g: 0.9803924, b: 1, a: 0.78431374} + - _DeepColor: {r: 0, g: 0.9803924, b: 1, a: 0.29803923} - _FoamColor: {r: 1, g: 1, b: 1, a: 1} - _FoamSpeed: {r: 0.1, g: 0.1, b: 0, a: 0} - _FoamSpeedA: {r: 0.1, g: 0.1, b: 0, a: 0} - _FoamSpeedB: {r: -0.08, g: 0.06, b: 0, a: 0} - _NormalTiling: {r: 40, g: 40, b: 0, a: 0} - - _ShallowColor: {r: 0, g: 0.9806142, b: 1, a: 1} + - _ShallowColor: {r: 0, g: 0.9806141, b: 1, a: 0.68235296} - _WaterColor: {r: 0.19999996, g: 0.6, b: 0.8, a: 0.8} - _WaveDirection: {r: 1, g: 1, b: 0, a: 0} - _WaveSpeed1: {r: 0.05, g: 0.03, b: 0, a: 0} diff --git a/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs b/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs index a576716513..6aeaf0b9d7 100644 --- a/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs +++ b/Assets/PerfectWorld/Scripts/Common/DataProcess/globaldataman.cs @@ -1,8 +1,33 @@ using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using CSNetwork.GPDataType; using UnityEngine; +[System.Serializable] +public struct TRANS_TARGET +{ + public int id; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] + public ushort[] name; + public int world_id; + public A3DVECTOR3 vecPos; + public int domain_id; + +} + +[System.Serializable] +public struct TRANS_TARGET_SERV +{ + public int id; + public int world_id; + public A3DVECTOR3 vecPos; + public int domain_id; + +} + [System.Serializable] public struct GShopBuyOption { @@ -71,4 +96,12 @@ public static class BinaryReaderExtensions byte[] bytes = reader.ReadBytes(length * 2); // Wide chars are 2 bytes each return System.Text.Encoding.Unicode.GetString(bytes).TrimEnd('\0'); } +} + +public class GlobalTransmitData +{ + private static List global_trans_targets = new(); + private static List global_trans_targets_server = new(); + + public static List globaldata_gettranstargets => global_trans_targets; } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/NPCManager.cs b/Assets/PerfectWorld/Scripts/Managers/NPCManager.cs index c36852fb2e..ecbde51b2f 100644 --- a/Assets/PerfectWorld/Scripts/Managers/NPCManager.cs +++ b/Assets/PerfectWorld/Scripts/Managers/NPCManager.cs @@ -104,7 +104,7 @@ namespace BrewMonster.Scripts.Managers public async Task GetModelPlayer(byte profession, byte gender) { var prefab = await AddressableManager.Instance.LoadPrefabAsync(_playerModelPaths[profession * GENDER.NUM_GENDER + gender]); - // BMLogger.LogError("_playerModelPaths[profession * GENDER.NUM_GENDER + gender] = " + _playerModelPaths[profession * GENDER.NUM_GENDER + gender]); + BMLogger.LogError("_playerModelPaths[profession * GENDER.NUM_GENDER + gender] = " + _playerModelPaths[profession * GENDER.NUM_GENDER + gender]); if (prefab == null) { BMLogger.LogError( $" [NPC Manager] Not found Prefab from Addressable with profession : {profession} gender : {gender}"); diff --git a/Assets/PerfectWorld/Scripts/Players/PlayerModelPreview.cs b/Assets/PerfectWorld/Scripts/Players/PlayerModelPreview.cs index d8e7d85e57..e02eb806cb 100644 --- a/Assets/PerfectWorld/Scripts/Players/PlayerModelPreview.cs +++ b/Assets/PerfectWorld/Scripts/Players/PlayerModelPreview.cs @@ -32,6 +32,7 @@ namespace BrewMonster.Scripts /// public async void ShowAllPlayerModels(List roleInfos) { + BMLogger.Log($"ShowAllPlayerModels: {roleInfos.Count}"); _loadVersion++; int version = _loadVersion; @@ -111,12 +112,14 @@ namespace BrewMonster.Scripts private async UniTask LoadPlayerModel(RoleInfo role) { + BMLogger.Log($"LoadPlayerModel: {role.roleid}"); var elemendataman = BrewMonster.ElementDataManProvider.GetElementDataMan(); GameObject prefab = await NPCManager.Instance.GetModelPlayer(role.occupation, role.gender); if (prefab == null) { return null; } + BMLogger.Log($"LoadPlayerModel: {role.roleid} - prefab loaded"); GameObject model = Instantiate(prefab); var playerDefaultEquipments = model.GetComponentInChildren(); if (playerDefaultEquipments == null) diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index 32fe8bfea6..4ecb7d13c1 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -3240,11 +3240,12 @@ namespace BrewMonster.UI // id_dialog = (int)pService.id_dialog; // idFunction = (int)SERVICE_TYPE.NPC_HEAL; // } - // else if (DataType == DATA_TYPE.DT_NPC_TRANSMIT_SERVICE) - // { - // NPC_TRANSMIT_SERVICE pService = (NPC_TRANSMIT_SERVICE)pData; - // idFunction = (int)SERVICE_TYPE.NPC_TRANSMIT; - // } + else if (DataType == DATA_TYPE.DT_NPC_TRANSMIT_SERVICE) + { + NPC_TRANSMIT_SERVICE pService = (NPC_TRANSMIT_SERVICE)pData; + id_dialog = (int)pService.id_dialog; + idFunction = (int)SERVICE_TYPE.NPC_TRANSMIT; + } // else if (DataType == DATA_TYPE.DT_NPC_TRANSPORT_SERVICE) // { // NPC_TRANSPORT_SERVICE pService = (NPC_TRANSPORT_SERVICE)pData; @@ -3464,8 +3465,10 @@ namespace BrewMonster.UI } else if (idFunction == (int)SERVICE_TYPE.NPC_TRANSMIT) { - dialogue1 = "Win_WorldMapTravel"; - // pShow1 = m_pAUIManager.GetDialog("Win_WorldMapTravel"); + dialogue1 = "Win_WorldMap"; + var pShow1 = m_pAUIManager.GetDialog("Win_WorldMap") as DlgWorldMap; + pShow1.Show(true); + pShow1.BuildTravelMap((uint)DATA_TYPE.DT_NPC_TRANSMIT_SERVICE, pData); //((CDlgWorldMap*)pShow1).BuildTravelMap(DT_NPC_TRANSMIT_SERVICE, pData); } // else if (idFunction == (int)SERVICE_TYPE.NPC_SKILL) diff --git a/Assets/PerfectWorld/Scripts/UI/WorldMap/DlgWorldMap.cs b/Assets/PerfectWorld/Scripts/UI/WorldMap/DlgWorldMap.cs index 425a0028da..78a4c7ee78 100644 --- a/Assets/PerfectWorld/Scripts/UI/WorldMap/DlgWorldMap.cs +++ b/Assets/PerfectWorld/Scripts/UI/WorldMap/DlgWorldMap.cs @@ -1,5 +1,8 @@ +using System.Collections.Generic; using BrewMonster.Network; using CSNetwork.Common; +using CSNetwork.GPDataType; +using ModelRenderer.Scripts.Common; using UnityEngine; using UnityEngine.UI; @@ -127,7 +130,8 @@ namespace BrewMonster.UI if(dwType == (uint)DATA_TYPE.DT_NPC_TRANSMIT_SERVICE) { - // worldid = pMgr->FindTransmitWorldID((NPC_TRANSMIT_SERVICE*)pData); + var serviceData = (NPC_TRANSMIT_SERVICE)pData; + var worldInstanceName = UnityGameSession.Instance.GetWorldInstanceName((int)serviceData.id); // save the worldid // SetDataPtr((void*)worldid, "WorldID"); @@ -167,4 +171,83 @@ namespace BrewMonster.UI CloseDialogue(); } } + + + public struct TRANS_POINT + { + public int id; + public int worldid; + public string strName; + public A3DVECTOR3 vecPos; + }; + + + public enum TransMode + { + TM_INVALID = 0, + TM_TRANSMITSCROLL = 1, // 通过传送卷轴传送 / Transmit scroll + TM_NPC_TRANSMIT_NORMAL = 2, // 通过 NPC 传送服务、向当前 NPC 连接点传送 / Transmit service to the current NPC connection point + TM_NPC_TRANSMIT_DIRECT = 3, // 通过 NPC 传送服务、向当前 NPC 可达点直接传送 / Transmit service to the current NPC reachable point directly + }; + + + + public class CECMapDlgsMgr + { + public int m_nCurFlagIndex; + public bool m_bMarking; + public bool m_bMapDragging; + public List m_vecTeamMate = new(); + public Dictionary m_transPoints = new(); + + // update player way-points + public void UpdateWayPoints(object pData, int iSize, bool bClear) + { + var vecTarget = GlobalTransmitData.globaldata_gettranstargets; + + if(bClear) + { + m_transPoints.Clear(); + } + + // got valid points. + for(int i = 0; i < iSize; i++ ) + { + int idThis = *(pData+i); + for(int j = 0; j < vecTarget.Count; j++ ) + { + if( idThis != vecTarget[j].id ) continue; + + TRANS_POINT tp; + + tp.id = idThis; + tp.strName = ByteToStringUtils.UshortArrayToUnicodeString(vecTarget[j].name); + tp.vecPos = vecTarget[j].vecPos; + tp.worldid = vecTarget[j].world_id; + + m_transPoints[idThis] = tp; + break; + } + } + } + } + + public class TransWay + { + public const int WAYPOINT_ME = 0; + public const int WAYPOINT_TARGET = 1; + + public const int MINIMAP_UL = 0; + public const int MINIMAP_UR = 1; + public const int MINIMAP_LL = 2; + public const int MINIMAP_LR = 3; + public const int MINIMAP_MAX = 4; + + // The transmission mode to use when sending the transmission protocol (TM_NPC_TRANSMIT_NORMAL =2 and the number of wayPoints is greater than 1 may be true at the same time) + public TransMode mode; // 发送传送协议时应使用的传送模式(TM_NPC_TRANSMIT_NORMAL =2 与 wayPoints 个数大于1可能同时成立) + public int nCost; // 需要的完美币 / The required perfect coin + public int nLevel; // 需求的等级 / The required level + // The transmission route (excluding the start point and including the end point) (can be used for display in all modes, can only be used for protocol in TM_NPC_TRANSMIT_DIRECT mode) + public List wayPoints = new(); // 传送路线(不含起点、包括终点)(各模式下均可用于显示,TM_NPC_TRANSMIT_DIRECT 模式下才可用于协议) + } } \ No newline at end of file diff --git a/Assets/Scripts/CECHostPlayer.World.cs b/Assets/Scripts/CECHostPlayer.World.cs index dbabb684df..fb2a72a562 100644 --- a/Assets/Scripts/CECHostPlayer.World.cs +++ b/Assets/Scripts/CECHostPlayer.World.cs @@ -57,54 +57,16 @@ namespace BrewMonster void OnMsgHstWayPoint(ECMSG Msg) { - //CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan(); + CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan(); - //if (Convert.ToInt32(Msg.dwParam2) == CommandID.ACTIVATE_WAYPOINT) - //{ - // cmd_activate_waypoint pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); - // m_aWayPoints.Add(pCmd.waypoint); + if (Convert.ToInt32(Msg.dwParam2) == CommandID.ACTIVATE_WAYPOINT) + { + cmd_activate_waypoint pCmd = GPDataTypeHelper.FromBytes((byte[])Msg.dwParam1); + m_aWayPoints.Add(pCmd.waypoint); - // // add to waypoints array - // pGameUI.GetMapDlgsMgr().UpdateWayPoints(&pCmd.waypoint, 1, false); - - // // Print a notify message - // const CECMapDlgsMgr::PointMap& aWayPoints = pGameUI.GetMapDlgsMgr().GetTransPoint(); - // CECMapDlgsMgr::PointMap::const_iterator itr = aWayPoints.find(pCmd.waypoint); - // if(itr != aWayPoints.end()) - // { - // g_pGame.GetGameRun().AddFixedMessage(FIXMSG_NEWWAYPOINT, (itr.second).strName); - - // bool bCanPopUITips = true; - // int count = CECUIConfig::Instance().GetGameUI().GetTaskIDDisableWayPointsUITipsCount(); - // // ¼ì²éÉíÉÏÊÇ·ñÓнûÖ¹µ¯³ötipsµÄÈÎÎñ - // for (int i=0;i