convert TaskTempl

This commit is contained in:
Le Duc Anh
2025-10-01 15:12:40 +07:00
parent 5477333690
commit 1efca22cb8
9 changed files with 366 additions and 137 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ public abstract class EC_Player : MonoBehaviour
PLAYER_ACTION action = actionConfig;
var szAct = EC_Utility.BuildActionName(action, 0);
BrewMonster.Logger.Log("HoangDev szActszAct: " + szAct);
BrewMonster.BMLogger.Log("HoangDev szActszAct: " + szAct);
EventBus.PublishChannel(m_PlayerInfo.cid, new PlayActionEvent(szAct));
return true;
}
+3 -3
View File
@@ -11,7 +11,7 @@ public class PlayerVisual : MonoBehaviour
private void PlayActionEventHandler(PlayActionEvent @event)
{
BrewMonster.Logger.Log("PlayActionEventHandler : "+@event.AnimationName);
BrewMonster.BMLogger.Log("PlayActionEventHandler : "+@event.AnimationName);
animancer.TryPlay(@event.AnimationName);
}
@@ -20,13 +20,13 @@ public class PlayerVisual : MonoBehaviour
animancer = GetComponentInChildren<NamedAnimancerComponent>();
if(animancer == null)
{
BrewMonster.Logger.LogError("animancer == null");
BrewMonster.BMLogger.LogError("animancer == null");
return;
}
var player = GetComponentInParent<EC_Player>();
if(player == null)
{
BrewMonster.Logger.LogError("player == null");
BrewMonster.BMLogger.LogError("player == null");
return;
}
_playerInfo = player.GetPlayInfo();
+42 -55
View File
@@ -6,12 +6,6 @@ using UnityEngine;
namespace PerfectWorld.Scripts.Task
{
public struct TASK_PACK_HEADER
{
public ulong magic;
public ulong version;
public ulong item_count;
};
public class ATaskTemplMan
{
public const ulong TASK_PACK_MAGIC = 0x93858361;
@@ -46,15 +40,21 @@ namespace PerfectWorld.Scripts.Task
{
m_pEleDataMan = pMan;
}
public bool LoadTasksFromPack(string szPackPath, bool bLoadDescript)
{
//TaskInterface::WriteLog(0, 0, 2, "LoadPack begin");
Debug.Log("[Dat]- szPackPath: " + szPackPath);
FileStream fs = new FileStream(szPackPath, FileMode.Open, FileAccess.Read);
TASK_PACK_HEADER tph;
BMLogger.Log("[Dat]- szPackPath: " + szPackPath);
if (!File.Exists(szPackPath))
{
BMLogger.LogError("[Dat]- File not found: " + szPackPath);
return false;
}
// fread(&tph, sizeof(tph), 1, fp);
tph = ReadStruct<TASK_PACK_HEADER>(fs);
long readBytes = 0;
FileStream fs = new FileStream(szPackPath, FileMode.Open, FileAccess.Read);
TASK_PACK_HEADER tph = AAssit.ReadFromBinaryOf<TASK_PACK_HEADER>(fs, ref readBytes);
if (tph.magic != TASK_PACK_MAGIC
|| tph.version != _task_templ_cur_version)
@@ -62,37 +62,24 @@ namespace PerfectWorld.Scripts.Task
if (tph.item_count == 0) return true;
long[] pOffs = new long[tph.item_count];
uint[] pOffs = new uint[tph.item_count];
g_ulNewCount++;
// fread(pOffs, sizeof(long), tph.item_count, fp);
// Convert fread(pOffs, sizeof(long), tph.item_count, fp); to C#
// Read tph.item_count 8-byte integers (long) from the FileStream fs into pOffs array
pOffs = AAssit.ReadArrayFromBinary<uint>(fs, tph.item_count, ref readBytes);
byte[] offsBuffer = new byte[tph.item_count * sizeof(long)];
int bytesRead = fs.Read(offsBuffer, 0, offsBuffer.Length);
if (bytesRead != offsBuffer.Length)
throw new EndOfStreamException("Could not read enough bytes for offsets");
for (ulong i = 0; i < tph.item_count; i++)
for (int i = 0; i < tph.item_count; i++)
{
pOffs[i] = System.BitConverter.ToInt64(offsBuffer, (int)(i * sizeof(long)));
}
for (ulong i = 0; i < tph.item_count; i++)
{
// if (fseek(fp, pOffs[i], SEEK_SET) != 0)
// continue;
if (fs.Seek(pOffs[i], SeekOrigin.Begin) != 0)
continue;
fs.Seek(pOffs[i], SeekOrigin.Begin);
ATaskTempl pTempl = new ATaskTempl();
g_ulNewCount++;
if (!pTempl.LoadFromBinFile(fs))
{
CECTaskInterface.WriteLog(0, (int)pTempl.m_ID, 0, "Cant Load Task");
CECTaskInterface.WriteLog(0, (int)pTempl.m_FixedData.m_ID, 0, "Cant Load Task");
// LOG_DELETE(pTempl);
continue;
}
@@ -101,14 +88,14 @@ namespace PerfectWorld.Scripts.Task
// TaskInterface::WriteLog(0, pTempl->m_ID, 2, "LoadTask");
}
// char log[1024];
// sprintf(log, "LoadTask, Count = %d", m_TaskTemplMap.size());
// TaskInterface::WriteLog(0, 0, 2, log);
// // char log[1024];
// // sprintf(log, "LoadTask, Count = %d", m_TaskTemplMap.size());
// // TaskInterface::WriteLog(0, 0, 2, log);
//todo: check
// LOG_DELETE_ARR(pOffs);
// //todo: check
// // LOG_DELETE_ARR(pOffs);
fs.Close();
UpdateTimeLimitCheckList();
// UpdateTimeLimitCheckList();
#if _ELEMENTCLIENT
_task_err.Release();
@@ -148,37 +135,37 @@ namespace PerfectWorld.Scripts.Task
private void AddOneTaskTempl(ATaskTempl pTask)
{
//todo: recheck - wrong logic
if (m_AllTemplMap.ContainsKey(pTask.m_ID))
if (m_AllTemplMap.ContainsKey(pTask.m_FixedData.m_ID))
{
CECTaskInterface.WriteLog(0, (int)pTask.m_ID, 0, "Dup Task Found");
CECTaskInterface.WriteLog(0, (int)pTask.m_FixedData.m_ID, 0, "Dup Task Found");
// Optionally log duplicate task found, e.g.:
// Debug.LogWarning($"Duplicate Task Found: {pTempl.m_ID}");
return;
}
m_TaskTemplMap[pTask.m_ID] = pTask;
m_TaskTemplMap[pTask.m_FixedData.m_ID] = pTask;
if (pTask.m_bDeathTrig) m_DeathTrigMap[pTask.m_ID] = pTask;
else if (pTask.m_bAutoDeliver) m_AutoDelvMap[pTask.m_ID] = pTask;
if (pTask.m_FixedData.m_bDeathTrig) m_DeathTrigMap[pTask.m_FixedData.m_ID] = pTask;
else if (pTask.m_FixedData.m_bAutoDeliver) m_AutoDelvMap[pTask.m_FixedData.m_ID] = pTask;
if (pTask.m_bPQTask) m_PQTemplMap[pTask.m_ID] = pTask;
if (pTask.m_FixedData.m_bPQTask) m_PQTemplMap[pTask.m_FixedData.m_ID] = pTask;
if (pTask.m_bSkillTask) m_SkillTaskLst.Add(pTask);
if (pTask.m_FixedData.m_bSkillTask) m_SkillTaskLst.Add(pTask);
//todo: recheck m_DynTaskType type
if (!string.IsNullOrEmpty(pTask.m_DynTaskType))
if (!string.IsNullOrEmpty(pTask.m_FixedData.m_DynTaskType))
{
if (m_DynTaskMap.TryGetValue(pTask.m_ID, out ATaskTempl task))
if (m_DynTaskMap.TryGetValue(pTask.m_FixedData.m_ID, out ATaskTempl task))
{
CECTaskInterface.WriteLog(0, (int)pTask.m_ID, 0, "Dup Dyn Task Found");
CECTaskInterface.WriteLog(0, (int)pTask.m_FixedData.m_ID, 0, "Dup Dyn Task Found");
}
m_DynTaskMap[pTask.m_ID] = pTask;
m_DynTaskMap[pTask.m_FixedData.m_ID] = pTask;
}
if (pTask.m_bDisplayInTitleTaskUI)
m_TitleTaskMap[pTask.m_ID] = pTask;
if (pTask.m_bAutoDeliver && pTask.m_bDisplayInExclusiveUI)
m_ExlusiveAwardTaskMap[pTask.m_ID] = pTask;
if (pTask.m_FixedData.m_bDisplayInTitleTaskUI)
m_TitleTaskMap[pTask.m_FixedData.m_ID] = pTask;
if (pTask.m_FixedData.m_bAutoDeliver && pTask.m_FixedData.m_bDisplayInExclusiveUI)
m_ExlusiveAwardTaskMap[pTask.m_FixedData.m_ID] = pTask;
//#if _TASK_CLIENT
// if (pTask.m_ulDelvNPC != 0 && pTask.m_bCanSeekOut)
@@ -190,10 +177,10 @@ namespace PerfectWorld.Scripts.Task
private void AddTaskToMap(ATaskTempl pTempl)
{
if (pTempl.m_enumMethod == (ulong)TaskMethod.enumTMProtectNPC && pTempl.m_ulNPCToProtect > 0)
m_ProtectNPCMap[pTempl.m_ulNPCToProtect] = pTempl;
if (pTempl.m_FixedData.m_enumMethod == (ulong)TaskMethod.enumTMProtectNPC && pTempl.m_FixedData.m_ulNPCToProtect > 0)
m_ProtectNPCMap[pTempl.m_FixedData.m_ulNPCToProtect] = pTempl;
m_AllTemplMap[pTempl.m_ID] = pTempl;
m_AllTemplMap[pTempl.m_FixedData.m_ID] = pTempl;
ATaskTempl pChild = pTempl.m_pFirstChild;
while (pChild != null)
@@ -209,7 +196,7 @@ namespace PerfectWorld.Scripts.Task
foreach (var entry in m_TaskTemplMap)
{
if (entry.Value.m_ulMaxReceiver != 0)
if (entry.Value.m_FixedData.m_ulMaxReceiver != 0)
{
m_TmLmtChkLst.Add(entry.Value);
}
+1 -1
View File
@@ -142,7 +142,7 @@ namespace PerfectWorld.Scripts.Task
continue;
ATaskTempl pTempl = CurEntry.GetTempl();
if (pTempl == null || !pTempl.m_bPQTask)
if (pTempl == null || !pTempl.m_FixedData.m_bPQTask)
continue;
pTempl.IncValidCount();
+13
View File
@@ -0,0 +1,13 @@
namespace PerfectWorld.Scripts.Task
{
public struct TASK_EXPRESSION
{
public int type;
public float value;
public bool Equals(TASK_EXPRESSION src)
{
return (type == src.type && value == src.value);
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9d2bf3627a0e544b2a6d78e170a46142
+278 -77
View File
@@ -1,7 +1,100 @@
using UnityEngine;
using System.IO;
using System.Runtime.InteropServices;
namespace PerfectWorld.Scripts.Task
{
public sealed class TaskConstant
{
public const int MAX_OCCUPATIONS = 12;
public const int MAX_TASK_NAME_LEN = 30;
public const int MAX_AWARD_NPC_NUM = 8;
public const int MAX_PREM_TASK_COUNT = 20;
public const int MAX_MUTEX_TASK_COUNT = 5;
public const int MAX_TEAM_MEM_WANTED = MAX_OCCUPATIONS;
public const int MAX_TIMETABLE_SIZE = 24;
public const int MAX_AWARD_SCALES = 5;
public const int MAX_AWARD_CANDIDATES = 12;
public const int MAX_LIVING_SKILLS = 4;
public const int MAX_CONTRIB_MONSTERS = 100;
public const int MAX_AWARD_PQ_RANKING = 32;
public const int MAX_TITLE_NUM = 10;
public const int MAX_TASKREGION = 8;
public const int TASK_GENDER_NONE = 0;
public const int TASK_GENDER_MALE = 1;
public const int TASK_GENDER_FEMALE = 2;
public const int TASK_MAX_PATH = 260;
public const int INVALID_VAL = -1;
public const int TASK_MAX_LINE_LEN = TASK_MAX_PATH;
public const int TASK_MAX_VALID_COUNT = 6;
public const int TASK_TREASURE_MAP_SIDE_MULTIPLE = 30;
public readonly long[] task_week_map =
{
7,
1,
2,
3,
4,
5,
6
};
}
public struct task_tm
{
public int year;
public int month;
public int day;
public int hour;
public int min;
public int wday;
}
public struct TASK_PACK_HEADER
{
public uint magic;
public uint version;
public int item_count;
}
public struct MONSTERS_CONTRIB
{
public ulong m_ulMonsterTemplId; // Monster ID
public int m_iWholeContrib; // Team exclusive contribution
public int m_iShareContrib; // Team shared contribution
public int m_iPersonalWholeContrib; // Personal exclusive contribution
public bool Equals(MONSTERS_CONTRIB src)
{
return (m_ulMonsterTemplId == src.m_ulMonsterTemplId &&
m_iWholeContrib == src.m_iWholeContrib &&
m_iShareContrib == src.m_iShareContrib &&
m_iPersonalWholeContrib == src.m_iPersonalWholeContrib);
}
}
public struct ZONE_VERT
{
public float x;
public float y;
public float z;
}
public enum task_tm_type
{
enumTaskTimeDate = 0,
enumTaskTimeMonth,
enumTaskTimeWeek,
enumTaskTimeDay
};
/// <summary>
/// Completion Method
/// </summary>
@@ -27,31 +120,141 @@ namespace PerfectWorld.Scripts.Task
enumTMSimpleClientTaskForceNavi // Force navigation
}
public class ATaskTemplFixedData
public struct Task_Region
{
public ulong m_ID;
public ulong m_ulNPCToProtect;
public ulong m_ulProtectTimeLen;
public ulong m_enumMethod;
public ulong m_enumFinishType;
public ZONE_VERT zvMin;
public ZONE_VERT zvMax;
//Hierarchy
public ATaskTempl m_pParent;
public ATaskTempl m_pPrevSibling;
public ATaskTempl m_pNextSibling;
public ATaskTempl m_pFirstChild;
public bool Equals(Task_Region src)
{
return (zvMin.x == src.zvMin.x && zvMin.y == src.zvMin.y && zvMin.z == src.zvMin.z &&
zvMax.x == src.zvMax.x && zvMax.y == src.zvMax.y && zvMax.z == src.zvMax.z);
}
// Required items
public ulong m_ulPremItems;
// public ItemWanted[] m_PremItems; // [MAX_ITEM_WANTED]
public bool m_bShowByItems;
public bool m_bPremItemsAnyOne;
public static bool operator ==(Task_Region a, Task_Region b)
{
return a.Equals(b);
}
// Level condition
public ulong m_ulPremise_Lev_Min;
public ulong m_ulPremise_Lev_Max;
public ulong m_bPremCheckMaxHistoryLevel;
public bool m_bShowByLev;
public static bool operator !=(Task_Region a, Task_Region b)
{
return !a.Equals(b);
}
public override bool Equals(object obj)
{
if (obj is Task_Region)
return Equals((Task_Region)obj);
return false;
}
public override int GetHashCode()
{
return zvMin.GetHashCode() ^ zvMax.GetHashCode();
}
}
public struct ATaskTemplFixedData
{
/* Task object properties */
// Task ID
public uint m_ID;
// Task name
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskConstant.MAX_TASK_NAME_LEN)]
public ushort[] m_szName;
// Task signature
public bool m_bHasSign;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskConstant.MAX_TASK_NAME_LEN)]
public ushort[] m_pszSignature;
// Task type
public uint m_ulType;
// Time limit
public uint m_ulTimeLimit;
// Task fails when offline
public bool m_bOfflineFail;
// Absolute failure time
public bool m_bAbsFail;
public task_tm m_tmAbsFailTime;
// Do not take items during task validation
public bool m_bItemNotTakeOff;
// Whether using absolute time
public bool m_bAbsTime;
// Number of time periods
public ulong m_ulTimetable;
// Time method
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskConstant.MAX_TIMETABLE_SIZE)]
public byte[] m_tmType;
// Start time for delivery
public task_tm[] m_tmStart; // [MAX_TIMETABLE_SIZE]
// End time for delivery
public task_tm[] m_tmEnd; // [MAX_TIMETABLE_SIZE]
// Delivery frequency
public long m_lAvailFrequency;
public long m_lPeriodLimit;
// Execute single subtask
public bool m_bChooseOne;
// Randomly rotate single subtask execution
public bool m_bRandOne;
// Whether subtasks have order
public bool m_bExeChildInOrder;
// Whether parent task fails when subtask fails
public bool m_bParentAlsoFail;
// Whether parent task succeeds when subtask succeeds
public bool m_bParentAlsoSucc;
// Whether task can be abandoned
public bool m_bCanGiveUp;
// Whether task can be repeated
public bool m_bCanRedo;
// Whether task can be redone after failure
public bool m_bCanRedoAfterFailure;
// Clear task on abandonment
public bool m_bClearAsGiveUp;
// Whether recording is needed
public bool m_bNeedRecord;
// Whether task fails when player dies
public bool m_bFailAsPlayerDie;
// Maximum number of receivers
public uint m_ulMaxReceiver;
// Delivery zone
public bool m_bDelvInZone;
public uint m_ulDelvWorld;
public uint m_ulDelvRegionCnt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskConstant.MAX_TASKREGION)]
public Task_Region[] m_pDelvRegion;
// Enter region task failure
public bool m_bEnterRegionFail;
public uint m_ulEnterRegionWorld;
public uint m_ulEnterRegionCnt;
//public ZONE_VERT m_EnterRegionMinVert;
//public ZONE_VERT m_EnterRegionMaxVert;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskConstant.MAX_TASKREGION)]
public Task_Region[] m_pEnterRegion;
// Leave region task failure
public bool m_bLeaveRegionFail;
public uint m_ulLeaveRegionWorld;
public uint m_ulLeaveRegionCnt;
//public ZONE_VERT m_LeaveRegionMinVert;
//public ZONE_VERT m_LeaveRegionMaxVert;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskConstant.MAX_TASKREGION)]
public Task_Region[] m_pLeaveRegion;
// Leave force failure
public bool m_bLeaveForceFail;
// Transport to specific point
public bool m_bTransTo;
public uint m_ulTransWldId;
public ZONE_VERT m_TransPt;
// Monster controller
public long m_lMonsCtrl;
@@ -67,14 +270,14 @@ namespace PerfectWorld.Scripts.Task
// Whether used in token shop
public bool m_bUsedInTokenShop;
// Trigger on death
// Death trigger
public bool m_bDeathTrig;
// Whether clear all acquired items
public bool m_bClearAcquired;
// Recommended level
public ulong m_ulSuitableLevel;
public uint m_ulSuitableLevel;
// Whether to show prompt
public bool m_bShowPrompt;
@@ -82,56 +285,77 @@ namespace PerfectWorld.Scripts.Task
// Whether it is a key task
public bool m_bKeyTask;
// Deliver NPC
public ulong m_ulDelvNPC;
// Delivery NPC
public uint m_ulDelvNPC;
// Award NPC
public ulong m_ulAwardNPC;
public uint m_ulAwardNPC;
// Whether it is a skill task
public bool m_bSkillTask;
// Can be sought out
// Whether can be searched
public bool m_bCanSeekOut;
// Whether to show direction
// Whether show direction
public bool m_bShowDirection;
// Marriage
public bool m_bMarriage;
// Change global key/value
public ulong m_ulChangeKeyCnt;
public long[] m_plChangeKey; // [TASK_AWARD_MAX_CHANGE_VALUE]
public uint m_ulChangeKeyCnt;
public long[] m_plChangeKey; // [TASK_AWARD_MAX_CHANGE_VALUE]
public long[] m_plChangeKeyValue;
public bool[] m_pbChangeType;
// Switch scene fail
// Fail on scene switch
public bool m_bSwitchSceneFail;
// Hidden task
public bool m_bHidden;
// Whether to deliver skill [Yongdong, 2010-1-6]
// Whether deliver skill
public bool m_bDeliverySkill;
public int m_iDeliveredSkillID;
public int m_iDeliveredSkillLevel;
// Whether to show task finished effect [Yongdong, 2010-1-21]
public bool m_bShowGfxFinished; // Show effect when task is completed
// Whether show task completion effect
public bool m_bShowGfxFinished;
// Whether change PQ ranking
// Whether change player ranking in PQ
public bool m_bChangePQRanking;
// Compare items with player inventory before delivery
// Compare delivery items with player inventory slots
public bool m_bCompareItemAndInventory;
public ulong m_ulInventorySlotNum; // Required number of inventory slots
public uint m_ulInventorySlotNum;
// Whether it is a PQ task
public bool m_bPQTask;
/////////////////////////////////////////////// PQ Task start
// 是否是PQ任务
public bool m_bPQTask;
// PQ任务全局变量显示
public uint m_ulPQExpCnt;
public uint m_ulNPCToProtect;
public uint m_ulProtectTimeLen;
public uint m_enumMethod;
public uint m_enumFinishType;
// Required items
public ulong m_ulPremItems;
// public ItemWanted[] m_PremItems; // [MAX_ITEM_WANTED]
public bool m_bShowByItems;
public bool m_bPremItemsAnyOne;
// Level condition
public ulong m_ulPremise_Lev_Min;
public ulong m_ulPremise_Lev_Max;
public ulong m_bPremCheckMaxHistoryLevel;
public bool m_bShowByLev;
// PQ task global variable display
public ulong m_ulPQExpCnt;
// Dynamic task type
public string m_DynTaskType;
@@ -140,11 +364,19 @@ namespace PerfectWorld.Scripts.Task
// Whether to display in the title task UI
public bool m_bDisplayInTitleTaskUI;
// Maximum number of receivers
public ulong m_ulMaxReceiver;
}
public class ATaskTempl : ATaskTemplFixedData
public class ATaskTempl
{
public ATaskTemplFixedData m_FixedData;
//Hierarchy
public ATaskTempl m_pParent;
public ATaskTempl m_pPrevSibling;
public ATaskTempl m_pNextSibling;
public ATaskTempl m_pFirstChild;
const int MAX_TASK_NAME_LEN = 30;
public byte m_uValidCount;
public bool LoadFromBinFile(FileStream fp)
@@ -198,41 +430,10 @@ namespace PerfectWorld.Scripts.Task
}
private bool LoadFixedDataFromBinFile(FileStream fp)
{
// LOG_DELETE(m_Award_S);
// LOG_DELETE(m_Award_F);
// LOG_DELETE(m_AwByRatio_S);
// LOG_DELETE(m_AwByRatio_F);
// LOG_DELETE(m_AwByItems_S);
// LOG_DELETE(m_AwByItems_F);
// LOG_DELETE_ARR(m_tmStart);
// LOG_DELETE_ARR(m_tmEnd);
// LOG_DELETE_ARR(m_plChangeKey);
// LOG_DELETE_ARR(m_plChangeKeyValue);
// LOG_DELETE_ARR(m_pbChangeType);
// LOG_DELETE_ARR(m_PremItems);
// LOG_DELETE_ARR(m_GivenItems);
// LOG_DELETE_ARR(m_TeamMemsWanted);
// LOG_DELETE_ARR(m_ItemsWanted);
// LOG_DELETE_ARR(m_PlayerWanted);
// LOG_DELETE_ARR(m_MonsterWanted);
// LOG_DELETE_ARR(m_pszSignature);
// LOG_DELETE_ARR(m_pszExp);
// LOG_DELETE_ARR(m_pExpArr);
// LOG_DELETE_ARR(m_pTaskChar);
// LOG_DELETE_ARR(m_pszPQExp);
// LOG_DELETE_ARR(m_pPQExpArr);
// LOG_DELETE_ARR(m_MonstersContrib);
// LOG_DELETE_ARR(m_pDelvRegion);
// LOG_DELETE_ARR(m_pEnterRegion);
// LOG_DELETE_ARR(m_pLeaveRegion);
// LOG_DELETE_ARR(m_pReachSite);
// LOG_DELETE_ARR(m_pLeaveSite);
// LOG_DELETE_ARR(m_PremTitles);
ulong i;
//write method FRead convert this to c#
//fread(this, sizeof(*this), 1, fp);
long readBytes = 0;
ATaskTemplFixedData fixedData = AAssit.ReadFromBinaryOf<ATaskTemplFixedData>(fp, ref readBytes);
//convert_txt(m_szName, MAX_TASK_NAME_LEN, (namechar)m_ID);
+24
View File
@@ -0,0 +1,24 @@
using System.IO;
using UnityEngine;
namespace PerfectWorld.Scripts.Task
{
public class TaskTest : MonoBehaviour
{
ATaskTemplMan m_pTaskMan;
[ContextMenu("Load Data")]
void LoadTaskData()
{
if (m_pTaskMan == null)
{
m_pTaskMan = new ATaskTemplMan();
}
string path = Path.Combine(Application.streamingAssetsPath, "data/tasks.data");
m_pTaskMan.LoadTasksFromPack(path, true);
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 561ff33122f704147a67d91c42fde5a4