get world target data.
This commit is contained in:
@@ -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:
|
||||
@@ -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
|
||||
@@ -2,6 +2,8 @@ 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;
|
||||
|
||||
@@ -12,6 +14,7 @@ public struct TRANS_TARGET
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public ushort[] name;
|
||||
public string Name;
|
||||
public int world_id;
|
||||
public A3DVECTOR3 vecPos;
|
||||
public int domain_id;
|
||||
@@ -98,9 +101,40 @@ public static class BinaryReaderExtensions
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
private static List<TRANS_TARGET> global_trans_targets = new();
|
||||
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.txt(C++:Configs/Coord_data.txt)用于任务可点击链接的自动移动。
|
||||
LoadObjectCoord();
|
||||
LoadPetAutoSkill();
|
||||
|
||||
GlobalDataManager.globaldata_load();
|
||||
return true;
|
||||
}
|
||||
public static CECConfigs GetConfigs() { return m_pConfigs; }
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace BrewMonster.UI
|
||||
public Dictionary<int, TRANS_POINT> m_transPoints = new();
|
||||
|
||||
// update player way-points
|
||||
public void UpdateWayPoints(object pData, int iSize, bool bClear)
|
||||
public void UpdateWayPoints(ushort[] pData, uint iSize, bool bClear)
|
||||
{
|
||||
var vecTarget = GlobalTransmitData.globaldata_gettranstargets;
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace BrewMonster.UI
|
||||
// got valid points.
|
||||
for(int i = 0; i < iSize; i++ )
|
||||
{
|
||||
int idThis = *(pData+i);
|
||||
int idThis = pData[i];//*(pData+i);
|
||||
for(int j = 0; j < vecTarget.Count; j++ )
|
||||
{
|
||||
if( idThis != vecTarget[j].id ) continue;
|
||||
@@ -221,7 +221,7 @@ namespace BrewMonster.UI
|
||||
TRANS_POINT tp;
|
||||
|
||||
tp.id = idThis;
|
||||
tp.strName = ByteToStringUtils.UshortArrayToUnicodeString(vecTarget[j].name);
|
||||
tp.strName = vecTarget[j].Name;
|
||||
tp.vecPos = vecTarget[j].vecPos;
|
||||
tp.worldid = vecTarget[j].world_id;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BrewMonster.Network;
|
||||
using BrewMonster.Scripts;
|
||||
using BrewMonster.UI;
|
||||
using CSNetwork;
|
||||
using CSNetwork.GPDataType;
|
||||
using Cysharp.Threading.Tasks;
|
||||
@@ -57,7 +58,7 @@ 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)
|
||||
{
|
||||
@@ -67,6 +68,17 @@ namespace BrewMonster
|
||||
// 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);
|
||||
|
||||
for (int i=0; i < pCmd.count; i++)
|
||||
m_aWayPoints.Add(pCmd.list[i]);
|
||||
|
||||
// update the whole list
|
||||
pGameUI.GetMapDlgsMgr().UpdateWayPoints(pCmd.list, pCmd.count, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMsgHstPressCancel(ECMSG Msg)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user