From 9bbfc4d84f1a7edff2ffd5f163f82d3420d9c76b Mon Sep 17 00:00:00 2001 From: MinhHai Date: Thu, 4 Dec 2025 09:32:08 +0700 Subject: [PATCH 01/25] update method InitActiveTask of CECTaskInterface --- .../Scripts/Task/ATaskTemplMan.cs | 39 ++ .../Scripts/Task/CECTaskInterface.cs | 355 +++++++++++++++--- .../PerfectWorld/Scripts/Task/TaskClient.cs | 2 +- .../PerfectWorld/Scripts/Task/TaskProcess.cs | 94 +++-- .../Scripts/Task/TaskTempl.Struct.cs | 137 +++++++ Assets/PerfectWorld/Scripts/Task/TaskTempl.cs | 20 +- .../Scripts/Task/UI/TaskTreeView.cs | 2 + .../PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs | 343 +---------------- 8 files changed, 554 insertions(+), 438 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs index 46446806a2..fcbff250e5 100644 --- a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs +++ b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs @@ -44,6 +44,8 @@ namespace BrewMonster.Scripts.Task private elementdataman m_pEleDataMan; #if _TASK_CLIENT + // char m_szDynPackPath[512]; + bool m_bDynTasksVerified; protected special_award m_SpecialAward; #endif @@ -517,5 +519,42 @@ namespace BrewMonster.Scripts.Task #endif } + + // process part +#if _TASK_CLIENT + // void GetTitleTasks(TaskInterface pTask, TaskTemplLst lst); + // void GetAvailableTasks(TaskInterface* pPlayer, TaskTemplLst& lst); + // void ManualTrigTask(TaskInterface* pTask, unsigned long ulTask); + // void ForceGiveUpTask(TaskInterface* pTask, unsigned long ulTask); + // void ForceRemoveFinishTask(TaskInterface* pTask, unsigned long ulTask); + public bool IsDynTasksVerified() { return m_bDynTasksVerified; } + // void SetDynTasksVerified(bool b) { m_bDynTasksVerified = b; } + // void OnDynTasksTimeMark(TaskInterface* pTask, unsigned long ulTimeMark, unsigned short version); + // void OnDynTasksData(TaskInterface* pTask, const void* data, size_t sz, bool ended); + // void OnStorageData(TaskInterface* pTask, const void* data); + // void OnSpecialAward(const special_award* p,TaskInterface* pTask); + // void VerifyDynTasksPack(const char* szPath); + // const special_award* GetSpecialAward() const { return &m_SpecialAward; } + public void ClearSpecailAward() + { + // memset(&m_SpecialAward, 0, sizeof(m_SpecialAward)); + m_SpecialAward = new special_award(); + } + // void SortTasksCanSeekOut(); + // void UpdateTasksSeekOutDiff(TaskInterface* pTask); + // bool IsTaskToPush(int id); + // void ClearTasksToPush() { m_TasksToPush.clear(); } + // bool HasTaskToPush() { return !m_TasksToPush.empty(); } +#else + void CheckDeathTrig(TaskInterface* pTask); + void OnTaskCheckAllTimeLimits(unsigned long ulCurTime); + void OnTaskGetDynTasksTimeMark(TaskInterface* pTask); + void OnTaskGetDynTasksData(TaskInterface* pTask); + void OnTaskGetSpecialAward(TaskInterface* pTask); + void OnTaskRemoveFinishTask(TaskInterface* pTask, unsigned long ulTask); + void OnTaskUpdateStorage(TaskInterface* pTask, unsigned long ulCurTime); + bool UpdateStorage(TaskInterface* pTask, StorageTaskList* pLst, unsigned long ulCurTime, unsigned long idStorage); + bool UpdateOneStorageDebug(TaskInterface* pTask, unsigned long ulCurTime, int idStorage, bool bUseDayAsSeed); +#endif } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index 73221fb451..076b1b2bcb 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -486,81 +486,307 @@ namespace BrewMonster.Scripts.Task return m_pActiveListBuf; } - private void InitActiveTaskList() + // private void InitActiveTaskList() + // { + // ActiveTaskList pLst = GetActiveTaskList(); + // if (pLst == null) return; + // + // ATaskTemplMan pMan = GetTaskTemplMan(); + // if (pMan == null) return; + // + // // reset counters + // pLst.m_uTopShowTaskCount = 0; + // pLst.m_uTopHideTaskCount = 0; + // pLst.m_uTitleTaskCount = 0; + // + // byte i = 0; + // while (i < pLst.m_uTaskCount) + // { + // ActiveTaskEntry entry = pLst.m_TaskEntries[i]; + // if (entry == null) + // { + // i++; + // continue; + // } + // + // // repair sibling linkage + // if (entry.m_NextSblIndex != (char)0xff) + // { + // ActiveTaskEntry entryNextSbl = pLst.m_TaskEntries[entry.m_NextSblIndex]; + // if (entryNextSbl == null || entryNextSbl.m_PrevSblIndex != (char)i) + // { + // entry.m_NextSblIndex = (char)0xff; + // } + // } + // + // // resolve template for top-level entries; children left unresolved in C# + // if (entry.m_ParentIndex == (char)0xff) + // { + // // entry.m_ulTemplAddr = 0u; + // entry.m_ulTemplAddr = pMan.GetTopTaskByID(entry.m_ID) != null ? 1u : 0u; + // + // ATaskTempl topTempl = pMan.GetTopTaskByID(entry.m_ID); + // if (topTempl != null) + // { + // if (topTempl.m_FixedData.m_bHidden) + // pLst.m_uTopHideTaskCount++; + // else if (topTempl.m_FixedData.m_bDisplayInTitleTaskUI) + // pLst.m_uTitleTaskCount++; + // else + // pLst.m_uTopShowTaskCount++; + // } + // } + // else + // { + // entry.m_ulTemplAddr = 0u; + // } + // + // // cap template best-effort (no pointer in managed) + // if (entry.m_uCapTaskId != 0) + // { + // ATaskTempl cap = pMan.GetTopTaskByID(entry.m_uCapTaskId); + // entry.m_ulCapTemplAddr = 0u; + // if (cap == null) + // { + // entry.m_uCapTaskId = 0; + // } + // } + // else + // { + // entry.m_ulCapTemplAddr = 0u; + // } + // + // i++; + // } + // + // // approximate used count + // pLst.m_uUsedCount = pLst.m_uTaskCount; + // } + + void InitActiveTaskList() { ActiveTaskList pLst = GetActiveTaskList(); - if (pLst == null) return; - + FinishedTaskList pFnsh = GetFinishedTaskList(); + // TaskFinishTimeList* pFnshTime = static_cast(GetFinishedTimeList()); + TaskFinishTimeList pFnshTime = new TaskFinishTimeList(GetFinishedTimeList()); + TaskFinishCountList pFnshCount = new TaskFinishCountList(GetFinishedCntList()); + ActiveTaskEntry[] pEntries = pLst.m_TaskEntries; ATaskTemplMan pMan = GetTaskTemplMan(); - if (pMan == null) return; - // reset counters + if (!CheckVersion() || !pLst.IsValid() || !pFnsh.IsValid() || !pFnshTime.IsValid()) + { + pLst.RemoveAll(); + pFnsh.RemoveAll(); + pFnshTime.RemoveAll(); + // TaskInterface::WriteLog(0, 0, 0, "InitLst, list is invalid"); + } + + if(!pFnshCount.IsValid()) + { + pFnshCount.RemoveAll(); + // TaskInterface::WriteLog(0, 0, 0, "InitLst, finish count list is invalid"); + } + + if (pFnsh.m_FnshHeader.m_Version == 0){ + List list_old = new (); + // list_old.reserve(pFnsh->m_FnshHeader.m_uTaskCount); + list_old.Capacity = pFnsh.m_FnshHeader.m_uTaskCount; // C# equivalent of reserve + // FnshedTaskListOld* pListOld = (FnshedTaskListOld*)pFnsh; + FnshedTaskListOld pListOld = new FnshedTaskListOld(pFnsh.m_Buf); + + for (int i = 0; i < pFnsh.m_FnshHeader.m_uTaskCount; i++) + { + list_old.Add(pListOld.m_aTaskList[i]); + } + + var FnshHeader = pFnsh.m_FnshHeader; + FnshHeader.m_Version = 1; + pFnsh.m_FnshHeader = FnshHeader; + + for (int i = 0; i < pFnsh.m_FnshHeader.m_uTaskCount; i++) + { + pFnsh.m_aTaskList[i].m_uTaskId = (ushort)(list_old[i].m_uTaskId & 0x7fff); + pFnsh.m_aTaskList[i].m_Mask = (byte)(list_old[i].m_uTaskId >> 15); + } + } + + #if _TASK_CLIENT + + // Debug output of finished tasks, for developer use -> not converted to C# + // FILE* fp = fopen("logs\\Tasks.log", "wb"); + // + // if (fp) + // { + // unsigned short magic = 0xfeff; + // fwrite(&magic, sizeof(magic), 1, fp); + // + // for (unsigned long n = 0; n < pFnsh->m_FnshHeader.m_uTaskCount; n++) + // { + // ATaskTempl* pTempl = GetTaskTemplMan()->GetTaskTemplByID(pFnsh->m_aTaskList[n].m_uTaskId); + // + // fwprintf( + // fp, + // L"task = %d, name = %s\r\n", + // pFnsh->m_aTaskList[n].m_uTaskId, + // pTempl ? pTempl->GetName() : L""); + // } + // + // for (unsigned short m = 0; m < pFnshTime->m_uCount; m++) + // { + // ATaskTempl* pTempl = GetTaskTemplMan()->GetTaskTemplByID(pFnshTime->m_aList[m].m_uTaskId); + // unsigned long his_time = pFnshTime->m_aList[m].m_ulTimeMark; + // his_time -= unsigned long(TaskInterface::GetTimeZoneBias() * 60); + // + // if ((long)(his_time) < 0) + // his_time = 0; + // + // tm t = *gmtime((time_t*)&his_time); + // wchar_t buf[256]; + // swprintf(buf, L"%d-%02d-%02d-%02d-%02d-%02d", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); + // + // fwprintf( + // fp, + // L"task = %d, deliver time = %s, name = %s\r\n", + // pFnshTime->m_aList[m].m_uTaskId, + // buf, + // pTempl ? pTempl->GetName() : L""); + // } + // + // fclose(fp); + // } + + if (!GetTaskTemplMan().IsDynTasksVerified()) + { + // ��ȡ��̬�����ʱ���ǩ + _notify_svr(this, ClientNotificationConstants.TASK_CLT_NOTIFY_DYN_TIMEMARK, 0); + } + else + { + // ������⽱����Ϣ + GetTaskTemplMan().ClearSpecailAward(); + _notify_svr(this, ClientNotificationConstants.TASK_CLT_NOTIFY_SPECIAL_AWARD, 0); + + // ��ȡ�ֿ����� + _notify_svr(this, ClientNotificationConstants.TASK_CLT_NOTIFY_STORAGE, 0); + } + + #else + uint ulCurTime = GetCurTime(); + const ATaskTempl pTempl; + pLst.m_Version = TASK_ENTRY_DATA_CUR_VER; + bool bTimeMarkUpdated = pLst.IsTimeMarkUpdate(); pLst.m_uTopShowTaskCount = 0; pLst.m_uTopHideTaskCount = 0; pLst.m_uTitleTaskCount = 0; + #endif - byte i = 0; - while (i < pLst.m_uTaskCount) + // unsigned char i = 0; + + for (int i=0; i < pLst.m_uTaskCount; i++) { - ActiveTaskEntry entry = pLst.m_TaskEntries[i]; - if (entry == null) - { - i++; - continue; - } + ActiveTaskEntry entry = pEntries[i]; - // repair sibling linkage - if (entry.m_NextSblIndex != (char)0xff) + if (!entry.IsValid((char)i, (char)pLst.m_uTaskCount)) { - ActiveTaskEntry entryNextSbl = pLst.m_TaskEntries[entry.m_NextSblIndex]; - if (entryNextSbl == null || entryNextSbl.m_PrevSblIndex != (char)i) - { - entry.m_NextSblIndex = (char)0xff; - } + pLst.RemoveAll(); + // TaskInterface::WriteLog(0, 0, 0, "InitLst, active list is invalid"); + break; } - - // resolve template for top-level entries; children left unresolved in C# - if (entry.m_ParentIndex == (char)0xff) - { - // entry.m_ulTemplAddr = 0u; - entry.m_ulTemplAddr = pMan.GetTopTaskByID(entry.m_ID) != null ? 1u : 0u; - - ATaskTempl topTempl = pMan.GetTopTaskByID(entry.m_ID); - if (topTempl != null) - { - if (topTempl.m_FixedData.m_bHidden) - pLst.m_uTopHideTaskCount++; - else if (topTempl.m_FixedData.m_bDisplayInTitleTaskUI) - pLst.m_uTitleTaskCount++; - else - pLst.m_uTopShowTaskCount++; - } - } - else - { - entry.m_ulTemplAddr = 0u; - } - - // cap template best-effort (no pointer in managed) - if (entry.m_uCapTaskId != 0) - { - ATaskTempl cap = pMan.GetTopTaskByID(entry.m_uCapTaskId); - entry.m_ulCapTemplAddr = 0u; - if (cap == null) - { - entry.m_uCapTaskId = 0; - } - } - else - { - entry.m_ulCapTemplAddr = 0u; - } - - i++; } - // approximate used count - pLst.m_uUsedCount = pLst.m_uTaskCount; + int i1 = 0; + + while (i1 < pLst.m_uTaskCount) + { + ActiveTaskEntry entry = pEntries[i1]; + + if (entry.m_NextSblIndex != 0xff) { + ActiveTaskEntry entryNextSbl = pEntries[entry.m_NextSblIndex]; + if (entryNextSbl.m_PrevSblIndex != i1) entry.m_NextSblIndex = (char)0xff; + } + if (entry.m_ParentIndex == 0xff) + entry.m_ulTemplAddr = pMan.GetTopTaskByID(entry.m_ID).m_FixedData.m_ID; + else + { + ATaskTempl pParent = pLst.m_TaskEntries[entry.m_ParentIndex].GetTempl(); + + if (pParent != null) + entry.m_ulTemplAddr = pParent.GetConstSubById(entry.m_ID).m_FixedData.m_ID; + else + entry.m_ulTemplAddr = 0; + } + #if _TASK_CLIENT + + #elif _TASK_CLIENT + + // if (entry.m_ulTemplAddr != 0) + // { + // // TaskInterface::WriteLog(0, entry.m_ID, 0, "InitLst, Cant Find Task"); + // + // pLst.ClearTask(this, entry, false); + // continue; + // } + // + // // ������������û��ɣ������ + // if (entry.m_ChildIndex == 0xff + // && entry.GetTempl().m_FixedData.m_enumMethod == (uint)TaskCompletionMethod.enumTMNone + // && !entry.IsFinished()) + // { + // // TaskInterface::WriteLog(0, entry.m_ID, 0, "InitLst, Task is Impossible"); + // pLst.ClearTask(this, entry, false); + // continue; + // } + + #endif + + if (entry.m_uCapTaskId != 0) + { + entry.m_ulCapTemplAddr = GetTaskTemplMan().GetTopTaskByID(entry.m_uCapTaskId).m_FixedData.m_ID; + if (entry.m_ulCapTemplAddr != 0) + { + entry.m_uCapTaskId = 0; + // TaskInterface::WriteLog(0, entry.m_uCapTaskId, 0, "InitLst, Cant Find CapTask"); + } + } + else + entry.m_ulCapTemplAddr = 0; + + #if _TASK_CLIENT + + #else + + // if (bTimeMarkUpdated != 0) + // { + // var pTempl = entry.GetTempl(); + // + // if (!pTempl.m_FixedData.m_bAbsTime && !pTempl.m_FixedData.m_bPQTask && !pTempl.m_FixedData.m_bPQSubTask) + // entry.m_ulTaskTime = ulCurTime - entry.m_ulTaskTime; + // } + #endif + + #if _TASK_CLIENT + #elif _TASK_CLIENT + // ��ʼ������������е����ء���ʾ������� + // if (entry.m_ParentIndex == 0xff) + // { + // if (entry.GetTempl()->m_bHidden) + // pLst->m_uTopHideTaskCount++; + // else if (entry.GetTempl()->m_bDisplayInTitleTaskUI) + // pLst->m_uTitleTaskCount++; + // else pLst->m_uTopShowTaskCount++; + // + // } + #endif + + i1++; + } + #if _TASK_CLIENT + #elif _TASK_CLIENT + // pLst->SetTimeMarkUpdate(); + // pLst->UpdateTaskMask(*GetTaskMask()); + #endif + + pLst.UpdateUsedCount(); } public bool CheckTaskForbid(uint task_id){ return false; } @@ -1296,7 +1522,7 @@ namespace BrewMonster.Scripts.Task void _notify_svr(TaskInterface pTask, byte uReason, ushort uTaskID) { - + TaskClient._notify_svr(pTask, uReason, uTaskID); } public bool IsTaskReadyToConfirm(int iTaskID) @@ -1433,6 +1659,11 @@ namespace BrewMonster.Scripts.Task // g_pGame->GetGameSession()->c2s_CmdTaskNotify(pBuf, sz); UnityGameSession.c2s_CmdTaskNotify(pBuf, sz); } + + public byte[] GetFinishedCntList() + { + return m_pFinishedCountListBuf; + } } diff --git a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs index ea4a0ef74f..450c1aa685 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs @@ -290,7 +290,7 @@ namespace BrewMonster.Scripts.Task && pos[2] >= min.z && pos[2] <= max.z; } - private static void _notify_svr(TaskInterface pTask, byte uReason, ushort uTaskID) + public static void _notify_svr(TaskInterface pTask, byte uReason, ushort uTaskID) { ATaskTempl._notify_svr(pTask, uReason, uTaskID); } diff --git a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs index 88153334cf..47fd691e2b 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs @@ -32,7 +32,7 @@ namespace BrewMonster.Scripts.Task public char m_uState; // Task state public uint m_ulTaskTime; // Timestamp public ushort m_uCapTaskId; // Captain task ID - public uint m_ulTemplAddr; // Template address + public uint m_ulTemplAddr; // Template address -> In C++ this is a pointer, here we use uint to store the ID of the template public uint m_ulCapTemplAddr; // Captain task template address }; @@ -180,34 +180,34 @@ namespace BrewMonster.Scripts.Task // } // bool HasParent() const { return m_ParentIndex != 0xff; } // bool HasChildren() const { return m_ChildIndex != 0xff; } - // bool IsValid(unsigned char uIndex, unsigned char uMaxCount) const - // { - // if (m_ParentIndex != 0xff) - // { - // if (m_ParentIndex >= uIndex || m_ParentIndex >= uMaxCount) - // return false; - // } - // - // if (m_PrevSblIndex != 0xff) - // { - // if (m_PrevSblIndex >= uIndex || m_PrevSblIndex >= uMaxCount) - // return false; - // } - // - // if (m_NextSblIndex != 0xff) - // { - // if (m_NextSblIndex <= uIndex || m_NextSblIndex >= uMaxCount) - // return false; - // } - // - // if (m_ChildIndex != 0xff) - // { - // if (m_ChildIndex <= uIndex || m_ChildIndex >= uMaxCount) - // return false; - // } - // - // return true; - // } + public bool IsValid(char uIndex, char uMaxCount) + { + if (m_ParentIndex != 0xff) + { + if (m_ParentIndex >= uIndex || m_ParentIndex >= uMaxCount) + return false; + } + + if (m_PrevSblIndex != 0xff) + { + if (m_PrevSblIndex >= uIndex || m_PrevSblIndex >= uMaxCount) + return false; + } + + if (m_NextSblIndex != 0xff) + { + if (m_NextSblIndex <= uIndex || m_NextSblIndex >= uMaxCount) + return false; + } + + if (m_ChildIndex != 0xff) + { + if (m_ChildIndex <= uIndex || m_ChildIndex >= uMaxCount) + return false; + } + + return true; + } }; public class ActiveTaskList @@ -309,7 +309,17 @@ namespace BrewMonster.Scripts.Task } // void UpdateTaskMask(unsigned long& ulMask) const; - // void UpdateUsedCount(); + public void UpdateUsedCount() + { + m_uUsedCount = 0; + for (int i = 0; i < m_uTaskCount; i++) + { + ATaskTempl pTempl = m_TaskEntries[i].GetTempl(); + if (pTempl == null) continue; + if (pTempl.m_pParent != null) continue; + m_uUsedCount += pTempl.m_uDepth; + } + } void RealignTask(ActiveTaskEntry pEntry, byte uReserve) { // TODO: implement RealignTask logic @@ -505,13 +515,23 @@ namespace BrewMonster.Scripts.Task // // return NULL; // } - // void RemoveAll() - // { - // unsigned short ver = m_Version; - // memset(this, 0, sizeof(*this)); - // m_Version = ver; - // } - // bool IsValid() const { return m_uTaskCount <= TASK_ACTIVE_LIST_MAX_LEN; } + public void RemoveAll() + { + ushort version = m_Version; // Preserve the version + Array.Clear(header, 0, header.Length); // Clear the header array + m_Version = version; // Restore the version + m_uTaskCount = 0; // Reset task count + m_uUsedCount = 0; // Reset used count + m_uTopShowTaskCount = 0; // Reset top show task count + m_uTopHideTaskCount = 0; // Reset top hide task count + m_uTitleTaskCount = 0; // Reset title task count + for (int i = 0; i < m_TaskEntries.Length; i++) // Clear all task entries + { + m_TaskEntries[i] = null; + } + } + + public bool IsValid() { return m_uTaskCount <= TaskInterfaceConstants.TASK_ACTIVE_LIST_MAX_LEN; } // bool IsTimeMarkUpdate() const { return (m_uListState & TLIST_STATE_UPDATE_TIME_MARK) != 0; } // void SetTimeMarkUpdate() { m_uListState |= TLIST_STATE_UPDATE_TIME_MARK; } // void ClearTimeMarkUpdate() { m_uListState &= ~TLIST_STATE_UPDATE_TIME_MARK; } diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs index 9e46c1af91..8ae2907f7d 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs @@ -356,6 +356,12 @@ namespace BrewMonster.Scripts.Task header.m_Reserved = m_Buf[3]; return header; } + set + { + Array.Copy(BitConverter.GetBytes(value.m_uTaskCount), 0, m_Buf, 0, 2); + m_Buf[2] = value.m_Version; + m_Buf[3] = value.m_Reserved; + } } @@ -461,4 +467,135 @@ namespace BrewMonster.Scripts.Task return m_FnshHeader.m_uTaskCount <= TaskInterfaceConstants.TASK_FINISHED_LIST_MAX_LEN; } } + + [ StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TaskFinishCountEntry + { + public ushort TaskId; + public uint FinishCount; + public uint FinishTime; + public uint Unused2; + } + + [ StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TaskFinishCountList + { + public ushort m_uCount; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN)] + public TaskFinishCountEntry[] m_aList; + + public TaskFinishCountList(byte[] data) + { + int offset = 0; + m_uCount = BitConverter.ToUInt16(data, offset); + offset += 2; + + m_aList = new TaskFinishCountEntry[TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN]; + int entrySize = Marshal.SizeOf(); + for (int i=0; i < m_uCount; i++) + { + m_aList[i] = GPDataTypeHelper.FromBytes(data[offset..]); + offset += entrySize; + } + } + + public uint Search(uint ulID, uint ulTime) + { + // TODO: Implement logic to search + return 0; + } + + public void ResetAt(uint ulID) + { + // TODO: Implement logic to reset at + } + + public void AddOrUpdate(uint ulID, uint ulFinishTime) + { + + } + + public void RemoveAll() + { + m_uCount = 0; + m_aList = Array.Empty(); + } + + public bool IsValid() { return m_uCount <= TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN; } + }; + + public struct FnshedTaskEntryOld + { + public ushort m_uTaskId; + }; + + [ StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct FnshedTaskListOld + { + // union + // { + // struct + // { + // FnshedTaskListHeader m_FnshHeader; + // FnshedTaskEntryOld m_aTaskList[TASK_FINISHED_LIST_MAX_LEN]; + // }; + // unsigned char m_Buf[TASK_FINISHED_LIST_BUF_SIZE_OLD]; + // }; + + public FnshedTaskListHeader m_FnshHeader + { + get + { + var FnshHeader = new FnshedTaskListHeader + { + m_uTaskCount = BitConverter.ToUInt16(m_Buf, 0), + m_Version = m_Buf[2], + m_Reserved = m_Buf[3] + }; + return FnshHeader; + } + set { + Array.Copy(BitConverter.GetBytes(value.m_uTaskCount), 0, m_Buf, 0, 2); + m_Buf[2] = value.m_Version; + m_Buf[3] = value.m_Reserved; + } + } + + // [MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskInterfaceConstants.TASK_FINISHED_LIST_MAX_LEN)] + public FnshedTaskEntryOld[] m_aTaskList + { + get + { + FnshedTaskEntryOld[] taskList = new FnshedTaskEntryOld[TaskInterfaceConstants.TASK_FINISHED_LIST_MAX_LEN]; + for (int i=0; i < m_FnshHeader.m_uTaskCount; i++) + { + int size = Marshal.SizeOf(); + int startIndex = i * size + 4; // 4 bytes for m_FnshHeader + int endIndex = startIndex + size; + taskList[i] = GPDataTypeHelper.FromBytes(m_Buf[startIndex..endIndex]); + } + return taskList; + } + set + { + for (int i=0; i < value.Length && i < TaskInterfaceConstants.TASK_FINISHED_LIST_MAX_LEN; i++) + { + int size = Marshal.SizeOf(); + int startIndex = i * size + 4; // 4 bytes for m_FnshHeader + byte[] entryBytes = GPDataTypeHelper.ToBytes(value[i]); + Array.Copy(entryBytes, 0, m_Buf, startIndex, size); + } + } + } + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskInterfaceConstants.TASK_FINISHED_LIST_BUF_SIZE_OLD)] + public byte[] m_Buf; + + public FnshedTaskListOld(byte[] data) + { + m_Buf = new byte[TaskInterfaceConstants.TASK_FINISHED_LIST_BUF_SIZE]; + Array.Copy(data, m_Buf, TaskInterfaceConstants.TASK_FINISHED_LIST_BUF_SIZE_OLD); + } + }; } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs index 9d719f0a22..938d39a6dd 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs @@ -1306,6 +1306,22 @@ namespace BrewMonster.Scripts.Task public ushort m_uCount; [MarshalAs(UnmanagedType.ByValArray, SizeConst = TaskInterfaceConstants.TASK_FINISH_TIME_MAX_LEN)] public TaskFinishTimeEntry[] m_aList; + + public TaskFinishTimeList(byte[] data) + { + int offset = 0; + m_uCount = BitConverter.ToUInt16(data, offset); + offset += sizeof(ushort); + + m_aList = new TaskFinishTimeEntry[TaskInterfaceConstants.TASK_FINISH_TIME_MAX_LEN]; + for (int i = 0; i < TaskInterfaceConstants.TASK_FINISH_TIME_MAX_LEN; i++) + { + m_aList[i].m_uTaskId = BitConverter.ToUInt16(data, offset); + offset += sizeof(ushort); + m_aList[i].m_ulTimeMark = BitConverter.ToUInt32(data, offset); + offset += sizeof(uint); + } + } public void ReadFromBuffer(byte[] data) { @@ -1350,7 +1366,7 @@ namespace BrewMonster.Scripts.Task m_uCount++; } - void RemoveAll() + public void RemoveAll() { m_uCount = 0; for (int i = 0; i < TaskInterfaceConstants.TASK_FINISH_TIME_MAX_LEN; i++) @@ -1359,7 +1375,7 @@ namespace BrewMonster.Scripts.Task m_aList[i].m_ulTimeMark = 0; } } - bool IsValid() { return m_uCount <= TaskInterfaceConstants.TASK_FINISH_TIME_MAX_LEN; } + public bool IsValid() { return m_uCount <= TaskInterfaceConstants.TASK_FINISH_TIME_MAX_LEN; } }; diff --git a/Assets/PerfectWorld/Scripts/Task/UI/TaskTreeView.cs b/Assets/PerfectWorld/Scripts/Task/UI/TaskTreeView.cs index 07a85ded67..e502b0d71e 100644 --- a/Assets/PerfectWorld/Scripts/Task/UI/TaskTreeView.cs +++ b/Assets/PerfectWorld/Scripts/Task/UI/TaskTreeView.cs @@ -110,8 +110,10 @@ namespace BrewMonster.Scripts.Task.UI public TaskTreeViewItem GetItemByData(uint taskType) { + if (m_aTreeViewItems == null) { + m_aTreeViewItems = new TaskTreeViewItem[this.transform.childCount]; m_aTreeViewItems = GetComponentsInChildren(true); } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index f5f8dd72c1..a3bbe6e075 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -1429,342 +1429,6 @@ namespace BrewMonster.UI if (!IsShow()) Show(true); } - bool c(int idFunction, int iService, object pData) - { - AUIDialog pShow1 = null, pShow2 = null; - NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; - - if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY) - { - //Button pButton; - - //pShow1 = m_pAUIManager.GetDialog("Win_Shop"); - //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - - //GetHostPlayer().PrepareNPCService(iService); - //GetGameUIMan().m_pDlgShop.UpdateShop(1); - - //if (pCurNPCEssence && pCurNPCEssence.id_repair_service) - //{ - // pShow1.GetDlgItem("Btn_Repair").Show(true); - // pShow1.GetDlgItem("Btn_RepairAll").Show(true); - //} - //else - //{ - // pShow1.GetDlgItem("Btn_Repair").Show(false); - // pShow1.GetDlgItem("Btn_RepairAll").Show(false); - //} - - //pButton = (Button)pShow2.GetDlgItem("Btn_NormalItem"); - //pButton.SetPushed(true); - //pButton = (Button)pShow2.GetDlgItem("Btn_QuestItem"); - //pButton.SetPushed(false); - //GetGameUIMan().m_pDlgInventory.SetShowItem(CDlgInventory::INVENTORY_ITEM_NORMAL); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_INSTALL) - { - pShow1 = m_pAUIManager.GetDialog("Win_Enchase"); - pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_UNINSTALL) - { - pShow1 = m_pAUIManager.GetDialog("Win_Disenchase"); - pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_HEAL) - { - UnityGameSession.c2s_CmdNPCSevHeal(); - GetGameUIMan().EndNPCService(); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_TRANSMIT) - { - //pShow1 = m_pAUIManager.GetDialog("Win_WorldMapTravel"); - //((CDlgWorldMap)pShow1).BuildTravelMap(DATA_TYPE.DT_NPC_TRANSMIT_SERVICE, pData); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_SKILL) - { - //string strText = m_pLst_Main.GetText(m_pLst_Main.GetCurSel()); - //string strHead = GetStringFromTable(249); - //string strComp = (strHead + GetStringFromTable(7107)); - //if (0 == a_stricmp(strText, strComp)) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_ELFLearn"); - // ((CDlgELFLearn*)pShow1).SetNPCName(pCurNPCEssence.name); - // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetData(DATA_TYPE.DT_NPC_SKILL_SERVICE); - //} - //else - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetData((uint)DATA_TYPE.DT_NPC_SKILL_SERVICE, ""); - // GetGameUIMan().UpdateTeach(0); - //} - } - else if (idFunction == (int)SERVICE_TYPE.NPC_MAKE) - { - //NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; - //if (pMake.produce_type == 2) - // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); - //else - // pShow1 = m_pAUIManager.GetDialog("Win_Produce"); - //GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; - //GetHostPlayer().PrepareNPCService(iService); - //pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); - //if (pMake.produce_type == 1 || - // pMake.produce_type == 3 || - // pMake.produce_type == 4 || - // pMake.produce_type == 5) - // GetGameUIMan().m_pDlgProduce.ClearMaterial(); - //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_DECOMPOSE) - { - //pShow1 = m_pAUIManager.GetDialog("Win_Split"); - //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //pShow1.SetDataPtr(pData, "ptr_NPC_DECOMPOSE_SERVICE"); - - //PAUIPROGRESS pProgress; - //PAUIIMAGEPICTURE pImage; - - //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_a"); - //pImage.ClearCover(); - //pImage.SetDataPtr(NULL); - - //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item_b"); - //pImage.ClearCover(); - //pImage.SetDataPtr(NULL); - - //pProgress = (PAUIPROGRESS)pShow1.GetDlgItem("Prgs_1"); - //pProgress.SetProgress(0); - - //pShow1.GetDlgItem("Btn_Start").Enable(false); - //pShow1.GetDlgItem("Btn_Cancel").Enable(true); - //pShow1.GetDlgItem("Txt_no1").SetText(_AL("")); - //pShow1.GetDlgItem("Txt_no2").SetText(_AL("")); - //pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); - //pShow1.GetDlgItem("Txt_SkillName").SetText(_AL("")); - //pShow1.GetDlgItem("Txt_SkillLevel").SetText(_AL("")); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_WAR_TOWERBUILD) - { - pShow1 = m_pAUIManager.GetDialog("Win_WarTower"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_RESETPROP) - { - pShow1 = m_pAUIManager.GetDialog("Win_ResetProp"); - pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_PETNAME) - { - pShow1 = m_pAUIManager.GetDialog("Win_PetRename"); - pShow2 = m_pAUIManager.GetDialog("Win_PetList"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_PETLEARNSKILL) - { - //CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); - //CECPetData* pPet = pPetCorral.GetActivePet(); - //if (!pPet) - //{ - // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); - // GetGameUIMan().EndNPCService(); - //} - //else - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_Teach"); - // GetHostPlayer().PrepareNPCService(iService); - // pShow1.SetData(DT_NPC_PETLEARNSKILL_SERVICE); - // GetGameUIMan().UpdateTeach(0); - //} - } - else if (idFunction == (int)SERVICE_TYPE.NPC_PETFORGETSKILL) - { - //CECPetCorral* pPetCorral = GetHostPlayer().GetPetCorral(); - //CECPetData* pPet = pPetCorral.GetActivePet(); - //if (!pPet) - //{ - // GetGameUIMan().MessageBox("", GetStringFromTable(814), MB_OK, A3DCOLORRGB(255, 255, 255)); - // GetGameUIMan().EndNPCService(); - //} - //else - // pShow1 = m_pAUIManager.GetDialog("Win_PetRetrain"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPBIND) - { - //pShow1 = m_pAUIManager.GetDialog("Win_EquipBind"); - //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //pShow1.SetData((DWORD)pData, "ptr_NPC_EQUIPBIND_SERVICE"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPDESTROY) - { - pShow1 = m_pAUIManager.GetDialog("Win_EquipDestroy"); - pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_EQUIPUNDESTROY) - { - pShow1 = m_pAUIManager.GetDialog("Win_EquipUndestroy"); - pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_IDENTIFY) - { - //PAUIIMAGEPICTURE pImage; - - //pShow1 = m_pAUIManager.GetDialog("Win_Identify"); - //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - //pShow1.SetDataPtr(pData, "ptr_NPC_IDENTIFY_SERVICE"); - - //pImage = (PAUIIMAGEPICTURE)pShow1.GetDlgItem("Item"); - //pImage.ClearCover(); - //pImage.SetDataPtr(NULL); - - //pShow1.GetDlgItem("Txt").SetText(_AL("")); - //pShow1.GetDlgItem("Txt_Gold").SetText(_AL("")); - //pShow1.GetDlgItem("Btn_Confirm").Enable(false); - //pShow1.GetDlgItem("Btn_Cancel").Enable(true); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_GIVE_TASK) - { - talk_proc.option opt = new talk_proc.option(); - opt = (talk_proc.option)pData; - int idTask = (int)opt.param; - //if (EC_Game.GetConfigs().IsMiniClient() && CECUIConfig.Instance().GetGameUI().IsTaskDisabledInMiniClient(idTask)) - //{ - // GetGameUIMan().MessageBox("", GetStringFromTable(10714), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); - //} - //else - { - UnityGameSession.c2s_CmdNPCSevAcceptTask(idTask, 0, 0); - } - GetGameUIMan().EndNPCService(); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_COMPLETE_TASK) - { - AWARD_DATA ad = new AWARD_DATA(); - talk_proc.option opt = (talk_proc.option)pData; - CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); - - pTask.GetAwardCandidates(opt.param, ref ad); - if (ad.m_ulCandItems > 1) - { - pShow1 = m_pAUIManager.GetDialog("Win_Award"); - //CDlgAward pAward = (pShow1) as CDlgAward; - //if (pAward) pAward.UpdateAwardItem(opt.param, true); - } - else - { - UnityGameSession.c2s_CmdNPCSevReturnTask((int)opt.param, 0); - GetGameUIMan().EndNPCService(); - } - } - else if (idFunction == (int)SERVICE_TYPE.NPC_GIVE_TASK_MATTER) - { - talk_proc.option opt = (talk_proc.option)pData; - UnityGameSession.c2s_CmdNPCSevTaskMatter((int)opt.param); - GetGameUIMan().EndNPCService(); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_STORAGE) - { - //if (GetHostPlayer().TrashBoxHasPsw()) - //{ - // pShow1 = m_pAUIManager.GetDialog("Win_InputString"); - // pShow1.GetDlgItem("DEFAULT_Txt_Input").SetText(_AL("")); - //} - //else - // g_pGame.GetGameSession().c2s_CmdNPCSevOpenTrash(""); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_STORAGE_PASSWORD) - { - pShow1 = m_pAUIManager.GetDialog("Win_InputString3"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_ACCOUNT_STORAGE) - { - //if (CECCrossServer::Instance().IsOnSpecialServer()) - //{ - // GetGameUIMan().ShowErrorMsg(10130); - // GetGameUIMan().EndNPCService(); - //} - //else g_pGame.GetGameSession().c2s_CmdNPCSevOpenAccountBox(); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_ENGRAVE) - { - pShow1 = m_pAUIManager.GetDialog("Win_Engrave"); - pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - } - else if (idFunction == (int)SERVICE_TYPE.NPC_RANDPROP) - { - pShow1 = m_pAUIManager.GetDialog("Win_RandProp"); - pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); - GetHostPlayer().PrepareNPCService(iService); - pShow1.SetDataPtr(pData, "ptr_NPC_RANDPROP_SERVICE"); - } - else if (idFunction == (int)SERVICE_TYPE.TALK_RETURN) - { - OnCommand_back("back"); - return true; // To avoid to close NPC dialog. - } - else if (idFunction == (int)SERVICE_TYPE.TALK_EXIT) - { - GetGameUIMan().EndNPCService(); - - int idCurFinishTask = GetGameUIMan().m_idCurFinishTask; - if (GetData() == NPC_DIALOG.NPC_DIALOG_TASK_TALK && idCurFinishTask > 0) - { - GetHostPlayer().GetTaskInterface().OnUIDialogEnd((uint)idCurFinishTask); - GetGameUIMan().m_idCurFinishTask = -1; - } - } - else if (idFunction == (int)SERVICE_TYPE.TALK_GIVEUP_TASK) - { - talk_proc.option opt = (talk_proc.option)pData; - GetHostPlayer().GetTaskInterface().GiveUpTask(opt.param); - GetGameUIMan().EndNPCService(); - } - else - { - //GetHostPlayer().GetPack(IVTRTYPE_PACK).UnfreezeAllItems(); - GetGameUIMan().EndNPCService(); - } - - if (pShow1) - { - DATA_TYPE DataType = new DATA_TYPE(); - elementdataman pDataMan = ElementDataManProvider.GetElementDataMan(); - - pDataMan.get_data_ptr((uint)iService, ID_SPACE.ID_SPACE_ESSENCE, ref DataType); - - pShow1.Show(true); - - if (pShow2) - { - //POINT ptPos = pShow1.GetPos(); - //if (ptPos.x == 0 && ptPos.y == 0) - //{ - // SIZE s1 = pShow1.GetSize(); - // SIZE s2 = pShow2.GetSize(); - // A3DVIEWPORTPARAM* p = m_pA3DEngine.GetActiveViewport().GetParam(); - // int x, y = (p.Height - max(s1.cy, s2.cy)) / 2; - - // x = (p.Width - s1.cx - s2.cx) / 2; - - // // old : pShow1.SetPos(x, y); - // pShow1.SetPosEx(x, y); - - // x += s1.cx; - - // // old : pShow2.SetPos(x, y); - // pShow2.SetPosEx(x, y); - //} - - pShow2.Show(true); - } - } - Show(false); - - return true; - } - public void OnCommand_back(string szCommand) { @@ -3084,6 +2748,13 @@ namespace BrewMonster.UI { AUIDialog pShow1 = null, pShow2 = null; NPC_ESSENCE? pCurNPCEssence = GetGameUIMan().m_pCurNPCEssence; + + // Check if the integer matches any enum value + if (Enum.IsDefined(typeof(SERVICE_TYPE), idFunction)) + { + SERVICE_TYPE k = (SERVICE_TYPE)idFunction; + BMLogger.Log($" PopupCorrespondingServiceDialog: {k}"); + } if (idFunction == (int)SERVICE_TYPE.NPC_SELL || idFunction == (int)SERVICE_TYPE.NPC_BUY) { From 9bc02e1fef3cd675b6c43a34fbc6825ef9466242 Mon Sep 17 00:00:00 2001 From: MinhHai Date: Fri, 5 Dec 2025 22:00:00 +0700 Subject: [PATCH 02/25] add DlgAward --- .../UI/DialogScriptTableObject.asset | 2 + .../Scripts/Managers/EC_IvtrItem.cs | 1 + .../Scripts/Network/CSNetwork/GPDataType.cs | 19 + .../Scripts/Task/ATaskTemplMan.cs | 288 ++- .../Scripts/Task/CECTaskInterface.cs | 25 +- .../PerfectWorld/Scripts/Task/TaskProcess.cs | 1 + Assets/PerfectWorld/Scripts/Task/TaskTempl.cs | 684 ++++- Assets/PerfectWorld/Scripts/Task/TaskTest.cs | 7 + Assets/PerfectWorld/Scripts/UI/AUIManager.cs | 17 + .../PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs | 22 +- Assets/PerfectWorld/Scripts/UI/DlgAward.meta | 3 + .../Scripts/UI/DlgAward/AwardItem.cs | 52 + .../Scripts/UI/DlgAward/AwardItem.cs.meta | 3 + .../Scripts/UI/DlgAward/CDlgAward.cs | 304 +++ .../Scripts/UI/DlgAward/CDlgAward.cs.meta | 3 + Assets/PerfectWorld/UI/Award.meta | 8 + Assets/PerfectWorld/UI/Award/DlgAward.prefab | 2290 +++++++++++++++++ .../UI/Award/DlgAward.prefab.meta | 7 + 18 files changed, 3706 insertions(+), 30 deletions(-) create mode 100644 Assets/PerfectWorld/Scripts/UI/DlgAward.meta create mode 100644 Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs create mode 100644 Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs.meta create mode 100644 Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs create mode 100644 Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs.meta create mode 100644 Assets/PerfectWorld/UI/Award.meta create mode 100644 Assets/PerfectWorld/UI/Award/DlgAward.prefab create mode 100644 Assets/PerfectWorld/UI/Award/DlgAward.prefab.meta diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index a9fbcb99ec..90130a3f87 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -15,3 +15,5 @@ MonoBehaviour: lstPrefabDialog: - id: DialogNPC prefab: {fileID: 8237288432181259026, guid: 7653e7e64393ec24c903f0606499b8c4, type: 3} + - id: Win_Award + prefab: {fileID: 903595479696773158, guid: cf26d96ae7d984ba8a5b6cef44adffeb, type: 3} diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs index dcf525698d..ee60ac1a13 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_IvtrItem.cs @@ -546,6 +546,7 @@ namespace BrewMonster.Scripts.Managers /// This class intentionally keeps C++-style naming and layout so other C++ systems /// can be ported over with minimal friction. /// + /// TODO: have to rename to CECIvtrItem to match C++ naming public class EC_IvtrItem { // NOTE: The nested enums and fields mirror the original C++ names and values. diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs index 1029be7765..c7fc7fbf7d 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs @@ -1360,6 +1360,25 @@ namespace CSNetwork.GPDataType Marshal.FreeHGlobal(ptr); } } + + public static T FromBytes(byte[] data, ref long startIndex) where T : struct + { + int size = Marshal.SizeOf(); + if (data.Length - startIndex < size) + throw new ArgumentException("Buffer không đủ dữ liệu"); + + IntPtr ptr = Marshal.AllocHGlobal(size); + try + { + Marshal.Copy(data, (int)startIndex, ptr, size); + startIndex += size; + return Marshal.PtrToStructure(ptr); + } + finally + { + Marshal.FreeHGlobal(ptr); + } + } public static bool ISPLAYERID(int id) { diff --git a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs index fcbff250e5..0af7e887e7 100644 --- a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs +++ b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs @@ -4,6 +4,7 @@ using ModelRenderer.Scripts.GameData; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using CSNetwork.GPDataType; using PerfectWorld.Scripts.Task; using UnityEngine; @@ -21,6 +22,16 @@ namespace BrewMonster.Scripts.Task public const ulong TASK_PACK_MAGIC = 0x93858361; public const ulong _task_templ_cur_version = 121; + private const int DYN_TASK_CUR_VERSION = 10; + private const int DYN_TASK_VERIFY_SVR = 8711; + private const int DYN_TASK_DELIVER_SVR = 8889; + + private const int TASK_NPC_INFO_VERSION = 1; + + private const int SEEK_SET = 0; /* set file offset to offset */ + private const int SEEK_CUR = 1; /* set file offset to current plus offset */ + private const int SEEK_END = 2; /* set file offset to EOF plus offset */ + private ulong g_ulNewCount = 0;// do we need this? // MH: I think not, it look like a debug counter private Dictionary m_TaskTemplMap = new Dictionary(); @@ -40,11 +51,22 @@ namespace BrewMonster.Scripts.Task private List m_SkillTaskLst = new List(); private List m_TmLmtChkLst = new List(); private List m_TasksCanSeekOut = new List(); - + private elementdataman m_pEleDataMan; + + // Dictionary m_DynTaskMap = new (); + uint m_ulDynTasksTimeMark; + byte[] m_pDynTasksData; + uint m_ulDynTasksDataSize; + + byte[] m_pNPCInfoData; + uint m_ulNPCInfoDataSize; + uint m_ulNPCInfoTimeMark; + private Dictionary m_NPCInfoMap = new (); #if _TASK_CLIENT // char m_szDynPackPath[512]; + private string m_szDynPackPath; bool m_bDynTasksVerified; protected special_award m_SpecialAward; #endif @@ -121,11 +143,17 @@ namespace BrewMonster.Scripts.Task // //todo: check // // LOG_DELETE_ARR(pOffs); fs.Close(); - // UpdateTimeLimitCheckList(); +#if !_TASK_CLIENT + UpdateTimeLimitCheckList(); +#else + SortTasksCanSeekOut(); +#endif + #if _ELEMENTCLIENT - _task_err.Release(); - _task_err.Init("Configs\\task_err.txt", true); + // TODO: implement task error logging if needed + // _task_err.Release(); + // _task_err.Init("Configs\\task_err.txt", true); #endif return true; @@ -151,11 +179,92 @@ namespace BrewMonster.Scripts.Task } public bool LoadNPCInfoFromPack(string szPath) { + // TODO: Implement NPC info loading if needed + // FILE* fp = fopen(szPath, "rb"); + FileStream fp = new FileStream(szPath, FileMode.Open, FileAccess.Read); + // if (fp == null) + // { + // TaskInterface::WriteLog(0, 0, 0, "LoadNPCInfoFromPack, no such file"); + // return false; + // } + + // fseek(fp, 0, SEEK_END); + // size_t sz = ftell(fp); + // fseek(fp, 0, SEEK_SET); + long sz = fp.Length; + + if (sz == 0) + { + BMLogger.LogError("[ATaskTemplMan] LoadNPCInfoFromPack, file size is 0"); + fp.Close(); + return false; + } + + long offset = 0; + byte[] buf = new Byte[sz]; + g_ulNewCount++; + // fread(buf, 1, sz, fp); + buf = AAssit.ReadArrayFromBinary( fp, (int)sz, ref offset); + // fclose(fp); + fp.Close(); + + if (!UnmarshalNPCInfo(buf, (int)sz, false)) + { + // LOG_DELETE_ARR(buf); + return false; + } + +#if _TASK_CLIENT + // LOG_DELETE_ARR(buf); +#else + m_pNPCInfoData = buf; + m_ulNPCInfoDataSize = (uint)sz; +#endif + return true; } public void VerifyDynTasksPack(string szPath) { + // TODO: Implement dynamic task pack verification if needed + // strcpy(m_szDynPackPath, szPath); + m_szDynPackPath = szPath; + + // FILE* fp = fopen(szPath, "rb"); + FileStream fp = new FileStream(szPath, FileMode.Open, FileAccess.Read); + // if (fp == NULL) return; + + // C++ + // fseek(fp, 0, SEEK_END); + // size_t sz = ftell(fp); + // fseek(fp, 0, SEEK_SET); + + // C# + long offset = 0; + long sz = fp.Length; + + int header_sz = Marshal.SizeOf(); + + if (sz < header_sz) + { + // fclose(fp); + fp.Close(); + return; + } + + // C++ + // char* buf = new char[header_sz]; + // g_ulNewCount++; + // fread(buf, 1, header_sz, fp); + // fclose(fp); + + byte[] buf = new byte[header_sz]; + g_ulNewCount++; + buf = AAssit.ReadArrayFromBinary(fp, header_sz, ref offset); + fp.Close(); + + UnmarshalDynTasks(buf, header_sz, true); + // LOG_DELETE_ARR(buf); } public ATaskTempl GetTopTaskByID(uint ulID) @@ -241,7 +350,7 @@ namespace BrewMonster.Scripts.Task pChild = pChild.m_pNextSibling; } } - +#if !_TASK_CLIENT void UpdateTimeLimitCheckList() { m_TmLmtChkLst.Clear(); @@ -255,7 +364,7 @@ namespace BrewMonster.Scripts.Task } } - +#endif public bool InitStorageTask() { m_StorageEssenseMap.Clear(); @@ -430,6 +539,40 @@ namespace BrewMonster.Scripts.Task ATaskTempl._notify_svr(pTask, uReason, uTaskID); } + static bool compare_tasks_canseekout( ATaskTempl lhs, ATaskTempl rhs) + { + if (lhs.m_FixedData.m_ulPremItems != 0 && rhs.m_FixedData.m_ulPremItems == 0) return true; + else if (lhs.m_FixedData.m_ulPremItems == 0 && rhs.m_FixedData.m_ulPremItems != 0) return false; + else if (lhs.m_FixedData.m_ulPremItems != 0 && rhs.m_FixedData.m_ulPremItems != 0) return lhs.m_FixedData.m_ID > rhs.m_FixedData.m_ID; + else return lhs.m_FixedData.m_ulPremise_Lev_Min > rhs.m_FixedData.m_ulPremise_Lev_Min; + } + + /// + /// Comparator tương đương C++ version + /// + private static int CompareTasksCanSeekOut(ATaskTempl lhs, ATaskTempl rhs) + { + // Rule 1: Ưu tiên task có PremItems + bool lhsHasPrem = lhs.m_FixedData.m_ulPremItems != 0; + bool rhsHasPrem = rhs.m_FixedData.m_ulPremItems != 0; + + if (lhsHasPrem && !rhsHasPrem) return -1; // lhs lên trước + if (!lhsHasPrem && rhsHasPrem) return 1; // rhs lên trước + + // Rule 2: Nếu cả hai có PremItems → sắp theo ID giảm dần + if (lhsHasPrem && rhsHasPrem) + return rhs.m_FixedData.m_ID.CompareTo(lhs.m_FixedData.m_ID); // ID lớn đứng trước + + // Rule 3: Nếu không có PremItems → LevelMin giảm dần + return rhs.m_FixedData.m_ulPremise_Lev_Min.CompareTo(lhs.m_FixedData.m_ulPremise_Lev_Min); + } + + void SortTasksCanSeekOut() + { + // std::sort(m_TasksCanSeekOut.begin(), m_TasksCanSeekOut.end(), compare_tasks_canseekout); + m_TasksCanSeekOut.Sort(CompareTasksCanSeekOut); + } + public void CheckAutoDelv(TaskInterface pTask) { ATaskTempl pTempl = null; @@ -488,13 +631,15 @@ namespace BrewMonster.Scripts.Task } // extarn from TaskServer + + +#endif +#if !_TASK_CLIENT private void OnTaskGiveUpOneTask(TaskInterface pTask, uint ulTaskId, bool bForce) { TaskServer.OnTaskGiveUpOneTask(pTask, ulTaskId, bForce); } - #endif - public void OnForgetLivingSkill(TaskInterface pTask) { // FinishedTaskList* pList = static_cast(pTask->GetFinishedTaskList()); // C++ @@ -504,12 +649,12 @@ namespace BrewMonster.Scripts.Task { pList.RemoveTask(m_SkillTaskLst[i].GetID()); -#if _TASK_CLIENT +#if !_TASK_CLIENT OnTaskGiveUpOneTask(pTask, m_SkillTaskLst[i].GetID(), false); #endif } -#if _TASK_CLIENT +#if !_TASK_CLIENT task_notify_base notify = new task_notify_base(); notify.reason = TaskTemplConstants.TASK_SVR_NOTIFY_FORGET_SKILL; @@ -556,5 +701,128 @@ namespace BrewMonster.Scripts.Task bool UpdateStorage(TaskInterface* pTask, StorageTaskList* pLst, unsigned long ulCurTime, unsigned long idStorage); bool UpdateOneStorageDebug(TaskInterface* pTask, unsigned long ulCurTime, int idStorage, bool bUseDayAsSeed); #endif + + bool UnmarshalNPCInfo(byte[] data, int data_size, bool header_only) + { + if (data_size < Marshal.SizeOf()) + { + // TaskInterface::WriteLog(0, 0, 0, "UnmarshalNPCInfo, wrong size"); + BMLogger.LogError($" [ATaskTemplMan] UnmarshalNPCInfo, wrong size: {data_size} < {Marshal.SizeOf()}"); + return false; + } + + // const char* p = data; + // TASK_NPC_PACK_HEADER* header = (TASK_NPC_PACK_HEADER*)p; + // p += sizeof(TASK_NPC_PACK_HEADER); + + TASK_NPC_PACK_HEADER header = GPDataTypeHelper.FromBytes(data); + var p = Marshal.SizeOf(); + + if (header.version != TASK_NPC_INFO_VERSION) + { + // TaskInterface::WriteLog(0, 0, 0, "UnmarshalNPCInfo, wrong version"); + BMLogger.LogError($" [ATaskTemplMan] UnmarshalNPCInfo, wrong version: {header.version}"); + return false; + } + + if (header.pack_size != data_size) + { + // TaskInterface::WriteLog(0, 0, 0, "UnmarshalNPCInfo, wrong header"); + BMLogger.LogError($" [ATaskTemplMan] UnmarshalNPCInfo, wrong header: pack_size {header.pack_size} != data_size {data_size}"); + return false; + } + + m_ulNPCInfoTimeMark = (uint)header.time_mark; + + if (header_only) + return true; + + // const NPC_INFO* pInfos = (const NPC_INFO*)p; + + for (int i = 0; i < header.npc_count; i++) + { + // const NPC_INFO& info = pInfos[i]; + // m_NPCInfoMap[info.id] = info; + + NPC_INFO info = GPDataTypeHelper.FromBytes(data, p); + p += Marshal.SizeOf(); + + m_NPCInfoMap[info.id] = info; + } + + return true; + } + + bool UnmarshalDynTasks(byte[] data, int data_size, bool header_only) + { + if (data_size < Marshal.SizeOf()) + { + // TaskInterface::WriteLog(0, 0, 0, "UnmarshalDynTasks, wrong size"); + BMLogger.LogError(" [ATaskTemplMan] UnmarshalDynTasks, wrong size"); + return false; + } + + // C++ + // const char* p = data; + // DYN_TASK_PACK_HEADER* header = (DYN_TASK_PACK_HEADER*)p; + // p += sizeof(DYN_TASK_PACK_HEADER); + + DYN_TASK_PACK_HEADER header = GPDataTypeHelper.FromBytes(data); + long p = Marshal.SizeOf(); + + if (header.version != DYN_TASK_CUR_VERSION) + { + // TaskInterface::WriteLog(0, 0, 0, "UnmarshalDynTasks, wrong version"); + BMLogger.LogError($" [ATaskTemplMan] UnmarshalDynTasks, wrong version: {header.version}"); + return false; + } + + if (header.pack_size != data_size) + { + // TaskInterface::WriteLog(0, 0, 0, "UnmarshalDynTasks, wrong header"); + BMLogger.LogError($" [ATaskTemplMan] UnmarshalDynTasks, wrong header: pack_size {header.pack_size} != data_size {data_size}"); + return false; + } + + m_ulDynTasksTimeMark = (uint)header.time_mark; + + if (header_only) + return true; + + + for (int i = 0; i < header.task_count; i++) + { + ATaskTempl pTempl = new ATaskTempl(); + g_ulNewCount++; + + pTempl.UnmarshalDynTask(data, ref p); + AddOneTaskTempl(pTempl); + + // TaskInterface::WriteLog(0, pTempl->GetID(), 2, "LoadDynTask"); + } +#if _TASK_CLIENT + SortTasksCanSeekOut(); +#endif + // assert(p == data + data_size); + return true; + } } + + [ StructLayout(LayoutKind.Sequential, Pack = 1) ] + public struct TASK_NPC_PACK_HEADER + { + public uint pack_size; + public int time_mark; + public short version; + public short npc_count; + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct DYN_TASK_PACK_HEADER + { + public uint pack_size; + public int time_mark; + public ushort version; + public ushort task_count; + }; } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index cf846f5ea9..36c6ac853d 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -2,6 +2,7 @@ using BrewMonster.Network; using CSNetwork.GPDataType; using PerfectWorld.Scripts.Task; using System.Collections.Generic; +using System.IO; using System.Runtime.InteropServices; using CSNetwork; using UnityEngine; @@ -403,16 +404,19 @@ namespace BrewMonster.Scripts.Task } else { - //string task_data_path = Path.Combine(Application.streamingAssetsPath, "data/tasks.data"); - //pTaskMan.LoadTasksFromPack(task_data_path, true); + string task_data_path = Path.Combine(Application.streamingAssetsPath, "data/tasks.data"); + pTaskMan.LoadTasksFromPack(task_data_path, true); } #else string task_data_path = Path.Combine(Application.streamingAssetsPath, "data/tasks.data"); pTaskMan.LoadTasksFromPack(task_data_path, true); #endif + var task_npc_path = Path.Combine(Application.streamingAssetsPath, "data/task_npc.data"); + pTaskMan.LoadNPCInfoFromPack(task_npc_path); + + var dyn_tasks_path = Path.Combine(Application.streamingAssetsPath, "data/dyn_tasks.data"); + pTaskMan.VerifyDynTasksPack(dyn_tasks_path); - pTaskMan.LoadNPCInfoFromPack("data\\task_npc.data"); - pTaskMan.VerifyDynTasksPack("userdata\\dyn_tasks.data"); InitActiveTaskList(); m_bForceNavigateFinish = false; @@ -711,9 +715,8 @@ namespace BrewMonster.Scripts.Task else entry.m_ulTemplAddr = 0; } - #if _TASK_CLIENT + #if !_TASK_CLIENT - #elif _TASK_CLIENT // if (entry.m_ulTemplAddr != 0) // { @@ -747,9 +750,8 @@ namespace BrewMonster.Scripts.Task else entry.m_ulCapTemplAddr = 0; - #if _TASK_CLIENT + #if !_TASK_CLIENT - #else // if (bTimeMarkUpdated != 0) // { @@ -760,8 +762,7 @@ namespace BrewMonster.Scripts.Task // } #endif - #if _TASK_CLIENT - #elif _TASK_CLIENT + #if !_TASK_CLIENT // ��ʼ������������е����ء���ʾ������� // if (entry.m_ParentIndex == 0xff) // { @@ -776,8 +777,7 @@ namespace BrewMonster.Scripts.Task i1++; } - #if _TASK_CLIENT - #elif _TASK_CLIENT + #if !_TASK_CLIENT // pLst->SetTimeMarkUpdate(); // pLst->UpdateTaskMask(*GetTaskMask()); #endif @@ -1244,6 +1244,7 @@ namespace BrewMonster.Scripts.Task // } } + #endif diff --git a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs index 47fd691e2b..d5b70f4243 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs @@ -442,6 +442,7 @@ namespace BrewMonster.Scripts.Task // ȥ����õ���Ʒ #if _TASK_CLIENT +#else if (bRemoveItem && pTempl != null) { if (bRemoveAcquired || pTempl.m_FixedData.m_bClearAcquired) pTempl.RemoveAcquiredItem(pTask, bClearTask, false); diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs index 938d39a6dd..fa0c1759a7 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs @@ -1432,6 +1432,9 @@ namespace BrewMonster.Scripts.Task /* °´»ñµÃÎï±ÈÀý·½Ê½ */ AWARD_ITEMS_SCALE m_AwByItems_S; AWARD_ITEMS_SCALE m_AwByItems_F; + + uint g_ulNewCount = 0; + public bool LoadFromBinFile(FileStream fp) { LoadBinary(fp); @@ -1644,12 +1647,13 @@ namespace BrewMonster.Scripts.Task LoadTributeBin(fp); pointerLog += $" After LoadTributeBin : {fp.Position}\n"; - // TODO: Check task type consistency - # if _TASK_CLIENT - CheckMask(); - #else - SyncTaskType(); - #endif + // Check task type consistency +# if _TASK_CLIENT + SyncTaskType(); + +#else + CheckMask(); +#endif // namechar code = (namechar)m_ID; @@ -4365,5 +4369,673 @@ namespace BrewMonster.Scripts.Task return true; } public uint GetType() { return m_FixedData.m_ulType; } + + void Init() + { + m_FixedData.m_bCanRedo = true; + m_FixedData.m_bParentAlsoFail = true; + m_FixedData.m_bCanGiveUp = true; + m_FixedData.m_bCanRedoAfterFailure = true; + m_FixedData.m_bClearAcquired = true; + m_FixedData.m_enumMethod = (uint)TaskCompletionMethod.enumTMNone; + m_FixedData.m_enumFinishType = (uint)TaskFinishType.enumTFTDirect; + m_FixedData.m_bShowByDeposit = true; + m_FixedData.m_bShowByGender = true; + m_FixedData.m_bShowByItems = true; + m_FixedData.m_bShowByFactionContrib = true; + m_FixedData.m_bShowByNeedRecordTasksNum = true; + m_FixedData.m_bShowByLev = true; + m_FixedData.m_bShowByOccup = true; + m_FixedData.m_bShowByPreTask = true; + m_FixedData.m_bShowByRepu = true; + m_FixedData.m_bShowByTeam = true; + m_FixedData.m_bShowByFaction = true; + m_FixedData.m_bShowByPeriod = true; + m_FixedData.m_bShowPrompt = true; + m_FixedData.m_bShowByCharTime = true; + m_FixedData.m_bShowByRMB = true; + m_FixedData.m_bShowBySpouse = true; + m_FixedData.m_bShowByWeddingOwner = true; + m_FixedData.m_bShowByKing = true; + m_FixedData.m_bShowByNotInTeam = true; + m_FixedData.m_bShowByGeneralCard = true; + m_FixedData.m_ulDelvWorld = 1; + m_FixedData.m_ulTransWldId = 1; + m_FixedData.m_ulReachSiteId = 1; + m_FixedData.m_lPeriodLimit = 1; + m_FixedData.m_bCanSeekOut = false; + m_FixedData.m_bShowDirection = true; + + m_FixedData.m_bDeliverySkill = false; // verison 77 + m_FixedData.m_iDeliveredSkillID = 0; + m_FixedData.m_iDeliveredSkillLevel = 0; + + m_FixedData.m_bShowGfxFinished = false; // version 78 + + m_FixedData.m_bChangePQRanking = false; // version 79. Ĭ�� PQ �ı���������� + + m_FixedData.m_bDisplayInExclusiveUI = false; + + m_FixedData.m_bReadyToNotifyServer = false; + + m_FixedData.m_bDistinguishedOcc = false; + + m_FixedData.m_bUsedInTokenShop = false; + + m_FixedData.m_iPremise_FactionRole = 6; + + m_FixedData.m_TreasureStartZone.x = 0; + m_FixedData.m_TreasureStartZone.y = 0; + m_FixedData.m_TreasureStartZone.z = 0; + m_FixedData.m_ucZonesNumX = 1; + m_FixedData.m_ucZonesNumZ = 1; + m_FixedData.m_ucZoneSide = 10; + + m_FixedData.m_ucPremiseTransformedForm = 0xFF; + + m_FixedData.m_bShowByForce = true; + m_FixedData.m_bShowByForceContribution = true; + m_FixedData.m_bShowByForceReputation = true; + m_FixedData.m_bShowByForceExp = true; + m_FixedData.m_bShowByForceSP = true; + m_FixedData.m_bShowByForceActivityLevel = true; + m_FixedData.m_bShowByReincarnation = true; + m_FixedData.m_bShowByRealmLevel = true; + m_FixedData.m_bShowByGeneralCardRank = true; + m_FixedData.m_bShowByHistoryStage = true; + + m_FixedData.m_iPremForceActivityLevel = -1; + m_FixedData.m_iPremGeneralCardRank = -1; + } + + void UnmarshalSpecialAwardData(byte[] data, ref long p) + { + // const char* p = pData; + // m_ulSpecialAward = *(long*)p; + // p += sizeof(long); + + m_FixedData.m_ulSpecialAward = GPDataTypeHelper.FromBytes(data, ref p); + + // return p - pData; + } + + void UnmarshalKillMonster(byte[] data, ref long p) + // int ATaskTempl::UnmarshalKillMonster(const char* pData) + { + // const char* p = pData; + + m_FixedData.m_ulMonsterWanted = GPDataTypeHelper.FromBytes(data, ref p); + +#if !TASK_TEMPL_EDITOR + + if (m_FixedData.m_ulMonsterWanted != 0) + { + m_FixedData.m_MonsterWanted = new MONSTER_WANTED[m_FixedData.m_ulMonsterWanted]; + g_ulNewCount++; + } + +#endif + + int sz = (int)(m_FixedData.m_ulMonsterWanted * Marshal.SizeOf()); + if (sz != 0) + { + // memcpy(m_FixedData.m_MonsterWanted, p, sz); + for( int i = 0; i < m_FixedData.m_MonsterWanted.Length; i++) + { + m_FixedData.m_MonsterWanted[i] = GPDataTypeHelper.FromBytes(data, ref p); + } + } + + // return p - pData; + } + + void UnmarshalCollectItems(byte[] data, ref long p) + // int ATaskTempl::UnmarshalCollectItems(const char* pData) + { + // const char* p = pData; + + m_FixedData.m_ulItemsWanted = GPDataTypeHelper.FromBytes(data, ref p); + + if (m_FixedData.m_ulItemsWanted != 0) + { +#if !TASK_TEMPL_EDITOR + m_FixedData.m_ItemsWanted = new ITEM_WANTED[m_FixedData.m_ulItemsWanted]; + g_ulNewCount++; +#endif + + int sz = (int)(m_FixedData.m_ulItemsWanted * Marshal.SizeOf()); + // memcpy(m_FixedData.m_ItemsWanted, p, sz); + // p += sz; + for( int i = 0; i < m_FixedData.m_ItemsWanted.Length; i++) + { + m_FixedData.m_ItemsWanted[i] = GPDataTypeHelper.FromBytes(data, ref p); + } + } + + m_FixedData.m_ulGoldWanted = GPDataTypeHelper.FromBytes(data, ref p); + + m_FixedData.m_iFactionContribWanted = GPDataTypeHelper.FromBytes(data, ref p); + + m_FixedData.m_iFactionExpContribWanted = GPDataTypeHelper.FromBytes(data, ref p); + + // return p - pData; + } + + void unmarshal_str(byte[] data, ushort[] s, ref long p) + // inline int unmarshal_str(const char* data, task_char*& s) + { + // const char* p = data; + + int len = GPDataTypeHelper.FromBytes( data, ref p); + + s = new ushort[len + 1]; + g_ulNewCount++; + s[len] = 0; + + if (len != 0) + { + // len *= sizeof(task_char); + // memcpy(s, p, len); + // p += len; + + for (int i = 0; i < len; i++) + { + s[i] = GPDataTypeHelper.FromBytes(data, ref p); + } + + } + + // return p - data; + } + + void unmarshal_option(ref talk_proc.option opt, byte[] data, ref long p) + // int unmarshal_option(talk_proc::option* opt, const char* data) + { + // const char* p = data; + + opt.id = GPDataTypeHelper.FromBytes( data, ref p); + + opt.param = GPDataTypeHelper.FromBytes(data, ref p); + + uint sz = GPDataTypeHelper.FromBytes(data, ref p); + + if (sz != 0) + { + // memcpy(opt->text, p, sz); + // p += sz; + + opt.text = new ushort[sz / sizeof(ushort)]; + for (int i = 0; i < opt.text.Length; i++) + { + opt.text[i] = GPDataTypeHelper.FromBytes(data, ref p); + } + } + + // return p - data; + } + + + void unmarshal_window(ref talk_proc.window win, byte[] data, ref long p) + // int unmarshal_window(talk_proc::window* win, const char* data) + { + // const char* p = data; + + win.id = GPDataTypeHelper.FromBytes(data, ref p); + + win.id_parent = GPDataTypeHelper.FromBytes(data, ref p); + + win.talk_text_len = GPDataTypeHelper.FromBytes(data, ref p); + + if (win.talk_text_len != 0) + { + // C++ + // win->talk_text = new namechar[win->talk_text_len]; + // size_t sz = sizeof(namechar) * win->talk_text_len; + // memcpy(win->talk_text, p, sz); + // p += sz; + // g_ulNewCount++; + + win.talk_text = new ushort[win.talk_text_len]; + for (int i = 0; i < win.talk_text_len; i++) + { + win.talk_text[i] = GPDataTypeHelper.FromBytes(data, ref p); + } + g_ulNewCount++; + } + + win.num_option = GPDataTypeHelper.FromBytes( data, ref p); + + if (win.num_option != 0) + { + // C++ + // win->options = new talk_proc::option[win->num_option]; + // memset(win->options, 0, sizeof(talk_proc::option) * win->num_option); + // g_ulNewCount++; + // + // for (int i = 0; i < win->num_option; i++) + // p += unmarshal_option(&win->options[i], p); + + win.options = new talk_proc.option[win.num_option]; + g_ulNewCount++; + for (int i = 0; i < win.num_option; i++) + { + win.options[i] = new talk_proc.option(); + unmarshal_option(ref win.options[i], data, ref p); + } + } + + // return p - data; + } + + void unmarshal_talk_proc(ref talk_proc talk, byte[] data, ref long p) + // int unmarshal_talk_proc(talk_proc* talk, const char* data) + { + // const char* p = data; + + int sz = GPDataTypeHelper.FromBytes(data, ref p); + + if (sz != 0) + { + // memcpy(talk->text, p, sz); + // p += sz; + + for( int i = 0; i < talk.text.Length; i++) + { + talk.text[i] = GPDataTypeHelper.FromBytes(data, ref p); + } + } + + talk.num_window = GPDataTypeHelper.FromBytes(data, ref p); + + if (talk.num_window != 0) + { + // C++ + // talk->windows = new talk_proc::window[talk->num_window]; + // memset(talk->windows, 0, sizeof(talk_proc::window) * talk->num_window); + // g_ulNewCount++; + // + // for (int i = 0; i < talk->num_window; i++) + // p += unmarshal_window(&talk->windows[i], p); + + talk.windows = new talk_proc.window[talk.num_window]; + g_ulNewCount++; + for (int i = 0; i < talk.num_window; i++) + { + talk.windows[i] = new talk_proc.window(); + unmarshal_window(ref talk.windows[i], data, ref p); + } + } + + // return p - data; + } + + + public void UnmarshalDynTask(byte[] pData, ref long p) + { + Init(); + + // const char* p = pData; + // int p = 0; + + uint token_mask1, token_mask2; + + token_mask1 = GPDataTypeHelper.FromBytes(pData, ref p); + + token_mask2 = GPDataTypeHelper.FromBytes(pData, ref p); + + int token_count = 0; + + // dyn type + m_FixedData.m_DynTaskType = GPDataTypeHelper.FromBytes(pData, ref p); + + // top task + if (m_pParent == null) + { + switch (m_FixedData.m_DynTaskType) + { + case (byte)DynTaskType.enumDTTSpecialAward: + break; + case (byte)DynTaskType.enumDTTGiftCard: + UnmarshalSpecialAwardData(pData, ref p); + break; + default: + break; + } + } + + // id + m_FixedData.m_ID = GPDataTypeHelper.FromBytes(pData, ref p); + + // name + // char len = *p; p++; + // len *= sizeof(task_char); + // memcpy(m_szName, p, len); + // p += len; + byte nameLen = pData[p++]; + // int nameByteLen = nameLen * sizeof(ushort); + m_FixedData.m_szName = new ushort[nameLen]; + for (int i = 0; i < nameLen; i++) + { + m_FixedData.m_szName[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // choose one + m_FixedData.m_bChooseOne = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // rand one + m_FixedData.m_bRandOne = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // in order + m_FixedData.m_bExeChildInOrder = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // parent fail + m_FixedData.m_bParentAlsoFail = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // parent succ + m_FixedData.m_bParentAlsoSucc = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // give up + m_FixedData.m_bCanGiveUp = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // redo + m_FixedData.m_bCanRedo = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // redo after fail + m_FixedData.m_bCanRedoAfterFailure = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // clear as give up + m_FixedData.m_bClearAsGiveUp = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + // record + m_FixedData.m_bNeedRecord = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // die + m_FixedData.m_bFailAsPlayerDie = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // auto deliver + m_FixedData.m_bAutoDeliver = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // death trig + m_FixedData.m_bDeathTrig = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // clear acquired + m_FixedData.m_bClearAcquired = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // spouse + m_FixedData.m_bPremise_Spouse = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + // teamwork + m_FixedData.m_bTeamwork = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + // direction + m_FixedData.m_bShowDirection = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + + // level + m_FixedData.m_ulPremise_Lev_Min = GPDataTypeHelper.FromBytes(pData, ref p); + m_FixedData.m_ulPremise_Lev_Max = GPDataTypeHelper.FromBytes(pData, ref p); + + // 0: time limit + if (((1 << token_count++) & token_mask1) != 0) + { + m_ulTimeLimit = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // 1: reputation + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_lPremise_Reputation = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // 2: period + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulPremise_Period = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // 3: prem items + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulPremItems = GPDataTypeHelper.FromBytes(pData, ref p); + + #if !TASK_TEMPL_EDITOR + m_FixedData.m_PremItems = new ITEM_WANTED[m_FixedData.m_ulPremItems]; + g_ulNewCount++; + #endif + + int sz = (int)(m_FixedData.m_ulPremItems * Marshal.SizeOf()); + // memcpy(m_PremItems, p, sz); + Array.Copy( pData, p, m_FixedData.m_PremItems, 0, sz ); + p += sz; + } + + // 4: delv in zone + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_bDelvInZone = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + m_FixedData.m_ulDelvWorld = GPDataTypeHelper.FromBytes(pData, ref p); + + m_FixedData.m_ulDelvRegionCnt = GPDataTypeHelper.FromBytes(pData, ref p); + + for (int i=0; i< m_FixedData.m_ulDelvRegionCnt; i++) + { + m_FixedData.m_pDelvRegion[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + /* m_DelvMinVert = *(ZONE_VERT*)p; + p += sizeof(ZONE_VERT); + + m_DelvMaxVert = *(ZONE_VERT*)p; + p += sizeof(ZONE_VERT);*/ + } + + // 5: trans to + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_bTransTo = GPDataTypeHelper.FromBytes(pData, ref p) != 0; + + m_FixedData.m_ulTransWldId = GPDataTypeHelper.FromBytes(pData, ref p); + + m_FixedData.m_TransPt = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // 6: given items + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulGivenItems =GPDataTypeHelper.FromBytes(pData, ref p); + + m_FixedData.m_ulGivenCmnCount = GPDataTypeHelper.FromBytes(pData, ref p); + + m_FixedData.m_ulGivenTskCount = GPDataTypeHelper.FromBytes(pData, ref p); + + + #if !TASK_TEMPL_EDITOR + m_FixedData.m_GivenItems = new ITEM_WANTED[m_FixedData.m_ulGivenItems]; + g_ulNewCount++; + #endif + + int sz = (int)(m_FixedData.m_ulGivenItems * Marshal.SizeOf()); + // memcpy(m_GivenItems, p, sz); + Array.Copy( pData, p, m_FixedData.m_GivenItems, 0, sz ); + p += sz; + } + + // 7: deposit + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulPremise_Deposit = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // 8: pre task + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulPremise_Task_Count = GPDataTypeHelper.FromBytes(pData, ref p); + + m_FixedData.m_ulPremise_Task_Least_Num = GPDataTypeHelper.FromBytes(pData, ref p); + + int sz = (int)(4 * m_FixedData.m_ulPremise_Task_Count); + // memcpy(m_ulPremise_Tasks, p, sz); + for (int i = 0; i < m_FixedData.m_ulPremise_Task_Count; i++) + { + m_FixedData.m_ulPremise_Tasks[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + } + + // 9: gender + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulGender = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // 10: occupation + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulOccupations = GPDataTypeHelper.FromBytes(pData, ref p); + + int sz = (int)(m_FixedData.m_ulOccupations * Marshal.SizeOf()); + for (int i = 0; i < m_FixedData.m_ulOccupations; i++) + { + m_FixedData.m_Occupations[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + } + + // 11: mutex task + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulMutexTaskCount = GPDataTypeHelper.FromBytes(pData, ref p); + + int sz = (int)(Marshal.SizeOf() * m_FixedData.m_ulMutexTaskCount); + // memcpy(m_ulMutexTasks, p, sz); + for( int i = 0; i < m_FixedData.m_ulMutexTaskCount; i++ ) + { + m_FixedData.m_ulMutexTasks[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + } + + // 12: time table + if (((1 << token_count++) & token_mask1) != 0) + { + m_FixedData.m_ulTimetable = GPDataTypeHelper.FromBytes(pData, ref p); + + #if !TASK_TEMPL_EDITOR + m_FixedData.m_tmStart = new task_tm[m_FixedData.m_ulTimetable]; + g_ulNewCount++; + + m_FixedData.m_tmEnd = new task_tm[m_FixedData.m_ulTimetable]; + g_ulNewCount++; + #endif + + int sz=0; + + sz = (int)(sizeof(byte) * m_FixedData.m_ulTimetable); + + // memcpy(m_tmType, p, sz); + Array.Copy( pData, p, m_FixedData.m_tmType, 0, sz ); + p += sz; + + sz = (int)(Marshal.SizeOf() * m_FixedData.m_ulTimetable); + + // memcpy(m_tmStart, p, sz); + // p += sz; + for (int i = 0; i < m_FixedData.m_ulTimetable; i++) + { + m_FixedData.m_tmStart[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // memcpy(m_tmEnd, p, sz); + // p += sz; + for (int i = 0; i < m_FixedData.m_ulTimetable; i++) + { + m_FixedData.m_tmEnd[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + } + + // method + m_FixedData.m_enumMethod = GPDataTypeHelper.FromBytes(pData, ref p); + + switch (m_FixedData.m_enumMethod) + { + case (uint)TaskCompletionMethod.enumTMKillNumMonster: + // p += UnmarshalKillMonster(p); + UnmarshalKillMonster( pData, ref p); + break; + case (uint)TaskCompletionMethod.enumTMCollectNumArticle: + // p += UnmarshalCollectItems(p); + UnmarshalCollectItems(data:pData, ref p); + break; + case (uint)TaskCompletionMethod.enumTMReachSite: + m_FixedData.m_ulReachSiteId = GPDataTypeHelper.FromBytes(pData, ref p); + + // C++ + // memcpy(m_pReachSite, p, sizeof(Task_Region)*m_ulReachSiteCnt); + // p += sizeof(Task_Region)*m_ulReachSiteCnt; + for (int i = 0; i < m_FixedData.m_ulReachSiteId; i++) + { + m_FixedData.m_pReachSite[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // memcpy(&m_ReachSiteMax, p, sizeof(ZONE_VERT)); + // p += sizeof(ZONE_VERT); + break; + case (uint)TaskCompletionMethod.enumTMLeaveSite: + m_FixedData.m_ulLeaveSiteId = GPDataTypeHelper.FromBytes(pData, ref p); + // memcpy(m_pLeaveSite, p, sizeof(Task_Region)*m_ulLeaveSiteCnt); + // p += sizeof(ZONE_VERT); + for (int i = 0; i < m_FixedData.m_ulLeaveSiteId; i++) + { + m_FixedData.m_pLeaveSite[i] = GPDataTypeHelper.FromBytes(pData, ref p); + } + + // memcpy(&m_LeaveSiteMax, p, sizeof(ZONE_VERT)); + // p += sizeof(ZONE_VERT); + break; + case (uint)TaskCompletionMethod.enumTMWaitTime: + m_FixedData.m_ulWaitTime = GPDataTypeHelper.FromBytes(pData, ref p); + break; + } + + // finish type + m_FixedData.m_enumFinishType = GPDataTypeHelper.FromBytes(pData, ref p); + p++; + + // award + byte[] award_byte_copy = new byte[pData.Length]; + Array.Copy( pData, p, award_byte_copy, 0, pData.Length - p ); + p += m_Award_S.UnmarshalBasicData(pData); + + // talks + unmarshal_str(pData, m_pwstrDescript, ref p); + unmarshal_str(pData, m_pwstrOkText, ref p); + unmarshal_str(pData, m_pwstrNoText, ref p); + unmarshal_talk_proc(ref m_DelvTaskTalk, pData, ref p); + unmarshal_talk_proc(ref m_UnqualifiedTalk, pData, ref p); + unmarshal_talk_proc(ref m_DelvItemTalk, pData, ref p); + unmarshal_talk_proc(ref m_ExeTalk, pData, ref p); + unmarshal_talk_proc(ref m_AwardTalk, pData, ref p); + + #if !_TASK_CLIENT + CheckMask(); + #else + SyncTaskType(); + #endif + + m_nSubCount = GPDataTypeHelper.FromBytes( pData, ref p); + + for (int i = 0; i < m_nSubCount; i++) + { + // ATaskTempl* pSub = new ATaskTempl; + // g_ulNewCount++; + // AddSubTaskTempl(pSub); + // p += pSub->UnmarshalDynTask(p); + + ATaskTempl pSub = new ATaskTempl(); + g_ulNewCount++; + AddSubTaskTempl( pSub ); + pSub.UnmarshalDynTask( pData , ref p); + } + + SynchID(); + if (m_pParent == null) CheckDepth(); + + // return p - pData; + } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTest.cs b/Assets/PerfectWorld/Scripts/Task/TaskTest.cs index 922a697489..f2fb3b47a6 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTest.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTest.cs @@ -4,6 +4,7 @@ using System.IO; using System.Reflection; using System.Runtime.InteropServices; using BrewMonster.Scripts.Task.UI; +using CSNetwork.Common; using ModelRenderer.Scripts.Common; using PerfectWorld.Scripts.Task; using UnityEngine; @@ -32,6 +33,12 @@ namespace BrewMonster.Scripts.Task #endif } + [ContextMenu("Test Npc Service Log")] + public void LogNpcService() + { + Debug.Log($" idFun = {(ExpTypes.SERVICE_TYPE)(-2147483641)} | idService = {44515} "); + } + [ContextMenu("Show Task Name")] public void ShowTaskName() { diff --git a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs index c95b6d801a..c652961e35 100644 --- a/Assets/PerfectWorld/Scripts/UI/AUIManager.cs +++ b/Assets/PerfectWorld/Scripts/UI/AUIManager.cs @@ -262,6 +262,23 @@ namespace BrewMonster.UI { return dlg; } + else + { + var prefab = m_dialogResouce.GetPrefabDialog(pszName); + if(prefab != null) + { + var instance = GameObject.Instantiate(prefab, m_canvas.transform); + var dialog = instance.GetComponent(); + if (dialog != null) + { + dialog.SetAUIManager(this); + m_DlgName[pszName] = dialog; + return dialog; + } + } + } + + return null; } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index a3bbe6e075..106730606e 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -17,6 +17,7 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Text; +using BrewMonster.Scripts.UI; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -2826,6 +2827,7 @@ namespace BrewMonster.UI } else if (idFunction == (int)SERVICE_TYPE.NPC_MAKE) { + // C++ //NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; //if (pMake.produce_type == 2) // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); @@ -2841,6 +2843,22 @@ namespace BrewMonster.UI // GetGameUIMan().m_pDlgProduce.ClearMaterial(); //pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); //GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); + + // NPC_MAKE_SERVICE pMake = (NPC_MAKE_SERVICE)pData; + // if (pMake.produce_type == 2) + // pShow1 = m_pAUIManager.GetDialog("Win_Produce1"); + // else + // pShow1 = m_pAUIManager.GetDialog("Win_Produce"); + // GetGameUIMan().m_pDlgProduce = (CDlgProduce*)pShow1; + // GetHostPlayer().PrepareNPCService(iService); + // pShow1.SetDataPtr(pMake, "ptr_NPC_MAKE_SERVICE"); + // if (pMake.produce_type == 1 || + // pMake.produce_type == 3 || + // pMake.produce_type == 4 || + // pMake.produce_type == 5) + // GetGameUIMan().m_pDlgProduce.ClearMaterial(); + // pShow2 = m_pAUIManager.GetDialog("Win_Inventory"); + // GetGameUIMan().m_pDlgProduce.UpdateProduce(1, 0); } else if (idFunction == (int)SERVICE_TYPE.NPC_DECOMPOSE) { @@ -2970,8 +2988,8 @@ namespace BrewMonster.UI if (ad.m_ulCandItems > 1) { pShow1 = m_pAUIManager.GetDialog("Win_Award"); - //CDlgAward pAward = (pShow1) as CDlgAward; - //if (pAward) pAward.UpdateAwardItem(opt.param, true); + CDlgAward pAward = (pShow1) as CDlgAward; + if (pAward) pAward.UpdateAwardItem((ushort)opt.param, true); } else { diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward.meta b/Assets/PerfectWorld/Scripts/UI/DlgAward.meta new file mode 100644 index 0000000000..3fea680895 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e3a8de291089473f9d21a99f27014a68 +timeCreated: 1764934713 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs b/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs new file mode 100644 index 0000000000..871742e81c --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs @@ -0,0 +1,52 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace BrewMonster.Scripts.UI +{ + public class AwardItem : MonoBehaviour + { + [SerializeField] private Image img; + [SerializeField] private Button btn; + + private Vector2Int _position; + + public Vector2Int Position => _position; + + public void SetPositionIndex(int row, int column) + { + _position = new Vector2Int(row, column); + this.gameObject.name = "Item_" + row + "_" + column; + } + + + public void SetImage(Sprite sprite) + { + img.sprite = sprite; + } + + public void SetText(string text) + { + // TODO: Add a Text component and set its text + } + + public void SetColor(Color color) + { + // TODO : Set color to relevant UI components + } + + public void SetHint(string text) + { + // TODO : Implement hint functionality + } + + public void ClearCover() + { + // TODO : Implement cover clearing functionality + } + + public void Show(bool show) + { + gameObject.SetActive(show); + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs.meta b/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs.meta new file mode 100644 index 0000000000..5639ac0e86 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9d87c7b8ac564f919171a5173812980e +timeCreated: 1764940671 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs new file mode 100644 index 0000000000..2cf20ea2c5 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs @@ -0,0 +1,304 @@ +using BrewMonster.Scripts.Managers; +using BrewMonster.Scripts.Task; +using BrewMonster.UI; +using PerfectWorld.Scripts.Managers; +using PerfectWorld.Scripts.Task; +using UnityEngine; +using UnityEngine.UI; + +namespace BrewMonster.Scripts.UI +{ + public class CDlgAward : AUIDialog + { + #region FIELDS AND PROPERTIES + + private const int MIN_ROW_COUNT_TO_SHOW = 6; + + [SerializeField] private Button m_pBtn_Confirm; + [SerializeField] private Vector2Int _itemSize = new Vector2Int(50, 50); + [SerializeField] private AwardItem _awardItemPrefab; + [SerializeField] private Toggle[] _radioButtons; + + [Header("DEBUG")] + [SerializeField] private AwardItem[] _awardItems; + + bool m_bThroughNPC; + bool m_bSpendContribution; + + #endregion + + int _rowCount => _itemSize.x; + int _columnCount => _itemSize.y; + + #region UNITY METHODS + + void Awake() + { + SpawnItems(); + } + + private void SpawnItems() + { + for (int i = 1; i <= _rowCount; i++) + { + for (int j = 1; j <= _columnCount; j++) + { + AwardItem item = Instantiate(_awardItemPrefab, this.transform); + item.SetPositionIndex(i, j); + // Positioning logic can be added here + } + } + + _awardItemPrefab.gameObject.SetActive(false); + } + + #endregion + + protected bool OnInitDialog() + { + m_bThroughNPC = false; + m_bSpendContribution = false; + return true; + } + + public void UpdateAwardItem(ushort idTask, bool throughNPC, bool spendContribution = false) + { + AWARD_DATA ad = new AWARD_DATA(); + CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); + m_bThroughNPC = throughNPC; + m_bSpendContribution = spendContribution; + pTask.GetAwardCandidates(idTask, ref ad); + if (ad.m_ulCandItems > 1) + { + string szName; + string strFile = ""; + string szText; + EC_IvtrItem pItem; + // AUICTranslate trans; // TODO + // int i, j, idItem, nNum; + uint idItem, nNum; + // Image pImage; + // Image pImage2; + AwardItem pImage; // Using AwardItem instead of Image + + SetData(idTask, ""); + // CheckRadioButton(1, 0); // TODO: + // GetDlgItem("Btn_Confirm")->Enable(false); + + for (int i=1; i < _rowCount; i++) + { + // sprintf(out szName, "Item_%02d01", i); + // pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName); + // if (!pImage) break; // All done. + + // TODO: Show/Hide radio button + // sprintf(out szName, "Rdo_Award%d", i); + // GetDlgItem(szName)->Show(false); + _radioButtons[i].gameObject.SetActive(false); + + // for (j = 1;; j++) + for (int j=1; j < _columnCount; j++) + { + // sprintf(out szName, "Item_%02d%02d", i, j); + // pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName); + // if (!pImage) break; // Line done. + pImage = GetAwardItemAt(i, j); + if(!pImage) break; + + if (i - 1 < (int)ad.m_ulCandItems && + j - 1 < (int)ad.m_CandItems[i - 1].m_ulAwardItems) + { + idItem = ad.m_CandItems[i - 1].m_AwardItems[j - 1].m_ulItemTemplId; + pItem = EC_IvtrItem.CreateItem((int)idItem, 0, 1); + + nNum = ad.m_CandItems[i - 1].m_AwardItems[j - 1].m_ulItemNum; + if (nNum > 1) + { + a_sprintf(out szText, _AL("%d"), nNum); + pImage.SetText(szText); + } + else + pImage.SetText(_AL("")); + + pItem.GetDetailDataFromLocal(); + // pImage.SetHint(trans.Translate(pItem.GetDesc())); // TODO + // af_GetFileTitle(pItem.GetIconFile(), strFile); // TODO + strFile.ToLower(); + + // TODO: Set the image cover here + // pImage.SetCover(GetGameUIMan().m_pA2DSpriteIcons[CECGameUIMan::ICONS_INVENTORY], + // GetGameUIMan().m_IconMap[CECGameUIMan::ICONS_INVENTORY][strFile]); + + EC_IvtrEquip pEquip = new EC_IvtrEquip(pItem.m_tid, pItem.m_expire_date); + pImage.SetColor( + (pItem.IsEquipment() && pEquip.IsDestroying()) + ? new Color32(128, 128, 128, 255) + : new Color32(255, 255, 255, 255)); + + // delete pItem; + pItem = null; + + // sprintf(out szName, "Rdo_Award%d", i); + // GetDlgItem(szName)->Show(true); + _radioButtons[i].gameObject.SetActive(true); + } + else + { + pImage.ClearCover(); + pImage.SetHint(_AL("")); + pImage.SetText(_AL("")); + } + } + } + + // turn off uneccessary rows + if (ad.m_ulCandItems <= MIN_ROW_COUNT_TO_SHOW) + { + // ����������٣�������ʣ���� + // for (i = MIN_ROW_COUNT_TO_SHOW + 1;; i++) + for (int i = MIN_ROW_COUNT_TO_SHOW + 1; i < _rowCount; i++) + { + // sprintf(out szName, "Item_%02d01", i); + // pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName); + // if (!pImage) break; // All done. + pImage = GetAwardItemAt(i, i); + if (!pImage) break; + + // sprintf(out szName, "Rdo_Award%d", i); + // GetDlgItem(szName)->Show(false); + _radioButtons[i].gameObject.SetActive(false); + + for (int j = 1; j < _columnCount; j++) + { + // sprintf(out szName, "Item_%02d%02d", i, j); + // pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName); + // if (!pImage) break; + // pImage->Show(false); + pImage = GetAwardItemAt(i, j); + pImage.Show(false); + + // pImage2 = (PAUIIMAGEPICTURE)GetDlgItem(AString().Format("Img_%02d%02d", i, j)); + // pImage2->Show(false); + // pImage2 = GetAwardItemAt(i, j); + + } + } + + // ����ȷ�ϰ�ť��λ�ã����öԻ����С + // TODO: Thiết lập vị trí của nút xác nhận, thiết lập kích thước của hộp thoại. + // var pBtnConfirm = m_pBtn_Confirm; + // AUIObject* pImgLineMid = GetDlgItem(AString().Format("Item_%02d01", MIN_ROW_COUNT_TO_SHOW)); + // AUIObject* pEdiBg = GetDlgItem("background"); + // pBtnConfirm->SetPos(pBtnConfirm->GetPos(true).x, + // pImgLineMid->GetPos(true).y + pImgLineMid->GetSize().cy + 10); + // SetSize(GetSize().cx, pBtnConfirm->GetPos(true).y + pBtnConfirm->GetSize().cy + 30); + // pEdiBg->SetSize(pEdiBg->GetSize().cx, GetSize().cy - pEdiBg->GetPos(true).y - 25); + } + else + { + // ������ʾȫ���� / Show all rows + for (int i = MIN_ROW_COUNT_TO_SHOW + 1; i < _rowCount; i++) + { + // sprintf(out szName, "Item_%02d01", i); + // pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName); + // if (!pImage) break; // All done. + pImage = GetAwardItemAt(i, 1); + if (!pImage) break; // All done. + + if (ad.m_ulCandItems >= i) + { + // sprintf(out szName, "Rdo_Award%d", i); + // GetDlgItem(szName)->Show(true); + _radioButtons[i].gameObject.SetActive(true); + } + + for (int j = 1; j < _columnCount; j++) + { + // sprintf(out szName, "Item_%02d%02d", i, j); + // pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName); + // if (!pImage) break; + pImage = GetAwardItemAt(i, j); + if (!pImage) break; + pImage.Show(true); + + // pImage2 = (PAUIIMAGEPICTURE)GetDlgItem(AString().Format("Img_%02d%02d", i, j)); + // pImage2->Show(true); + // TODO: Handle pImage2 if needed + // AwardItem pImage2 = GetAwardItemAt(i, j); + // pImage2?.Show(true); + } + } + + // ����ȷ�ϰ�ť��λ�ã����öԻ����С + // TODO: Thiết lập vị trí của nút xác nhận, thiết lập kích thước của hộp thoại. + // AUIObject* pBtnConfirm = GetDlgItem("Btn_Confirm"); + // AUIObject* pImgLineLast = GetDlgItem(AString().Format("Item_%02d01", i - 1)); + // AUIObject* pEdiBg = GetDlgItem("background"); + // pBtnConfirm->SetPos(pBtnConfirm->GetPos(true).x, + // pImgLineLast->GetPos(true).y + pImgLineLast->GetSize().cy + 10); + // SetSize(GetSize().cx, pBtnConfirm->GetPos(true).y + pBtnConfirm->GetSize().cy + 30); + // pEdiBg->SetSize(pEdiBg->GetSize().cx, GetSize().cy - pEdiBg->GetPos(true).y - 25); + } + } + } + + void sprintf(out string szName, string format, int i) + { + // Convert C-style format specifiers to C# format + // %02d -> zero-padded 2-digit integer (D2 format) + // %d -> regular integer + string csharpFormat = format + .Replace("%02d", "{0:D2}") + .Replace("%d", "{0}"); + szName = string.Format(csharpFormat, i); + } + + void sprintf(out string szName, string format, int i, int j) + { + // Convert C-style format specifiers to C# format for two parameters + // %02d -> zero-padded 2-digit integer (D2 format) + // %d -> regular integer + // Replace occurrences sequentially: first -> {0}, second -> {1} + string csharpFormat = format; + int paramIndex = 0; + csharpFormat = System.Text.RegularExpressions.Regex.Replace(csharpFormat, @"%02d|%d", match => + { + string replacement = paramIndex == 0 + ? (match.Value == "%02d" ? "{0:D2}" : "{0}") + : (match.Value == "%02d" ? "{1:D2}" : "{1}"); + paramIndex++; + return replacement; + }); + szName = string.Format(csharpFormat, i, j); + } + + void a_sprintf(out string szText, string format, uint nNum) + { + // Convert C-style format specifiers to C# format + // %d -> regular integer (for uint) + string csharpFormat = format.Replace("%d", "{0}"); + szText = string.Format(csharpFormat, nNum); + } + + string _AL(string text) + { + // Localization helper - returns the string as-is + // In C++ this would typically handle localization, but for now just return the text + return text; + } + + AwardItem GetAwardItemAt(int row, int column) + { + foreach (var item in _awardItems) + { + if (item.Position.x == row && + item.Position.y == column) + { + return item; + } + } + return null; + } + + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs.meta b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs.meta new file mode 100644 index 0000000000..eb8f98efef --- /dev/null +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1fac4acd7d2948cb81a522265a3f3863 +timeCreated: 1764934733 \ No newline at end of file diff --git a/Assets/PerfectWorld/UI/Award.meta b/Assets/PerfectWorld/UI/Award.meta new file mode 100644 index 0000000000..d15938cbbf --- /dev/null +++ b/Assets/PerfectWorld/UI/Award.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce7649e37400b4c67baf894c0f5c049b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/UI/Award/DlgAward.prefab b/Assets/PerfectWorld/UI/Award/DlgAward.prefab new file mode 100644 index 0000000000..6286daa5d3 --- /dev/null +++ b/Assets/PerfectWorld/UI/Award/DlgAward.prefab @@ -0,0 +1,2290 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &227158560462075115 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1037286517714561285} + - component: {fileID: 2958213901730883256} + m_Layer: 5 + m_Name: Toggle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1037286517714561285 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 227158560462075115} + 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: 5967673672506633234} + m_Father: {fileID: 2450815123296561302} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2958213901730883256 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 227158560462075115} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: 1 + 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: 4376062802034248599} + toggleTransition: 1 + graphic: {fileID: 2531169264107607804} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &598635325287938884 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8266277978150929460} + - component: {fileID: 4062238967256872709} + - component: {fileID: 2531169264107607804} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8266277978150929460 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598635325287938884} + 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: 5967673672506633234} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4062238967256872709 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598635325287938884} + m_CullTransparentMesh: 1 +--- !u!114 &2531169264107607804 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 598635325287938884} + 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: 10901, guid: 0000000000000000f000000000000000, type: 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 &665647423033171590 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5381073653143899758} + - component: {fileID: 6511730806452177545} + - component: {fileID: 6219347094978315234} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5381073653143899758 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 665647423033171590} + 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: 8111247010163892649} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6511730806452177545 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 665647423033171590} + m_CullTransparentMesh: 1 +--- !u!114 &6219347094978315234 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 665647423033171590} + 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: 10901, guid: 0000000000000000f000000000000000, type: 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 &725403511909136917 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3990244885253972839} + - component: {fileID: 8883014756042783028} + - component: {fileID: 736858322421180486} + m_Layer: 5 + m_Name: Title + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3990244885253972839 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 725403511909136917} + 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: 2109723218317570040} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -25} + m_SizeDelta: {x: 200, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8883014756042783028 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 725403511909136917} + m_CullTransparentMesh: 1 +--- !u!114 &736858322421180486 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 725403511909136917} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: "Ch\u1ECDn v\u1EADt ph\u1EA9m" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + m_sharedMaterial: {fileID: 9092487103257209053, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &903595479696773158 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2539478906271782923} + - component: {fileID: 1693421925832320050} + m_Layer: 5 + m_Name: DlgAward + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2539478906271782923 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 903595479696773158} + 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: 2109723218317570040} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1693421925832320050 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 903595479696773158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1fac4acd7d2948cb81a522265a3f3863, type: 3} + m_Name: + m_EditorClassIdentifier: + m_pBtn_Confirm: {fileID: 2022223185403607436} + _itemSize: {x: 6, y: 10} + _awardItemPrefab: {fileID: 421596072721705907} + _radioButtons: + - {fileID: 2958213901730883256} + - {fileID: 733246749774266009} + - {fileID: 9010375097557978456} + - {fileID: 2166136893266299956} + - {fileID: 1707764266222510119} + - {fileID: 2876579923345408843} + _awardItems: [] +--- !u!1 &1403327757381850957 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2930918014260929987} + - component: {fileID: 2166136893266299956} + m_Layer: 5 + m_Name: Toggle (3) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2930918014260929987 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1403327757381850957} + 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: 8275321302884129443} + m_Father: {fileID: 2450815123296561302} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2166136893266299956 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1403327757381850957} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: 1 + 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: 3354338157638316856} + toggleTransition: 1 + graphic: {fileID: 6225229690304520632} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &2100466003483804571 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1146872655239044338} + - component: {fileID: 3314083933085270264} + - component: {fileID: 1784872807370305018} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1146872655239044338 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2100466003483804571} + 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: 7340325585816733614} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3314083933085270264 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2100466003483804571} + m_CullTransparentMesh: 1 +--- !u!114 &1784872807370305018 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2100466003483804571} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, 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_text: Confirm + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 24 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &2103274587524243331 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 341579013854257098} + - component: {fileID: 4036842375779331908} + - component: {fileID: 5045479894881455806} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &341579013854257098 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2103274587524243331} + 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: 3655441090811935129} + m_Father: {fileID: 9069806343431675717} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4036842375779331908 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2103274587524243331} + m_CullTransparentMesh: 1 +--- !u!114 &5045479894881455806 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2103274587524243331} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &2811283081231293190 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 943110452829201244} + - component: {fileID: 9121733115126255695} + - component: {fileID: 6225229690304520632} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &943110452829201244 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2811283081231293190} + 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: 8275321302884129443} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9121733115126255695 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2811283081231293190} + m_CullTransparentMesh: 1 +--- !u!114 &6225229690304520632 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2811283081231293190} + 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: 10901, guid: 0000000000000000f000000000000000, type: 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 &3111559935471862568 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2109723218317570040} + - component: {fileID: 151657509607830235} + - component: {fileID: 4009005441555249558} + m_Layer: 5 + m_Name: Popup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2109723218317570040 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3111559935471862568} + 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: 3990244885253972839} + - {fileID: 1558872982091896349} + - {fileID: 2450815123296561302} + - {fileID: 7340325585816733614} + m_Father: {fileID: 2539478906271782923} + 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: 1451.8601, y: 811} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &151657509607830235 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3111559935471862568} + m_CullTransparentMesh: 1 +--- !u!114 &4009005441555249558 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3111559935471862568} + 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: 4744752b0496d42d0b1c52fcb705e044, 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!1 &3348139318622115234 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2594379282254710028} + - component: {fileID: 3662653153686734878} + - component: {fileID: 7848180479837842084} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2594379282254710028 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3348139318622115234} + 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: 6425438017683825551} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3662653153686734878 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3348139318622115234} + m_CullTransparentMesh: 1 +--- !u!114 &7848180479837842084 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3348139318622115234} + 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: 10901, guid: 0000000000000000f000000000000000, type: 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 &3479383918729952281 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1558872982091896349} + - component: {fileID: 3544446125153758963} + m_Layer: 5 + m_Name: ItemGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1558872982091896349 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3479383918729952281} + 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: 2175163742848198118} + m_Father: {fileID: 2109723218317570040} + 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: 110.20192, y: 11.7493} + m_SizeDelta: {x: 1123.4043, y: 590.3094} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &3544446125153758963 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3479383918729952281} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8a8695521f0d02e499659fee002a26c2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_StartCorner: 0 + m_StartAxis: 0 + m_CellSize: {x: 100, y: 100} + m_Spacing: {x: 10, y: 10} + m_Constraint: 1 + m_ConstraintCount: 10 +--- !u!1 &3565430854526106865 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9069806343431675717} + - component: {fileID: 2876579923345408843} + m_Layer: 5 + m_Name: Toggle (5) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9069806343431675717 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3565430854526106865} + 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: 341579013854257098} + m_Father: {fileID: 2450815123296561302} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2876579923345408843 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3565430854526106865} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: 1 + 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: 5045479894881455806} + toggleTransition: 1 + graphic: {fileID: 7207637042536033371} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &3664700763723290860 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4250138675328193934} + - component: {fileID: 733246749774266009} + m_Layer: 5 + m_Name: Toggle (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4250138675328193934 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3664700763723290860} + 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: 7217077735022209564} + m_Father: {fileID: 2450815123296561302} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &733246749774266009 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3664700763723290860} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: 1 + 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: 6245175927925089128} + toggleTransition: 1 + graphic: {fileID: 126544343920740120} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &3692755084474195755 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2175163742848198118} + - component: {fileID: 421596072721705907} + - component: {fileID: 1897581106405175503} + - component: {fileID: 2930912330486762729} + - component: {fileID: 5829300517807457460} + m_Layer: 5 + m_Name: AwardItem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2175163742848198118 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3692755084474195755} + 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: 504415793170309261} + m_Father: {fileID: 1558872982091896349} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &421596072721705907 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3692755084474195755} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9d87c7b8ac564f919171a5173812980e, type: 3} + m_Name: + m_EditorClassIdentifier: + img: {fileID: 0} + btn: {fileID: 5829300517807457460} +--- !u!222 &1897581106405175503 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3692755084474195755} + m_CullTransparentMesh: 1 +--- !u!114 &2930912330486762729 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3692755084474195755} + 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 +--- !u!114 &5829300517807457460 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3692755084474195755} + 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: 1 + 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: 2930912330486762729} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &3824823497742539506 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6425438017683825551} + - component: {fileID: 8923213407923052435} + - component: {fileID: 4503678912350313887} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6425438017683825551 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3824823497742539506} + 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: 2594379282254710028} + m_Father: {fileID: 6397292135018809548} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8923213407923052435 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3824823497742539506} + m_CullTransparentMesh: 1 +--- !u!114 &4503678912350313887 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3824823497742539506} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &4660714409237943125 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2450815123296561302} + - component: {fileID: 1430101278767489564} + m_Layer: 5 + m_Name: RadioBtnGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2450815123296561302 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4660714409237943125} + 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: 1037286517714561285} + - {fileID: 4250138675328193934} + - {fileID: 2363640227141846661} + - {fileID: 2930918014260929987} + - {fileID: 6397292135018809548} + - {fileID: 9069806343431675717} + m_Father: {fileID: 2109723218317570040} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 122.298096, y: -393.75} + m_SizeDelta: {x: 129.4809, y: 590.31} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1430101278767489564 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4660714409237943125} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 30 + m_Bottom: 0 + m_ChildAlignment: 1 + m_Spacing: 50 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!1 &5325640235670539457 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8980072884036013229} + - component: {fileID: 3187243540436091359} + - component: {fileID: 126544343920740120} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8980072884036013229 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5325640235670539457} + 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: 7217077735022209564} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3187243540436091359 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5325640235670539457} + m_CullTransparentMesh: 1 +--- !u!114 &126544343920740120 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5325640235670539457} + 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: 10901, guid: 0000000000000000f000000000000000, type: 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 &5498099694921818792 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8111247010163892649} + - component: {fileID: 1389627216354638004} + - component: {fileID: 5687745320305579942} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8111247010163892649 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5498099694921818792} + 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: 5381073653143899758} + m_Father: {fileID: 2363640227141846661} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1389627216354638004 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5498099694921818792} + m_CullTransparentMesh: 1 +--- !u!114 &5687745320305579942 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5498099694921818792} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &5837337214923895561 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 504415793170309261} + - component: {fileID: 673608011296253043} + - component: {fileID: 5798109676702798723} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &504415793170309261 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5837337214923895561} + 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: 2175163742848198118} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -10, y: -10} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &673608011296253043 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5837337214923895561} + m_CullTransparentMesh: 1 +--- !u!114 &5798109676702798723 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5837337214923895561} + 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 +--- !u!1 &6028272593332042850 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7217077735022209564} + - component: {fileID: 5661059597940117097} + - component: {fileID: 6245175927925089128} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7217077735022209564 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6028272593332042850} + 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: 8980072884036013229} + m_Father: {fileID: 4250138675328193934} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &5661059597940117097 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6028272593332042850} + m_CullTransparentMesh: 1 +--- !u!114 &6245175927925089128 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6028272593332042850} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &6328435563484088153 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8275321302884129443} + - component: {fileID: 3155131478209322163} + - component: {fileID: 3354338157638316856} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8275321302884129443 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6328435563484088153} + 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: 943110452829201244} + m_Father: {fileID: 2930918014260929987} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3155131478209322163 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6328435563484088153} + m_CullTransparentMesh: 1 +--- !u!114 &3354338157638316856 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6328435563484088153} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &7110776141332968999 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3655441090811935129} + - component: {fileID: 1542407570922745670} + - component: {fileID: 7207637042536033371} + m_Layer: 5 + m_Name: Checkmark + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3655441090811935129 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7110776141332968999} + 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: 341579013854257098} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1542407570922745670 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7110776141332968999} + m_CullTransparentMesh: 1 +--- !u!114 &7207637042536033371 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7110776141332968999} + 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: 10901, guid: 0000000000000000f000000000000000, type: 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 &7363450080172263604 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6397292135018809548} + - component: {fileID: 1707764266222510119} + m_Layer: 5 + m_Name: Toggle (4) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6397292135018809548 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7363450080172263604} + 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: 6425438017683825551} + m_Father: {fileID: 2450815123296561302} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1707764266222510119 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7363450080172263604} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: 1 + 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: 4503678912350313887} + toggleTransition: 1 + graphic: {fileID: 7848180479837842084} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &7637041124332687819 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5967673672506633234} + - component: {fileID: 4720584933096987406} + - component: {fileID: 4376062802034248599} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5967673672506633234 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7637041124332687819} + 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: 8266277978150929460} + m_Father: {fileID: 1037286517714561285} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &4720584933096987406 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7637041124332687819} + m_CullTransparentMesh: 1 +--- !u!114 &4376062802034248599 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7637041124332687819} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &9015749914769670722 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2363640227141846661} + - component: {fileID: 9010375097557978456} + m_Layer: 5 + m_Name: Toggle (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2363640227141846661 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9015749914769670722} + 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: 8111247010163892649} + m_Father: {fileID: 2450815123296561302} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 50, y: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &9010375097557978456 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9015749914769670722} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, 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: 1 + 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: 5687745320305579942} + toggleTransition: 1 + graphic: {fileID: 6219347094978315234} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 1 +--- !u!1 &9105626102026763552 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7340325585816733614} + - component: {fileID: 6190841901814383368} + - component: {fileID: 6310281645281955538} + - component: {fileID: 2022223185403607436} + m_Layer: 5 + m_Name: ConfirmBtn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7340325585816733614 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9105626102026763552} + 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: 1146872655239044338} + m_Father: {fileID: 2109723218317570040} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 64} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6190841901814383368 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9105626102026763552} + m_CullTransparentMesh: 1 +--- !u!114 &6310281645281955538 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9105626102026763552} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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 &2022223185403607436 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9105626102026763552} + 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: 1 + 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: 6310281645281955538} + m_OnClick: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/PerfectWorld/UI/Award/DlgAward.prefab.meta b/Assets/PerfectWorld/UI/Award/DlgAward.prefab.meta new file mode 100644 index 0000000000..27f7f9cec9 --- /dev/null +++ b/Assets/PerfectWorld/UI/Award/DlgAward.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cf26d96ae7d984ba8a5b6cef44adffeb +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: From 81701772dc730f1f92955d28c6e704b08d70cfc1 Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Mon, 8 Dec 2025 16:07:16 +0700 Subject: [PATCH 03/25] dummy fix task --- Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index d22bf9f05a..5fe6264a21 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -1282,7 +1282,8 @@ namespace CSNetwork { gamedatasend gamedatasend = new gamedatasend(); gamedatasend.Data = C2SCommandFactory.CreateTaskNotifyCmd( pData, dwDataSize); - SendProtocol(gamedatasend); + //todo send data curent get error message 3 + // SendProtocol(gamedatasend); } public void c2s_SendCmdStandUp() From 3de0b5537dd77c402104af852bdf8147215fb071 Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Tue, 9 Dec 2025 09:51:30 +0700 Subject: [PATCH 04/25] read dynamic task --- .../Scripts/Task/ATaskTemplMan.cs | 63 ++++++++++++++++++- .../Scripts/Task/CECTaskInterface.cs | 2 +- .../PerfectWorld/Scripts/Task/TaskClient.cs | 14 ++--- .../Scripts/Task/TaskInterface.cs | 2 +- 4 files changed, 71 insertions(+), 10 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs index 0af7e887e7..f248bad32b 100644 --- a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs +++ b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs @@ -675,7 +675,68 @@ namespace BrewMonster.Scripts.Task public bool IsDynTasksVerified() { return m_bDynTasksVerified; } // void SetDynTasksVerified(bool b) { m_bDynTasksVerified = b; } // void OnDynTasksTimeMark(TaskInterface* pTask, unsigned long ulTimeMark, unsigned short version); - // void OnDynTasksData(TaskInterface* pTask, const void* data, size_t sz, bool ended); + public void OnDynTasksData(TaskInterface pTask, byte[] data, int sz, bool ended) + { + if (m_bDynTasksVerified) + { + // assert(false); + return; + } + + uint new_sz = (uint)(sz + m_ulDynTasksDataSize); + var buf = new byte[new_sz]; + g_ulNewCount++; + + if (m_pDynTasksData != null && m_ulDynTasksDataSize > 0) + { + // memcpy(buf, m_pDynTasksData, m_ulDynTasksDataSize); + Buffer.BlockCopy( + m_pDynTasksData, // src + 0, // src offset + buf, // dst + 0, // dst offset + (int)m_ulDynTasksDataSize // bytes + ); + } + // memcpy(buf + m_ulDynTasksDataSize, data, sz); + Buffer.BlockCopy( + data, // src + 0, // src offset + buf, // dst + (int)m_ulDynTasksDataSize, // dst offset + sz // bytes + ); + + // LOG_DELETE_ARR(m_pDynTasksData); + m_pDynTasksData = buf; + m_ulDynTasksDataSize = new_sz; + + if (ended) + { + // a_LogOutput(1, "[Dat Task] OnDynTasksData"); + if (UnmarshalDynTasks(m_pDynTasksData, (int)m_ulDynTasksDataSize, false)) + { + // if (m_pDynTasksData) + // { + // FILE* fp = fopen(m_szDynPackPath, "wb"); + // + // if (fp) + // { + // fwrite(m_pDynTasksData, 1, m_ulDynTasksDataSize, fp); + // fclose(fp); + // } + // } + + SetDynTasksVerified(true); + pTask.InitActiveTaskList(); + UpdateDynDataNPCService(); + } + + // LOG_DELETE_ARR(m_pDynTasksData); + m_pDynTasksData = 0; + m_ulDynTasksDataSize = 0; + } + } // void OnStorageData(TaskInterface* pTask, const void* data); // void OnSpecialAward(const special_award* p,TaskInterface* pTask); // void VerifyDynTasksPack(const char* szPath); diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index 36c6ac853d..b8dd0447e1 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -563,7 +563,7 @@ namespace BrewMonster.Scripts.Task // pLst.m_uUsedCount = pLst.m_uTaskCount; // } - void InitActiveTaskList() + public void InitActiveTaskList() { ActiveTaskList pLst = GetActiveTaskList(); FinishedTaskList pFnsh = GetFinishedTaskList(); diff --git a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs index 450c1aa685..04ad38acb5 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs @@ -371,13 +371,13 @@ namespace BrewMonster.Scripts.Task { if (sz <= (uint)Marshal.SizeOf()) return; // TODO: OnDynTasksData method not found in ATaskTemplMan; implement if needed - // ATaskTemplMan pMan = GetTaskTemplMan(pTask); - // if (pMan != null) - // { - // byte[] dynData = new byte[sz - Marshal.SizeOf()]; - // Array.Copy(pBuf, Marshal.SizeOf(), dynData, 0, dynData.Length); - // pMan.OnDynTasksData(pTask, dynData, (uint)dynData.Length, pNotify.task != 0); - // } + ATaskTemplMan pMan = GetTaskTemplMan(); + if (pMan != null) + { + byte[] dynData = new byte[sz - Marshal.SizeOf()]; + Array.Copy(pBuf, Marshal.SizeOf(), dynData, 0, dynData.Length); + pMan.OnDynTasksData(pTask, dynData, (uint)dynData.Length, pNotify.task != 0); + } return; } // Handle storage data notification diff --git a/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs index b33ec6f88c..9b7623b4c6 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs @@ -151,6 +151,6 @@ namespace BrewMonster.Scripts.Task int GetPlayerId(); void PopChatMessage(int iIndex, int dwNum=0); - + void InitActiveTaskList(); } } \ No newline at end of file From 7cd12d50416672dfb6cbabeafd5a8975bc73781f Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Tue, 9 Dec 2025 11:33:18 +0700 Subject: [PATCH 05/25] read dynamic task data --- .../Scripts/Task/ATaskTemplMan.cs | 125 ++++++++++++++++-- .../PerfectWorld/Scripts/Task/TaskClient.cs | 2 +- Assets/PerfectWorld/Scripts/Task/TaskTempl.cs | 5 + 3 files changed, 119 insertions(+), 13 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs index f248bad32b..b57e757c38 100644 --- a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs +++ b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs @@ -673,7 +673,7 @@ namespace BrewMonster.Scripts.Task // void ForceGiveUpTask(TaskInterface* pTask, unsigned long ulTask); // void ForceRemoveFinishTask(TaskInterface* pTask, unsigned long ulTask); public bool IsDynTasksVerified() { return m_bDynTasksVerified; } - // void SetDynTasksVerified(bool b) { m_bDynTasksVerified = b; } + void SetDynTasksVerified(bool b) { m_bDynTasksVerified = b; } // void OnDynTasksTimeMark(TaskInterface* pTask, unsigned long ulTimeMark, unsigned short version); public void OnDynTasksData(TaskInterface pTask, byte[] data, int sz, bool ended) { @@ -716,16 +716,20 @@ namespace BrewMonster.Scripts.Task // a_LogOutput(1, "[Dat Task] OnDynTasksData"); if (UnmarshalDynTasks(m_pDynTasksData, (int)m_ulDynTasksDataSize, false)) { - // if (m_pDynTasksData) - // { - // FILE* fp = fopen(m_szDynPackPath, "wb"); - // - // if (fp) - // { - // fwrite(m_pDynTasksData, 1, m_ulDynTasksDataSize, fp); - // fclose(fp); - // } - // } + if (m_pDynTasksData!=null && m_pDynTasksData.Length>0) + { + try + { + using (FileStream fs = new FileStream(m_szDynPackPath, FileMode.Create, FileAccess.Write)) + { + fs.Write(m_pDynTasksData, 0, (int)m_ulDynTasksDataSize); + } + } + catch (Exception ex) + { + BMLogger.LogError($"[ATaskTemplMan] Failed to write dyn tasks pack: {ex.Message}"); + } + } SetDynTasksVerified(true); pTask.InitActiveTaskList(); @@ -733,7 +737,7 @@ namespace BrewMonster.Scripts.Task } // LOG_DELETE_ARR(m_pDynTasksData); - m_pDynTasksData = 0; + m_pDynTasksData = null; m_ulDynTasksDataSize = 0; } } @@ -751,6 +755,53 @@ namespace BrewMonster.Scripts.Task // bool IsTaskToPush(int id); // void ClearTasksToPush() { m_TasksToPush.clear(); } // bool HasTaskToPush() { return !m_TasksToPush.empty(); } + + void UpdateDynDataNPCService() + { + // assert(m_pEleDataMan); + + DATA_TYPE dt = default; + NPC_TASK_IN_SERVICE service = (NPC_TASK_IN_SERVICE)m_pEleDataMan.get_data_ptr( + DYN_TASK_VERIFY_SVR, + ID_SPACE.ID_SPACE_ESSENCE, + ref dt + ); + + if (dt != DATA_TYPE.DT_NPC_TASK_IN_SERVICE) + { + BMLogger.LogError($"UpdateDynDataNPCService, wrong service, dt = {dt}"); + return; + } + + NPC_TASK_OUT_SERVICE deliver = (NPC_TASK_OUT_SERVICE)m_pEleDataMan.get_data_ptr( + DYN_TASK_DELIVER_SVR, + ID_SPACE.ID_SPACE_ESSENCE, + ref dt + ); + + if (dt != DATA_TYPE.DT_NPC_TASK_OUT_SERVICE) + { + BMLogger.LogError($"UpdateDynDataNPCService, wrong service, dt = {dt}"); + return; + } + + deliver.id_tasks ??= new uint[256]; + service.id_tasks ??= new uint[256]; + + deliver.id_tasks.AsSpan().Clear(); + service.id_tasks.AsSpan().Clear(); + + foreach (var kv in m_DynTaskMap) + { + ATaskTempl p = kv.Value; + + if (p != null && p.m_FixedData.m_DynTaskType != (byte)DynTaskType.enumDTTGiftCard) + { + mount_task_out_service(p, ref deliver); + mount_task_in_service(p, ref service); + } + } + } #else void CheckDeathTrig(TaskInterface* pTask); void OnTaskCheckAllTimeLimits(unsigned long ulCurTime); @@ -838,6 +889,7 @@ namespace BrewMonster.Scripts.Task return false; } + BMLogger.LogError($" [ATaskTemplMan] UnmarshalDynTasks, wrong header: pack_size {header.pack_size} ____ data_size {data_size}"); if (header.pack_size != data_size) { // TaskInterface::WriteLog(0, 0, 0, "UnmarshalDynTasks, wrong header"); @@ -867,6 +919,55 @@ namespace BrewMonster.Scripts.Task // assert(p == data + data_size); return true; } + + void mount_task_out_service(ATaskTempl task, ref NPC_TASK_OUT_SERVICE svr) + { + if (task.IsAutoDeliver()) + return; + + if (task.m_pParent != null && !task.m_pParent.m_FixedData.m_bChooseOne) + return; + + uint[] tasks = svr.id_tasks; + for (int i = 0; i < tasks.Length; i++) + { + if (tasks[i] != 0) + continue; + + tasks[i] = task.GetID(); + break; + } + + ATaskTempl child = task.m_pFirstChild; + while (child != null) + { + mount_task_out_service(child,ref svr); + child = child.m_pNextSibling; + } + } + + void mount_task_in_service(ATaskTempl task,ref NPC_TASK_IN_SERVICE svr) + { + if ((TaskFinishType)task.m_FixedData.m_enumFinishType == TaskFinishType.enumTFTNPC) + { + uint[] tasks = svr.id_tasks; + for (int i = 0; i < tasks.Length; i++) + { + if (tasks[i] != 0) + continue; + + tasks[i] = task.GetID(); + break; + } + } + + ATaskTempl child = task.m_pFirstChild; + while (child != null) + { + mount_task_in_service(child, ref svr); + child = child.m_pNextSibling; + } + } } [ StructLayout(LayoutKind.Sequential, Pack = 1) ] diff --git a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs index 04ad38acb5..4bf6ebe2a9 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs @@ -376,7 +376,7 @@ namespace BrewMonster.Scripts.Task { byte[] dynData = new byte[sz - Marshal.SizeOf()]; Array.Copy(pBuf, Marshal.SizeOf(), dynData, 0, dynData.Length); - pMan.OnDynTasksData(pTask, dynData, (uint)dynData.Length, pNotify.task != 0); + pMan.OnDynTasksData(pTask, dynData, dynData.Length, pNotify.task != 0); } return; } diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs index fa0c1759a7..23320eb30f 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs @@ -5037,5 +5037,10 @@ namespace BrewMonster.Scripts.Task // return p - pData; } + + public bool IsAutoDeliver() + { + return m_FixedData.m_bDeathTrig || m_FixedData.m_bAutoDeliver; + } } } \ No newline at end of file From c8a21a5a3355d8f49526973af8202361582d1a06 Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Tue, 9 Dec 2025 18:13:30 +0700 Subject: [PATCH 06/25] add auto team --- .../Scripts/Network/CSNetwork/GameSession.cs | 19 ++ .../Scripts/Network/UnityGameSession.cs | 5 + .../Scripts/Players/CECAutoTeam.cs | 184 ++++++++++++++++++ .../Scripts/Players/CECAutoTeam.cs.meta | 2 + .../PerfectWorld/Scripts/Task/TaskClient.cs | 20 +- Assets/Scripts/CECHostPlayer.cs | 6 + 6 files changed, 226 insertions(+), 10 deletions(-) create mode 100644 Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs create mode 100644 Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs.meta diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 5fe6264a21..b0f8b0e660 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -1292,5 +1292,24 @@ namespace CSNetwork gamedatasend.Data = C2SCommandFactory.CreateNakeCmd(C2SCommand.CommandID.STAND_UP); SendProtocol(gamedatasend); } + + // public void c2s_SendCmdAutoTeamSetGoal(int type, int goal_id, int op) + // { + // using namespace C2S; + // int iSize = sizeof(cmd_header) + sizeof(cmd_auto_team_set_goal); + // BYTE* pBuf = (BYTE*)a_malloctemp(iSize); + // if(!pBuf) return; + // + // ((cmd_header*)pBuf)->cmd = C2S::AUTO_TEAM_SET_GOAL; + // + // cmd_auto_team_set_goal* pCmd = (cmd_auto_team_set_goal*)(pBuf + sizeof(cmd_header)); + // pCmd->goal_type = type; + // pCmd->goal_id = goal_id; + // pCmd->op = op; + // + // g_pGame->GetGameSession()->SendGameData(pBuf, iSize); + // + // a_freetemp(pBuf); + // } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs index 5da25ae735..47fb516a00 100644 --- a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs @@ -334,6 +334,11 @@ namespace BrewMonster.Network Instance._gameSession.c2s_SendCmdTaskNotify( pBuf, sz); } + public static void c2s_CmdAutoTeamSetGoal(int type, int goal_id, int op) + { + Instance._gameSession.c2s_SendCmdStandUp();void c2s_CmdAutoTeamSetGoal(int type, int goal_id, int op) { ::c2s_SendCmdAutoTeamSetGoal(type, goal_id, op); } + } + #endregion public static void GetRoleBaseInfo(int iNumRole, List aRoleIDs) diff --git a/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs b/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs new file mode 100644 index 0000000000..760d9b4dc6 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs @@ -0,0 +1,184 @@ +using BrewMonster.Network; +using CSNetwork.GPDataType; +using UnityEngine; + +namespace BrewMonster +{ + public class CECAutoTeam + { + public const float TASK_TEAM_DISTANCE = 300.0f; + public enum AutoTeamType + { + TYPE_UNKNOWN, + TYPE_TASK, + TYPE_ACTIVITY, + } + + protected int m_iType; // Auto team type + protected int m_iCurGoal; // For task-based teams: task ID; otherwise activity/event ID + protected A3DVECTOR3 m_vTaskPos; // In task teams: player position + protected CECCounter m_cntCancel; + +// CECAutoTeam::CECAutoTeam() +// { +// m_iType = TYPE_UNKNOWN; +// m_iCurGoal = 0; +// m_vTaskPos.Clear(); +// m_cntCancel.SetPeriod(500); +// m_cntCancel.Reset(); +// } + + public void Tick(float dwDeltaTime) + { + if (m_iType == (int)AutoTeamType.TYPE_TASK && m_iCurGoal>0 && m_cntCancel.IncCounter(dwDeltaTime)) + { + A3DVECTOR3 vPos = CECGameRun.Instance.GetHostPlayer().GetPos(); + if (a3d_MagnitudeH(m_vTaskPos - vPos) > TASK_TEAM_DISTANCE) + { + m_vTaskPos = vPos; + Cancel(TYPE_TASK); + } + + m_cntCancel.Reset(); + } + } + +// bool CECAutoTeam::DoAutoTeam(int type, int iGoalID) +// { +// if( GetHostPlayer()->GetTeam() ) +// return false; +// +// if( type == TYPE_TASK && !g_pGame->GetConfigs()->GetGameSettings().bAutoTeamForTask ) +// return false; +// +// // Èç¹ûÕýÔÚ½øÐл×é¶ÓÇëÇó£¬ÔòºöÂÔÆäËûÇëÇó +// if( m_iType == TYPE_ACTIVITY && m_iCurGoal ) +// return false; +// +// // ¼Ç¼´ËʱµÄλÖà +// if( type == TYPE_TASK ) +// m_vTaskPos = GetHostPlayer()->GetPos(); +// +// if( m_iType == type && m_iCurGoal == iGoalID ) +// return false; +// +// GetGameSession()->c2s_CmdAutoTeamSetGoal(type, iGoalID, 1); +// return true; +// } + + void Cancel(int type) + { + if ((m_iType == type) && m_iCurGoal>0) + UnityGameSession.c2s_CmdAutoTeamSetGoal(type, m_iCurGoal, 0); + } + +// void CECAutoTeam::OnPrtcAutoTeamSetGoalRe(GNET::Protocol* p) +// { +// enum +// { +// ERR_INVALID_GOAL = -1, +// ERR_INVALID_ROLE_STATUS = -2, +// }; +// +// using namespace GNET; +// AutoTeamSetGoal_Re* pProto = (AutoTeamSetGoal_Re*)p; +// if( pProto->retcode == 0 ) +// { +// if( pProto->op == 1 ) +// { +// m_iType = (int)pProto->goal_type; +// m_iCurGoal = pProto->goal_id; +// +// if( pProto->goal_type == TYPE_ACTIVITY ) +// GetGameUIMan()->AddChatMessage(GetGameUIMan()->GetStringFromTable(10864), GP_CHAT_MISC); +// +// // ¸üнçÃæ +// CDlgActivity* pDlg = dynamic_cast(GetGameUIMan()->GetDialog("Win_Activity")); +// if( pDlg ) pDlg->UpdateActivityList(true); +// } +// } +// else +// { +// if( pProto->goal_type == TYPE_ACTIVITY ) +// { +// if( pProto->op == 1 && pProto->retcode == ERR_INVALID_GOAL ) +// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10860), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); +// else if( pProto->op == 0 && pProto->retcode == ERR_INVALID_ROLE_STATUS ) +// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10861), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); +// } +// } +// } +// +// void CECAutoTeam::OnPrtcPlayerLeave(GNET::Protocol* p) +// { +// enum +// { +// REASON_COMPOSE_TEAM = 0, +// REASON_INVALID_STATUS, +// REASON_PLAYER_OP, +// REASON_JOIN_TEAM, +// REASON_TIMEOUT, +// }; +// +// using namespace GNET; +// AutoTeamPlayerLeave* pProto = (AutoTeamPlayerLeave*)p; +// if( m_iType == TYPE_ACTIVITY ) +// { +// switch(pProto->reason) +// { +// case REASON_INVALID_STATUS: +// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10862), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); +// break; +// case REASON_TIMEOUT: +// GetGameUIMan()->AddChatMessage(GetGameUIMan()->GetStringFromTable(10863), GP_CHAT_MISC); +// break; +// } +// } +// +// m_iCurGoal = 0; +// m_iType = TYPE_UNKNOWN; +// +// // ¸üнçÃæ +// CDlgActivity* pDlg = dynamic_cast(GetGameUIMan()->GetDialog("Win_Activity")); +// if( pDlg ) pDlg->UpdateActivityList(true); +// } +// +// void CECAutoTeam::OnWorldChanged() +// { +// if( !IsMatchingForActivity() ) +// return; +// +// bool bFound = false; +// int world_id = g_pGame->GetGameRun()->GetWorld()->GetInstanceID(); +// for( size_t i=0;iMessageBox("", GetGameUIMan()->GetStringFromTable(10865), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); +// Cancel(TYPE_ACTIVITY); +// } +// } +// +// CECGameUIMan* CECAutoTeam::GetGameUIMan() +// { +// return g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan(); +// } +// +// CECGameSession* CECAutoTeam::GetGameSession() +// { +// return g_pGame->GetGameSession(); +// } +// +// CECHostPlayer* CECAutoTeam::GetHostPlayer() +// { +// return g_pGame->GetGameRun()->GetHostPlayer(); +// } + } +} diff --git a/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs.meta b/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs.meta new file mode 100644 index 0000000000..feead89096 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0c340e14ce1c73c409d397575cdf8029 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs index 4bf6ebe2a9..7157b53a2a 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs @@ -462,16 +462,16 @@ namespace BrewMonster.Scripts.Task { // Monster kill count >= 2 triggers auto team // TODO: svr_monster_killed struct not defined; need to define or use alternative - // if (sz == Marshal.SizeOf()) - // { - // svr_monster_killed pKilled = Marshal.PtrToStructure(handle.AddrOfPinnedObject()); - // if (pKilled.monster_num >= 2) - // { - // // TODO: CECAutoTeam and DoAutoTeam not found; implement auto team if needed - // // CECAutoTeam pAutoTeam = g_pGame.GetGameRun().GetHostPlayer().GetAutoTeam(); - // // pAutoTeam.DoAutoTeam(CECAutoTeam.TYPE_TASK, pNotify.task); - // } - // } + if (sz == Marshal.SizeOf()) + { + svr_monster_killed pKilled = GPDataTypeHelper.FromBytes(pBuf) ;//Marshal.PtrToStructure(pNotify.AddrOfPinnedObject()); + if (pKilled.monster_num >= 2) + { + // TODO: CECAutoTeam and DoAutoTeam not found; implement auto team if needed + // CECAutoTeam pAutoTeam = EC_Game.GetGameRun().GetHostPlayer().GetAutoTeam(); + // pAutoTeam.DoAutoTeam(CECAutoTeam.TYPE_TASK, pNotify.task); + } + } // TODO: CECUIHelper.OnTaskProcessUpdated not found; implement UI update if needed // CECUIHelper.OnTaskProcessUpdated(pNotify.task); } diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 01da1934b8..0983664e92 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -91,6 +91,8 @@ namespace BrewMonster public uint m_dwMoveRelDir = 0; // Move relative direction flags public ON_AIR_CDR_INFO m_AirCDRInfo; + private CECAutoTeam m_pAutoTeam; // Player auto team / automatic team grouping + // ====== Ground cast config ====== [Header("Ground Cast")] [Tooltip("Khoảng thêm ngoài skinWidth để SphereCast xuống (m ngắn)")] @@ -138,6 +140,7 @@ namespace BrewMonster public EC_Inventory EquipInventory => m_equipInventory; public EC_Inventory TaskInventory => m_taskInventory; public bool IsMeleeing() { return m_bMelee; } + public CECAutoTeam GetAutoTeam() { return m_pAutoTeam; } public EC_Inventory GetInventory(byte byPackage) { @@ -271,6 +274,9 @@ namespace BrewMonster //m_dwMoveRelDir = 0; m_fVertSpeed = 0.0f; + + // Auto team / Automatic party grouping + m_pAutoTeam.Tick(Time.deltaTime); } public void StopMovement() From c454eba9888f748549719a4be837cc6fdd8bcf8f Mon Sep 17 00:00:00 2001 From: NguyenVanDat Date: Wed, 10 Dec 2025 13:55:52 +0700 Subject: [PATCH 07/25] add auto team --- Assets/PerfectWorld/Scripts/Move/CECPlayer.cs | 7 + .../CSNetwork/C2SCommand/C2SCommandFactory.cs | 33 +++++ .../Scripts/Network/CSNetwork/GPDataType.cs | 8 ++ .../Scripts/Network/CSNetwork/GameSession.cs | 31 ++--- .../CSNetwork/Protocols/AutoTeamSetGoal_Re.cs | 56 ++++++++ .../Protocols/AutoTeamSetGoal_Re.cs.meta | 2 + .../Scripts/Network/UnityGameSession.cs | 2 +- .../Scripts/Players/CECAutoTeam.cs | 129 +++++++++--------- .../PerfectWorld/Scripts/Task/TaskClient.cs | 3 +- Assets/Scripts/CECHostPlayer.cs | 2 +- 10 files changed, 187 insertions(+), 86 deletions(-) create mode 100644 Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs create mode 100644 Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs.meta diff --git a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs index e2f3e39cd4..ce500ffecd 100644 --- a/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs +++ b/Assets/PerfectWorld/Scripts/Move/CECPlayer.cs @@ -1594,6 +1594,13 @@ public abstract partial class CECPlayer : CECObject return; } } + + #region Team + + // Get team to which this player belongs to + // public CECTeam GetTeam() { return m_pTeam; } + + #endregion } public struct PlayActionEvent diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs index 45825038c8..b183f3ba1e 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs @@ -668,5 +668,38 @@ namespace CSNetwork.C2SCommand }; return SerializeCommand(CommandID.TASK_NOTIFY, cmd); } + + public static Octets CreateAutoTeamSetGoalCommand(int type, int goal_id, int op) + { + // int iSize = sizeof(cmd_header) + sizeof(cmd_auto_team_set_goal); + // uint itemSize = (uint)Marshal.SizeOf(); + // uint totalLen = contentSize + (uint)itemNum * itemSize; + // BYTE* pBuf = (BYTE*)a_malloctemp(iSize); + // if(!pBuf) return; + // + // ((cmd_header*)pBuf)->cmd = C2S::AUTO_TEAM_SET_GOAL; + // + // cmd_auto_team_set_goal pCmd = (cmd_auto_team_set_goal*)(pBuf + sizeof(cmd_header)); + cmd_auto_team_set_goal pCmd = new cmd_auto_team_set_goal() + { + goal_type = type, + goal_id = goal_id, + op = op + }; + + // + // g_pGame->GetGameSession()->SendGameData(pBuf, iSize); + // + // a_freetemp(pBuf); + // var cmd = new CMD_GetAllData + // { + // byPack = Convert.ToByte(byPack), + // byEquip = Convert.ToByte(byEquip), + // byTask = Convert.ToByte(byTask) + // }; + + // Serialize the command and return the serialized data + return SerializeCommand(CommandID.AUTO_TEAM_SET_GOAL, pCmd); + } } } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs index dfd8303375..721f44b5eb 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs @@ -1818,5 +1818,13 @@ namespace CSNetwork.GPDataType public int vigour; public ROLEEXTPROP prop; }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct cmd_auto_team_set_goal + { + public int goal_type; // 0 unknown, 1 task, 2 Activity + public int op; + public int goal_id; + }; } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index b0f8b0e660..8142519a4d 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -360,6 +360,13 @@ namespace CSNetwork OnPrtcPlayerBaseInfoRe(protocol); break; case ProtocolType.PROTOCOL_GETUICONFIG_RE: OnPrtcGetConfigRe(protocol); break; + case ProtocolType.PROTOCOL_AUTOTEAMSETGOAL_RE: + { + // CECAutoTeam pAutoTeam = CECGameRun.Instance.GetHostPlayer().GetAutoTeam(); + // if( pAutoTeam !=null) + // pAutoTeam.OnPrtcAutoTeamSetGoalRe((AutoTeamSetGoal_Re)protocol); + } + break; default: _logger.Log(LogType.Warning, $"Received unhandled protocol type: {protocol.GetPType()}"); break; @@ -1293,23 +1300,11 @@ namespace CSNetwork SendProtocol(gamedatasend); } - // public void c2s_SendCmdAutoTeamSetGoal(int type, int goal_id, int op) - // { - // using namespace C2S; - // int iSize = sizeof(cmd_header) + sizeof(cmd_auto_team_set_goal); - // BYTE* pBuf = (BYTE*)a_malloctemp(iSize); - // if(!pBuf) return; - // - // ((cmd_header*)pBuf)->cmd = C2S::AUTO_TEAM_SET_GOAL; - // - // cmd_auto_team_set_goal* pCmd = (cmd_auto_team_set_goal*)(pBuf + sizeof(cmd_header)); - // pCmd->goal_type = type; - // pCmd->goal_id = goal_id; - // pCmd->op = op; - // - // g_pGame->GetGameSession()->SendGameData(pBuf, iSize); - // - // a_freetemp(pBuf); - // } + public void c2s_SendCmdAutoTeamSetGoal(int type, int goal_id, int op) + { + gamedatasend gamedatasend = new gamedatasend(); + gamedatasend.Data = C2SCommandFactory.CreateAutoTeamSetGoalCommand(type,goal_id, op); + SendProtocol(gamedatasend); + } } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs new file mode 100644 index 0000000000..43eace2152 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs @@ -0,0 +1,56 @@ +namespace CSNetwork.Protocols +{ + namespace BrewMonster + { + public class AutoTeamSetGoal_Re : Protocol + { + public int roleid { get; set; } + public int goal_type { get; set; } + public int op { get; set; } + public int goal_id { get; set; } + public int retcode { get; set; } + public int localsid { get; set; } + + public AutoTeamSetGoal_Re() : base(ProtocolType.PROTOCOL_AUTOTEAMSETGOAL_RE) + { + + } + + public override Protocol Clone() => new AutoTeamSetGoal_Re + { + roleid = roleid, + goal_type = goal_type, + op = op, + goal_id = goal_id, + retcode = retcode, + localsid = localsid + }; + + public override void Marshal(OctetsStream os) + { + os.Write(roleid); + os.Write(goal_type); + os.Write(op); + os.Write(goal_id); + os.Write(retcode); + os.Write(localsid); + } + + public override void Unmarshal(OctetsStream os) + { + roleid = os.ReadInt32(); + goal_type = os.ReadInt32(); + op = os.ReadInt32(); + goal_id = os.ReadInt32(); + retcode = os.ReadInt32(); + localsid = os.ReadInt32(); + } + + public override int PriorPolicy() => 1; + + public override bool SizePolicy(int size) => size <= 32; + + public override string ToString => $" Type={Type}"; // - CMD_ID: {Enum.GetName(typeof(CommandID), BitConverter.ToUInt16(Data.ByteArray.Take(2).ToArray())) + } + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs.meta b/Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs.meta new file mode 100644 index 0000000000..1a18b601e0 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/Protocols/AutoTeamSetGoal_Re.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2e2c269d6707b37478238369cf01884f \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs index 47fb516a00..7891a9813d 100644 --- a/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/UnityGameSession.cs @@ -336,7 +336,7 @@ namespace BrewMonster.Network public static void c2s_CmdAutoTeamSetGoal(int type, int goal_id, int op) { - Instance._gameSession.c2s_SendCmdStandUp();void c2s_CmdAutoTeamSetGoal(int type, int goal_id, int op) { ::c2s_SendCmdAutoTeamSetGoal(type, goal_id, op); } + Instance._gameSession.c2s_SendCmdAutoTeamSetGoal(type, goal_id, op);//{ ::c2s_SendCmdAutoTeamSetGoal(type, goal_id, op); } } #endregion diff --git a/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs b/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs index 760d9b4dc6..0d0937daa3 100644 --- a/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs +++ b/Assets/PerfectWorld/Scripts/Players/CECAutoTeam.cs @@ -1,6 +1,5 @@ using BrewMonster.Network; using CSNetwork.GPDataType; -using UnityEngine; namespace BrewMonster { @@ -33,82 +32,84 @@ namespace BrewMonster if (m_iType == (int)AutoTeamType.TYPE_TASK && m_iCurGoal>0 && m_cntCancel.IncCounter(dwDeltaTime)) { A3DVECTOR3 vPos = CECGameRun.Instance.GetHostPlayer().GetPos(); - if (a3d_MagnitudeH(m_vTaskPos - vPos) > TASK_TEAM_DISTANCE) + var target = m_vTaskPos - vPos; + if (target.MagnitudeH() > TASK_TEAM_DISTANCE) { m_vTaskPos = vPos; - Cancel(TYPE_TASK); + Cancel((int)AutoTeamType.TYPE_TASK); } - m_cntCancel.Reset(); } } -// bool CECAutoTeam::DoAutoTeam(int type, int iGoalID) -// { -// if( GetHostPlayer()->GetTeam() ) -// return false; -// -// if( type == TYPE_TASK && !g_pGame->GetConfigs()->GetGameSettings().bAutoTeamForTask ) -// return false; -// -// // Èç¹ûÕýÔÚ½øÐл×é¶ÓÇëÇó£¬ÔòºöÂÔÆäËûÇëÇó -// if( m_iType == TYPE_ACTIVITY && m_iCurGoal ) -// return false; -// -// // ¼Ç¼´ËʱµÄλÖà -// if( type == TYPE_TASK ) -// m_vTaskPos = GetHostPlayer()->GetPos(); -// -// if( m_iType == type && m_iCurGoal == iGoalID ) -// return false; -// -// GetGameSession()->c2s_CmdAutoTeamSetGoal(type, iGoalID, 1); -// return true; -// } + public bool DoAutoTeam(int type, int iGoalID) + { + // if(EC_Game.GetGameRun().GetHostPlayer().GetTeam()) + // return false; + //todo need to get bAutoTeamForTask + var bAutoTeamForTask = 1; + if( type == (int)AutoTeamType.TYPE_TASK && bAutoTeamForTask<=0)//&& !g_pGame->GetConfigs()->GetGameSettings().bAutoTeamForTask + return false; + + // Èç¹ûÕýÔÚ½øÐл×é¶ÓÇëÇó£¬ÔòºöÂÔÆäËûÇëÇó + //todo need to get m_iCurGoal + if( m_iType == (int)AutoTeamType.TYPE_TASK && m_iCurGoal>0)// && m_iCurGoal + return false; + + // ¼Ç¼´ËʱµÄλÖà + if( type == (int)AutoTeamType.TYPE_TASK ) + m_vTaskPos = EC_Game.GetGameRun().GetHostPlayer().GetPos(); + + if( m_iType == type && m_iCurGoal == iGoalID ) + return false; + + UnityGameSession.c2s_CmdAutoTeamSetGoal(type, iGoalID, 1); + return true; + } void Cancel(int type) { - if ((m_iType == type) && m_iCurGoal>0) + if (m_iType == type && m_iCurGoal>0) UnityGameSession.c2s_CmdAutoTeamSetGoal(type, m_iCurGoal, 0); } -// void CECAutoTeam::OnPrtcAutoTeamSetGoalRe(GNET::Protocol* p) -// { -// enum -// { -// ERR_INVALID_GOAL = -1, -// ERR_INVALID_ROLE_STATUS = -2, -// }; -// -// using namespace GNET; -// AutoTeamSetGoal_Re* pProto = (AutoTeamSetGoal_Re*)p; -// if( pProto->retcode == 0 ) -// { -// if( pProto->op == 1 ) -// { -// m_iType = (int)pProto->goal_type; -// m_iCurGoal = pProto->goal_id; -// -// if( pProto->goal_type == TYPE_ACTIVITY ) -// GetGameUIMan()->AddChatMessage(GetGameUIMan()->GetStringFromTable(10864), GP_CHAT_MISC); -// -// // ¸üнçÃæ -// CDlgActivity* pDlg = dynamic_cast(GetGameUIMan()->GetDialog("Win_Activity")); -// if( pDlg ) pDlg->UpdateActivityList(true); -// } -// } -// else -// { -// if( pProto->goal_type == TYPE_ACTIVITY ) -// { -// if( pProto->op == 1 && pProto->retcode == ERR_INVALID_GOAL ) -// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10860), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); -// else if( pProto->op == 0 && pProto->retcode == ERR_INVALID_ROLE_STATUS ) -// GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10861), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); -// } -// } -// } -// + // public void OnPrtcAutoTeamSetGoalRe(Protocol p) + // { + // enum + // { + // ERR_INVALID_GOAL = -1, + // ERR_INVALID_ROLE_STATUS = -2, + // }; + // + // using namespace GNET; + // AutoTeamSetGoal_Re* pProto = (AutoTeamSetGoal_Re*)p; + // if( pProto->retcode == 0 ) + // { + // if( pProto->op == 1 ) + // { + // m_iType = (int)pProto->goal_type; + // m_iCurGoal = pProto->goal_id; + // + // if( pProto->goal_type == TYPE_ACTIVITY ) + // GetGameUIMan()->AddChatMessage(GetGameUIMan()->GetStringFromTable(10864), GP_CHAT_MISC); + // + // // ¸üнçÃæ + // CDlgActivity* pDlg = dynamic_cast(GetGameUIMan()->GetDialog("Win_Activity")); + // if( pDlg ) pDlg->UpdateActivityList(true); + // } + // } + // else + // { + // if( pProto->goal_type == TYPE_ACTIVITY ) + // { + // if( pProto->op == 1 && pProto->retcode == ERR_INVALID_GOAL ) + // GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10860), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); + // else if( pProto->op == 0 && pProto->retcode == ERR_INVALID_ROLE_STATUS ) + // GetGameUIMan()->MessageBox("", GetGameUIMan()->GetStringFromTable(10861), MB_OK, A3DCOLORRGBA(255, 255, 255, 160)); + // } + // } + // } + // void CECAutoTeam::OnPrtcPlayerLeave(GNET::Protocol* p) // { // enum diff --git a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs index 7157b53a2a..ddba62a349 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs @@ -467,9 +467,8 @@ namespace BrewMonster.Scripts.Task svr_monster_killed pKilled = GPDataTypeHelper.FromBytes(pBuf) ;//Marshal.PtrToStructure(pNotify.AddrOfPinnedObject()); if (pKilled.monster_num >= 2) { - // TODO: CECAutoTeam and DoAutoTeam not found; implement auto team if needed // CECAutoTeam pAutoTeam = EC_Game.GetGameRun().GetHostPlayer().GetAutoTeam(); - // pAutoTeam.DoAutoTeam(CECAutoTeam.TYPE_TASK, pNotify.task); + // pAutoTeam.DoAutoTeam((int)CECAutoTeam.AutoTeamType.TYPE_TASK, pNotify.task); } } // TODO: CECUIHelper.OnTaskProcessUpdated not found; implement UI update if needed diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 0983664e92..2613d2e456 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -276,7 +276,7 @@ namespace BrewMonster m_fVertSpeed = 0.0f; // Auto team / Automatic party grouping - m_pAutoTeam.Tick(Time.deltaTime); + // m_pAutoTeam.Tick(Time.deltaTime); } public void StopMovement() From 09c3b5de281e172995df03b3e2d169d9b450af43 Mon Sep 17 00:00:00 2001 From: MinhHai Date: Thu, 11 Dec 2025 11:41:54 +0700 Subject: [PATCH 08/25] complete mockup for DlgAward, after npc deliver award -> update runtime in Inventory --- .../UI/DialogScriptTableObject.asset | 2 + Assets/PerfectWorld/Scene/TaskTest.unity | 4 +- .../CSNetwork/C2SCommand/C2SCommandFactory.cs | 14 +- .../Scripts/Network/CSNetwork/GPDataType.cs | 11 ++ .../Scripts/Network/CSNetwork/GameSession.cs | 4 +- .../Scripts/Task/ATaskTemplMan.cs | 66 ++++++++- .../Scripts/Task/CECTaskInterface.cs | 11 +- .../PerfectWorld/Scripts/Task/TaskClient.cs | 14 +- .../Scripts/Task/TaskTempl.Struct.cs | 12 ++ Assets/PerfectWorld/Scripts/Task/TaskTempl.cs | 21 +-- Assets/PerfectWorld/Scripts/Task/TaskTest.cs | 21 +++ .../Scripts/UI/Dialogs/AUIDialog.cs | 1 + .../PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs | 1 + .../Scripts/UI/DlgAward/AwardItem.cs | 1 + .../Scripts/UI/DlgAward/CDlgAward.cs | 103 +++++++++++-- Assets/PerfectWorld/UI/Award/DlgAward.prefab | 33 +++-- Assets/Scripts/CECHostPlayer.cs | 138 ++++++++++++------ 17 files changed, 354 insertions(+), 103 deletions(-) diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index 24be82aded..294dfb24bf 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -17,3 +17,5 @@ MonoBehaviour: prefab: {fileID: 8237288432181259026, guid: 7653e7e64393ec24c903f0606499b8c4, type: 3} - id: DialogNPCShop prefab: {fileID: 8237288432181259026, guid: eaeb778b6aab3d74299373b3a96b72c4, type: 3} + - id: Win_Award + prefab: {fileID: 903595479696773158, guid: cf26d96ae7d984ba8a5b6cef44adffeb, type: 3} diff --git a/Assets/PerfectWorld/Scene/TaskTest.unity b/Assets/PerfectWorld/Scene/TaskTest.unity index 4b95fd26fc..79f0527a85 100644 --- a/Assets/PerfectWorld/Scene/TaskTest.unity +++ b/Assets/PerfectWorld/Scene/TaskTest.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:79aee339596409d8a47e0a553b1257768bd84fa0e0d6261052b33c1077658ab0 -size 41493 +oid sha256:013ea9a5ad664a8ed7ae162ffb1f16e0da6571fb6660ad5b4f1736197f8e3fd4 +size 41531 diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs index 45825038c8..efcdc4e9fb 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/C2SCommand/C2SCommandFactory.cs @@ -24,7 +24,7 @@ namespace CSNetwork.C2SCommand } // Generic command serializationw - public static Octets SerializeCommand(CommandID cmdId, T command) + public static Octets SerializeCommand(CommandID cmdId, T command, bool writeLength = true) where T : struct { var octets = new Octets(); @@ -33,7 +33,7 @@ namespace CSNetwork.C2SCommand WriteBasicValue(octets, (ushort)cmdId); // Write command body - WriteStruct(octets, command); + WriteStruct(octets, command, writeLength); return octets; } @@ -76,7 +76,7 @@ namespace CSNetwork.C2SCommand return octets; } - private static void WriteStruct(Octets octets, T value) + private static void WriteStruct(Octets octets, T value, bool writeLength=true) where T : struct { // Get fields of the struct @@ -103,7 +103,7 @@ namespace CSNetwork.C2SCommand } else if (fieldType.IsArray) { - WriteArray(octets, (Array)fieldValue); + WriteArray(octets, (Array)fieldValue, writeLength); } } else if (fieldType.IsEnum) @@ -191,7 +191,7 @@ namespace CSNetwork.C2SCommand octets.Insert(octets.Size, strBytes.AsSpan(0, length).ToArray()); } - private static void WriteArray(Octets octets, Array array) + private static void WriteArray(Octets octets, Array array, bool writeLength) { if (octets == null) return; @@ -201,7 +201,7 @@ namespace CSNetwork.C2SCommand return; } - if (array.Length != 1 ) + if (array.Length != 1 && writeLength) { WriteBasicValue(octets, array.Length); } @@ -666,7 +666,7 @@ namespace CSNetwork.C2SCommand size = dwDataSize, placeholder = pData }; - return SerializeCommand(CommandID.TASK_NOTIFY, cmd); + return SerializeCommand( CommandID.TASK_NOTIFY, cmd, false); } } } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs index dfd8303375..ac2baea4cb 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GPDataType.cs @@ -1818,5 +1818,16 @@ namespace CSNetwork.GPDataType public int vigour; public ROLEEXTPROP prop; }; + + [ StructLayout(LayoutKind.Sequential, Pack = 1)] + struct cmd_task_deliver_item + { + public int type; + public int expire_date; + public uint amount; + public uint slot_amount; + public byte where; //���ĸ���������0 ��׼��2 ����1 װ�� + public byte index; //��󲿷ַ����ĸ�λ�� + }; } diff --git a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs index 5fe6264a21..c5548dce06 100644 --- a/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs +++ b/Assets/PerfectWorld/Scripts/Network/CSNetwork/GameSession.cs @@ -503,6 +503,8 @@ namespace CSNetwork break; case CommandID.PICKUP_ITEM: case CommandID.HOST_OBTAIN_ITEM: + // case CommandID.PRODUCE_ONCE: + case CommandID.TASK_DELIVER_ITEM: EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_PICKUPITEM, (int)MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader); break; @@ -1283,7 +1285,7 @@ namespace CSNetwork gamedatasend gamedatasend = new gamedatasend(); gamedatasend.Data = C2SCommandFactory.CreateTaskNotifyCmd( pData, dwDataSize); //todo send data curent get error message 3 - // SendProtocol(gamedatasend); + SendProtocol(gamedatasend); } public void c2s_SendCmdStandUp() diff --git a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs index b57e757c38..2f183be64f 100644 --- a/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs +++ b/Assets/PerfectWorld/Scripts/Task/ATaskTemplMan.cs @@ -674,7 +674,20 @@ namespace BrewMonster.Scripts.Task // void ForceRemoveFinishTask(TaskInterface* pTask, unsigned long ulTask); public bool IsDynTasksVerified() { return m_bDynTasksVerified; } void SetDynTasksVerified(bool b) { m_bDynTasksVerified = b; } - // void OnDynTasksTimeMark(TaskInterface* pTask, unsigned long ulTimeMark, unsigned short version); + public void OnDynTasksTimeMark(TaskInterface pTask, uint ulTimeMark, ushort version) + { + if (version != DYN_TASK_CUR_VERSION) + return; + + if (m_ulDynTasksTimeMark == ulTimeMark && LoadDynTasksFromPack(m_szDynPackPath)) + { + SetDynTasksVerified(true); + pTask.InitActiveTaskList(); + UpdateDynDataNPCService(); + } + else + _notify_svr(pTask, ClientNotificationConstants.TASK_CLT_NOTIFY_DYN_DATA, 0); + } public void OnDynTasksData(TaskInterface pTask, byte[] data, int sz, bool ended) { if (m_bDynTasksVerified) @@ -968,6 +981,57 @@ namespace BrewMonster.Scripts.Task child = child.m_pNextSibling; } } + + bool LoadDynTasksFromPack(string szPath) + { + // TaskInterface::WriteLog(0, 0, 2, "LoadDynPack begin"); + + // FILE* fp = fopen(szPath, "rb"); + FileStream fp = new FileStream(szPath, FileMode.Open, FileAccess.Read); + if (fp == null) + { + // TaskInterface::WriteLog(0, 0, 0, "LoadDynTasksFromPack, no such file"); + BMLogger.LogError("[ATaskTemplMan] LoadDynTasksFromPack, no such file"); + return false; + } + + // fseek(fp, 0, SEEK_END); + // size_t sz = ftell(fp); + // fseek(fp, 0, SEEK_SET); + + long sz = fp.Length; + + + if (sz == 0) + { + fp.Close(); + return false; + } + + // char* buf = new char[sz]; + byte[] buf = new byte[sz]; + g_ulNewCount++; + // fread(buf, 1, sz, fp); + long offset = 0; + buf = AAssit.ReadArrayFromBinary( fp, (int)sz, ref offset); + fp.Close(); + + if (!UnmarshalDynTasks(buf, (int)sz, false)) + { + // LOG_DELETE_ARR(buf); + return false; + } + +#if _TASK_CLIENT + // LOG_DELETE_ARR(buf); +#else + m_pDynTasksData = buf; + m_ulDynTasksDataSize = sz; + UpdateDynDataNPCService(); +#endif + + return true; + } } [ StructLayout(LayoutKind.Sequential, Pack = 1) ] diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index b8dd0447e1..d60122cf27 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -4,6 +4,7 @@ using PerfectWorld.Scripts.Task; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; +using BrewMonster.UI; using CSNetwork; using UnityEngine; @@ -1613,11 +1614,11 @@ namespace BrewMonster.Scripts.Task public void UpdateTaskUI(uint idTask, int reason) { // TODO: update task UI - // CECGameUIMan* pGameUI = g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan(); - // if (pGameUI) - // { - // pGameUI->UpdateTask(idTask, reason); - // } + CECGameUIMan pGameUI = CECUIManager.Instance.GetInGameUIMan(); + if (pGameUI != null ) + { + pGameUI.UpdateTask(idTask, reason); + } } public bool IsTitleDataReady() diff --git a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs index 4bf6ebe2a9..b7b328db7f 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskClient.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskClient.cs @@ -356,14 +356,14 @@ namespace BrewMonster.Scripts.Task else if (pNotify.reason == TaskTemplConstants.TASK_SVR_NOTIFY_DYN_TIME_MARK) { // TODO: svr_task_dyn_time_mark struct not defined; need to define or use alternative - // if (sz != Marshal.SizeOf()) return; + if (sz != Marshal.SizeOf()) return; // TODO: OnDynTasksTimeMark method not found in ATaskTemplMan; implement if needed - // ATaskTemplMan pMan = GetTaskTemplMan(pTask); - // if (pMan != null) - // { - // svr_task_dyn_time_mark dynMark = Marshal.PtrToStructure(handle.AddrOfPinnedObject()); - // pMan.OnDynTasksTimeMark(pTask, dynMark.time_mark, dynMark.version); - // } + ATaskTemplMan pMan = GetTaskTemplMan(); + if (pMan != null) + { + svr_task_dyn_time_mark dynMark = GPDataTypeHelper.FromBytes(pBuf); + pMan.OnDynTasksTimeMark(pTask, dynMark.time_mark, dynMark.version); + } return; } // Handle dynamic task data notification diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs index 8ae2907f7d..483bc4b218 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs @@ -597,5 +597,17 @@ namespace BrewMonster.Scripts.Task m_Buf = new byte[TaskInterfaceConstants.TASK_FINISHED_LIST_BUF_SIZE]; Array.Copy(data, m_Buf, TaskInterfaceConstants.TASK_FINISHED_LIST_BUF_SIZE_OLD); } + + + }; + + [ StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct svr_task_dyn_time_mark + { + public task_notify_base baseObj; + public uint time_mark; + public ushort version; + + } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs index 23320eb30f..c2c56a698d 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs @@ -1419,19 +1419,20 @@ namespace BrewMonster.Scripts.Task /* ÈÎÎñ½áÊøºóµÄ½±Àø */ - uint m_ulAwardType_S; - uint m_ulAwardType_F; + uint m_ulAwardType_S => m_FixedData.m_ulAwardType_S; + uint m_ulAwardType_F => m_FixedData.m_ulAwardType_F; // ʱ¼äÏÞÖÆ - uint m_ulTimeLimit; + uint m_ulTimeLimit => m_FixedData.m_ulTimeLimit; + /* ÆÕͨºÍ°´Ã¿¸ö·½Ê½ */ - AWARD_DATA m_Award_S = new AWARD_DATA(); /* ³É¹¦ */ - AWARD_DATA m_Award_F = new AWARD_DATA(); /* ʧ°Ü */ + AWARD_DATA m_Award_S => m_FixedData.m_Award_S; /* ³É¹¦ */ + AWARD_DATA m_Award_F => m_FixedData.m_Award_F; /* ʧ°Ü */ /* ʱ¼ä±ÈÀý·½Ê½ */ - AWARD_RATIO_SCALE m_AwByRatio_S; - AWARD_RATIO_SCALE m_AwByRatio_F; + AWARD_RATIO_SCALE m_AwByRatio_S => m_FixedData.m_AwByRatio_S; + AWARD_RATIO_SCALE m_AwByRatio_F => m_FixedData.m_AwByRatio_F; /* °´»ñµÃÎï±ÈÀý·½Ê½ */ - AWARD_ITEMS_SCALE m_AwByItems_S; - AWARD_ITEMS_SCALE m_AwByItems_F; + AWARD_ITEMS_SCALE m_AwByItems_S => m_FixedData.m_AwByItems_S; + AWARD_ITEMS_SCALE m_AwByItems_F => m_FixedData.m_AwByItems_F; uint g_ulNewCount = 0; @@ -4776,7 +4777,7 @@ namespace BrewMonster.Scripts.Task // 0: time limit if (((1 << token_count++) & token_mask1) != 0) { - m_ulTimeLimit = GPDataTypeHelper.FromBytes(pData, ref p); + m_FixedData.m_ulTimeLimit = GPDataTypeHelper.FromBytes(pData, ref p); } // 1: reputation diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTest.cs b/Assets/PerfectWorld/Scripts/Task/TaskTest.cs index 429e68496a..b10a8dc566 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTest.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTest.cs @@ -4,6 +4,8 @@ using System.IO; using System.Reflection; using System.Runtime.InteropServices; using BrewMonster.Scripts.Task.UI; +using BrewMonster.Scripts.UI; +using BrewMonster.UI; using CSNetwork.Common; using ModelRenderer.Scripts.Common; using PerfectWorld.Scripts.Task; @@ -17,6 +19,10 @@ namespace BrewMonster.Scripts.Task public GameObject m_pTaskDlg; public static ATaskTemplMan m_pTaskMan; // use static to store loaded data across instances public bool WasLoadTaskData = false; + + [Header("Test Dlg Award Options")] + [SerializeField] private uint _awardItemID = 1001; + [SerializeField] private KeyCode _awardkey = KeyCode.A; private void OnValidate() { @@ -30,6 +36,21 @@ namespace BrewMonster.Scripts.Task { m_pTaskDlg.SetActive(!m_pTaskDlg.activeInHierarchy); } + + if (Input.GetKeyDown(_awardkey)) + { + var pShow1 = CECUIManager.Instance.GetInGameUIMan().GetDialog("Win_Award"); + CDlgAward pAward = (pShow1) as CDlgAward; + if (pAward && !pAward.gameObject.activeInHierarchy) + { + pAward.UpdateAwardItem((ushort)_awardItemID, true); + pAward.Show(true); + } + else + { + pAward.Show(false); + } + } #endif } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs index 186994bfbb..014e50b7a8 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/AUIDialog.cs @@ -99,5 +99,6 @@ namespace BrewMonster.UI { } + } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs index bf41c0f1f2..ee6feccc66 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/DlgNPC.cs @@ -3374,6 +3374,7 @@ namespace BrewMonster.UI CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); pTask.GetAwardCandidates(opt.param, ref ad); + if (ad.m_ulCandItems > 1) { pShow1 = m_pAUIManager.GetDialog("Win_Award"); diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs b/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs index 871742e81c..6754b86008 100644 --- a/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward/AwardItem.cs @@ -48,5 +48,6 @@ namespace BrewMonster.Scripts.UI { gameObject.SetActive(show); } + } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs index 2cf20ea2c5..1e3bfcf743 100644 --- a/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs +++ b/Assets/PerfectWorld/Scripts/UI/DlgAward/CDlgAward.cs @@ -1,3 +1,5 @@ +using System; +using BrewMonster.Network; using BrewMonster.Scripts.Managers; using BrewMonster.Scripts.Task; using BrewMonster.UI; @@ -17,6 +19,7 @@ namespace BrewMonster.Scripts.UI [SerializeField] private Button m_pBtn_Confirm; [SerializeField] private Vector2Int _itemSize = new Vector2Int(50, 50); [SerializeField] private AwardItem _awardItemPrefab; + [SerializeField] private Transform _itemsParent; [SerializeField] private Toggle[] _radioButtons; [Header("DEBUG")] @@ -35,20 +38,34 @@ namespace BrewMonster.Scripts.UI void Awake() { SpawnItems(); + InitRadioBtns(); + + m_pBtn_Confirm.onClick.AddListener(OnCommand_confirm); } + private void InitRadioBtns() + { + for (int i = 0; i < _radioButtons.Length; i++) + { + _radioButtons[i].isOn = false; + _radioButtons[i].onValueChanged.AddListener( OnCommand_select ); + } + + } + private void SpawnItems() { for (int i = 1; i <= _rowCount; i++) { for (int j = 1; j <= _columnCount; j++) { - AwardItem item = Instantiate(_awardItemPrefab, this.transform); + AwardItem item = Instantiate(_awardItemPrefab ,_itemsParent); item.SetPositionIndex(i, j); // Positioning logic can be added here } } - + _awardItems = new AwardItem[_rowCount]; + _awardItems = GetComponentsInChildren(); _awardItemPrefab.gameObject.SetActive(false); } @@ -82,10 +99,10 @@ namespace BrewMonster.Scripts.UI AwardItem pImage; // Using AwardItem instead of Image SetData(idTask, ""); - // CheckRadioButton(1, 0); // TODO: - // GetDlgItem("Btn_Confirm")->Enable(false); + // CheckRadioButton(1, 0); // TODO: maybe dont need this + m_pBtn_Confirm.gameObject.SetActive(false); - for (int i=1; i < _rowCount; i++) + for (int i=1; i <= _rowCount; i++) { // sprintf(out szName, "Item_%02d01", i); // pImage = (PAUIIMAGEPICTURE)GetDlgItem(szName); @@ -94,8 +111,9 @@ namespace BrewMonster.Scripts.UI // TODO: Show/Hide radio button // sprintf(out szName, "Rdo_Award%d", i); // GetDlgItem(szName)->Show(false); - _radioButtons[i].gameObject.SetActive(false); - + // _radioButtons[i-1].gameObject.SetActive(false); + GetToggleBtnAt(i).gameObject.SetActive(false); + // for (j = 1;; j++) for (int j=1; j < _columnCount; j++) { @@ -128,19 +146,21 @@ namespace BrewMonster.Scripts.UI // TODO: Set the image cover here // pImage.SetCover(GetGameUIMan().m_pA2DSpriteIcons[CECGameUIMan::ICONS_INVENTORY], // GetGameUIMan().m_IconMap[CECGameUIMan::ICONS_INVENTORY][strFile]); - - EC_IvtrEquip pEquip = new EC_IvtrEquip(pItem.m_tid, pItem.m_expire_date); - pImage.SetColor( - (pItem.IsEquipment() && pEquip.IsDestroying()) - ? new Color32(128, 128, 128, 255) - : new Color32(255, 255, 255, 255)); + var sprite = EC_IvtrItemUtils.Instance.ResolveItemIconSprite(pItem.m_tid); + pImage.SetImage(sprite); + + EC_IvtrEquip pEquip = new EC_IvtrEquip(pItem.m_tid, pItem.m_expire_date); + pImage.SetColor( + (pItem.IsEquipment() && pEquip.IsDestroying()) + ? new Color32(128, 128, 128, 255) + : new Color32(255, 255, 255, 255)); // delete pItem; pItem = null; // sprintf(out szName, "Rdo_Award%d", i); // GetDlgItem(szName)->Show(true); - _radioButtons[i].gameObject.SetActive(true); + GetToggleBtnAt(i).gameObject.SetActive(true); } else { @@ -166,7 +186,7 @@ namespace BrewMonster.Scripts.UI // sprintf(out szName, "Rdo_Award%d", i); // GetDlgItem(szName)->Show(false); - _radioButtons[i].gameObject.SetActive(false); + GetToggleBtnAt(i).gameObject.SetActive(false); for (int j = 1; j < _columnCount; j++) { @@ -209,7 +229,7 @@ namespace BrewMonster.Scripts.UI { // sprintf(out szName, "Rdo_Award%d", i); // GetDlgItem(szName)->Show(true); - _radioButtons[i].gameObject.SetActive(true); + GetToggleBtnAt(i).gameObject.SetActive(true); } for (int j = 1; j < _columnCount; j++) @@ -299,6 +319,57 @@ namespace BrewMonster.Scripts.UI } return null; } + + Toggle GetToggleBtnAt(int row) + { + int index = row - 1; + if( index < 0 || index >= _radioButtons.Length) + return null; + return _radioButtons[index]; + } + + void OnCommand_select(bool toggleValue) + { + if(toggleValue) m_pBtn_Confirm.gameObject.SetActive(true); + } + + void OnCommand_confirm() + { + // int i; + string szName; + Toggle pRadio; + uint idTask = GetData(); + + for( int i = 1; i < _rowCount ; i++ ) + { + // sprintf(szName, "Rdo_Award%d", i); + // pRadio = (PAUIRADIOBUTTON)GetDlgItem(szName); + // if( !pRadio || !pRadio->IsShow() ) break; + pRadio = GetToggleBtnAt(i); + if(!pRadio || !pRadio.gameObject.activeInHierarchy) return; + + // if( pRadio.IsChecked() ) + if( pRadio.isOn ) + { + if (m_bThroughNPC) { + // GetGameSession().c2s_CmdNPCSevReturnTask(idTask, i - 1); + UnityGameSession.c2s_CmdNPCSevReturnTask((int)idTask, i - 1); + GetGameUIMan().EndNPCService(); + } else if (m_bSpendContribution) { + // TODO: Implement spend contribution logic + // CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); + // pTask.FinishTaskSpendingWorldContribution(idTask, i - 1); + } else { + // TODO: Implement choose award logic + // CECTaskInterface pTask = GetHostPlayer().GetTaskInterface(); + // pTask.ChooseAward(idTask, i - 1); + } + Show(false); + break; + } + } + } + } } \ No newline at end of file diff --git a/Assets/PerfectWorld/UI/Award/DlgAward.prefab b/Assets/PerfectWorld/UI/Award/DlgAward.prefab index 6286daa5d3..3a24f98a6b 100644 --- a/Assets/PerfectWorld/UI/Award/DlgAward.prefab +++ b/Assets/PerfectWorld/UI/Award/DlgAward.prefab @@ -80,7 +80,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 4376062802034248599} toggleTransition: 1 graphic: {fileID: 2531169264107607804} - m_Group: {fileID: 0} + m_Group: {fileID: 8788665475006443126} onValueChanged: m_PersistentCalls: m_Calls: [] @@ -421,8 +421,9 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_pBtn_Confirm: {fileID: 2022223185403607436} - _itemSize: {x: 6, y: 10} + _itemSize: {x: 6, y: 6} _awardItemPrefab: {fileID: 421596072721705907} + _itemsParent: {fileID: 1558872982091896349} _radioButtons: - {fileID: 2958213901730883256} - {fileID: 733246749774266009} @@ -511,7 +512,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 3354338157638316856} toggleTransition: 1 graphic: {fileID: 6225229690304520632} - m_Group: {fileID: 0} + m_Group: {fileID: 8788665475006443126} onValueChanged: m_PersistentCalls: m_Calls: [] @@ -1017,7 +1018,7 @@ MonoBehaviour: m_CellSize: {x: 100, y: 100} m_Spacing: {x: 10, y: 10} m_Constraint: 1 - m_ConstraintCount: 10 + m_ConstraintCount: 6 --- !u!1 &3565430854526106865 GameObject: m_ObjectHideFlags: 0 @@ -1098,7 +1099,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 5045479894881455806} toggleTransition: 1 graphic: {fileID: 7207637042536033371} - m_Group: {fileID: 0} + m_Group: {fileID: 8788665475006443126} onValueChanged: m_PersistentCalls: m_Calls: [] @@ -1183,7 +1184,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 6245175927925089128} toggleTransition: 1 graphic: {fileID: 126544343920740120} - m_Group: {fileID: 0} + m_Group: {fileID: 8788665475006443126} onValueChanged: m_PersistentCalls: m_Calls: [] @@ -1240,7 +1241,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9d87c7b8ac564f919171a5173812980e, type: 3} m_Name: m_EditorClassIdentifier: - img: {fileID: 0} + img: {fileID: 5798109676702798723} btn: {fileID: 5829300517807457460} --- !u!222 &1897581106405175503 CanvasRenderer: @@ -1410,6 +1411,7 @@ GameObject: m_Component: - component: {fileID: 2450815123296561302} - component: {fileID: 1430101278767489564} + - component: {fileID: 8788665475006443126} m_Layer: 5 m_Name: RadioBtnGroup m_TagString: Untagged @@ -1468,6 +1470,19 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &8788665475006443126 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4660714409237943125} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AllowSwitchOff: 0 --- !u!1 &5325640235670539457 GameObject: m_ObjectHideFlags: 0 @@ -2001,7 +2016,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 4503678912350313887} toggleTransition: 1 graphic: {fileID: 7848180479837842084} - m_Group: {fileID: 0} + m_Group: {fileID: 8788665475006443126} onValueChanged: m_PersistentCalls: m_Calls: [] @@ -2162,7 +2177,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 5687745320305579942} toggleTransition: 1 graphic: {fileID: 6219347094978315234} - m_Group: {fileID: 0} + m_Group: {fileID: 8788665475006443126} onValueChanged: m_PersistentCalls: m_Calls: [] diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 01da1934b8..0a5721e60c 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -714,6 +714,10 @@ namespace BrewMonster { var data = Msg.dwParam1 as byte[]; int cmd = Convert.ToInt32(Msg.dwParam2); + + bool bDoOther = false; + int idItem, iExpireDate=0, iAmount, iCmdLastSlot, iCmdSlotAmount, iPack, iMsg=-1; + switch (cmd) { case CommandID.HOST_OBTAIN_ITEM: @@ -755,61 +759,105 @@ namespace BrewMonster } break; case CommandID.PICKUP_ITEM: - { - int tid = BitConverter.ToInt32(data, 0); - int expire_date = BitConverter.ToInt32(data, 4); - uint iAmount = BitConverter.ToUInt32(data, 8); - uint iSlotAmount = BitConverter.ToUInt32(data, 12); - byte byPackage = data[16]; - byte bySlot = data[17]; + { + int tid = BitConverter.ToInt32(data, 0); + int expire_date = BitConverter.ToInt32(data, 4); + iAmount = (int)BitConverter.ToUInt32(data, 8); + uint iSlotAmount = BitConverter.ToUInt32(data, 12); + byte byPackage = data[16]; + byte bySlot = data[17]; + //Debug.Log($"[Inventory] PICKUP_ITEM: tid={tid}, expire_date={expire_date}, iAmount={iAmount}, iSlotAmount={iSlotAmount}, byPackage={byPackage}, bySlot={bySlot}"); + + // Notify pickupItem script about successful pickup + pickupItem pickupScript = pickupItem.Instance; + if (pickupScript != null) + { //Debug.Log($"[Inventory] PICKUP_ITEM: tid={tid}, expire_date={expire_date}, iAmount={iAmount}, iSlotAmount={iSlotAmount}, byPackage={byPackage}, bySlot={bySlot}"); // Notify pickupItem script about successful pickup - pickupItem pickupScript = pickupItem.Instance; + pickupScript = UnityEngine.Object.FindFirstObjectByType(); if (pickupScript != null) { - //Debug.Log($"[Inventory] PICKUP_ITEM: tid={tid}, expire_date={expire_date}, iAmount={iAmount}, iSlotAmount={iSlotAmount}, byPackage={byPackage}, bySlot={bySlot}"); - - // Notify pickupItem script about successful pickup - pickupScript = UnityEngine.Object.FindFirstObjectByType(); - if (pickupScript != null) - { - pickupScript.OnPickupSuccess(tid); - } - - // Create new inventory item data - var newItem = new EC_IvtrItem - { - Package = byPackage, - Slot = bySlot, - m_tid = tid, - m_expire_date = expire_date, - State = 0, - m_iCount = (int)iAmount, - Crc = 0, - Content = null - }; - - // Add item to inventory - var ivt = GetInventory(byPackage); - ivt.SetItem(bySlot, newItem); - - //Debug.Log($"[Inventory] Successfully added item {tid} to package {byPackage}, slot {bySlot} with count {iAmount}"); - - // Trigger UI refresh if an EC_InventoryUI is present in scene - var ui = GameObject.FindFirstObjectByType(); - if (ui != null) - { - ui.RefreshAll(); - } + pickupScript.OnPickupSuccess(tid); } - else + + // Create new inventory item data + var newItem = new EC_IvtrItem { - Debug.LogWarning("[Inventory] PICKUP_ITEM: Invalid data length"); + Package = byPackage, + Slot = bySlot, + m_tid = tid, + m_expire_date = expire_date, + State = 0, + m_iCount = (int)iAmount, + Crc = 0, + Content = null + }; + + // Add item to inventory + var ivt = GetInventory(byPackage); + ivt.SetItem(bySlot, newItem); + + //Debug.Log($"[Inventory] Successfully added item {tid} to package {byPackage}, slot {bySlot} with count {iAmount}"); + + // Trigger UI refresh if an EC_InventoryUI is present in scene + var ui = GameObject.FindFirstObjectByType(); + if (ui != null) + { + ui.RefreshAll(); } - break; } + else + { + Debug.LogWarning("[Inventory] PICKUP_ITEM: Invalid data length"); + } + break; + } + case CommandID.TASK_DELIVER_ITEM: + cmd_task_deliver_item pCmd = GPDataTypeHelper.FromBytes(data); + // ASSERT(pCmd); + + idItem = pCmd.type; + iExpireDate = pCmd.expire_date; + iAmount = (int)pCmd.amount; + iCmdLastSlot = pCmd.index; + iCmdSlotAmount = (int)pCmd.slot_amount; + iPack = pCmd.where; + iMsg = (int)FixedMsg.FIXMSG_GAINITEM; + bDoOther = true; + + + // Create new inventory item data + var taskNewItem = new EC_IvtrItem + { + Package = (byte)iPack, + Slot = iCmdLastSlot, + m_tid = idItem, + m_expire_date = iExpireDate, + State = 0, + m_iCount = (int)iAmount, + Crc = 0, + Content = null + }; + + // Add item to inventory + var task_ivt = GetInventory((byte)iPack); + task_ivt.SetItem(iCmdLastSlot, taskNewItem); + + //Debug.Log($"[Inventory] Successfully added item {tid} to package {byPackage}, slot {bySlot} with count {iAmount}"); + + // Trigger UI refresh if an EC_InventoryUI is present in scene + var task_ui = GameObject.FindFirstObjectByType(); + if (task_ui != null) + { + task_ui.RefreshAll(); + } + break; + + + // TODO: Handle other pickup item commands if necessary + } } public void OnMsgHstItemOperation(ECMSG Msg) From a57e5b4f32c3fb47b211a433a9b15766b30814fd Mon Sep 17 00:00:00 2001 From: HungDK <> Date: Thu, 11 Dec 2025 17:41:20 +0700 Subject: [PATCH 09/25] Update task, filtering all task can take --- .../Scripts/MainFiles/EC_Game.Time.cs | 2 +- .../Scripts/Task/CECTaskInterface.cs | 32 ++- .../Scripts/Task/TaskInterface.cs | 12 +- .../PerfectWorld/Scripts/Task/TaskProcess.cs | 104 ++++++++ .../Scripts/Task/TaskTempl.Method.cs | 237 ++++++++++++++++-- .../Scripts/Task/TaskTempl.Struct.cs | 24 +- Assets/PerfectWorld/Scripts/Task/TaskTempl.cs | 113 ++++++++- Assets/Scripts/CECGameRun.cs | 14 +- Assets/Scripts/CECHostPlayer.cs | 1 + 9 files changed, 499 insertions(+), 40 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.Time.cs b/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.Time.cs index c1e6089fb2..f4ee1a2419 100644 --- a/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.Time.cs +++ b/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.Time.cs @@ -10,7 +10,7 @@ namespace BrewMonster.Network private static int m_AbsTimeStart; private static int m_iTimeError; // 服务器与本机时间差(秒) // Time error in seconds private static int m_iTimeZoneBias; // 服务器时区偏移(秒) // Server timezone bias in seconds - + public static int GetTimeZoneBias() { return m_iTimeZoneBias; } // 设置时间误差 // Set time error public static void SetServerTime(int iSevTime, int iTimeZoneBias) { diff --git a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs index 2698055ebc..5bc9f745f5 100644 --- a/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/CECTaskInterface.cs @@ -306,6 +306,24 @@ namespace BrewMonster.Scripts.Task } public class CECTaskInterface : TaskInterface { + public int GetCurHistoryStageIndex() + { + return EC_Game.GetGameRun().GetCurStageIndex() + 1; + } + public uint GetObtainedGeneralCardCount() + { + return 0; + //return m_pHost ? m_pHost.GetGeneralCardData().GetObtainedCount() : 0; + }public uint GetObtainedGeneralCardCountByRank(int rank) + { + return 0; + //return m_pHost ? m_pHost.GetGeneralCardData().GetObtainedCount() : 0; + } + public bool HaveGotTitle(uint id_designation) + { + return true; + } + // public const int TASK_MAX_DELIVER_COUNT = 5; // public const int TASK_STORAGE_COUNT = 32; // public const int TASK_STORAGE_LEN = 10; @@ -978,7 +996,14 @@ namespace BrewMonster.Scripts.Task return 0u; } - + public bool CanDeliverCommonItem(uint ulTypes) + { + return m_pHost.GetPack().GetEmptySlotNum() >= (int)(ulTypes); + } + public bool CanDeliverTaskItem(uint ulTypes) + { + return m_pHost.GetTaskPack().GetEmptySlotNum() >= (int)ulTypes; + } public void ShowPunchBagMessage(bool bSucced,bool bMax,uint MonsterTemplID,int dps,int dph) { // TODO : implement UI message box @@ -1325,7 +1350,10 @@ namespace BrewMonster.Scripts.Task { return m_pFinishedTimeListBuf; } - + public byte[] GetFinishedCntList() + { + return m_pFinishedCountListBuf; + } void SetForceNavigateFinishFlag(bool bFinish) { m_bForceNavigateFinish = bFinish;} // public void OnNewTask(int iTaskID) { diff --git a/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs b/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs index b33ec6f88c..62523b9646 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskInterface.cs @@ -122,6 +122,7 @@ namespace BrewMonster.Scripts.Task int GetExp(); int GetSP(); int GetForceActivityLevel(); + bool HaveGotTitle(uint id_designation); bool IsKing(); bool IsInTeam(); uint GetAccountTotalCash(); @@ -151,6 +152,15 @@ namespace BrewMonster.Scripts.Task int GetPlayerId(); void PopChatMessage(int iIndex, int dwNum=0); - + bool CanDeliverCommonItem(uint ulItemTypes); + bool CanDeliverTaskItem(uint ulItemTypes); + static int GetTimeZoneBias() + { + return EC_Game.GetTimeZoneBias(); + } + int GetCurHistoryStageIndex(); + byte[] GetFinishedCntList(); + uint GetObtainedGeneralCardCount(); + uint GetObtainedGeneralCardCountByRank(int rank); } } \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs index 88153334cf..95923b89db 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskProcess.cs @@ -1,6 +1,7 @@ using System; using System.Runtime.InteropServices; using BrewMonster.Scripts.Task; +using CSNetwork.GPDataType; using UnityEngine; namespace BrewMonster.Scripts.Task @@ -19,6 +20,109 @@ namespace BrewMonster.Scripts.Task TASK_STATE_AWARD_NOTIFY_TEAM = 0x10, // Award has been notified to team TASK_STATE_CONTRIBUTION_FINISH = 0x20 // Contribution finished } + + [StructLayout( LayoutKind.Sequential, Pack = 1 )] + public struct TaskFinishCountList + { + public static ushort m_uCount; + + public static TaskFinishCountEntry[] m_aList = new TaskFinishCountEntry[(uint)TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN]; + + + public uint Search(uint ulID, ref uint ulTime) + + { + for (ushort i = 0; i < TaskFinishCountList.m_uCount; i++) + { + if (TaskFinishCountList.m_aList[i].m_uTaskId == (ushort)ulID) + { + ulTime = TaskFinishCountList.m_aList[i].m_ulFinishTime; + return TaskFinishCountList.m_aList[i].m_ulFinishCount; + } + } + + return 0u; + } + + public void ResetAt(uint ulID) + { + for (ushort i = 0; i < m_uCount; i++) + if (m_aList[i].m_uTaskId == (ushort)ulID) + m_aList[i].m_ulFinishCount = 0; + } + + public void AddOrUpdate(uint ulID, uint ulFinishTime) + { + for (ushort i = 0; i < m_uCount; i++) + { + if (m_aList[i].m_uTaskId == (ushort)ulID) + { + m_aList[i].m_ulFinishCount ++; + m_aList[i].m_ulFinishTime = ulFinishTime; + return; + } + } + + if (m_uCount >= (uint)TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN) + return; + + m_aList[m_uCount].m_uTaskId = (ushort)ulID; + m_aList[m_uCount].m_ulFinishCount = 1; + m_aList[m_uCount].m_ulFinishTime = ulFinishTime; + m_uCount++; + } + public void RemoveAll() + { + m_uCount = 0; + m_aList = new TaskFinishCountEntry[(uint)TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN]; + } + public bool IsValid() { return m_uCount <= TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN; } + + public bool ReadFromBytes(byte[] data) + { + if (data == null || data.Length < 2) + return false; + + // Read m_uCount (2 bytes) + m_uCount = BitConverter.ToUInt16(data, 0); + + // Read m_aList array + int entrySize = Marshal.SizeOf(); + int expectedSize = 2 + entrySize * TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN; + + if (data.Length < expectedSize) + return false; + + if (m_aList == null || m_aList.Length != TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN) + m_aList = new TaskFinishCountEntry[TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN]; + + for (int i = 0; i < TaskInterfaceConstants.TASK_FINISH_COUNT_MAX_LEN; i++) + { + int offset = 2 + i * entrySize; + m_aList[i] = GPDataTypeHelper.FromBytes(data[offset..(offset + entrySize)]); + } + + return true; + } + }; + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct TaskFinishCountEntry + { + public ushort m_uTaskId; + public uint m_ulFinishCount; + public uint m_ulFinishTime; + public uint m_ulUnused2; + }; + + [StructLayout( LayoutKind.Sequential, Pack = 1 )] + public class TASK_ + { + public const int TASK_DEFAULT_MAX_SIMULTANEOUS_COUT = 20; + public const int TASK_MAX_SIMULTANEOUS_COUT = 30; + public const int TASK_HIDDEN_COUNT = 30; // formally 6, for test + public const int TASK_TITLE_TASK_COUNT = 10; + } [StructLayout( LayoutKind.Sequential, Pack = 1 )] // Cur Size 21 bytes diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs index 7df89ff3ff..4e2984a76f 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Method.cs @@ -40,11 +40,16 @@ namespace BrewMonster.Scripts.Task if (ulRet != 0u) goto ret_here; } // else if (pList->GetEntry(m_ID)) // English: Already has the same task - else if (pTask.HasTask(m_FixedData.m_ID)) + else if (pList.GetEntry(m_FixedData.m_ID) != null) { ulRet = (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_SAME_TASK; goto ret_here; } + /*else if (pTask.HasTask(m_FixedData.m_ID)) + { + ulRet = (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_SAME_TASK; + goto ret_here; + }*/ // �Ƿ����� // English: Is task forbidden if (pTask.CheckTaskForbid(m_FixedData.m_ID)) @@ -58,7 +63,7 @@ namespace BrewMonster.Scripts.Task { for (byte i = 0; i < pList.m_uTaskCount; i++) { - var CurEntry = pList.m_TaskEntries[i]; + ActiveTaskEntry CurEntry = pList.m_TaskEntries[i]; if (CurEntry == null) continue; ATaskTempl pTempl = CurEntry.GetTempl(); @@ -819,7 +824,14 @@ namespace BrewMonster.Scripts.Task // 检查交付所需道具容量合法性 // English: Check deliverable item capacity public uint CheckGivenItems(TaskInterface pTask) { - // TODO: Use m_FixedData.m_ulGivenItems, m_ulGivenCmnCount, m_ulGivenTskCount and pTask.CanDeliver* API when fields confirmed + if (m_FixedData.m_ulGivenItems != 0) + { + if (!pTask.IsDeliverLegal()) return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_GIVEN_ITEM; + + if (m_FixedData.m_ulGivenCmnCount != 0 && !pTask.CanDeliverCommonItem(m_FixedData.m_ulGivenCmnCount) + || m_FixedData.m_ulGivenTskCount != 0 && !pTask.CanDeliverTaskItem(m_FixedData.m_ulGivenTskCount)) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_GIVEN_ITEM; + } return 0u; } @@ -827,7 +839,15 @@ namespace BrewMonster.Scripts.Task // 检查任务可接时间表 // English: Check task timetable window public uint CheckTimetable(uint ulCurTime) { - // TODO: Implement judge_time_date against m_FixedData.m_tmStart/m_tmEnd/m_tmType + if (m_FixedData.m_ulTimetable == 0) return 0; + + uint i; + + for (i = 0; i < m_FixedData.m_ulTimetable; i++) + //if (judge_time_date(&m_tmStart[i], &m_tmEnd[i], ulCurTime, (task_tm_type)m_tmType[i])) + return 0; + + //return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_WRONG_TIME; return 0u; } @@ -843,7 +863,14 @@ namespace BrewMonster.Scripts.Task // 检查完成与失败记录是否允许重复领取 // English: Check finished/failed list for redo permissions public uint CheckFnshLst(TaskInterface pTask, uint ulCurTime) { - // TODO: Implement using FinishedTaskList and m_FixedData.m_bCanRedo/m_bCanRedoAfterFailure + if (!m_FixedData.m_bCanRedo || !m_FixedData.m_bCanRedoAfterFailure) + { + FinishedTaskList pFinished = (FinishedTaskList)pTask.GetFinishedTaskList(); + int nRet = pFinished.SearchTask(m_FixedData.m_ID); + + if (nRet == 0 && !m_FixedData.m_bCanRedo || nRet == 1 && !m_FixedData.m_bCanRedoAfterFailure) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_CANT_REDO; + } return 0u; } @@ -851,7 +878,27 @@ namespace BrewMonster.Scripts.Task // 检查周期内角色/账号次数限制 // English: Check period deliver counts for role/account public uint CheckDeliverCount(TaskInterface pTask) { - // TODO: Implement with FinishedCountList/FinishedTaskList based on account/role limits + if (m_FixedData.m_bAccountTaskLimit && m_FixedData.m_lPeriodLimit != 0) + { + if (pTask.IsAtCrossServer()) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_CROSSSERVER_NO_ACOUNT_LIMIT; + + byte[] finishedCntListBuf = pTask.GetFinishedCntList(); + TaskFinishCountList pFnshList = new TaskFinishCountList(); + pFnshList.ReadFromBytes(finishedCntListBuf); + uint ulTemp = 0; + uint nRet = pFnshList.Search(m_FixedData.m_ID, ref ulTemp); + + if ((uint)nRet >= m_FixedData.m_lPeriodLimit) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_MAX_ACC_CNT; + } + else if (m_FixedData.m_bRoleTaskLimit && m_FixedData.m_lPeriodLimit != 0) + { + FinishedTaskList pFnshList = (FinishedTaskList)pTask.GetFinishedTaskList(); + long finish_count = pFnshList.SearchTaskFinishCount(m_FixedData.m_ID); + if (finish_count >= m_FixedData.m_lPeriodLimit) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_MAX_ROLE_CNT; + } return 0u; } @@ -951,8 +998,32 @@ namespace BrewMonster.Scripts.Task // 前置道具检查(任一/全部) // English: Prerequisite item check (any/ALL) public uint CheckItems(TaskInterface pTask) { - // TODO: Implement using m_FixedData.m_ulPremItems, m_bPremItemsAnyOne, m_PremItems[] - return 0u; + uint i = 0; + uint ret = m_FixedData.m_bPremItemsAnyOne ? (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_NO_ITEM : 0; + + for (; i < m_FixedData.m_ulPremItems; i++) + { + ITEM_WANTED wi = m_FixedData.m_PremItems[i]; + + if (m_FixedData.m_bPremItemsAnyOne) + { + if (_get_item_count(pTask, wi.m_ulItemTemplId, wi.m_bCommonItem) >= wi.m_ulItemNum) + { + ret = 0; + break; + } + } + else + { + if (_get_item_count(pTask, wi.m_ulItemTemplId, wi.m_bCommonItem) < wi.m_ulItemNum) + { + ret = (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_NO_ITEM; + break; + } + } + } + + return ret; } // inline unsigned long ATaskTempl::CheckFaction(TaskInterface* pTask) const @@ -1020,22 +1091,78 @@ namespace BrewMonster.Scripts.Task // 前置任务 // English: Previous tasks public uint CheckPreTask(TaskInterface pTask) { - // TODO: Implement using FinishedTaskList and m_FixedData.m_ulPremise_Tasks[*] - return 0u; + uint i; + FinishedTaskList pFinished = (FinishedTaskList)pTask.GetFinishedTaskList(); + + uint iPremTaskFinishedCount = 0; + for (i = 0; i < m_FixedData.m_ulPremise_Task_Count; i++) + { + if (m_FixedData.m_ulPremise_Task_Least_Num == 0) + { + if (pFinished.SearchTask(m_FixedData.m_ulPremise_Tasks[i]) != 0) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_PREV_TASK; + } + else if (pFinished.SearchTask(m_FixedData.m_ulPremise_Tasks[i]) == 0) + { + iPremTaskFinishedCount++; + } + } + return m_FixedData.m_ulPremise_Task_Least_Num != 0 ? + (iPremTaskFinishedCount < m_FixedData.m_ulPremise_Task_Least_Num ? (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_PREV_TASK : 0) : 0; } // (No inline in provided snippet) 互斥任务 // English: Mutex task public uint CheckMutexTask(TaskInterface pTask, uint ulCurTime) { - // TODO: Implement when mutex task data is available - return 0u; + uint i; + FinishedTaskList pFinished = (FinishedTaskList)pTask.GetFinishedTaskList(); + + uint iPremTaskFinishedCount = 0; + for (i = 0; i < m_FixedData.m_ulPremise_Task_Count; i++) + { + if (m_FixedData.m_ulPremise_Task_Least_Num == 0) + { + if (pFinished.SearchTask(m_FixedData.m_ulPremise_Tasks[i]) != 0) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_PREV_TASK; + } + else if (pFinished.SearchTask(m_FixedData.m_ulPremise_Tasks[i]) == 0) + { + iPremTaskFinishedCount++; + } + } + + return m_FixedData.m_ulPremise_Task_Least_Num != 0 ? (iPremTaskFinishedCount < m_FixedData.m_ulPremise_Task_Least_Num ? + (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_PREV_TASK : 0) : 0; + } // inline unsigned long ATaskTempl::CheckInZone(TaskInterface* pTask) const // 区域检查 // English: In-zone check public uint CheckInZone(TaskInterface pTask) { - // TODO: Implement worldId + region bounding box check using m_FixedData.m_ulDelvWorld and m_pDelvRegion + if (m_FixedData.m_bDelvInZone) + { + float[] pos = new float[3]; + uint ulWorldId = (uint)pTask.GetPos(pos); + + /* if (ulWorldId != m_ulDelvWorld || + !is_in_zone( + m_DelvMinVert, + m_DelvMaxVert, + pos)) + return TASK_PREREQU_FAIL_NOT_IN_ZONE;*/ + if(ulWorldId != m_FixedData.m_ulDelvWorld) + return (uint) TaskInterfaceConstants.TASK_PREREQU_FAIL_NOT_IN_ZONE; + + for (uint i=0; i < m_FixedData.m_ulDelvRegionCnt; i++) + { + Task_Region t = m_FixedData.m_pDelvRegion[i]; + if(is_in_zone(t.zvMin,t.zvMax,pos)) + return 0; + } + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_NOT_IN_ZONE; + } + return 0u; } @@ -1043,7 +1170,11 @@ namespace BrewMonster.Scripts.Task // 组队接任务要求 // English: Team-task requirements public uint CheckTeamTask(TaskInterface pTask) { - // TODO: Implement full team captain and member checks per HasAllTeamMemsWanted + // if (m_FixedData.m_bTeamwork && m_FixedData.m_bRcvByTeam) // ��ӽ��� + // { + // if (!pTask.IsCaptain()) return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_NOT_CAPTAIN; + // return HasAllTeamMemsWanted(pTask, true); + // } return 0u; } @@ -1072,7 +1203,28 @@ namespace BrewMonster.Scripts.Task // 结婚任务条件 // English: Marriage task requirements public uint CheckMarriage(TaskInterface pTask) { - // TODO: Implement two-person team with opposite gender per original logic if APIs exist + //TODO: + /*if (m_FixedData.m_bMarriage) + { + + if (pTask.IsAtCrossServer()) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_CROSSSERVER_NO_MARRIAGE; + if (pTask.IsMarried()) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_ILLEGAL_MEM; + + if (!pTask.IsInTeam()) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_ILLEGAL_MEM; + + if (pTask.GetTeamMemberNum() != 2) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_ILLEGAL_MEM; + + task_team_member_info m1, m2; + pTask.GetTeamMemberInfo(0, &m1); + pTask.GetTeamMemberInfo(1, &m2); + + if (m1.m_bMale == m2.m_bMale) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_ILLEGAL_MEM; + }*/ return 0u; } @@ -1081,6 +1233,17 @@ namespace BrewMonster.Scripts.Task public uint CheckLivingSkill(TaskInterface pTask) { // TODO: Loop m_FixedData.m_lSkillLev[MAX_LIVING_SKILLS] with skill ids and pTask.HasLivingSkill/GetLivingSkillLevel + // unsigned long i; + // + // for (i = 0; i < MAX_LIVING_SKILLS; i++) + // { + // if (m_lSkillLev[i] == 0) + // continue; + // + // if (!pTask.HasLivingSkill(_living_skill_ids[i]) + // || pTask->GetLivingSkillLevel(_living_skill_ids[i]) < m_lSkillLev[i]) + // return TASK_PREREQU_FAIL_LIVING_SKILL; + // } return 0u; } @@ -1237,7 +1400,30 @@ namespace BrewMonster.Scripts.Task // 称号检查 // English: Title check public uint CheckTitle(TaskInterface pTask) { - // TODO: Implement using m_FixedData.m_iPremTitleNumTotal/m_iPremTitleNumRequired and award title arrays + if (m_FixedData.m_iPremTitleNumTotal != 0) { + int iNumRequired = (int)m_FixedData.m_iPremTitleNumTotal; + if (m_FixedData.m_iPremTitleNumRequired > 0 && m_FixedData.m_iPremTitleNumRequired < m_FixedData.m_iPremTitleNumTotal) + iNumRequired = (int)m_FixedData.m_iPremTitleNumRequired; + int iTitleCount = 0; + for (uint i = 0; i < m_FixedData.m_iPremTitleNumTotal; ++i) { + if (pTask.HaveGotTitle((uint)m_FixedData.m_PremTitles[i])) + iTitleCount++; + } + if (iTitleCount < iNumRequired) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_TITLE; + } + if (m_Award_S.m_ulTitleNum != 0) { + for (uint i = 0; i < m_Award_S.m_ulTitleNum; ++i) { + if (pTask.HaveGotTitle(m_Award_S.m_pTitleAward[i].m_ulTitleID)) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_TITLE; + } + } + if (m_Award_F.m_ulTitleNum != 0) { + for (uint i = 0; i < m_Award_F.m_ulTitleNum; ++i) { + if (pTask.HaveGotTitle(m_Award_F.m_pTitleAward[i].m_ulTitleID)) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_TITLE; + } + } return 0u; } @@ -1245,7 +1431,13 @@ namespace BrewMonster.Scripts.Task // 历史阶段 // English: History stage public uint CheckHistoryStage(TaskInterface pTask) { - // TODO: Implement using pTask.GetCurHistoryStageIndex() and m_FixedData.m_iPremHistoryStageIndex[2] + int index = pTask.GetCurHistoryStageIndex(); + + if (m_FixedData.m_iPremHistoryStageIndex[0] != 0 && (index <=0 || index < m_FixedData.m_iPremHistoryStageIndex[0])) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_HISTORYSTAGE; + if (m_FixedData.m_iPremHistoryStageIndex[1] != 0 && (index <=0 || index > m_FixedData.m_iPremHistoryStageIndex[1])) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_HISTORYSTAGE; + return 0u; } @@ -1253,7 +1445,11 @@ namespace BrewMonster.Scripts.Task // 将星卡收集数量 // English: General card collection count public uint CheckCardCollection(TaskInterface pTask) { - // TODO: Implement using pTask.GetObtainedGeneralCardCount() and m_FixedData.m_ulPremGeneralCardCount + uint count = pTask.GetObtainedGeneralCardCount(); + + if (m_FixedData.m_ulPremGeneralCardCount != 0 && (count < m_FixedData.m_ulPremGeneralCardCount)) + return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_CARD_COUNT_COLLECTION; + return 0u; } @@ -1261,7 +1457,10 @@ namespace BrewMonster.Scripts.Task // 指定品级将星卡数量 // English: Specific rank general card count public uint CheckCardRankCount(TaskInterface pTask) { - // TODO: Implement using pTask.GetObtainedGeneralCardCountByRank(rank) and m_FixedData fields + if (m_FixedData.m_iPremGeneralCardRank >= 0 && m_FixedData.m_ulPremGeneralCardRankCount != 0) { + uint count = pTask.GetObtainedGeneralCardCountByRank(m_FixedData.m_iPremGeneralCardRank); + if (count < m_FixedData.m_ulPremGeneralCardRankCount) return (uint)TaskInterfaceConstants.TASK_PREREQU_FAIL_CARD_COUNT_RANK; + } return 0u; } diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs index 9e46c1af91..af28905621 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.Struct.cs @@ -200,18 +200,18 @@ namespace BrewMonster.Scripts.Task } - struct tm { - int tm_sec; /* seconds after the minute [0-60] */ - int tm_min; /* minutes after the hour [0-59] */ - int tm_hour; /* hours since midnight [0-23] */ - int tm_mday; /* day of the month [1-31] */ - int tm_mon; /* months since January [0-11] */ - int tm_year; /* years since 1900 */ - int tm_wday; /* days since Sunday [0-6] */ - int tm_yday; /* days since January 1 [0-365] */ - int tm_isdst; /* Daylight Savings Time flag */ - long tm_gmtoff; /* offset from UTC in seconds */ - byte tm_zone; /* timezone abbreviation */ + public struct tm { + public int tm_sec; /* seconds after the minute [0-60] */ + public int tm_min; /* minutes after the hour [0-59] */ + public int tm_hour; /* hours since midnight [0-23] */ + public int tm_mday; /* day of the month [1-31] */ + public int tm_mon; /* months since January [0-11] */ + public int tm_year; /* years since 1900 */ + public int tm_wday; /* days since Sunday [0-6] */ + public int tm_yday; /* days since January 1 [0-365] */ + public int tm_isdst; /* Daylight Savings Time flag */ + public long tm_gmtoff; /* offset from UTC in seconds */ + public byte tm_zone; /* timezone abbreviation */ }; [StructLayout(LayoutKind.Explicit)] diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs index 9d719f0a22..9ef3d5bf55 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTempl.cs @@ -356,6 +356,76 @@ namespace BrewMonster.Scripts.Task public float x; public float y; public float z; + + // Property to access as array (union equivalent) + // 作为数组访问的属性(联合体等价) // Property to access as array (union equivalent) + public float[] v + { + get + { + return new float[] { x, y, z }; + } + } + + // Indexer for array-like access + // 数组式访问的索引器 // Indexer for array-like access + public float this[int index] + { + get + { + switch (index) + { + case 0: return x; + case 1: return y; + case 2: return z; + default: throw new IndexOutOfRangeException(); + } + } + set + { + switch (index) + { + case 0: x = value; break; + case 1: y = value; break; + case 2: z = value; break; + default: throw new IndexOutOfRangeException(); + } + } + } + + public static bool operator ==(ZONE_VERT left, ZONE_VERT right) + { + return (left.x == right.x && left.y == right.y && left.z == right.z); + } + + public static bool operator !=(ZONE_VERT left, ZONE_VERT right) + { + return !(left == right); + } + + public override bool Equals(object obj) + { + if (obj is ZONE_VERT) + { + return this == (ZONE_VERT)obj; + } + return false; + } + + public override int GetHashCode() + { + return x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode(); + } + + public bool great_than(float[] v) + { + return x >= v[0] && y >= v[1] && z >= v[2]; + } + + public bool less_than(float[] v) + { + return x <= v[0] && y <= v[1] && z <= v[2]; + } } [StructLayout(LayoutKind.Sequential, Pack = 1)] @@ -1190,8 +1260,6 @@ namespace BrewMonster.Scripts.Task enumTaskTimeWeek, enumTaskTimeDay }; - - /// /// Completion Method /// @@ -1363,7 +1431,41 @@ namespace BrewMonster.Scripts.Task }; - + /*public bool judge_time_date(task_tm tmStart, task_tm tmEnd, uint ulCurTime, task_tm_type tm_type) + { + tm _time, _time_tomorrow; + uint ulTimeTomorrow; + bool last_day; + +#if _TASK_CLIENT + ulCurTime -= (uint)(TaskInterface.GetTimeZoneBias() * 60); + + if ((long)(ulCurTime) < 0) + ulCurTime = 0; + _time = DateTimeOffset.FromUnixTimeSeconds(ulCurTime).UtcDateTime; + _time_tomorrow = _time.AddDays(1); +#else + _time = *localtime((time_t*)&ulCurTime); + ulTimeTomorrow = ulCurTime + 24 * 3600; + _time_tomorrow = *localtime((time_t*)&ulTimeTomorrow); +#endif + + last_day = (_time.tm_mon != _time_tomorrow.tm_mon); + + switch (tm_type) + { + case enumTaskTimeDate: + return tmStart->before(&_time) && tmEnd->after(&_time); + case enumTaskTimeMonth: + return tmStart->before_per_month(&_time, last_day) && tmEnd->after_per_month(&_time, last_day); + case enumTaskTimeWeek: + return tmStart->before_per_week(&_time) && tmEnd->after_per_week(&_time); + case enumTaskTimeDay: + return tmStart->before_per_day(&_time) && tmEnd->after_per_day(&_time); + } + + return false; + }*/ /// /// 任务模板类 // Task Template Class /// include @@ -1372,6 +1474,11 @@ namespace BrewMonster.Scripts.Task { public ATaskTemplFixedData m_FixedData; + public bool is_in_zone(ZONE_VERT _min, ZONE_VERT _max, float[] pos) + { + return _min.less_than(pos) && _max.great_than(pos); + } + //Hierarchy public ATaskTempl m_pParent; public ATaskTempl m_pPrevSibling; diff --git a/Assets/Scripts/CECGameRun.cs b/Assets/Scripts/CECGameRun.cs index 40ecf6c3bc..fd2b78e848 100644 --- a/Assets/Scripts/CECGameRun.cs +++ b/Assets/Scripts/CECGameRun.cs @@ -306,8 +306,18 @@ public partial class CECGameRun return true; } - - + public int GetCurStageIndex() + { + // CECGameRun.unique_data* data = GetUniqueData(0); + // if (data) + // { + // if(data->type ==1) + // { + // return data->GetValueAsInt(); + // } + // } + return -1; + } // Get UI manager public CECUIManager GetUIManager() { diff --git a/Assets/Scripts/CECHostPlayer.cs b/Assets/Scripts/CECHostPlayer.cs index 01da1934b8..0e0f426904 100644 --- a/Assets/Scripts/CECHostPlayer.cs +++ b/Assets/Scripts/CECHostPlayer.cs @@ -139,6 +139,7 @@ namespace BrewMonster public EC_Inventory TaskInventory => m_taskInventory; public bool IsMeleeing() { return m_bMelee; } + public EC_Inventory GetTaskPack() { return m_taskInventory; } public EC_Inventory GetInventory(byte byPackage) { switch (byPackage) From ba94ec341686692fde320d98cd14319ade51fd0c Mon Sep 17 00:00:00 2001 From: MinhHai Date: Fri, 12 Dec 2025 15:46:38 +0700 Subject: [PATCH 10/25] add DlgTask into UI System --- .../Task/UI/{TaskWindow.prefab => DlgTask.prefab} | 8 ++++---- .../{TaskWindow.prefab.meta => DlgTask.prefab.meta} | 0 .../Resources/UI/DialogScriptTableObject.asset | 2 ++ Assets/PerfectWorld/Scene/TaskTest.unity | 4 ++-- Assets/PerfectWorld/Scripts/Task/TaskTest.cs | 12 ++++++++++-- 5 files changed, 18 insertions(+), 8 deletions(-) rename Assets/PerfectWorld/Prefab/Task/UI/{TaskWindow.prefab => DlgTask.prefab} (99%) rename Assets/PerfectWorld/Prefab/Task/UI/{TaskWindow.prefab.meta => DlgTask.prefab.meta} (100%) diff --git a/Assets/PerfectWorld/Prefab/Task/UI/TaskWindow.prefab b/Assets/PerfectWorld/Prefab/Task/UI/DlgTask.prefab similarity index 99% rename from Assets/PerfectWorld/Prefab/Task/UI/TaskWindow.prefab rename to Assets/PerfectWorld/Prefab/Task/UI/DlgTask.prefab index 9a7f272149..66ea57e014 100644 --- a/Assets/PerfectWorld/Prefab/Task/UI/TaskWindow.prefab +++ b/Assets/PerfectWorld/Prefab/Task/UI/DlgTask.prefab @@ -6483,8 +6483,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 7392889747821849613} m_HandleRect: {fileID: 2343337405992641122} m_Direction: 2 - m_Value: 1 - m_Size: 1 + m_Value: 0 + m_Size: 0.9999435 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -7244,7 +7244,7 @@ GameObject: - component: {fileID: 5506476487848131018} - component: {fileID: 125385901698294646} m_Layer: 5 - m_Name: TaskWindow + m_Name: DlgTask m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -8731,7 +8731,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8395333742829132721, guid: 9456de25596014039bd4d0d3927b709a, type: 3} propertyPath: m_AnchoredPosition.y - value: 336.93002 + value: 336.93 objectReference: {fileID: 0} - target: {fileID: 8395333742829132721, guid: 9456de25596014039bd4d0d3927b709a, type: 3} propertyPath: m_LocalEulerAnglesHint.x diff --git a/Assets/PerfectWorld/Prefab/Task/UI/TaskWindow.prefab.meta b/Assets/PerfectWorld/Prefab/Task/UI/DlgTask.prefab.meta similarity index 100% rename from Assets/PerfectWorld/Prefab/Task/UI/TaskWindow.prefab.meta rename to Assets/PerfectWorld/Prefab/Task/UI/DlgTask.prefab.meta diff --git a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset index 294dfb24bf..58a0cfb272 100644 --- a/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset +++ b/Assets/PerfectWorld/Resources/UI/DialogScriptTableObject.asset @@ -19,3 +19,5 @@ MonoBehaviour: prefab: {fileID: 8237288432181259026, guid: eaeb778b6aab3d74299373b3a96b72c4, type: 3} - id: Win_Award prefab: {fileID: 903595479696773158, guid: cf26d96ae7d984ba8a5b6cef44adffeb, type: 3} + - id: Win_Task + prefab: {fileID: 6999114045547682248, guid: 8027cada0ef5e4a9f827001b4747174d, type: 3} diff --git a/Assets/PerfectWorld/Scene/TaskTest.unity b/Assets/PerfectWorld/Scene/TaskTest.unity index 79f0527a85..408ffe954c 100644 --- a/Assets/PerfectWorld/Scene/TaskTest.unity +++ b/Assets/PerfectWorld/Scene/TaskTest.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:013ea9a5ad664a8ed7ae162ffb1f16e0da6571fb6660ad5b4f1736197f8e3fd4 -size 41531 +oid sha256:3c180e1658dbb5bd3b438f36770253ae8e04dff1d86b8b22e2bc279b683134d8 +size 10732 diff --git a/Assets/PerfectWorld/Scripts/Task/TaskTest.cs b/Assets/PerfectWorld/Scripts/Task/TaskTest.cs index b10a8dc566..264ec208ac 100644 --- a/Assets/PerfectWorld/Scripts/Task/TaskTest.cs +++ b/Assets/PerfectWorld/Scripts/Task/TaskTest.cs @@ -16,7 +16,6 @@ namespace BrewMonster.Scripts.Task { public class TaskTest : MonoSingleton { - public GameObject m_pTaskDlg; public static ATaskTemplMan m_pTaskMan; // use static to store loaded data across instances public bool WasLoadTaskData = false; @@ -34,7 +33,16 @@ namespace BrewMonster.Scripts.Task #if UNITY_EDITOR if (Input.GetKeyDown(KeyCode.Q)) { - m_pTaskDlg.SetActive(!m_pTaskDlg.activeInHierarchy); + var dlgTaskGO = CECUIManager.Instance.GetInGameUIMan().GetDialog("Win_Task"); + var dlgTask = (dlgTaskGO) as DlgTask; + if (dlgTask && !dlgTask.gameObject.activeInHierarchy) + { + dlgTask.Show(true); + } + else + { + dlgTask.Show(false); + } } if (Input.GetKeyDown(_awardkey)) From b4777baca394cc45d27c86be038f56257530a728 Mon Sep 17 00:00:00 2001 From: VungochaiC7 Date: Fri, 12 Dec 2025 16:42:48 +0700 Subject: [PATCH 11/25] Update Prefabs Inventory UI, add drag-and-drop equipment functionality. --- .../Scripts/Managers/EC_InventoryUI.cs | 674 +++++++++------ Assets/Prefabs/UI/InventoryUI.prefab | 784 +++++++++++++++++- 2 files changed, 1185 insertions(+), 273 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs index 70d4966f54..4107c5d1fb 100644 --- a/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs +++ b/Assets/PerfectWorld/Scripts/Managers/EC_InventoryUI.cs @@ -1,16 +1,17 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; -using System.Reflection; -using System.Text; -using CSNetwork.GPDataType; -using BrewMonster.Network; using BrewMonster; using BrewMonster.Common; +using BrewMonster.Network; +using BrewMonster.Scripts; +using CSNetwork.GPDataType; using ModelRenderer.Scripts.GameData; using PerfectWorld.Scripts.Managers; -using BrewMonster.Scripts; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; namespace BrewMonster.Scripts.Managers { @@ -23,7 +24,7 @@ namespace BrewMonster.Scripts.Managers [Header("Detail Panel (assign in Inspector)")] [SerializeField] private GameObject detailPanelRoot; - [SerializeField] private Vector2 detailPanelOffset = new Vector2(20f, 0f); + [SerializeField] private Vector2 detailPanelOffset = new Vector2(20f, 0f); [SerializeField] private bool hideDetailOnStart = true; [SerializeField] private TextOutlet nameText; [SerializeField] private TextOutlet descriptionText; @@ -35,35 +36,41 @@ namespace BrewMonster.Scripts.Managers [SerializeField] private bool autoRefresh = true; [SerializeField] private float refreshInterval = 1.0f; [SerializeField] private bool showEquipmentDetails = true; - - [Header("Money UI (assign any text fields to mirror money amount)")] - [SerializeField] private List moneyTextsLegacy = new List(); - [SerializeField] private List moneyTextsTMP = new List(); - - [Header("Cash UI (assign any text fields to mirror cash amount)")] - [SerializeField] private List cashTextsLegacy = new List(); - [SerializeField] private List cashTextsTMP = new List(); + + [Header("Money UI (assign any text fields to mirror money amount)")] + [SerializeField] private List moneyTextsLegacy = new List(); + [SerializeField] private List moneyTextsTMP = new List(); + + [Header("Cash UI (assign any text fields to mirror cash amount)")] + [SerializeField] private List cashTextsLegacy = new List(); + [SerializeField] private List cashTextsTMP = new List(); private float lastRefreshTime; - // Pending currency cache for when UI is not yet active - private static bool s_hasPendingMoney; - private static ulong s_pendingMoneyAmount; - private static ulong s_pendingMoneyMaxAmount; - private static bool s_hasPendingCash; - private static int s_pendingCashAmount; + // Pending currency cache for when UI is not yet active + private static bool s_hasPendingMoney; + private static ulong s_pendingMoneyAmount; + private static ulong s_pendingMoneyMaxAmount; + private static bool s_hasPendingCash; + private static int s_pendingCashAmount; - // Flags to prevent log spam for extended description warnings - // 防止扩展描述警告日志刷屏的标志 - private static bool m_HasLoggedExtDescNull = false; - private static bool m_HasLoggedExtDescNotInit = false; - private static bool m_HasLoggedExtDescError = false; + // Flags to prevent log spam for extended description warnings + // 防止扩展描述警告日志刷屏的标志 + private static bool m_HasLoggedExtDescNull = false; + private static bool m_HasLoggedExtDescNotInit = false; + private static bool m_HasLoggedExtDescError = false; private InventoryModel model; private InventoryView view; - + + // Drag-and-drop state + private int draggedItemSourceSlot = -1; + private byte draggedItemSourcePackage = 0; + [SerializeField] private Image currentDragImage; + private bool isDragging = false; + // === Text Formatting Methods === - + /// /// Format text for TextMeshPro components with rich text support /// @@ -73,7 +80,7 @@ namespace BrewMonster.Scripts.Managers { return EC_Utility.FormatForTextMeshPro(text); } - + // Current selected item for equip/unequip operations private byte currentSelectedPackage; private int currentSelectedSlot; @@ -88,6 +95,20 @@ namespace BrewMonster.Scripts.Managers { model = new InventoryModel(); view = new InventoryView(); + + if (currentDragImage == null) + { + var canvas = GetComponentInParent(); + if (canvas == null) + { + canvas = FindAnyObjectByType(); + } + var go = new GameObject("DragImage", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image)); + go.transform.SetParent(canvas.transform, false); + currentDragImage = go.GetComponent(); + currentDragImage.raycastTarget = false; + currentDragImage.gameObject.SetActive(false); + } } private void Start() @@ -97,15 +118,15 @@ namespace BrewMonster.Scripts.Managers { ShowDetailPanel(false); } - // Apply any pending currency values captured before the UI became active - ApplyPendingCurrency(); + // Apply any pending currency values captured before the UI became active + ApplyPendingCurrency(); } - private void OnEnable() - { - // Ensure cached values are pushed when the UI is enabled - ApplyPendingCurrency(); - } + private void OnEnable() + { + // Ensure cached values are pushed when the UI is enabled + ApplyPendingCurrency(); + } private void Update() { @@ -128,109 +149,109 @@ namespace BrewMonster.Scripts.Managers view.RenderPackage(fashionPackButtons, fshItems, PKG_FASHION, OnInventoryButtonClicked, GetDisplayTextForItem); } - /// - /// Update all configured money text components with the current amount. - /// Call this when GET_OWN_MONEY arrives. - /// - public void UpdateMoney(ulong amount, ulong maxAmount) - { - string text = amount.ToString(); - if (moneyTextsLegacy != null) - { - for (int i = 0; i < moneyTextsLegacy.Count; i++) - { - var t = moneyTextsLegacy[i]; - if (t != null) t.text = text; - } - } - if (moneyTextsTMP != null) - { - for (int i = 0; i < moneyTextsTMP.Count; i++) - { - var t = moneyTextsTMP[i]; - if (t != null) t.text = text; - } - } - } - - /// - /// Update all configured cash text components with the current boutique cash amount. - /// Call this when PLAYER_CASH arrives. - /// - public void UpdateCash(int amount) - { - string text = amount.ToString(); - if (cashTextsLegacy != null) - { - for (int i = 0; i < cashTextsLegacy.Count; i++) - { - var t = cashTextsLegacy[i]; - if (t != null) t.text = text; - } - } - if (cashTextsTMP != null) - { - for (int i = 0; i < cashTextsTMP.Count; i++) - { - var t = cashTextsTMP[i]; - if (t != null) t.text = text; - } - } - } + /// + /// Update all configured money text components with the current amount. + /// Call this when GET_OWN_MONEY arrives. + /// + public void UpdateMoney(ulong amount, ulong maxAmount) + { + string text = amount.ToString(); + if (moneyTextsLegacy != null) + { + for (int i = 0; i < moneyTextsLegacy.Count; i++) + { + var t = moneyTextsLegacy[i]; + if (t != null) t.text = text; + } + } + if (moneyTextsTMP != null) + { + for (int i = 0; i < moneyTextsTMP.Count; i++) + { + var t = moneyTextsTMP[i]; + if (t != null) t.text = text; + } + } + } - // Public static entry points to cache values when UI is unavailable - public static void CacheMoney(ulong amount, ulong maxAmount) - { - s_pendingMoneyAmount = amount; - s_pendingMoneyMaxAmount = maxAmount; - s_hasPendingMoney = true; - // If an instance exists (even inactive), push immediately so the value is ready - var all = Resources.FindObjectsOfTypeAll(); - if (all != null) - { - for (int i = 0; i < all.Length; i++) - { - var ui = all[i]; - if (ui != null && ui.gameObject.scene.IsValid()) - { - ui.ApplyPendingCurrency(); - break; - } - } - } - } + /// + /// Update all configured cash text components with the current boutique cash amount. + /// Call this when PLAYER_CASH arrives. + /// + public void UpdateCash(int amount) + { + string text = amount.ToString(); + if (cashTextsLegacy != null) + { + for (int i = 0; i < cashTextsLegacy.Count; i++) + { + var t = cashTextsLegacy[i]; + if (t != null) t.text = text; + } + } + if (cashTextsTMP != null) + { + for (int i = 0; i < cashTextsTMP.Count; i++) + { + var t = cashTextsTMP[i]; + if (t != null) t.text = text; + } + } + } - public static void CacheCash(int amount) - { - s_pendingCashAmount = amount; - s_hasPendingCash = true; - // If an instance exists (even inactive), push immediately so the value is ready - var all = Resources.FindObjectsOfTypeAll(); - if (all != null) - { - for (int i = 0; i < all.Length; i++) - { - var ui = all[i]; - if (ui != null && ui.gameObject.scene.IsValid()) - { - ui.ApplyPendingCurrency(); - break; - } - } - } - } + // Public static entry points to cache values when UI is unavailable + public static void CacheMoney(ulong amount, ulong maxAmount) + { + s_pendingMoneyAmount = amount; + s_pendingMoneyMaxAmount = maxAmount; + s_hasPendingMoney = true; + // If an instance exists (even inactive), push immediately so the value is ready + var all = Resources.FindObjectsOfTypeAll(); + if (all != null) + { + for (int i = 0; i < all.Length; i++) + { + var ui = all[i]; + if (ui != null && ui.gameObject.scene.IsValid()) + { + ui.ApplyPendingCurrency(); + break; + } + } + } + } - private void ApplyPendingCurrency() - { - if (s_hasPendingMoney) - { - UpdateMoney(s_pendingMoneyAmount, s_pendingMoneyMaxAmount); - } - if (s_hasPendingCash) - { - UpdateCash(s_pendingCashAmount); - } - } + public static void CacheCash(int amount) + { + s_pendingCashAmount = amount; + s_hasPendingCash = true; + // If an instance exists (even inactive), push immediately so the value is ready + var all = Resources.FindObjectsOfTypeAll(); + if (all != null) + { + for (int i = 0; i < all.Length; i++) + { + var ui = all[i]; + if (ui != null && ui.gameObject.scene.IsValid()) + { + ui.ApplyPendingCurrency(); + break; + } + } + } + } + + private void ApplyPendingCurrency() + { + if (s_hasPendingMoney) + { + UpdateMoney(s_pendingMoneyAmount, s_pendingMoneyMaxAmount); + } + if (s_hasPendingCash) + { + UpdateCash(s_pendingCashAmount); + } + } private void OnInventoryButtonClicked(byte package, int slot) { @@ -242,13 +263,13 @@ namespace BrewMonster.Scripts.Managers currentSelectedPackage = package; currentSelectedSlot = slot; currentSelectedItem = itemData; - + // Create equipment object if this is equipment currentSelectedEquipment = CreateEquipmentFromItemData(itemData); - // Position detail panel near the clicked item button - PositionDetailPanelNearButton(package, slot); - + // Position detail panel near the clicked item button + PositionDetailPanelNearButton(package, slot); + FillDetailPanel(package, itemData); } else @@ -266,19 +287,19 @@ namespace BrewMonster.Scripts.Managers return null; var equipment = new EC_IvtrEquip(itemData.m_tid, itemData.m_expire_date); - + // Set basic properties (use default values since InventoryItemData doesn't have these) equipment.Price = 0; equipment.Count = itemData.m_iCount; equipment.PriceScale = 1.0f; equipment.ScaleType = 0; - + // Parse item info if available (use Content field) if (itemData.Content != null && itemData.Content.Length > 0) { equipment.SetItemInfo(itemData.Content, itemData.Content.Length); } - + return equipment; } @@ -418,7 +439,7 @@ namespace BrewMonster.Scripts.Managers // Call RequestDropIvrtItem with slot index and amount UnityGameSession.RequestDropIvrtItem((byte)currentSelectedSlot, 1); Debug.Log($"[InventoryUI] Drop request sent for inventory item {currentSelectedItem.m_tid} from slot {currentSelectedSlot} with amount {currentSelectedItem.m_iCount}"); - + // Refresh inventory after drop RefreshAll(); } @@ -430,12 +451,12 @@ namespace BrewMonster.Scripts.Managers // Call RequestDropEquipItem with slot index UnityGameSession.RequestDropEquipItem((byte)currentSelectedSlot); Debug.Log($"[InventoryUI] Drop request sent for equipment item {currentSelectedItem.m_tid} from slot {currentSelectedSlot}"); - + // Refresh inventory after drop RefreshAll(); } - + private int FindEmptyInventorySlot() { var inventoryData = model.GetInventoryData(PKG_INVENTORY); @@ -451,7 +472,7 @@ namespace BrewMonster.Scripts.Managers } return -1; } - + /// /// Get item description from string table /// @@ -490,10 +511,10 @@ namespace BrewMonster.Scripts.Managers { Debug.LogWarning($"[InventoryUI] Error getting item description for ID {templateId}: {ex.Message}"); } - + return null; } - + /// /// Get extended item description from string table /// @@ -532,10 +553,10 @@ namespace BrewMonster.Scripts.Managers { Debug.LogWarning($"[InventoryUI] Error getting extended item description for ID {templateId}: {ex.Message}"); } - + return null; } - + /// /// Get user-friendly text for item state /// @@ -602,7 +623,7 @@ namespace BrewMonster.Scripts.Managers bool hasItem = items != null && items.TryGetValue(slot, out itemData); button.onClick.RemoveAllListeners(); int capturedSlot = slot; - button.onClick.AddListener(() => onClick(package, capturedSlot)); + button.onClick.AddListener(() => onClick(package, capturedSlot)); // Optional visual tweaks based on state/count var image = button.GetComponent(); if (image != null) @@ -627,6 +648,24 @@ namespace BrewMonster.Scripts.Managers image.enabled = true; } } + + var eventTrigger = button.GetComponent(); + if (eventTrigger == null) + eventTrigger = button.gameObject.AddComponent(); + + eventTrigger.triggers.Clear(); + + void AddEvent(EventTriggerType type, UnityEngine.Events.UnityAction action) + { + var entry = new EventTrigger.Entry { eventID = type }; + entry.callback.AddListener(action); + eventTrigger.triggers.Add(entry); + } + + AddEvent(EventTriggerType.BeginDrag, (data) => ((EC_InventoryUI)button.GetComponentInParent()).OnBeginDrag((PointerEventData)data)); + AddEvent(EventTriggerType.Drag, (data) => ((EC_InventoryUI)button.GetComponentInParent()).OnDrag((PointerEventData)data)); + AddEvent(EventTriggerType.EndDrag, (data) => ((EC_InventoryUI)button.GetComponentInParent()).OnEndDrag((PointerEventData)data)); + AddEvent(EventTriggerType.Drop, (data) => ((EC_InventoryUI)button.GetComponentInParent()).OnDrop((PointerEventData)data)); } } } @@ -649,7 +688,7 @@ namespace BrewMonster.Scripts.Managers tmp.text = FormatForTextMeshPro(value ?? string.Empty); } } - + /// /// Set text with explicit formatting preference /// @@ -657,10 +696,10 @@ namespace BrewMonster.Scripts.Managers /// Whether to prefer TextMeshPro formatting public void SetFormatted(string value, bool preferTextMeshPro = true) { - string formattedText = preferTextMeshPro ? - FormatForTextMeshPro(value ?? string.Empty) : + string formattedText = preferTextMeshPro ? + FormatForTextMeshPro(value ?? string.Empty) : EC_Utility.FormatForLegacyText(value ?? string.Empty); - + if (legacy != null) { legacy.text = formattedText; @@ -675,7 +714,7 @@ namespace BrewMonster.Scripts.Managers public void RefreshLayout(GameObject gameObject) { var parent = gameObject.GetComponent(); - + // Force Unity to rebuild layout immediately parent.ForceUpdateRectTransforms(); LayoutRebuilder.ForceRebuildLayoutImmediate(parent); @@ -689,115 +728,115 @@ namespace BrewMonster.Scripts.Managers } } - private Button GetButtonForSlot(byte package, int slot) - { - List