Merge branch 'develop' of https://git.pthub.vn/Unity/perfect-world-unity into feature/optimate

# Conflicts:
#	Assets/PerfectWorld/Scene/Bootstrap.unity
#	Assets/PerfectWorld/Scene/LoginScene.unity
This commit is contained in:
VuNgocHaiC7
2026-05-04 13:35:23 +07:00
33 changed files with 1092 additions and 238 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
{
"name": "Attach to Unity",
"type": "vstuc",
"request": "attach"
"request": "attach",
}
]
}
@@ -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}
@@ -0,0 +1,51 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f04e4cee6b3592d46866e3d631e4d4e0, type: 3}
m_Name: WorldTargetSO
m_EditorClassIdentifier:
worldTargets:
- id: 9047
name:
Name: "\u4E5D\u5195\u5C18\u5BF0\u53F0"
world_id: 161
vecPos:
x: -799.016
y: 45
z: -282.283
domain_id: -1
- id: 9048
name:
Name: "\u841D\u4F1A\u57CE"
world_id: 161
vecPos:
x: -162.798
y: 36
z: 299.386
domain_id: -1
- id: 9049
name:
Name: "\u5D06\u5CD2\u53E4\u9547"
world_id: 161
vecPos:
x: 876.326
y: 51
z: 369.481
domain_id: -1
- id: 9050
name:
Name: "\u6A2A\u5929\u9619"
world_id: 161
vecPos:
x: 887.151
y: 154
z: -295.974
domain_id: -1
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3e25bab2c9ca9714ea2d7d5f094ddd5b
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d67ebb03315697fc106ae8d9795e0d693a19af2a8d69ccb3f3dd652e26c95989
size 308246
oid sha256:329ce992197e8e90aa8ecc86ad5a2e9d0e4516ae41630b0e0fb4b68080d9ba75
size 303602
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1a1058735fae3c5bdd13717ff067673ea1c9ddf07983b2e5a84abe2dd35905c8
size 106802
oid sha256:08dd99327890c9a20d09b1faadef16ad55b5a276d5080d744bfdc2f4191dceac
size 111628
@@ -210,6 +210,9 @@ namespace BrewMonster.Scripts
if (handle.OperationException != null)
{
BMLogger.Log($"AddressableManager: Failed to load Prefab '{assetPath}': {handle.OperationException.Message} {handle.OperationException.StackTrace}");
#if UNITY_EDITOR
_invalidAssetPaths.Add(assetPath);
#endif
return null;
}
_loadedPrefabAssets[assetPath] = handle;
@@ -218,6 +221,9 @@ namespace BrewMonster.Scripts
catch (System.Exception e)
{
BMLogger.Log($"AddressableManager: Failed to load Prefab '{assetPath}': {e.Message} {e.StackTrace}");
#if UNITY_EDITOR
_invalidAssetPaths.Add(assetPath);
#endif
return null;
}
}
@@ -367,6 +373,10 @@ namespace BrewMonster.Scripts
return _loadedPrefabAssets.ContainsKey(assetPath) && _loadedPrefabAssets[assetPath].IsValid();
}
#if UNITY_EDITOR
private HashSet<string> _invalidAssetPaths = new();
#endif
/// <summary>
/// Checks if a given Addressable key or path exists in the current catalogs.
/// </summary>
@@ -375,6 +385,9 @@ namespace BrewMonster.Scripts
/// <returns>True if the key exists, false otherwise.</returns>
public static bool KeyExists(object key, System.Type type = null)
{
#if UNITY_EDITOR
return !Instance._invalidAssetPaths.Contains(key.ToString());
#else
// Iterate through all loaded locators (catalogs)
foreach (IResourceLocator locator in Addressables.ResourceLocators)
{
@@ -390,6 +403,7 @@ namespace BrewMonster.Scripts
}
return false;
#endif
}
#endregion
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 33958689dea439040976b900bc6494d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
using System.Collections.Generic;
using UnityEngine;
namespace BrewMonster.Scripts.Common.DataProcess.ScriptableObjects
{
[CreateAssetMenu(fileName = "WorldTargetSO", menuName = "BrewMonster/WorldTargetSO")]
public class WorldTargetSO : ScriptableObject
{
public List<TRANS_TARGET> worldTargets;
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f04e4cee6b3592d46866e3d631e4d4e0
@@ -1,8 +1,36 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using BrewMonster;
using BrewMonster.Scripts.Common.DataProcess.ScriptableObjects;
using CSNetwork.GPDataType;
using UnityEngine;
[System.Serializable]
public struct TRANS_TARGET
{
public int id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public ushort[] name;
public string 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 +99,43 @@ 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 GlobalDataManager
{
public static void globaldata_load()
{
// read world target data
var worldTargetSO = Resources.Load<WorldTargetSO>("WorldTargetSO");
if(worldTargetSO == null)
{
BMLogger.LogError("GlobalDataManager: world target data not found");
#if UNITY_EDITOR
// show a dialouge for the error
UnityEditor.EditorUtility.DisplayDialog("GlobalDataManager", "World target data not found", "OK");
#endif
return;
}
GlobalTransmitData.global_trans_targets = worldTargetSO.worldTargets;
//TODO: Load the domain info file. It's a binary file.
// now load domain info file
// AFileImage domainFile = new AFileImage();
// if( !domainFile.Open("Data\\domain.data", AFILE_OPENEXIST | AFILE_BINARY) )
// {
// a_LogOutput(1, "GlobalData_Load(), Failed to open domain data file");
// return false;
// }
}
}
public class GlobalTransmitData
{
public static List<TRANS_TARGET> global_trans_targets = new();
private static List<TRANS_TARGET_SERV> global_trans_targets_server = new();
public static List<TRANS_TARGET> globaldata_gettranstargets => global_trans_targets;
}
@@ -138,6 +138,8 @@ namespace BrewMonster.Network
// 加载 coord_data.txtC++Configs/Coord_data.txt)用于任务可点击链接的自动移动。
LoadObjectCoord();
LoadPetAutoSkill();
GlobalDataManager.globaldata_load();
return true;
}
public static CECConfigs GetConfigs() { return m_pConfigs; }
@@ -104,7 +104,7 @@ namespace BrewMonster.Scripts.Managers
public async Task<GameObject> 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}");
@@ -1018,6 +1018,7 @@ namespace CSNetwork.GPDataType
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[System.Serializable]
public struct A3DVECTOR3
{
public float x;
@@ -2303,6 +2304,60 @@ namespace CSNetwork.GPDataType
{
public ushort waypoint;
};
public struct cmd_waypoint_list
{
public uint count;
public ushort[] list;
public bool FromBytes(byte[] data)
{
const int CountSize = sizeof(uint);
const int ItemSize = sizeof(ushort);
if (data == null || data.Length < CountSize)
{
count = 0;
list = Array.Empty<ushort>();
return false;
}
ReadOnlySpan<byte> buffer = data;
uint parsedCount = BinaryPrimitives.ReadUInt32LittleEndian(buffer.Slice(0, CountSize));
uint maxCount = (uint)((data.Length - CountSize) / ItemSize);
if (parsedCount > maxCount || parsedCount > int.MaxValue)
{
count = 0;
list = Array.Empty<ushort>();
return false;
}
int itemCount = (int)parsedCount;
if (itemCount == 0)
{
count = parsedCount;
list = Array.Empty<ushort>();
return true;
}
ushort[] parsedList = list;
if (parsedList == null || parsedList.Length != itemCount)
parsedList = new ushort[itemCount];
int offset = CountSize;
for (int i = 0; i < itemCount; i++)
{
parsedList[i] = BinaryPrimitives.ReadUInt16LittleEndian(buffer.Slice(offset, ItemSize));
offset += ItemSize;
}
count = parsedCount;
list = parsedList;
return true;
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public static class GNETRoles
{
@@ -22,6 +22,7 @@ namespace CSNetwork
private CancellationTokenSource? _cts;
private Task? _receiveTask;
private Task? _sendTask;
private Task? _keepAliveTask;
private readonly ConcurrentQueue<Protocol> _sendQueue = new ConcurrentQueue<Protocol>();
private readonly object _streamLock = new object(); // Lock for stream access
@@ -82,6 +83,7 @@ namespace CSNetwork
_receiveTask = Task.Run(() => ProcessReceivedData(_cts.Token), _cts.Token);
_sendTask = Task.Run(() => ProcessSendQueue(_cts.Token), _cts.Token);
_keepAliveTask = Task.Run(() => KeepAlive(_cts.Token), _cts.Token);
}
catch (Exception ex)
{
@@ -255,6 +257,17 @@ namespace CSNetwork
_logger.Log(LogType.Info, "Send loop finished.");
}
private async Task KeepAlive(CancellationToken token)
{
var keepAlivePack = new keepalive();
keepAlivePack.code = (byte)Protocols.ProtocolType.PROTOCOL_KEEPALIVE;
while (!token.IsCancellationRequested)
{
await Task.Delay(5000, token); // send keep alive packet every 1000ms
Send(keepAlivePack);
}
}
private int _previousLength;
// Internal task to read from network and process data
private async Task ProcessReceivedData(CancellationToken token)
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
namespace CSNetwork.Protocols
{
public class keepalive : Protocol
{
public byte code { get; set; }
public keepalive() : base(ProtocolType.PROTOCOL_KEEPALIVE)
{
}
public override Protocol Clone() => new keepalive { code = code };
public override void Marshal(OctetsStream os)
{
os.Write(code);
}
public override void Unmarshal(OctetsStream os)
{
code = os.ReadByte();
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 872e7956373f84f2ea7610eadc366426
@@ -35,6 +35,7 @@ namespace BrewMonster.Scripts
/// </summary>
public async void ShowAllPlayerModels(List<RoleInfo> roleInfos)
{
BMLogger.Log($"ShowAllPlayerModels: {roleInfos.Count}");
_loadVersion++;
int version = _loadVersion;
@@ -136,12 +137,14 @@ namespace BrewMonster.Scripts
private async UniTask<GameObject> 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<PlayerDefaultEquipments>();
if (playerDefaultEquipments == null)
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
using UnityEngine.Audio;
using BrewMonster.Scripts;
namespace BrewMonster.Scripts
@@ -24,10 +25,23 @@ namespace BrewMonster.Scripts
/// </summary>
[SerializeField] private AudioSource _moveSoundSource;
/// <summary>
/// Mixer group that all skill SFX are routed through. Assign in the Inspector.
/// </summary>
[SerializeField] private AudioMixerGroup _sfxMixerGroup;
/// <summary>
/// Number of pooled AudioSources available for concurrent skill SFX playback.
/// </summary>
[SerializeField] private int _sfxPoolSize = 8;
private readonly List<AudioSource> _sfxPool = new();
protected override void Initialize()
{
base.Initialize();
LoadSoundTable();
BuildSfxPool();
}
// ────────────────────────────────────────────────────────────────────
@@ -81,6 +95,37 @@ namespace BrewMonster.Scripts
return path;
}
// ────────────────────────────────────────────────────────────────────
// Skill SFX pool
// ────────────────────────────────────────────────────────────────────
private void BuildSfxPool()
{
for (int i = 0; i < _sfxPoolSize; i++)
{
var child = new GameObject($"SFXPool_{i}");
child.transform.SetParent(transform);
var src = child.AddComponent<AudioSource>();
src.playOnAwake = false;
src.outputAudioMixerGroup = _sfxMixerGroup;
_sfxPool.Add(src);
}
}
/// <param name="worldPos">World position the source is moved to before playback.</param>
/// <param name="spatialBlend">0 = fully 2D, 1 = fully 3D positional.</param>
private AudioSource GetPooledSource(Vector3 worldPos, float spatialBlend = 0f)
{
AudioSource chosen = null;
foreach (var src in _sfxPool)
if (!src.isPlaying) { chosen = src; break; }
if (chosen == null) chosen = _sfxPool[0]; // fallback: steal oldest
chosen.transform.position = worldPos;
chosen.spatialBlend = spatialBlend;
return chosen;
}
// ────────────────────────────────────────────────────────────────────
// Public API
// ────────────────────────────────────────────────────────────────────
@@ -114,14 +159,14 @@ namespace BrewMonster.Scripts
if (mgr.TryGetCachedAudioClip(address, out var clip) && clip != null)
{
AudioSource.PlayClipAtPoint(clip, Vector3.zero, SkillSfxVolume);
GetPooledSource(worldPos).PlayOneShot(clip, SkillSfxVolume);
return;
}
await mgr.WaitUntilInitializedAsync();
var loaded = await mgr.LoadAudioClipAsync(address);
if (loaded != null)
AudioSource.PlayClipAtPoint(loaded, Vector3.zero, SkillSfxVolume);
GetPooledSource(worldPos).PlayOneShot(loaded, SkillSfxVolume);
}
/// <summary>
@@ -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,11 @@ 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);
GetGameUIMan().EndNPCService();
//((CDlgWorldMap*)pShow1).BuildTravelMap(DT_NPC_TRANSMIT_SERVICE, pData);
}
// else if (idFunction == (int)SERVICE_TYPE.NPC_SKILL)
@@ -37,6 +37,14 @@ namespace BrewMonster.UI
public CDlgMiniMap m_pDlgMiniMap;
//TODO: There're some managers here. We probably need to implement them in the future.
// CECCustomizeMgr *m_CustomizeMgr;
// CECHomeDlgsMgr *m_HomeDlgsMgr;
// CECMiniBarMgr *m_pMiniBarMgr;
private CECMapDlgsMgr m_pMapDlgsMgr;
// CECShortcutMgr *m_pShortcutMgr;
// CECIconStateMgr *m_pIconStateMgr;
private readonly ChatEmotionDisplayPipeline _chatEmotionPipeline = new ChatEmotionDisplayPipeline();
/// <summary>
@@ -437,7 +445,15 @@ namespace BrewMonster.UI
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_INVENTORY] = (INVENTORY_ICONLIST_NAME, Resources.LoadAll<Sprite>(INVENTORY_ICONLIST_NAME));
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE] = (STATE_ICONLIST_NAME, Resources.LoadAll<Sprite>(STATE_ICONLIST_NAME));
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_SKILLGRP] = (SKILL_GROUP_ICON_NAME, Resources.LoadAll<Sprite>(SKILL_GROUP_ICON_NAME));
m_pMapDlgsMgr = new CECMapDlgsMgr();
}
public CECMapDlgsMgr GetMapDlgsMgr()
{
return m_pMapDlgsMgr;
}
public AUIImagePictureBase SetCover(AUIImagePictureBase pImgPic, string nameImage, EC_GAMEUI_ICONS iCONS_TYPE)
{
if (pImgPic == null)
@@ -1,5 +1,10 @@
using System.Collections.Generic;
using BrewMonster.Network;
using CSNetwork.Common;
using CSNetwork.GPDataType;
using ModelRenderer.Scripts.Common;
using ModelRenderer.Scripts.GameData;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
@@ -9,9 +14,20 @@ namespace BrewMonster.UI
{
[SerializeField] private Image mapImage;
[SerializeField] private Image _hostPlayerPositionImage;
[Space(10)]
[SerializeField] private float _positionFactor = 2f;
[SerializeField] private Button _closeButton;
[Space(10)]
[Header("Transmit Service")]
[SerializeField] private RectTransform _transPointButtonParent;
// this is the prefab for the trans point button
[SerializeField] private WorldMapTransPoint _transPointButtonPrefab;
[SerializeField] private Image _trasmitWayImagePrefab; // this is the line to connect the trans point to the host player.
private List<Image> _waypointImages = new(); // this is the list of waypoint images.
private Dictionary<int, WorldMapTransPoint> _transPoints = new();
// 世界 / World
const int MAJOR_MAP = 1;
@@ -43,7 +59,7 @@ namespace BrewMonster.UI
_closeButton.onClick.AddListener(OnCloseButtonClicked);
}
#region Override
public override void Show(bool value)
{
base.Show(value);
@@ -53,13 +69,31 @@ namespace BrewMonster.UI
}
}
public override void CloseDialogue()
{
base.CloseDialogue();
// hide all the trans points
foreach(var transPoint in _transPoints)
{
transPoint.Value.gameObject.SetActive(false);
}
// clear the waypoint images
foreach(var waypointImage in _waypointImages)
{
waypointImage.gameObject.SetActive(false);
}
}
public override bool Render()
{
UpdateHostPlayerPositionImage();
return base.Render();
}
#endregion
#region Rendering Functions
Vector3 _hostPlayerPosition;
Quaternion _hostPlayerRotation;
@@ -92,6 +126,43 @@ namespace BrewMonster.UI
hostPlayerRectTransform.localRotation = Quaternion.Euler(0, 0, -_hostPlayerRotation.eulerAngles.y);
}
/// <summary>
/// If use use Transmit Scroll or Transmit Service, we have to show the transmit points on the map.
/// </summary>
private void ShowTranPoints()
{
CECGameUIMan pGameUI = CECUIManager.Instance.GetInGameUIMan();
var transPoints = pGameUI.GetMapDlgsMgr().m_transPoints;
WorldMapTransPoint transPointObject = null;
int currentMapId = (int)GetDataPtr("WorldID");
foreach(var transPointPair in transPoints)
{
// Only show the trans points for the current map.
if (transPointPair.Value.worldid != currentMapId) continue;
// check if the trans point is already created. If not, create it.
if(_transPoints.TryGetValue(transPointPair.Key, out transPointObject))
{
// now enable the trans point object
transPointObject.gameObject.SetActive(true);
}
else
{
// create the trans point object
transPointObject = Instantiate(_transPointButtonPrefab, _transPointButtonParent);
transPointObject.Init(this, transPointPair.Key);
transPointObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(transPointPair.Value.vecPos.x / _positionFactor, transPointPair.Value.vecPos.z / _positionFactor);
_transPoints[transPointPair.Key] = transPointObject;
transPointObject.gameObject.SetActive(true);
}
}
}
private void ShowTransWays()
{
}
private bool TryGetHostPlayerPosition(out Vector3 hostPlayerPosition, out Quaternion hostPlayerRotation)
{
hostPlayerPosition = Vector3.zero;
@@ -118,6 +189,7 @@ namespace BrewMonster.UI
// PAUIIMAGEPICTURE pImage = (PAUIIMAGEPICTURE)GetDlgItem("WorldMapTravel");
// prepare the necessary information
// This set the type of the map to show (DT_NPC_TRANSMIT_SERVICE or DT_TRANSMITSCROLL_ESSENCE)
SetData(dwType);
// CECMapDlgsMgr *pMgr = GetGameUIMan()->GetMapDlgsMgr();
@@ -127,12 +199,15 @@ 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");
// pMgr->LoadMapTexture(m_pA3DDevice, pImage, CECMapDlgsMgr::MAP_TYPE_TRANSMIT);
// save the worldid so the ShowTranPoints() function know which map to show.
//TODO: We have to get the worldid from the service data.
worldid = 161;//(int)serviceData.worldid;
SetDataPtr(worldid, "WorldID");
ShowTranPoints();
DrawWayPoints(GetGameUIMan().m_pCurNPCEssence, worldid, true);
}
else if(dwType == (uint)DATA_TYPE.DT_TRANSMITSCROLL_ESSENCE)
{
@@ -148,6 +223,75 @@ namespace BrewMonster.UI
}
}
// This function onriginally is in the CECMapDlgsMgr class.
// However I moved it here since we need to draw the waypoints on Unity Canvas.
/// <summary>Draw the waypoints from the current NPC Position to all the possible Transmit targets.</summary>
public void DrawWayPoints(NPC_ESSENCE? pNPC, int iWorldID, bool bDrawLines)
{
if (!pNPC.HasValue && bDrawLines) return; // only draw lines if the NPC is not null and bDrawLines is true.
DATA_TYPE dataType = DATA_TYPE.DT_INVALID;
int idCur = (int)pNPC.Value.id_to_discover;
var dataPtr = ElementDataManProvider.GetElementDataMan().get_data_ptr(pNPC.Value.id_transmit_service, ID_SPACE.ID_SPACE_ESSENCE, ref dataType);
if (dataType == DATA_TYPE.DT_NPC_TRANSMIT_SERVICE)
{
var serviceData = (NPC_TRANSMIT_SERVICE)dataPtr;
// start point is current location of the player or NPC
Vector3 startPoint = Vector3.zero;
bool hasHostPlayerPosition = TryGetHostPlayerPosition(out startPoint, out var startRotation);
CECGameUIMan pGameUI = CECUIManager.Instance.GetInGameUIMan();
var transPoints = pGameUI.GetMapDlgsMgr().m_transPoints;
if (transPoints.TryGetValue(idCur, out var transPoint))
{
startPoint = new Vector3(transPoint.vecPos.x, transPoint.vecPos.y, transPoint.vecPos.z);
}
int targetNum = GetTransmitTargetsNum(serviceData);
TRANS_POINT traget;
Vector2 anchoredTargetPosition = Vector2.zero;
Image waypointImage = null;
for (int i = 0; i < targetNum; i++)
{
if (transPoints.TryGetValue(serviceData.targets[i].idTarget, out traget))
{
// instantiate the waypoint image
if (i < _waypointImages.Count)
{
waypointImage = _waypointImages[i];
}
else
{
waypointImage = Instantiate(_trasmitWayImagePrefab, _transPointButtonParent);
_waypointImages.Add(waypointImage);
}
var rectTransform = waypointImage.rectTransform;
rectTransform.anchoredPosition = new Vector2(startPoint.x / _positionFactor, startPoint.z / _positionFactor);
anchoredTargetPosition = new Vector2(traget.vecPos.x / _positionFactor, traget.vecPos.z / _positionFactor);
Vector2 direction = anchoredTargetPosition - rectTransform.anchoredPosition;
float distance = direction.magnitude;
rectTransform.sizeDelta = new Vector2(distance, 2);
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
rectTransform.localEulerAngles = new Vector3(0, 0, angle);
waypointImage.gameObject.SetActive(true);
}
}
}
}
public static int GetTransmitTargetsNum(NPC_TRANSMIT_SERVICE pService)
{
int num_targets = 0;
num_targets = Mathf.Max(0, pService.num_targets);
num_targets = Mathf.Min(num_targets, pService.targets.Length);
return num_targets;
}
#endregion
#region UI Event Handlers
/// <summary>
/// When user click on the map texture.
/// We will calculate the world coordinates from the local cursor position. Then move the host player to the world coordinates.
@@ -162,9 +306,102 @@ namespace BrewMonster.UI
OnCloseButtonClicked();
}
public void OnTransPointClicked(int id)
{
var transPoints = CECUIManager.Instance.GetInGameUIMan().GetMapDlgsMgr().m_transPoints;
if(transPoints.TryGetValue(id, out var transPoint))
{
UnityGameSession.c2s_CmdGoto(transPoint.vecPos.x, transPoint.vecPos.y, transPoint.vecPos.z);
// close the map
OnCloseButtonClicked();
}
}
private void OnCloseButtonClicked()
{
CloseDialogue();
}
#endregion
}
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<TRANS_POINT> m_vecTeamMate = new();
public Dictionary<int, TRANS_POINT> m_transPoints = new();
// update player way-points
public void UpdateWayPoints(ushort[] pData, uint 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];//*(pData+i);
for(int j = 0; j < vecTarget.Count; j++ )
{
if( idThis != vecTarget[j].id ) continue;
TRANS_POINT tp;
tp.id = idThis;
tp.strName = 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<TRANS_POINT> wayPoints = new(); // 传送路线(不含起点、包括终点)(各模式下均可用于显示,TM_NPC_TRANSMIT_DIRECT 模式下才可用于协议)
}
}
@@ -12,6 +12,10 @@ namespace BrewMonster.UI
public DlgWorldMap dlgWorldMap;
// if true, user can click on the map to move the host player to the clicked position.
// ideally we only enble this for testing/development.
[SerializeField] private bool _enableClickToMove = true;
// The host player player (0,0,0) is not at the center of the map. It usually has an offset that we have to calculate at Awake
private Vector2 _hostPlayerOffsetPosition;
@@ -38,6 +42,8 @@ namespace BrewMonster.UI
// This triggers automatically when the user clicks/taps on this Image
public void OnPointerClick(PointerEventData eventData)
{
if(!_enableClickToMove) return;
Vector2 localCursorPosition;
// Convert the screen click position to local anchored position inside the Map
@@ -0,0 +1,26 @@
using UnityEngine;
namespace BrewMonster.UI
{
/// <summary>
/// This script should be attached to the trans point button in the world map.
/// A Transmit Point will show up when user use Transmit Scroll or Transmit Service. (Dịch vụ dịch chuyển ở NPC)
/// </summary>
public class WorldMapTransPoint : MonoBehaviour
{
[HideInInspector] public int id;
private DlgWorldMap _dlgWorldMap;
public void Init(DlgWorldMap dlgWorldMap, int id)
{
_dlgWorldMap = dlgWorldMap;
this.id = id;
}
public void OnClick()
{
_dlgWorldMap.OnTransPointClicked(id);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 252f6fb85c7e72d49b2e8ea20c2d59c8
@@ -6,7 +6,7 @@ TextureImporter:
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
@@ -37,13 +37,13 @@ TextureImporter:
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
@@ -52,9 +52,9 @@ TextureImporter:
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
@@ -139,7 +139,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34c21eadb8c5ac749a341f92da503988
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -75,6 +75,153 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &222794976166085183
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8205908652006291613}
- component: {fileID: 701947802954970172}
- component: {fileID: 4401574036847015979}
- component: {fileID: 6841128026403163401}
- component: {fileID: 2537562987844392478}
m_Layer: 0
m_Name: TransmitPoint
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &8205908652006291613
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 222794976166085183}
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: 6891421740142056974}
m_Father: {fileID: 7169122999130120872}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.518}
m_AnchorMax: {x: 0.5, y: 0.518}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 12, y: 12.000002}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &701947802954970172
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 222794976166085183}
m_CullTransparentMesh: 1
--- !u!114 &4401574036847015979
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 222794976166085183}
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: 21300000, guid: bd0c1ffed4c1947fe817f36f72257283, type: 3}
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 &6841128026403163401
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 222794976166085183}
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: 0
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: 4401574036847015979}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 2537562987844392478}
m_TargetAssemblyTypeName: BrewMonster.UI.WorldMapTransPoint, Assembly-CSharp
m_MethodName: OnClick
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &2537562987844392478
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 222794976166085183}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 252f6fb85c7e72d49b2e8ea20c2d59c8, type: 3}
m_Name:
m_EditorClassIdentifier:
id: 0
--- !u!1 &936441858863998774
GameObject:
m_ObjectHideFlags: 0
@@ -232,6 +379,81 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3185449669602415166
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6891421740142056974}
- component: {fileID: 4819673339622355777}
- component: {fileID: 603420354022532661}
m_Layer: 0
m_Name: hitbox
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6891421740142056974
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3185449669602415166}
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: 8205908652006291613}
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: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4819673339622355777
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3185449669602415166}
m_CullTransparentMesh: 1
--- !u!114 &603420354022532661
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3185449669602415166}
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: 0.003921569}
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!1 &4370684628053341786
GameObject:
m_ObjectHideFlags: 0
@@ -363,6 +585,9 @@ MonoBehaviour:
_hostPlayerPositionImage: {fileID: 4036230907032538800}
_positionFactor: 1.8
_closeButton: {fileID: 8858186809287203567}
_transPointButtonParent: {fileID: 7169122999130120872}
_transPointButtonPrefab: {fileID: 2537562987844392478}
_trasmitWayImagePrefab: {fileID: 8731835385296660332}
--- !u!1 &8308536083041954008
GameObject:
m_ObjectHideFlags: 0
@@ -547,6 +772,8 @@ RectTransform:
- {fileID: 5906545349664091413}
- {fileID: 1510574663178069641}
- {fileID: 9142400375056319150}
- {fileID: 8205908652006291613}
- {fileID: 4100535739032287444}
m_Father: {fileID: 7323734624486819451}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
@@ -606,3 +833,79 @@ MonoBehaviour:
m_EditorClassIdentifier:
_hostPlayerPositionImage: {fileID: 5906545349664091413}
dlgWorldMap: {fileID: 135853640611757204}
_enableClickToMove: 1
--- !u!1 &9069447884487553244
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4100535739032287444}
- component: {fileID: 7327245972570987933}
- component: {fileID: 8731835385296660332}
m_Layer: 0
m_Name: TransmitWayImage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!224 &4100535739032287444
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9069447884487553244}
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: 7169122999130120872}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.518}
m_AnchorMax: {x: 0.5, y: 0.518}
m_AnchoredPosition: {x: -2.5000153, y: -0.000015258789}
m_SizeDelta: {x: 5, y: 5}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &7327245972570987933
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9069447884487553244}
m_CullTransparentMesh: 1
--- !u!114 &8731835385296660332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9069447884487553244}
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
+102 -132
View File
@@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 3636302681040170949}
- component: {fileID: 4656951194032224}
- component: {fileID: 1928072503138413728}
m_Layer: 0
m_Name: SFX
m_TagString: Untagged
@@ -29,8 +30,7 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2281112146744556387}
m_Children: []
m_Father: {fileID: 4292995824318243454}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4656951194032224
@@ -45,7 +45,106 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4cfa292fff0815d40b82f32256b3f2cc, type: 3}
m_Name:
m_EditorClassIdentifier:
_moveSoundSource: {fileID: 2796487417538969809}
_moveSoundSource: {fileID: 1928072503138413728}
_sfxMixerGroup: {fileID: 217038053835239290, guid: 9c6a7598ca0dfcd4fa51470ebbdd7549, type: 2}
_sfxPoolSize: 8
--- !u!82 &1928072503138413728
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2838129733766203984}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 217038053835239290, guid: 9c6a7598ca0dfcd4fa51470ebbdd7549, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1 &6634120867767479402
GameObject:
m_ObjectHideFlags: 0
@@ -314,132 +413,3 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
_worldMusicDB: {fileID: 11400000, guid: 7602c1f71697aae42a7751212c5144dc, type: 2}
--- !u!1 &9129044928287689905
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2281112146744556387}
- component: {fileID: 2796487417538969809}
m_Layer: 0
m_Name: MoveSoundSource
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2281112146744556387
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9129044928287689905}
serializedVersion: 2
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: 3636302681040170949}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &2796487417538969809
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9129044928287689905}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 217038053835239290, guid: 9c6a7598ca0dfcd4fa51470ebbdd7549, type: 2}
m_audioClip: {fileID: 0}
m_Resource: {fileID: 0}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
+18 -44
View File
@@ -1,5 +1,6 @@
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.UI;
using CSNetwork;
using CSNetwork.GPDataType;
using Cysharp.Threading.Tasks;
@@ -57,54 +58,27 @@ namespace BrewMonster
void OnMsgHstWayPoint(ECMSG Msg)
{
//CECGameUIMan pGameUI = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
CECGameUIMan pGameUI = CECUIManager.Instance.GetInGameUIMan();
//if (Convert.ToInt32(Msg.dwParam2) == CommandID.ACTIVATE_WAYPOINT)
//{
// cmd_activate_waypoint pCmd = GPDataTypeHelper.FromBytes<cmd_activate_waypoint>((byte[])Msg.dwParam1);
// m_aWayPoints.Add(pCmd.waypoint);
if (Convert.ToInt32(Msg.dwParam2) == CommandID.ACTIVATE_WAYPOINT)
{
cmd_activate_waypoint pCmd = GPDataTypeHelper.FromBytes<cmd_activate_waypoint>((byte[])Msg.dwParam1);
m_aWayPoints.Add(pCmd.waypoint);
// // add to waypoints array
// pGameUI.GetMapDlgsMgr().UpdateWayPoints(&pCmd.waypoint, 1, false);
// add to waypoints array
// pGameUI.GetMapDlgsMgr().UpdateWayPoints(&pCmd.waypoint, 1, false);
}
else if (Convert.ToInt32(Msg.dwParam2) == CommandID.WAYPOINT_LIST)
{
cmd_waypoint_list pCmd = new cmd_waypoint_list();
pCmd.FromBytes((byte[])Msg.dwParam1);
// // 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);
for (int i=0; i < pCmd.count; i++)
m_aWayPoints.Add(pCmd.list[i]);
// bool bCanPopUITips = true;
// int count = CECUIConfig::Instance().GetGameUI().GetTaskIDDisableWayPointsUITipsCount();
// // ¼ì²éÉíÉÏÊÇ·ñÓнûÖ¹µ¯³ötipsµÄÈÎÎñ
// for (int i=0;i<count;i++){
// int taskID = CECUIConfig::Instance().GetGameUI().GetTaskIDDisableWayPointsUITips(i);
// if(GetTaskInterface() && GetTaskInterface().HasTask(taskID)){
// bCanPopUITips = false;
// break;
// }
// }
// // µ¯³ötips
// CECScriptMan* pScriptMan = g_pGame.GetGameRun().GetUIManager().GetScriptMan();
// if (pScriptMan && bCanPopUITips)
// {
// pScriptMan.GetContext().GetUI().SetTipDialogTitleAndContent(AC2AS_CP(CP_UTF8, pGameUI.GetStringFromTable(11350)), AC2AS_CP(CP_UTF8, (itr.second).strName));
// pScriptMan.GetContext().GetUI().ShowTip(500, 500, 5000, 300);
// }
// }
// }
// else if (Msg.dwParam2 == WAYPOINT_LIST)
// {
// cmd_waypoint_list* pCmd = (cmd_waypoint_list*)Msg.dwParam1;
// m_aWayPoints.SetSize(pCmd.count, 16);
// for (size_t i = 0; i < pCmd.count; i++)
// m_aWayPoints[i] = pCmd.list[i];
// // update the whole list
// pGameUI.GetMapDlgsMgr().UpdateWayPoints(pCmd.list, pCmd.count, true);
// }
// update the whole list
pGameUI.GetMapDlgsMgr().UpdateWayPoints(pCmd.list, pCmd.count, true);
}
}
private void OnMsgHstPressCancel(ECMSG Msg)
+30 -30
View File
@@ -54,8 +54,8 @@ namespace BrewMonster
private bool m_bJumpInWater = false;
public A3DVECTOR3 m_vVelocity; // Velocity
bool m_bChangingFace; // true, host is changing face
private int m_iRoleCreateTime;
private int m_iRoleLastLoginTime; // Role last login time
@@ -185,7 +185,7 @@ namespace BrewMonster
private UnityEngine.InputSystem.Keyboard m_cachedKeyboard;
int[] targetsCastSkill;
public bool IsChangingFace()
{
return m_bChangingFace;
@@ -367,8 +367,8 @@ namespace BrewMonster
m_iAccountTotalCash = RoleInfo.cash_add;
EC_Game.GetGameRun().AddPlayerName(m_PlayerInfo.cid, m_strName);
if (!await LoadPlayerSkeleton(true))
if (!await LoadPlayerSkeleton(true))
{
BMLogger.LogError($"HoangDev CECHostPlayer::LoadResources, Failed to load skeleton. {m_strName}");
return false;
@@ -487,7 +487,7 @@ namespace BrewMonster
public void ProcessMessage(in ECMSG Msg)
{
var msg = (int)Msg.dwMsg;
//Debug.LogError("HoangDev : ProcessMessageProcessMessageProcessMessage " + msg);
//Debug.LogError("HoangDev : ProcessMessageProcessMessageProcessMessage " + msg);
switch (msg)
{
case EC_MsgDef.MSG_HST_CORRECTPOS: OnMsgHstCorrectPos(Msg); break;
@@ -878,7 +878,7 @@ namespace BrewMonster
NotifyServerForceAttack(true);
}
}
#if UNITY_EDITOR
/// <summary>
/// Cycles through learned skills by removing all shortcuts and adding 2 new skills to slots 0 and 1.
@@ -891,7 +891,7 @@ namespace BrewMonster
{
return m_bEnterGame;
}
void SetLevel2(int level2, bool bFirstTime)
{
int lastLevel2 = m_BasicProps.iLevel2;
@@ -905,7 +905,7 @@ namespace BrewMonster
{
return m_pWorkMan.IsMovingToPosition();
}*/
public bool IsPosCollideFree(A3DVECTOR3 vTargetPos)
{
bool bAvailable = (false);
@@ -1502,7 +1502,7 @@ namespace BrewMonster
// SetPlayerModel();
//Debug.LogError("Pos Character = " + pos);
}
/// <summary>Use host's m_pvp (we update it from S2C duel packets). Base IsInDuel() reads CECPlayer.m_pvp which is never set.</summary>
public new bool IsInDuel() { return m_pvp.iDuelState == Duel_state.DUEL_ST_INDUEL; }
@@ -1536,7 +1536,7 @@ namespace BrewMonster
//bool bResult = false;
float fRange = 0.0f;
//string reasonStr = iReason == 1 ? "melee" : (iReason == 2 ? "cast magic" : (iReason == 3 ? "talk" : $"unknown({iReason})"));
switch (iReason)
{
case 1: // melee
@@ -1769,7 +1769,7 @@ namespace BrewMonster
return fSpeedSev;
}
public void PrepareNPCService(int idSev)
{
@@ -2077,9 +2077,9 @@ namespace BrewMonster
return bRet;
}
public int GetMaxLevelSofar() { return Math.Max(m_ReincarnationTome.max_level, m_BasicProps.iLevel); }
public bool CanUseProjectile(CECIvtrArrow pArrow)
{
if (pArrow == null)
@@ -2660,7 +2660,7 @@ namespace BrewMonster
return idNewSel;
}
//public float GetSwimSpeedSev()
//{
// float fSpeedSev = GetSwimSpeed();
@@ -3021,7 +3021,7 @@ namespace BrewMonster
// cursorType = CursorType.Pickup;
// else if (CanGatherMatter(pMatter))
// cursorType = pMatter.IsMonsterSpiritMine() ? CursorType.Swallow : CursorType.Dig;
//
//
// if (cursorType != CursorType.Normal)
// m_idCurHover = idHitObject;
// }
@@ -3382,7 +3382,7 @@ namespace BrewMonster
BUBBLE_HPWARN,
BUBBLE_MPWARN,
BUBBLE_REBOUND, // ·´µ¯
BUBBLE_BEAT_BACK, // ·´»÷
BUBBLE_BEAT_BACK, // ·´»÷
BUBBLE_ADD, // ÎüѪµÄ¼ÓºÅ
BUBBLE_DODGE_DEBUFF,
BUBBLE_REALMEXP,
@@ -3781,7 +3781,7 @@ namespace BrewMonster
// Get key object(NPC..) coordinates
public A3DVECTOR3 GetObjectCoordinates(int idTarget, out List<OBJECT_COORD> TargetCoord, ref bool bInTable)
{
TargetCoord = new List<OBJECT_COORD>();
A3DVECTOR3 vDestPos = new A3DVECTOR3(0, 0, 0);
@@ -3816,7 +3816,7 @@ namespace BrewMonster
string strCurMap = pInstance.GetPath() ?? string.Empty;
// ȼͬһͼǷҪҵƷ
bool bHasObjectInCurrentInstance = originalCoords.Any(coord => coord.strMap == strCurMap);
// Iterate over original list and build filtered TargetCoord list
for (int i = 0; i < iCount; i++)
{
@@ -3848,10 +3848,10 @@ namespace BrewMonster
if (instCoord[j].strMap == strCurMap)
{
TargetCoord.Add(instCoord[j]);
// Check if this is the nearest target
float tempDist = (instCoord[j].vPos - GetPos()).Magnitude();
if (tempDist < fMinDist)
{
fMinDist = tempDist;
@@ -3869,7 +3869,7 @@ namespace BrewMonster
public int GetRealmSubLevel() { return m_RealmLevel % 100; }
public static int GetRealmLayer(int realmLevel) { return realmLevel > 0 ? (realmLevel + 9) / 10 : 0; }
public static int GetRealmSubLevel(int realmLevel) { return realmLevel > 0 ? (realmLevel % 10 > 0 ? realmLevel % 10 : 10) : 0; }
// <summary>
// Calculate distance to an object and optionally retrieve the object reference
// 计算到对象的距离,并可选地获取对象引用
@@ -3981,13 +3981,13 @@ namespace BrewMonster
// }
//}
}
}
//// ID checking helper methods
//private bool ISNPCID(int id) => ((id & 0x80000000) != 0) && ((id & 0x40000000) == 0);
//private bool ISPLAYERID(int id) => id != 0 && (id & 0x80000000) == 0;
//private bool ISMATTERID(int id) => ((id) & 0xC0000000) == 0xC0000000;
// Release object
public void Release()
{
@@ -4213,7 +4213,7 @@ namespace BrewMonster
}
else
{
newId = 0;
newId = 164;
}
PlayMoveSound(newId);
@@ -4228,13 +4228,13 @@ namespace BrewMonster
if (id == _curMoveSndId) return;
_curMoveSndId = id;
if(id > 0)
{
{
SFXManager.Instance?.PlayMoveSoundAsync(id).Forget();
}
else
/*else
{
SFXManager.Instance?.StopMoveSoundAsync().Forget();
}
}*/
}
/// <summary>
@@ -4261,8 +4261,8 @@ namespace BrewMonster
return trace.GetTraceReason() == Trace_reason.TRACE_SPELL;
}
}
}
+1
View File
@@ -49,6 +49,7 @@ public class CECUIManager : MonoSingleton<CECUIManager>
Sprite[] m_iconlistIvtr;
private CDlgInfoTooltip m_pDlgSkillTooltip;
// Task update timer / 任务更新计时器
private float _nextTaskUpdateTime = 0f;
private const float TASK_UPDATE_INTERVAL = .1f;