Merge branch 'develop' of https://git.pthub.vn/Unity/perfect-world-unity into develop
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1611,19 +1611,5 @@ public static class generate_item_temp
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static void PrintData(byte[] buf, int offset, int size)
|
||||
{
|
||||
for(int i = offset; i < offset + size; i++)
|
||||
{
|
||||
BMLogger.Log("[thn]PrintData: buf[" + i + "]: " + buf[i]);
|
||||
}
|
||||
}
|
||||
private static void PrintPreData(byte[] buf, int offset, int size)
|
||||
{
|
||||
for(int i = offset-1; i >= offset - size; i--)
|
||||
{
|
||||
BMLogger.Log("[thn]PrintPreData: buf[" + i + "]: " + buf[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -505,7 +505,6 @@ namespace BrewMonster
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
//Debug.Log("[THN]return_item_for_sell: ret:" + ret + " size:" + size + " datatype:" + datatype + " id:" + id);
|
||||
if (ret == 0 && size != 0)
|
||||
{
|
||||
sale_item_ptr_array.Add(item);
|
||||
|
||||
@@ -1312,14 +1312,14 @@ namespace BrewMonster.Scripts
|
||||
{
|
||||
if (CECUIManager.Instance != null)
|
||||
{
|
||||
string message = $"Please deactive the fly mode to start the path finding.";
|
||||
// string message = $"Please deactive the fly mode to start the path finding.";
|
||||
|
||||
CECUIManager.Instance.ShowMessageBox(
|
||||
"Fly Mode", // 飞行模式
|
||||
message, // 消息
|
||||
BrewMonster.MessageBoxType.YesButton
|
||||
);
|
||||
Finish();
|
||||
// CECUIManager.Instance.ShowMessageBox(
|
||||
// "Fly Mode", // 飞行模式
|
||||
// message, // 消息
|
||||
// BrewMonster.MessageBoxType.YesButton
|
||||
// );
|
||||
// Finish();
|
||||
//return;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -212,9 +212,18 @@ namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
info_player_1 info_Player_1 = GPDataTypeHelper.FromBytes<info_player_1>((byte[])Msg.dwParam1);
|
||||
EC_ElsePlayer pPlayer = ElsePlayerEnter(info_Player_1, commandID);
|
||||
if (pPlayer != null && !pPlayer.m_bBaseInfoReady)
|
||||
if (pPlayer != null)
|
||||
{
|
||||
UnityGameSession.GetRoleBaseInfo(1, new List<int> { info_Player_1.cid });
|
||||
if (!pPlayer.m_bBaseInfoReady)
|
||||
{
|
||||
UnityGameSession.GetRoleBaseInfo(1, new List<int> { info_Player_1.cid });
|
||||
}
|
||||
|
||||
//Is equipment data ready
|
||||
if (!pPlayer.IsEquipDataReady())
|
||||
{
|
||||
UnityGameSession.c2s_CmdGetOtherEquip(1, new List<int> { info_Player_1.cid });
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -370,7 +379,7 @@ namespace PerfectWorld.Scripts.Managers
|
||||
UnityGameSession.GetRoleBaseInfo(a2.Count, a2);
|
||||
|
||||
if (a1.Count > 0)
|
||||
UnityGameSession.GetRoleEquipData(a1.Count, a1);
|
||||
UnityGameSession.c2s_CmdGetOtherEquip(a1.Count, a1);
|
||||
|
||||
// Only get custom data
|
||||
if (a3.Count > 0)
|
||||
@@ -623,6 +632,7 @@ namespace PerfectWorld.Scripts.Managers
|
||||
|
||||
switch (Msg.dwMsg)
|
||||
{
|
||||
|
||||
case EC_MsgDef.MSG_PM_PLAYEREQUIPDATA:
|
||||
var param2 = Convert.ToInt32(Msg.dwParam2);
|
||||
if (param2 == CommandID.EQUIP_DATA)
|
||||
@@ -639,7 +649,7 @@ namespace PerfectWorld.Scripts.Managers
|
||||
Array.Copy((byte[])Msg.dwParam1, 2, buffer, 0, 4);
|
||||
cid = BitConverter.ToInt32(buffer, 0);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case EC_MsgDef.MSG_PM_PLAYERBASEINFO:
|
||||
@@ -648,17 +658,17 @@ namespace PerfectWorld.Scripts.Managers
|
||||
UnityGameSession.Instance.GetC2SCmdCache().RemovePlayerBaseInfo(cid);
|
||||
break;
|
||||
|
||||
/*case long value when value == EC_MsgDef.MSG_PM_PLAYERCUSTOM:
|
||||
cid = ((GetCustomData_Re)msg.dwParam1).cus_roleid;
|
||||
break;
|
||||
//case long value when value == EC_MsgDef.MSG_PM_PLAYERCUSTOM:
|
||||
// cid = ((GetCustomData_Re)msg.dwParam1).cus_roleid;
|
||||
// break;
|
||||
|
||||
case long value when value == EC_MsgDef.MSG_PM_PLAYERFLY:
|
||||
if (msg.dwParam2 == S2C.OBJECT_TAKEOFF)
|
||||
cid = ((cmd_object_takeoff)msg.dwParam1).object_id;
|
||||
if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_TAKEOFF)
|
||||
cid = (GPDataTypeHelper.FromBytes<cmd_object_takeoff>((byte[])Msg.dwParam1)).object_id;
|
||||
else
|
||||
cid = ((cmd_object_landing)msg.dwParam1).object_id;
|
||||
break;*/
|
||||
case EC_MsgDef.MSG_PM_PLAYERATKRESULT:
|
||||
cid = (GPDataTypeHelper.FromBytes<cmd_object_landing>((byte[])Msg.dwParam1)).object_id;
|
||||
break;
|
||||
case long value when value == EC_MsgDef.MSG_PM_PLAYERATKRESULT:
|
||||
cmd_object_atk_result pCmdAtk = GPDataTypeHelper.FromBytes<cmd_object_atk_result>((byte[])Msg.dwParam1);
|
||||
cid = pCmdAtk.attacker_id;
|
||||
break;
|
||||
|
||||
@@ -19,6 +19,7 @@ using CSNetwork;
|
||||
using ModelRenderer.Scripts.Common;
|
||||
using Unity.VisualScripting;
|
||||
using DG.Tweening.Plugins;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
@@ -2925,6 +2926,72 @@ namespace BrewMonster
|
||||
}
|
||||
m_pActionController.Bind(this, m_pPlayerCECModel);
|
||||
}
|
||||
|
||||
protected bool ShouldUseModel()
|
||||
{
|
||||
if (!IsElsePlayer()){
|
||||
return true;
|
||||
}
|
||||
bool result = (true);
|
||||
//switch (m_iMemUsage){
|
||||
//case CECMemSimplify::MEMUSAGE_NOMODEL:
|
||||
// result = g_pGame->GetGameRun()->GetMemSimplify()->IsMostImportant(this);
|
||||
// break;
|
||||
//case CECMemSimplify::MEMUSAGE_NOMODEL_UNIMPORTANT:
|
||||
// result = g_pGame->GetGameRun()->GetMemSimplify()->IsImportant(this);
|
||||
// break;
|
||||
//}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected bool LoadPlayerSkeleton(bool bAtOnce)
|
||||
{
|
||||
EC_PLAYERLOADRESULT Ret = default;
|
||||
if (bAtOnce /*|| !IsLoadThreadReady()*/)
|
||||
{
|
||||
// Under normal circumstances, only HostPlayer can reach here
|
||||
/* if (!LoadPlayerModel(m_iProfession, m_iGender, m_CustomizeData.bodyID, aEquips, szPetPath, Ret, false, false))
|
||||
{
|
||||
a_LogOutput(1, "CECPlayer::Init, failed to call LoadPlayerModel() !");
|
||||
return false;
|
||||
}*/
|
||||
|
||||
SetPlayerLoadedResult(Ret);
|
||||
|
||||
/* if (IsShapeChanged() && !QueueLoadDummyModel(m_iShape, true))
|
||||
{
|
||||
// ignore the dummy model loading failure
|
||||
a_LogOutput(1, "CECPlayer::Init, failed to call QueueLoadDummyModel() !");
|
||||
}*/
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected bool SetPlayerLoadedResult(EC_PLAYERLOADRESULT ret)
|
||||
{
|
||||
OnAllResourceReady();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void OnAllResourceReady()
|
||||
{
|
||||
CECHostSkillModel.Instance.Initialize();
|
||||
}
|
||||
|
||||
// Is resources ready ?
|
||||
protected bool IsSkeletonReady() { return (m_dwResFlags & (uint)PlayerResourcesReadyFlag.RESFG_SKELETON) != 0 ? true : false; }
|
||||
|
||||
// Set resources ready flag
|
||||
protected void SetResReadyFlag(uint dwFlag, bool bSet)
|
||||
{
|
||||
if (bSet)
|
||||
{
|
||||
m_dwResFlags |= dwFlag;
|
||||
}
|
||||
else
|
||||
m_dwResFlags &= ~dwFlag;
|
||||
}
|
||||
}
|
||||
|
||||
public struct PlayActionEvent
|
||||
|
||||
@@ -1645,6 +1645,13 @@ namespace CSNetwork.S2CCommand
|
||||
{
|
||||
public int iPetIdx;
|
||||
};
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct cmd_get_other_equip
|
||||
{
|
||||
public ushort size;
|
||||
public int[] idlist;
|
||||
};
|
||||
}
|
||||
|
||||
// Player and NPC state
|
||||
@@ -1132,5 +1132,15 @@ namespace CSNetwork.C2SCommand
|
||||
};
|
||||
return SerializeCommand(CommandID.SEVNPC_SERVE, cmd, content);
|
||||
}
|
||||
|
||||
public static Octets CreateGetOtherEquipCmd(ushort _size, int[] _idlist)
|
||||
{
|
||||
var cmd = new cmd_get_other_equip
|
||||
{
|
||||
size = _size,
|
||||
idlist = _idlist
|
||||
};
|
||||
return SerializeCommand(CommandID.GET_OTHER_EQUIP, cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0c06c588e2a6442488a3542551fb243
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -766,24 +766,51 @@ namespace CSNetwork.GPDataType
|
||||
public int idPlayer;
|
||||
public long mask_add;
|
||||
public long mask_del;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
|
||||
public int[] data_add; //0 ~ 29
|
||||
|
||||
public bool CheckValid(uint buf_size, uint sz)
|
||||
|
||||
public static cmd_equip_data_changed FromBytes(byte[] buffer)
|
||||
{
|
||||
// sz = sizeof(*this) - sizeof(data_add);
|
||||
cmd_equip_data_changed cmd = new cmd_equip_data_changed();
|
||||
|
||||
if (buffer.Length > 0)
|
||||
{
|
||||
byte[] tempBuf = new byte[2];
|
||||
Array.Copy(buffer, 0, tempBuf, 0, 2);
|
||||
cmd.crc = BitConverter.ToUInt16(tempBuf, 0);
|
||||
tempBuf = new byte[4];
|
||||
Array.Copy(buffer, 2, tempBuf, 0, 4);
|
||||
cmd.idPlayer = BitConverter.ToInt32(tempBuf, 0);
|
||||
tempBuf = new byte[8];
|
||||
Array.Copy(buffer, 6, tempBuf, 0, 8);
|
||||
cmd.mask_add = BitConverter.ToInt64(tempBuf, 0);
|
||||
tempBuf = new byte[8];
|
||||
Array.Copy(buffer, 14, tempBuf, 0, 8);
|
||||
cmd.mask_del = BitConverter.ToInt64(tempBuf, 0);
|
||||
|
||||
// if (buf_size < sz)
|
||||
// return false;
|
||||
// calculate the size of the data_add array base on the bits in the mask_add
|
||||
int sz = 0;
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
if ((cmd.mask_add & (1L << i)) != 0)
|
||||
sz += 4;
|
||||
}
|
||||
|
||||
// for (int i = 0; i < 32; i++)
|
||||
// {
|
||||
// if (mask_add & (1 << i))
|
||||
// sz += sizeof(int);
|
||||
// }
|
||||
if (buffer.Length < sz)
|
||||
{
|
||||
cmd.crc = ushort.MaxValue;
|
||||
return cmd;
|
||||
}
|
||||
|
||||
|
||||
cmd.data_add = new int[sz / 4];
|
||||
for (int i = 0; i < cmd.data_add.Length; i++)
|
||||
{
|
||||
Array.Copy(buffer, 22 + i * 4, tempBuf, 0, 4);
|
||||
cmd.data_add[i] = BitConverter.ToInt32(tempBuf, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// return buf_size >= sz;
|
||||
return true;
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1212,8 +1212,6 @@ namespace CSNetwork
|
||||
// Post MSG_HST_PRODUCEITEM message with command ID as parameter (matches C++ behavior)
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_PRODUCEITEM, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
|
||||
|
||||
case CommandID.LEARN_SKILL:
|
||||
BMLogger.LogError("### GameDataSend: LEARN_SKILL");
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_LEARNSKILL, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf, pCmdHeader);
|
||||
@@ -1878,7 +1876,6 @@ namespace CSNetwork
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void c2s_SendCmdGetOtherEquip(int iNumID, List<int> aIDs)
|
||||
{
|
||||
// using namespace C2S;
|
||||
|
||||
@@ -655,7 +655,7 @@ namespace BrewMonster.Network
|
||||
Instance._gameSession.GetRoleBaseInfo(iNumRole, aRoleIDs);
|
||||
}
|
||||
|
||||
public static void GetRoleEquipData(int iNumRole, List<int> aRoleIDs)
|
||||
public static void c2s_CmdGetOtherEquip(int iNumRole, List<int> aRoleIDs)
|
||||
{
|
||||
Instance._gameSession.c2s_SendCmdGetOtherEquip(iNumRole, aRoleIDs);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ using Cysharp.Threading.Tasks;
|
||||
using PerfectWorld.Scripts;
|
||||
using PerfectWorld.Scripts.Managers;
|
||||
using UnityEngine;
|
||||
using BrewMonster.Scripts.Managers;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BrewMonster
|
||||
@@ -32,12 +33,12 @@ namespace BrewMonster
|
||||
public A3DVECTOR3 m_vServerPos; // Player's real position on server
|
||||
A3DVECTOR3 m_vStopDir; // The direction when player stop moving
|
||||
// 是否是依附者 = Is it a dependent/attacher?
|
||||
bool m_bHangerOn;
|
||||
//bool m_bHangerOn;
|
||||
// 依附者或被依附者id = The ID of the attacher (dependent) or the attached target.
|
||||
int m_iBuddyId;
|
||||
//int m_iBuddyId;
|
||||
bool m_bStopMove; // Stop move flag
|
||||
public const float MAX_LAGDIST = 10.0f; // Maximum lag distance
|
||||
A3DVECTOR3 g_vAxisY = new A3DVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
//A3DVECTOR3 g_vAxisY = new A3DVECTOR3(0.0f, 1.0f, 0.0f);
|
||||
long m_dwLastMoveTime = 0; // Last move command arrived time
|
||||
float m_fMoveSpeed; // Move speed
|
||||
OtherPlayer_Move_Info m_cdr = new OtherPlayer_Move_Info();
|
||||
@@ -47,10 +48,11 @@ namespace BrewMonster
|
||||
public CECCounter m_FightCnt;
|
||||
CECEPWorkMan m_pEPWorkMan;
|
||||
private CECEPWork _workStand;
|
||||
bool m_bLoadingModel = false; // Model loading flag
|
||||
bool m_bUseHintModel = false; // true, use hint model
|
||||
long m_i64NewEqpMask; // New equipment mask
|
||||
int[] m_aNewEquips = new int[InventoryConst.SIZE_ALL_EQUIPIVTR]; // New equipment item ID array
|
||||
CECHostPlayer pHost => EC_ManMessageMono.Instance?.GetECManPlayer?.GetHostPlayer();
|
||||
|
||||
public int[] m_aNewEquips = new int[InventoryConst.SIZE_ALL_EQUIPIVTR]; // New equipment item ID array
|
||||
public long m_i64NewEqpMask; // New equipment mask
|
||||
|
||||
public void Init(info_player_1 Info, int iAppearFlag)
|
||||
{
|
||||
@@ -326,13 +328,13 @@ namespace BrewMonster
|
||||
A3DVECTOR3 vDelta = m_cdr.t * m_cdr.vVelocity;
|
||||
m_cdr.vCenter += vDelta;
|
||||
|
||||
m_cdr.vecGroundNormal = g_vAxisY;
|
||||
m_cdr.vecGroundNormal = EC_Utility.ToA3DVECTOR3(g_vAxisY);
|
||||
if (m_cdr.bTraceGround)
|
||||
SetGroundNormal(m_cdr.vecGroundNormal);
|
||||
else
|
||||
SetGroundNormal(g_vAxisY);
|
||||
SetGroundNormal(EC_Utility.ToA3DVECTOR3(g_vAxisY));
|
||||
|
||||
return m_cdr.vCenter - g_vAxisY * m_cdr.vExts.y;
|
||||
return m_cdr.vCenter - EC_Utility.ToA3DVECTOR3(g_vAxisY) * m_cdr.vExts.y;
|
||||
}
|
||||
|
||||
void OtherPlayerMove(OtherPlayer_Move_Info OPMoveInfo)
|
||||
@@ -340,7 +342,7 @@ namespace BrewMonster
|
||||
A3DVECTOR3 vDelta = OPMoveInfo.t * OPMoveInfo.vVelocity;
|
||||
OPMoveInfo.vCenter += vDelta;
|
||||
|
||||
OPMoveInfo.vecGroundNormal = g_vAxisY;
|
||||
OPMoveInfo.vecGroundNormal = EC_Utility.ToA3DVECTOR3(g_vAxisY);
|
||||
A3DVECTOR3 vGroundPos, vNormal;
|
||||
|
||||
// Now, we directly interpolate the pos, and we don't use bTraceGround
|
||||
@@ -392,6 +394,20 @@ namespace BrewMonster
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
//bool bSelected = pHost.GetSelectedTarget() == GetPlayerInfo().cid;
|
||||
//if (!m_pPlayerModel && !m_bLoadingModel && IsBaseInfoReady() && IsCustomDataReady() && IsEquipDataReady())
|
||||
//{
|
||||
// if ((!m_bUseHintModel && m_iBoothState != 2) || bSelected)
|
||||
// {
|
||||
// // prepared equip info
|
||||
// //memcpy(m_aEquips, m_aNewEquips, sizeof(m_aEquips));
|
||||
// if (ShouldUseModel())
|
||||
// LoadPlayerSkeleton(false);
|
||||
// m_bLoadingModel = true;
|
||||
// }
|
||||
//}
|
||||
|
||||
MovingTo(Time.deltaTime);
|
||||
|
||||
if (pHost != null /*&& pHost.IsSkeletonReady()*/)
|
||||
@@ -432,6 +448,7 @@ namespace BrewMonster
|
||||
{
|
||||
switch (Msg.dwMsg)
|
||||
{
|
||||
case EC_MsgDef.MSG_PM_PLAYERFLY: OnMsgPlayerFly(Msg); break;
|
||||
case EC_MsgDef.MSG_PM_PLAYERBASEINFO: OnMsgPlayerBaseInfo(Msg); break;
|
||||
case EC_MsgDef.MSG_PM_PLAYEREQUIPDATA: OnMsgPlayerEquipData(Msg); break;
|
||||
case EC_MsgDef.MSG_PM_PLAYERATKRESULT: OnMsgPlayerAtkResult(Msg); break;
|
||||
@@ -499,17 +516,16 @@ namespace BrewMonster
|
||||
iDelMask = 0;
|
||||
aAdded = pCmd.data;
|
||||
}
|
||||
// else // Msg.dwParam2 == EQUIP_DATA_CHANGED
|
||||
// {
|
||||
// cmd_equip_data_changed* pCmd = (cmd_equip_data_changed*)Msg.dwParam1;
|
||||
// ASSERT(pCmd);
|
||||
else // Msg.dwParam2 == EQUIP_DATA_CHANGED
|
||||
{
|
||||
cmd_equip_data_changed pCmd = cmd_equip_data_changed.FromBytes((byte[])Msg.dwParam1);
|
||||
|
||||
// bReset = false;
|
||||
// crc = pCmd->crc;
|
||||
// iAddMask = pCmd->mask_add;
|
||||
// iDelMask = pCmd->mask_del;
|
||||
// aAdded = iAddMask ? pCmd->data_add : NULL;
|
||||
// }
|
||||
bReset = false;
|
||||
crc = pCmd.crc;
|
||||
iAddMask = pCmd.mask_add;
|
||||
iDelMask = pCmd.mask_del;
|
||||
aAdded = pCmd.data_add;
|
||||
}
|
||||
|
||||
// // Change equipment
|
||||
ChangeEquipments(bReset, crc, iAddMask, iDelMask, aAdded);
|
||||
@@ -798,7 +814,7 @@ namespace BrewMonster
|
||||
public void LevelUp()
|
||||
{
|
||||
// if (m_pLevelUpGFX)
|
||||
// m_pLevelUpGFX->Start(true);
|
||||
// m_pLevelUpGFX.Start(true);
|
||||
//
|
||||
PlayGfx(EC_Resource.res_GFXFile((int)GfxResourceType.RES_GFX_LEVELUP), null, 1f,1);//PLAYERMODEL_TYPEALL
|
||||
}
|
||||
@@ -818,9 +834,9 @@ namespace BrewMonster
|
||||
|
||||
// if( m_iBuddyId )
|
||||
// {
|
||||
// CECPlayer pBuddy = m_pPlayerMan->GetPlayer(m_iBuddyId);
|
||||
// CECPlayer pBuddy = m_pPlayerMan.GetPlayer(m_iBuddyId);
|
||||
// if (pBuddy)
|
||||
// pBuddy->DoEmote(pCmd->emotion);
|
||||
// pBuddy.DoEmote(pCmd.emotion);
|
||||
// }
|
||||
}
|
||||
else if (cmd == CommandID.OBJECT_EMOTE_RESTORE)
|
||||
@@ -899,11 +915,11 @@ namespace BrewMonster
|
||||
if (cmd == CommandID.PLAYER_GATHER_START)
|
||||
{
|
||||
cmd_player_gather_start pCmd =GPDataTypeHelper.FromBytes<cmd_player_gather_start>((byte[])Msg.dwParam1);
|
||||
EC_ManMatter pMatterMan = EC_ManMessageMono.Instance.GetECManMatter;//g_pGame->GetGameRun()->GetWorld()->GetMatterMan();
|
||||
EC_ManMatter pMatterMan = EC_ManMessageMono.Instance.GetECManMatter;//g_pGame.GetGameRun().GetWorld().GetMatterMan();
|
||||
CECMatter pMatter = pMatterMan.GetMatter(pCmd.mid);
|
||||
// if (pMatter && pMatter->IsMonsterSpiritMine()) {
|
||||
// StartMonsterSpiritConnectGfx(pCmd->mid, pMatter->GetPos());
|
||||
// m_pEPWorkMan->StartNormalWork(new CECEPWorkPickUp(m_pEPWorkMan, pCmd->use_time * 1000, CECEPWorkPickUp::GATHER_MONSTER_SPIRIT));
|
||||
// if (pMatter && pMatter.IsMonsterSpiritMine()) {
|
||||
// StartMonsterSpiritConnectGfx(pCmd.mid, pMatter.GetPos());
|
||||
// m_pEPWorkMan.StartNormalWork(new CECEPWorkPickUp(m_pEPWorkMan, pCmd.use_time * 1000, CECEPWorkPickUp::GATHER_MONSTER_SPIRIT));
|
||||
// } else {
|
||||
m_pEPWorkMan.StartNormalWork(new CECEPWorkPickUp(m_pEPWorkMan, 0, CECEPWorkPickUp.PickUpType.GATHER_ITEM, pMatter ? pMatter.GetTemplateID() : 0));
|
||||
// }
|
||||
@@ -912,16 +928,56 @@ namespace BrewMonster
|
||||
{
|
||||
cmd_player_gather_stop pCmd = GPDataTypeHelper.FromBytes<cmd_player_gather_stop>((byte[])Msg.dwParam1);
|
||||
m_pEPWorkMan.FinishWork(CECEPWork.EP_work_ID.WORK_PICKUP);
|
||||
// m_pEPWorkMan->FinishWork(CECEPWork::WORK_PICKUP);
|
||||
// m_pEPWorkMan.FinishWork(CECEPWork::WORK_PICKUP);
|
||||
// StopMonsterSpiritConnectGfx();
|
||||
}
|
||||
else if (cmd == CommandID.MINE_GATHERED)
|
||||
{
|
||||
cmd_mine_gathered pCmd = GPDataTypeHelper.FromBytes<cmd_mine_gathered>((byte[])Msg.dwParam1);
|
||||
// ASSERT(pCmd && pCmd->player_id == m_PlayerInfo.cid);
|
||||
// ASSERT(pCmd && pCmd.player_id == m_PlayerInfo.cid);
|
||||
// StartMonsterSpiritBallGfx();
|
||||
}
|
||||
}
|
||||
|
||||
// Is base info ready ?
|
||||
bool IsBaseInfoReady() { return m_bBaseInfoReady; }
|
||||
// Is customized data ready ?
|
||||
bool IsCustomDataReady() { return m_bCustomReady; }
|
||||
// Is equipment data ready ?
|
||||
public bool IsEquipDataReady() { return m_bEquipReady; }
|
||||
|
||||
void OnMsgPlayerFly(ECMSG Msg)
|
||||
{
|
||||
if (IsAllResReady())
|
||||
{
|
||||
if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_LANDING)
|
||||
ShowWing(false);
|
||||
else // OBJECT_TAKEOFF
|
||||
ShowWing(true);
|
||||
}
|
||||
|
||||
if (Convert.ToInt32(Msg.dwParam2) == CommandID.OBJECT_LANDING)
|
||||
m_dwStates &= ~(uint)PlayerNPCState.GP_STATE_FLY;
|
||||
else
|
||||
m_dwStates |= (uint)PlayerNPCState.GP_STATE_FLY;
|
||||
}
|
||||
|
||||
// Load player equipments
|
||||
bool LoadPlayerEquipments()
|
||||
{
|
||||
ShowEquipments(m_aNewEquips, false, false);
|
||||
SetResReadyFlag((uint)PlayerResourcesReadyFlag.RESFG_SKIN, true);
|
||||
|
||||
if (m_pPlayerModel)
|
||||
{
|
||||
// If weapon changed, action index may be changed, so update here
|
||||
int iCurAction = GetLowerBodyAction();
|
||||
if (IsValidAction(iCurAction))
|
||||
PlayAction(iCurAction, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Player appear flag
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace BrewMonster
|
||||
}
|
||||
public CECSkill GetSkill() { return m_pSkill; }
|
||||
public void SetSkill(CECSkill pSkill) { m_pSkill = pSkill; }
|
||||
public override string GetDesc() { return m_pSkill.GetSkillID().ToString(); }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,6 @@ namespace BrewMonster.Scripts.Task.UI
|
||||
|
||||
A3DVECTOR3 vPos = instCoord[0].vPos;
|
||||
strName = FormatFromTable(9393, ((int)vPos.x+4000)/10, ((int)vPos.z+5500)/10);
|
||||
Debug.Log($"[DlgTaskTrace] AppendCommand: strName {strName}");
|
||||
strName = string.Format("<link=\"coord\">{0}</link>", strName);
|
||||
//FormatFromTable(9393, ((int)vPos.x+4000)/10, ((int)vPos.z+5500)/10);
|
||||
|
||||
|
||||
@@ -13,17 +13,20 @@ namespace BrewMonster
|
||||
[SerializeField] private SkillUI skillUI;
|
||||
|
||||
bool m_bOpenAction;
|
||||
bool m_bReceivedNCPGreeting; // 是否收到了NPC的Greeting
|
||||
bool m_bReceivedNCPGreeting; // �Ƿ��յ���NPC��Greeting
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
uiSkillButton.onClick.RemoveAllListeners();
|
||||
uiSkillButton.onClick.AddListener(OnSkillButtonClicked);
|
||||
EventBus.Unsubscribe<OpenSkillUIEvent>(OnOpenSkillUIEvent);
|
||||
EventBus.Subscribe<OpenSkillUIEvent>(OnOpenSkillUIEvent);
|
||||
}
|
||||
|
||||
public void OnDestroy()
|
||||
{
|
||||
EventBus.Unsubscribe<OpenSkillUIEvent>(OnOpenSkillUIEvent);
|
||||
}
|
||||
|
||||
private void OnOpenSkillUIEvent(OpenSkillUIEvent @event)
|
||||
{
|
||||
TryOpenDialog(false);
|
||||
@@ -35,6 +38,10 @@ namespace BrewMonster
|
||||
}
|
||||
public void TryOpenDialog(bool bAction)
|
||||
{
|
||||
if(skillUI == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var boolll = skillUI.gameObject.activeInHierarchy;
|
||||
if (boolll)
|
||||
{
|
||||
|
||||
@@ -3827,7 +3827,12 @@ namespace BrewMonster.UI
|
||||
var dlg2 = CECUIManager.Instance.ShowUI(dialogue2);
|
||||
}
|
||||
}
|
||||
CloseDialogue();
|
||||
// CloseDialogue();
|
||||
// use for case dont do any thing just close popup : example: click to Thank you in NPC selection
|
||||
if (idFunction < 0)
|
||||
{
|
||||
CloseDialogue();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,6 @@ namespace BrewMonster.Scripts.UI
|
||||
string strDesc = pItem.GetDesc();
|
||||
pImage.SetHint(strDesc); // TODO
|
||||
pImage.SetOnClick(OnAwardItemClicked);
|
||||
//Debug.Log("[THN]CDlgAward: pItem.GetDesc():" + pItem.GetDesc());
|
||||
// af_GetFileTitle(pItem.GetIconFile(), strFile); // TODO
|
||||
strFile.ToLower();
|
||||
// TODO: Set the image cover here
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -44,6 +45,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
public void SetDataPtr(CECShortcut pvData, string strName = null)
|
||||
{
|
||||
pSC = pvData;
|
||||
|
||||
}
|
||||
public void SetInteract(bool isInteract)
|
||||
{
|
||||
@@ -141,6 +143,15 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
{
|
||||
return m_hintText;
|
||||
}
|
||||
public void Clear()
|
||||
{
|
||||
// BMLogger.Log("Clear AUIImagePicture with name: " + name) ;
|
||||
pSC = null;
|
||||
this.SetDataPtr(null);
|
||||
borderImage.SetActive(false);
|
||||
m_ClockCounter.SetProgressRange(0, 1);
|
||||
m_ClockCounter.SetProgressPos(1);
|
||||
}
|
||||
}
|
||||
public struct OpenSkillUIEvent
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BrewMonster
|
||||
public int m_nCurPanel1 = 1;
|
||||
public int m_nCurPanel2 = 1;
|
||||
|
||||
int m_CurrentShortcutOffset = 0;
|
||||
int currentListIndex = 0;
|
||||
/// <summary>
|
||||
/// Apply for a license remove later
|
||||
/// </summary>
|
||||
@@ -40,7 +40,7 @@ namespace BrewMonster
|
||||
[ContextMenu("SwitchShowSkillShortcut")]
|
||||
public void SwitchShowSkillShortcut()
|
||||
{
|
||||
m_CurrentShortcutOffset += AUIImagePictureList.Count;
|
||||
currentListIndex += 1;
|
||||
UpdateShortcuts();
|
||||
}
|
||||
public bool UpdateShortcuts()
|
||||
@@ -54,7 +54,6 @@ namespace BrewMonster
|
||||
|
||||
int nCurPanel9 = GetCurPanel1();
|
||||
int nCurPanel8 = GetCurPanel2();
|
||||
int countOffset = 0;
|
||||
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
||||
if (pHost == null) return false;
|
||||
var a_pSCS = new List<CECShortcutSet>();
|
||||
@@ -62,43 +61,17 @@ namespace BrewMonster
|
||||
GetQuickBarNameAndSC(pHost, a_pszPanel, a_pSCS, nCurPanel9, nCurPanel8);
|
||||
if (a_pSCS == null || a_pSCS.Count < 2)
|
||||
return false;
|
||||
#if LICENSE_VERSION
|
||||
|
||||
int slotIndex = 0;
|
||||
#endif
|
||||
if(m_CurrentShortcutOffset >( a_pSCS.Count * 9)){
|
||||
m_CurrentShortcutOffset = 0;
|
||||
}
|
||||
for (int i = 0; i < a_pSCS.Count; i++)
|
||||
|
||||
if(currentListIndex >= a_pSCS.Count )
|
||||
{
|
||||
if (a_pSCS[i] == null)
|
||||
continue;
|
||||
|
||||
//*//*CDlgQuickBar* pQuickBar = dynamic_cast<CDlgQuickBar*>(GetGameUIMan()->GetDialog(a_pszPanel[i]));
|
||||
//if (!pQuickBar || !pQuickBar->IsShow()) continue;*//*
|
||||
|
||||
#if LICENSE_VERSION
|
||||
|
||||
for (int j = 0; j < AUIImagePictureList.Count /*a_pSCS.Count*/; j++)
|
||||
{
|
||||
#else
|
||||
int nSlots = Mathf.Min(a_pSCS[i].GetShortcutNum(), AUIImagePictureList.Count);
|
||||
currentListIndex = 0;
|
||||
}
|
||||
int nSlots = Mathf.Min(a_pSCS[currentListIndex].GetShortcutNum(), AUIImagePictureList.Count);
|
||||
for (int j = 0; j < nSlots; j++)
|
||||
{
|
||||
#endif
|
||||
#if LICENSE_VERSION
|
||||
if (slotIndex >= AUIImagePictureList.Count) break;
|
||||
pCell = AUIImagePictureList[slotIndex];
|
||||
#else
|
||||
pCell = AUIImagePictureList[j];
|
||||
#endif
|
||||
if (pCell == null || !pCell.gameObject.activeInHierarchy) continue;
|
||||
if(m_CurrentShortcutOffset > countOffset)
|
||||
{
|
||||
countOffset++;
|
||||
continue;
|
||||
}
|
||||
pSC = a_pSCS[i].GetShortcut(j);
|
||||
pSC = a_pSCS[currentListIndex].GetShortcut(j);
|
||||
pClock = pCell.GetClockIcon();
|
||||
pClock.SetProgressRange(0, 1);
|
||||
pClock.SetProgressPos(1);
|
||||
@@ -361,9 +334,6 @@ namespace BrewMonster
|
||||
|
||||
if (pSC != null)
|
||||
{
|
||||
#if LICENSE_VERSION
|
||||
slotIndex++;
|
||||
#endif
|
||||
if (pCell.GetDataPtr() == pSC)
|
||||
{
|
||||
continue;
|
||||
@@ -400,9 +370,10 @@ namespace BrewMonster
|
||||
pCell->SetText(_AL(""));
|
||||
pCell->SetDataPtr(NULL);
|
||||
pCell->SetColor(A3DCOLORRGB(255, 255, 255)); */
|
||||
pCell.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private void GetQuickBarNameAndSC(CECHostPlayer pHost, List<string> pszPanel, List<CECShortcutSet> pSCS, int panel9, int panel8)
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace BrewMonster
|
||||
int offset = sizeof(uint);
|
||||
int skillSize = Marshal.SizeOf<cmd_skill_data.SKILL>();
|
||||
pCmd.skill_list = new cmd_skill_data.SKILL[pCmd.skill_count];
|
||||
BMLogger.LogError("OnMsgHstSkillData: skill_count= " + pCmd.skill_count);
|
||||
for (int i = 0; i < pCmd.skill_count; i++)
|
||||
{
|
||||
pCmd.skill_list[i] = GPDataTypeHelper.FromBytes<cmd_skill_data.SKILL>((byte[])Msg.dwParam1, offset);
|
||||
@@ -1818,7 +1819,7 @@ namespace BrewMonster
|
||||
|
||||
/// <summary>
|
||||
/// Cycles through learned skills by removing all shortcuts and adding 8 new skills to slots 0-7.
|
||||
/// If m_startingSkillID is set (>0), uses that specific skill ID and the next 7 (ID+1 to ID+7).
|
||||
/// If m_startingSkillID is set (>0), uses that specific skill ID and the next 7 (ID+1 through ID+7).
|
||||
/// Otherwise, cycles through all learned skills in groups of 8.
|
||||
/// </summary>
|
||||
#if UNITY_EDITOR
|
||||
@@ -1834,56 +1835,39 @@ namespace BrewMonster
|
||||
|
||||
// Remove all shortcuts
|
||||
pSCS.RemoveAllShortcuts();
|
||||
const int skillsPerCycle = 8;
|
||||
|
||||
// If starting skill ID is configured, cycle through groups of 8 starting from that ID
|
||||
// If starting skill ID is configured, cycle through pairs starting from that ID
|
||||
if (m_startingSkillID > 0)
|
||||
{
|
||||
// Calculate the current skill IDs based on cycle index
|
||||
// First press: startingID + 0 to startingID + 7 (e.g., 5-12)
|
||||
// Second press: startingID + 8 to startingID + 15 (e.g., 13-20)
|
||||
// Third press: startingID + 16 to startingID + 23 (e.g., 21-28)
|
||||
int baseSkillID = m_startingSkillID + (m_currentSkillCycleIndex * skillsPerCycle);
|
||||
BMLogger.LogError($"CycleSkillShortcuts: Trying to add skills {baseSkillID} to {baseSkillID + skillsPerCycle - 1}");
|
||||
|
||||
// Add 8 skills to slots 0-7
|
||||
for (int slot = 0; slot < skillsPerCycle; slot++)
|
||||
// First press: startingID + 0, startingID + 1 (e.g., 5, 6)
|
||||
// Second press: startingID + 2, startingID + 3 (e.g., 7, 8)
|
||||
// Third press: startingID + 4, startingID + 5 (e.g., 9, 10)
|
||||
int firstIndex = m_startingSkillID + (m_currentSkillCycleIndex * 8);
|
||||
List<int> skillIDs = new List<int>();
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
int currentSkillID = baseSkillID + slot;
|
||||
CECSkill pSkill = GetPositiveSkillByID(currentSkillID);
|
||||
|
||||
skillIDs.Add(firstIndex + i);
|
||||
}
|
||||
string skillIDsString = string.Join(", ", skillIDs);
|
||||
BMLogger.LogError($"CycleSkillShortcuts: Trying to add skills {skillIDsString}");
|
||||
for (int i = 0; i < skillIDs.Count; i++)
|
||||
{
|
||||
int skillID = skillIDs[i];
|
||||
CECSkill pSkill = GetPositiveSkillByID(skillID);
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
Debug.LogError($"CycleSkillShortcuts: Added skill ID {currentSkillID} to slot {slot}");
|
||||
pSCS.CreateSkillShortcut(i, pSkill);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Skill with ID {currentSkillID} not found in learned skills");
|
||||
// Try to find a valid skill by incrementing starting ID
|
||||
int find = 1;
|
||||
while (pSkill == null && find < 100)
|
||||
{
|
||||
m_startingSkillID++;
|
||||
Debug.LogError($"CycleSkillShortcuts: m_startingSkillID {m_startingSkillID}");
|
||||
currentSkillID = m_startingSkillID + (m_currentSkillCycleIndex * skillsPerCycle) + slot;
|
||||
pSkill = GetPositiveSkillByID(currentSkillID);
|
||||
find++;
|
||||
}
|
||||
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"CycleSkillShortcuts: Failed to find skill for slot {slot} after {find} attempts");
|
||||
}
|
||||
Debug.LogError($"CycleSkillShortcuts: Skill with ID {skillID} not found in learned skills");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Increment cycle index for next press
|
||||
m_currentSkillCycleIndex++;
|
||||
++m_currentSkillCycleIndex;
|
||||
|
||||
// Update UI
|
||||
CDlgQuickBar cDlgQuickBar2 = CECUIManager.Instance?.GetCDlgQuickBar();
|
||||
@@ -1905,7 +1889,7 @@ namespace BrewMonster
|
||||
}
|
||||
|
||||
// Calculate how many groups of 8 we can make
|
||||
int maxGroups = (skillCount + skillsPerCycle - 1) / skillsPerCycle; // Round up division
|
||||
int maxGroups = (skillCount + 7) / 8; // Round up division
|
||||
|
||||
// Wrap around if we've reached the end
|
||||
if (m_currentSkillCycleIndex >= maxGroups)
|
||||
@@ -1913,19 +1897,19 @@ namespace BrewMonster
|
||||
m_currentSkillCycleIndex = 0;
|
||||
}
|
||||
|
||||
// Calculate skill indices for this cycle
|
||||
int baseSkillIndex = m_currentSkillCycleIndex * skillsPerCycle;
|
||||
// Calculate starting skill index for this cycle
|
||||
int startSkillIndex = m_currentSkillCycleIndex * 8;
|
||||
|
||||
// Add up to 8 skills to slots 0-7
|
||||
for (int slot = 0; slot < skillsPerCycle; slot++)
|
||||
// Fill all 8 shortcut slots
|
||||
for (int slotIndex = 0; slotIndex < 8; slotIndex++)
|
||||
{
|
||||
int skillIndex = baseSkillIndex + slot;
|
||||
int skillIndex = startSkillIndex + slotIndex;
|
||||
if (skillIndex < skillCount)
|
||||
{
|
||||
CECSkill pSkill = GetPositiveSkillByIndex(skillIndex);
|
||||
if (pSkill != null)
|
||||
{
|
||||
pSCS.CreateSkillShortcut(slot, pSkill);
|
||||
pSCS.CreateSkillShortcut(slotIndex, pSkill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,41 +351,6 @@ namespace BrewMonster
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool LoadPlayerSkeleton(bool bAtOnce)
|
||||
{
|
||||
EC_PLAYERLOADRESULT Ret = default;
|
||||
if (bAtOnce /*|| !IsLoadThreadReady()*/)
|
||||
{
|
||||
// Under normal circumstances, only HostPlayer can reach here
|
||||
/* if (!LoadPlayerModel(m_iProfession, m_iGender, m_CustomizeData.bodyID, aEquips, szPetPath, Ret, false, false))
|
||||
{
|
||||
a_LogOutput(1, "CECPlayer::Init, failed to call LoadPlayerModel() !");
|
||||
return false;
|
||||
}*/
|
||||
|
||||
SetPlayerLoadedResult(Ret);
|
||||
|
||||
/* if (IsShapeChanged() && !QueueLoadDummyModel(m_iShape, true))
|
||||
{
|
||||
// ignore the dummy model loading failure
|
||||
a_LogOutput(1, "CECPlayer::Init, failed to call QueueLoadDummyModel() !");
|
||||
}*/
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool SetPlayerLoadedResult(EC_PLAYERLOADRESULT ret)
|
||||
{
|
||||
OnAllResourceReady();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void OnAllResourceReady()
|
||||
{
|
||||
CECHostSkillModel.Instance.Initialize();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
mainCam = Camera.main;
|
||||
|
||||
@@ -31,6 +31,7 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
|
||||
[SerializeField] private UnityEngine.UI.Button btnSecondClick;
|
||||
[SerializeField] CDlgQuickBar m_pDlgQuickBar1;
|
||||
[SerializeField] GameObject ChangeSkillShortcutButton;
|
||||
public CDlgSkillSubOther m_pDlgSkillSubOther;
|
||||
CDlgMessageBox m_pDlgMessageBox;
|
||||
public CDlgSkillAction m_pDlgSkillAction;
|
||||
@@ -61,6 +62,11 @@ public class CECUIManager : MonoSingleton<CECUIManager>
|
||||
}
|
||||
|
||||
ShowUI("Win_Hpmpxp");
|
||||
#if UNITY_EDITOR
|
||||
ChangeSkillShortcutButton.SetActive(true);
|
||||
#else
|
||||
ChangeSkillShortcutButton.SetActive(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
Reference in New Issue
Block a user