WIP logic show vfx select target and level up
This commit is contained in:
@@ -87,6 +87,12 @@ MonoBehaviour:
|
||||
m_SerializedLabels:
|
||||
- models
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 55af737b2941ead45a871fdefa955831
|
||||
m_Address: "\u7A0B\u5E8F\u8054\u5165/\u89D2\u8272\u5347\u7EA7\u4EBA\u7C7B.gfx"
|
||||
m_ReadOnly: 0
|
||||
m_SerializedLabels:
|
||||
- models
|
||||
FlaggedDuringContentUpdateRestriction: 0
|
||||
- m_GUID: 576e84b3fd877477eb7f0a424f30d5df
|
||||
m_Address: "models/\u573A\u666F\u6D3B\u7269/\u51E4\u7FBD\u9E7F/\u96C4\u6027\u51E4\u7FBD\u9E7F/\u96CC\u6027\u51E4\u7FBD\u9E7F.ecm"
|
||||
m_ReadOnly: 0
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
using BrewMonster;
|
||||
using BrewMonster.Network;
|
||||
using CSNetwork;
|
||||
using CSNetwork;
|
||||
using CSNetwork.GPDataType;
|
||||
using CSNetwork.Protocols;
|
||||
using CSNetwork.Protocols.RPCData;
|
||||
using PerfectWorld.Scripts.Player;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace PerfectWorld.Scripts.Managers
|
||||
{
|
||||
@@ -52,6 +47,9 @@ namespace PerfectWorld.Scripts.Managers
|
||||
OnMsgPlayerStopMove(Msg);
|
||||
break;
|
||||
}
|
||||
case int value when value == EC_MsgDef.MSG_PM_PLAYERLEVELUP:
|
||||
OnMsgPlayerLevelUp(Msg);
|
||||
break;
|
||||
case int value when value == EC_MsgDef.MSG_PM_FACTION_PVP_MASK_MODIFY:
|
||||
case int value1 when value1 == EC_MsgDef.MSG_PM_PLAYERATKRESULT:
|
||||
Debug.Log("EC_MsgDef.MSG_PM_FACTION_PVP_MASK_MODIFY");
|
||||
@@ -397,6 +395,23 @@ namespace PerfectWorld.Scripts.Managers
|
||||
pPlayer.StopMoveTo(pCmd);
|
||||
return true;
|
||||
}
|
||||
private bool OnMsgPlayerLevelUp(ECMSG Msg)
|
||||
{
|
||||
cmd_level_up pCmd = GPDataTypeHelper.FromBytes<cmd_level_up>((byte[])Msg.dwParam1);
|
||||
CECHostPlayer pHost = GetHostPlayer();
|
||||
if (pCmd.id == pHost.GetCharacterID())
|
||||
{
|
||||
pHost.LevelUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
EC_ElsePlayer pPlayer = SeekOutElsePlayer(pCmd.id);
|
||||
if (pPlayer)
|
||||
pPlayer.LevelUp();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool OnMsgPlayerRunOut(ECMSG Msg)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,8 @@ using PerfectWorld.Scripts.Player;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using BrewMonster.PerfectWorld.Scripts.Vfx;
|
||||
using BrewMonster.Scripts;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
@@ -1132,6 +1134,53 @@ public abstract class CECPlayer : CECObject
|
||||
return (m_dwResFlags & (uint)PlayerResourcesReadyFlag.RESFG_ALL) == (uint)PlayerResourcesReadyFlag.RESFG_ALL;
|
||||
}
|
||||
// Get character ID
|
||||
|
||||
// Play Gfx on Models
|
||||
protected bool PlayGfx(string szPath, string szHook, float fScale /*1.0f*/, uint iShapeTypeMask /*(1<<PLAYERMODEL_MAJOR)*/, bool bForceNoRecord =false)
|
||||
{
|
||||
// bool bPlayed(false);
|
||||
// bool bSkipRecord = (iShapeTypeMask != PLAYERMODEL_TYPEALL) || bForceNoRecord;
|
||||
// for(int i=0;i<PLAYERMODEL_MAX;i++)
|
||||
// {
|
||||
// if (m_pModels[i] && (iShapeTypeMask & (1<<i)))
|
||||
// {
|
||||
// if (IsCurrentModel(m_pModels[i])){
|
||||
// m_pModels[i]->PlayGfx(szPath, szHook, fScale);
|
||||
// bPlayed = true;
|
||||
// }
|
||||
// if(bSkipRecord) continue;
|
||||
// A3DGFXEx* pGfx = m_pModels[i]->GetGfx(szPath, szHook);
|
||||
// if (pGfx && pGfx->IsInfinite()){
|
||||
// GFXRECORD rec;
|
||||
// rec.strPath = szPath;
|
||||
// rec.strHook = szHook;
|
||||
// rec.fScale = fScale;
|
||||
// AString key = rec.strPath + rec.strHook;
|
||||
// m_GfxRecords[key] = rec;
|
||||
// bSkipRecord = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
PlayLevelUpGfx(szPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
private async void PlayLevelUpGfx(string path)
|
||||
{
|
||||
// Usage: Load the prefab asynchronously using AddressableManager
|
||||
GameObject prefab = await AddressableManager.Instance.LoadPrefabAsync(path);
|
||||
if(prefab != null)
|
||||
{
|
||||
// Instantiate at player's current position and rotation
|
||||
var vfx = Instantiate(prefab, transform.position, transform.rotation).GetComponent<BaseVfxObject>();
|
||||
vfx.transform.SetParent(transform);
|
||||
vfx.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
BMLogger.LogError($"Failed to load level up effect prefab at: {path}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct PlayActionEvent
|
||||
|
||||
@@ -807,7 +807,7 @@ public class CECNPC : CECObject
|
||||
if (model == null) {
|
||||
|
||||
model = GameObject.CreatePrimitive(PrimitiveType.Capsule);
|
||||
BMLogger.LogError($" CECNPC.QueueLoadNPCModel model == null szModelFile= {szModelFile} ");
|
||||
BMLogger.LogWarning($" CECNPC.QueueLoadNPCModel model == null szModelFile= {szModelFile} ");
|
||||
}
|
||||
|
||||
var monsterModel = Instantiate(model, transform);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class NPCVisual : MonoBehaviour
|
||||
namedAnimancer = GetComponentInChildren<NamedAnimancerComponent>();
|
||||
if (namedAnimancer == null)
|
||||
{
|
||||
BrewMonster.BMLogger.LogError("animancer == null");
|
||||
BMLogger.LogWarning("animancer == null");
|
||||
return;
|
||||
}
|
||||
EventBus.SubscribeChannel<QueueNPCActionEvent>(m_NPCInfo.nid, OnQueueAction);
|
||||
|
||||
@@ -607,6 +607,12 @@ namespace CSNetwork.GPDataType
|
||||
public byte dir;
|
||||
public byte move_mode;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct cmd_level_up
|
||||
{
|
||||
public int id;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
public struct cmd_host_attacked
|
||||
|
||||
@@ -654,6 +654,15 @@ namespace CSNetwork
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_HST_INFO00, MANAGER_INDEX.MAN_PLAYER, 0, pDataBuf,
|
||||
pCmdHeader);
|
||||
break;
|
||||
case CommandID.LEVEL_UP:
|
||||
{
|
||||
cmd_level_up pCmdLevelUp = GPDataTypeHelper.FromBytes<cmd_level_up>(pDataBuf);;
|
||||
if (ISPLAYERID(pCmdLevelUp.id))
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_PM_PLAYERLEVELUP, MANAGER_INDEX.MAN_PLAYER, -1, pDataBuf, pCmdHeader);
|
||||
else if (ISNPCID(pCmdLevelUp.id))
|
||||
EC_ManMessage.PostMessage(EC_MsgDef.MSG_NM_NPCLEVELUP, MANAGER_INDEX.MAN_NPC, 0, pDataBuf, pCmdHeader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using CSNetwork.Protocols.RPCData;
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using BrewMonster.PerfectWorld.Scripts.Vfx;
|
||||
using UnityEngine;
|
||||
using static CECNPC;
|
||||
|
||||
@@ -49,7 +50,6 @@ namespace PerfectWorld.Scripts.Player
|
||||
|
||||
SetModelHostPlayer();
|
||||
string roleName = Encoding.Unicode.GetString(roleInfo.name.ByteArray);
|
||||
BMLogger.LogError("HoangDev: roleName:" + roleName);
|
||||
if (txtName != null) txtName.text = roleName;
|
||||
|
||||
m_cdr.fStepHeight = m_MoveConst.fStepHei;
|
||||
@@ -558,6 +558,14 @@ namespace PerfectWorld.Scripts.Player
|
||||
//{
|
||||
// return new A3DVECTOR3(transform.position.x, transform.position.y, transform.position.z);
|
||||
//}
|
||||
// Level up
|
||||
public void LevelUp()
|
||||
{
|
||||
// if (m_pLevelUpGFX)
|
||||
// m_pLevelUpGFX->Start(true);
|
||||
//
|
||||
PlayGfx(EC_Resource.res_GFXFile((int)GfxResourceType.RES_GFX_LEVELUP), null, 1f,1);//PLAYERMODEL_TYPEALL
|
||||
}
|
||||
}
|
||||
|
||||
// Player appear flag
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Threading.Tasks;
|
||||
using BrewMonster.PerfectWorld.Scripts.Vfx;
|
||||
using BrewMonster.Scripts;
|
||||
using UnityEngine;
|
||||
@@ -7,7 +8,7 @@ namespace BrewMonster
|
||||
public class CECGFXCaster
|
||||
{
|
||||
// Load normal gfx
|
||||
public BaseVfxObject LoadGFXEx(string szFile)
|
||||
public async Task<BaseVfxObject> LoadGFXEx(string szFile)
|
||||
{
|
||||
if (string.IsNullOrEmpty(szFile))
|
||||
{
|
||||
@@ -16,15 +17,16 @@ namespace BrewMonster
|
||||
}
|
||||
|
||||
// // ASSERT(m_pGFXMan);
|
||||
// var loadObj = AddressableManager.Instance.LoadPrefabAsync(szFile.ToLower()).Result;
|
||||
// if (loadObj == null)
|
||||
// {
|
||||
// BMLogger.LogError("Null vfx object in path: " + szFile);
|
||||
// return null;
|
||||
// }
|
||||
var loadObj = await AddressableManager.Instance.LoadPrefabAsync(szFile.ToLower());
|
||||
if (loadObj == null)
|
||||
{
|
||||
BMLogger.LogError("Null vfx object in path: " + szFile);
|
||||
return null;
|
||||
}
|
||||
//GameController.Instance.SelectingVfxPrefab
|
||||
|
||||
// todo: make pool
|
||||
BaseVfxObject pGFX = GameController.Instance.InstantiateObject(GameController.Instance.SelectingVfxPrefab).GetComponent<BaseVfxObject>();
|
||||
BaseVfxObject pGFX = GameController.Instance.InstantiateObject(loadObj).GetComponent<BaseVfxObject>();
|
||||
if (!pGFX)
|
||||
{
|
||||
return null;
|
||||
@@ -40,6 +42,21 @@ namespace BrewMonster
|
||||
|
||||
return pGFX;
|
||||
}
|
||||
|
||||
// private async void PlayLevelUpGfx(string path)
|
||||
// {
|
||||
// // Usage: Load the prefab asynchronously using AddressableManager
|
||||
// GameObject prefab = await AddressableManager.Instance.LoadPrefabAsync(path);
|
||||
// if(prefab != null)
|
||||
// {
|
||||
// // Instantiate at player's current position and rotation
|
||||
// GameObject instance = Instantiate(prefab, transform.position, transform.rotation);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// BMLogger.LogError($"Failed to load level up effect prefab at: {path}");
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Release normal gfx
|
||||
// void CECGFXCaster::ReleaseGFXEx(A3DGFXEx* pGFX, bool bCacheRelease/* true */)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55af737b2941ead45a871fdefa955831
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -93,6 +93,8 @@ public partial class CECHostPlayer : CECPlayer
|
||||
Camera mainCam;
|
||||
|
||||
private BaseVfxObject m_pSelectedGFX;
|
||||
|
||||
public bool IsChangingFace() { return m_bChangingFace; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -949,11 +951,16 @@ public partial class CECHostPlayer : CECPlayer
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LoadGfx();
|
||||
}
|
||||
|
||||
public async void LoadGfx()
|
||||
{
|
||||
// Load GFX
|
||||
var gfxCaster = EC_Game.GetGFXCaster();
|
||||
// m_pMoveTargetGFX = g_pGame->GetGFXCaster()->LoadGFXEx(res_GFXFile(RES_GFX_MOVETARGET));
|
||||
m_pSelectedGFX = gfxCaster.LoadGFXEx(EC_Resource.res_GFXFile((int)GfxResourceType.RES_GFX_SELECTED));
|
||||
m_pSelectedGFX = await gfxCaster.LoadGFXEx(EC_Resource.res_GFXFile((int)GfxResourceType.RES_GFX_SELECTED));
|
||||
// m_pHoverGFX = g_pGame->GetGFXCaster()->LoadGFXEx(res_GFXFile(RES_GFX_CURSORHOVER));
|
||||
// m_pFloatDust = g_pGame->GetGFXCaster()->LoadGFXEx(res_GFXFile(RES_GFX_FLOATING_DUST));
|
||||
}
|
||||
@@ -1845,7 +1852,53 @@ public partial class CECHostPlayer : CECPlayer
|
||||
// UpdateMonsterSpiritGfx(dwDeltaTime);
|
||||
}
|
||||
|
||||
public bool IsChangingFace() { return m_bChangingFace; }
|
||||
// Level up
|
||||
public void LevelUp()
|
||||
{
|
||||
// CECGameSession *pSession = g_pGame->GetGameSession();
|
||||
//
|
||||
// m_BasicProps.iLevel++;
|
||||
// g_pGame->GetGameRun()->AddFixedMessage(FIXMSG_LEVELUP, m_BasicProps.iLevel);
|
||||
//
|
||||
// // Get all extend properties
|
||||
// pSession->c2s_CmdGetExtProps();
|
||||
|
||||
// if (m_pLevelUpGFX)
|
||||
// m_pLevelUpGFX->Start(true);
|
||||
PlayGfx(EC_Resource.res_GFXFile((int)GfxResourceType.RES_GFX_LEVELUP), null, 1f,1);//PLAYERMODEL_TYPEALL
|
||||
|
||||
// // Popup notify bubble text
|
||||
// BubbleText(BUBBLE_LEVELUP, 0);
|
||||
//
|
||||
// // Notify my friends that my level changed
|
||||
// ACHAR szInfo[40];
|
||||
// a_sprintf(szInfo, _AL("L%d"), m_BasicProps.iLevel);
|
||||
//
|
||||
// for (int i=0; i < m_pFriendMan->GetGroupNum(); i++)
|
||||
// {
|
||||
// CECFriendMan::GROUP* pGroup = m_pFriendMan->GetGroupByIndex(i);
|
||||
// for (int j=0; j < pGroup->aFriends.GetSize(); j++)
|
||||
// {
|
||||
// CECFriendMan::FRIEND* pFriend = pGroup->aFriends[j];
|
||||
// if (pFriend->IsGameOnline())
|
||||
// {
|
||||
// pSession->SendPrivateChatData(pFriend->GetName(),
|
||||
// szInfo, GNET::CHANNEL_USERINFO, pFriend->id);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (GetBasicProps().iLevel==30)
|
||||
// {
|
||||
// CECGameUIMan* pGameUI = g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan();
|
||||
// pGameUI->AddChatMessage(pGameUI->GetStringFromTable(9638), GP_CHAT_SYSTEM);
|
||||
// }
|
||||
// if (GetBasicProps().iLevel>31)
|
||||
// {
|
||||
// CECGameUIMan* pGameUI = g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan();
|
||||
// ((CDlgOnlineAward*)pGameUI->GetDialog("Win_AddExp2"))->RestartWhenLevelup();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
public enum StateAnim
|
||||
|
||||
@@ -38,10 +38,9 @@ public class PlayerVisual : MonoBehaviour
|
||||
var player = GetComponentInParent<CECPlayer>();
|
||||
if (player == null)
|
||||
{
|
||||
BrewMonster.BMLogger.LogError("player == null");
|
||||
BMLogger.LogError("player == null");
|
||||
return;
|
||||
}
|
||||
BrewMonster.BMLogger.LogError("HoangDev: player:"+ player);
|
||||
|
||||
_playerInfo = player.GetPlayInfo();
|
||||
id = _playerInfo.cid;
|
||||
|
||||
Reference in New Issue
Block a user