ui skill for tesst

This commit is contained in:
VDH
2025-12-29 17:32:48 +07:00
parent bf624ec7b1
commit cc1f4a9556
12 changed files with 907 additions and 812 deletions
@@ -8,6 +8,7 @@
* Copyright (c) 2004 Archosaur Studio, All Rights Reserved.
*/
using BrewMonster.Network;
using System;
using System.Collections.Generic;
using System.IO;
@@ -1078,30 +1079,30 @@ namespace BrewMonster
if (dwVer < 15)
{
DefaultUserConfigData();
return true;
goto End;
}
else if (dwVer > EC_ConfigConstants.EC_CONFIG_VERSION)
{
Debug.LogError("CECConfigs::LoadUserConfigData, version mismatch");
DefaultUserConfigData();
return false;
throw new Exception("CECConfigs::LoadUserConfigData, version mismatch");
}
m_vs.Read(reader, dwVer);
m_gs.Read(reader, dwVer);
m_bs.Read(reader, dwVer);
m_cas.Read(reader, dwVer);
}
ApplyUserSetting();
return true;
}
catch (Exception e)
{
Debug.LogError($"CECConfigs::LoadUserConfigData, data read error: {e.Message}");
DefaultUserConfigData();
return false;
}
End:
/*if (CECCrossServer::Instance().IsOnSpecialServer())
memset(m_bs.idPlayer, 0, sizeof(m_bs.idPlayer));*/
ApplyUserSetting();
return true;
}
public void ApplyUserSetting()
@@ -1113,6 +1114,10 @@ namespace BrewMonster
m_fCurPVRadius = CalcPlayerVisRadius(m_vs.nDistance);
// Note: Would need EC_Game reference
// g_pGame->GetA3DGFXExMan()->SetPriority(m_vs.nEffect);
// Send force attack to server
/* byte forceAttack = glb_BuildPVPMask(false);
byte refuseBless = glb_BuildRefuseBLSMask();
UnityGameSession.Instance.c2s_CmdNotifyForceAttack(forceAttack, refuseBless);*/
}
public void SetSceneLoadRadius(float fRadius)
@@ -145,6 +145,8 @@ namespace BrewMonster.Managers
@@ -2,6 +2,7 @@
using BrewMonster.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Skills;
using BrewMonster.UI;
using CSNetwork.C2SCommand;
using CSNetwork.GPDataType;
using CSNetwork.Protocols;
@@ -358,6 +359,7 @@ namespace CSNetwork
OnPrtcPlayerBaseInfoRe(protocol);
break;
case ProtocolType.PROTOCOL_GETUICONFIG_RE: OnPrtcGetConfigRe(protocol); break;
case ProtocolType.PROTOCOL_AUTOTEAMSETGOAL_RE:
{
// CECAutoTeam pAutoTeam = CECGameRun.Instance.GetHostPlayer().GetAutoTeam();
@@ -1116,11 +1118,11 @@ namespace CSNetwork
BMLogger.LogError("CECGameSession::OnPrtcGetConfigRe, link return error code of " + p.Result);
else
{
if (!EC_Game.GetGameRun().LoadConfigsFromServer(p.UiConfig.RawBuffer, p.UiConfig.Size))
if (!CECGameRun.Instance.LoadConfigsFromServer(p.UiConfig.RawBuffer, p.UiConfig.Size))
{
// if load failed then use current setting directly
//TODO : fix later
//g_pGame.GetConfigs().ApplyUserSetting();
EC_Game.GetConfigs().ApplyUserSetting();
}
// Now, Get config data request is sent after all host initial data ready.
@@ -1128,47 +1130,31 @@ namespace CSNetwork
// really starts. Maybe it's not the best place to do these work, but
// now we do it here.
// Enalbe game UI
//CECGameUIMan* pGameUI = (CECGameUIMan*)g_pGame->GetGameRun()->GetUIManager()->GetInGameUIMan();
//if (pGameUI)
//{
// pGameUI->EnableUI(true);
CECGameUIMan pGameUI = (CECGameUIMan)EC_Game.GetGameRun().GetUIManager().GetInGameUIMan();
if (pGameUI != null)
{
pGameUI.EnableUI(true);
// // Get referral name for adding friend or other display
// RoleInfo info = g_pGame->GetGameRun()->GetSelectedRoleInfo();
// if (info.referrer_role > 0)
// GetPlayerBriefInfo(1, &info.referrer_role, 2);
//}
// Get referral name for adding friend or other display
//TODO: a Hung lam phan select role info di
/* RoleInfo info = EC_Game.GetGameRun().GetSelectedRoleInfo();
if (info.referrer_role > 0)
GetPlayerBriefInfo(1, info.referrer_role, 2);*/
}
//CECHostPlayer* pHost = g_pGame->GetGameRun()->GetHostPlayer();
//pHost->OnAllInitDataReady();
CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
pHost.OnAllInitDataReady();
//if (pHost->IsGM())
//{
// CDlgCountryMap* pDlgCountryMap = (CDlgCountryMap*)pGameUI->GetDialog("Win_CountryMap");
// pDlgCountryMap->GetConfig();
//}
/* if (pHost.IsGM())
{
CDlgCountryMap pDlgCountryMap = (CDlgCountryMap)pGameUI.GetDialog("Win_CountryMap");
pDlgCountryMap.GetConfig();
}
//g_pGame->GetConfigs()->ApplyOptimizeSetting();
g_pGame.GetConfigs().ApplyOptimizeSetting();
//if (g_pGame->GetConfigs()->IsMiniClient())
// CECMCDownload::GetInstance().SendGetDownloadOK();
// if (g_pGame->GetConfigs()->IsSendLogicCheckInfo()){
// // Ïò·þÎñÆ÷·¢ËÍ»úÆ÷ʶ±ðÂë
// LogicHelp::LogicCheck logicChecker;
// unsigned char buffer[1024] = {0};
// int actualSize = logicChecker.ReceiveMessage(buffer, sizeof(buffer)/sizeof(buffer[0]));
// if (actualSize <= 0){
//#ifdef LOG_PROTOCOL
// a_LogOutput(1, "LogicHelp::LogicCheck ReceiveMessage returns %d", actualSize);
//#endif
// }else{
//#ifdef LOG_PROTOCOL
// a_LogOutput(1, "LogicHelp::LogicCheck ReceiveMessage returns %d bytes:%s", actualSize, glb_FormatOctets(Octets(buffer, actualSize)));
//#endif
// sendClientMachineInfo(buffer, actualSize);
// }
// }
if (g_pGame.GetConfigs().IsMiniClient())
CECMCDownload::GetInstance().SendGetDownloadOK();*/
}
}
private void OnPrtcPlayerBaseInfoRe(Protocol pProtocol)
@@ -177,3 +177,5 @@ namespace BrewMonster
@@ -175,3 +175,5 @@ namespace BrewMonster
@@ -114,3 +114,5 @@ namespace BrewMonster
@@ -44,6 +44,8 @@ namespace BrewMonster
/*CDlgQuickBar* pQuickBar = dynamic_cast<CDlgQuickBar*>(GetGameUIMan()->GetDialog(a_pszPanel[i]));
if (!pQuickBar || !pQuickBar->IsShow()) continue;*/
for (int j = 0; j < AUIImagePictureList.Count; j++)
{
pCell = AUIImagePictureList[j];
@@ -192,6 +194,7 @@ namespace BrewMonster
{
if (pSkill != null)
{
pCell.gameObject.SetActive(true);
//BMLogger.Log("HoangDev: QuickBar Set Skill Icon: " + (uint)pSkill.GetSkillID() + " : " + ElementSkill.GetIcon((uint)pSkill.GetSkillID()));
var nameskill = ElementSkill.GetIcon((uint)pSkill.GetSkillID());
Sprite[] sprites = Resources.LoadAll<Sprite>("iconlist_skill_multisprite");
@@ -206,10 +209,10 @@ namespace BrewMonster
}
else
{
/* pCell->SetCover(NULL, -1);
pCell->SetText(_AL(""));
pCell->SetDataPtr(NULL);
pCell->SetColor(A3DCOLORRGB(255, 255, 255));*/
/* pCell->SetCover(NULL, -1);
pCell->SetText(_AL(""));
pCell->SetDataPtr(NULL);
pCell->SetColor(A3DCOLORRGB(255, 255, 255));*/
}
}
}
@@ -113,7 +113,10 @@ namespace BrewMonster.UI
{
return m_canvas;
}
public void EnableUI(bool bEnable)
{
}
public override void Init()
{
base.Init();
+2 -2
View File
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3e260ce45e0cd70b25ca5f8b1731c7a776be13d81c9c1b6d1e5a101ef1650b80
size 200746103
oid sha256:27cdb98d2531dd977d79cb4295dda14351a24dd1f31593cdf45f5222ff212594
size 200746624
+47 -28
View File
@@ -1,6 +1,8 @@
using BrewMonster;
using BrewMonster.Network;
using BrewMonster.Scripts;
using BrewMonster.Scripts.World;
using BrewMonster.UI;
using CSNetwork;
using CSNetwork.GPDataType;
using CSNetwork.GPDataType;
@@ -18,13 +20,13 @@ public partial class CECGameRun
private GameObject _playerPrefab;
private GameObject _monsterPrefab;//CECMonster
private GameObject _npcServerPrefab;//CECNPCServer
// CECTeamMan* m_pTeamMan; // Team manager
private CECShortcutSet m_pNormalSCS; // Normal shortcut set
private CECShortcutSet m_pTeamSCS; // Team shortcut set
private CECShortcutSet m_pTradeSCS; // Trade shortcut set
private CECShortcutSet m_pPoseSCS; // Pose shortcut set
private CECShortcutSet m_pFactionSCS; // Faction shortcut set
private CECShortcutSet m_pFactionSCS; // Faction shortcut set
// private GameRunConfig _gameRunConfig;
//[SerializeField] private Transform ground;
@@ -42,6 +44,16 @@ public partial class CECGameRun
public CECShortcutSet GetFactionCmdShortcuts() { return m_pFactionSCS; }
private static Dictionary<int, CECInstance> m_InstTab = new Dictionary<int, CECInstance>();
static RoleInfo l_SelRoleInfo; // Selected character's role info.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void AfterSceneLoad()
{
l_SelRoleInfo = null;
m_InstTab = new Dictionary<int, CECInstance>();
}
public void Init()
{
Application.targetFrameRate = 60;
@@ -61,7 +73,7 @@ public partial class CECGameRun
// glb_ErrorOutput(ECERR_FAILEDTOCALL, "CECGameRun::Init", __LINE__);
// return false;
//}
if(!m_InstTab.ContainsKey(161))
if (!m_InstTab.ContainsKey(161))
m_InstTab.Add(161, new CECInstance());
AddressableManager.Instance.OnDispose += Dispose;
StartGame(0, Vector3.zero);
@@ -141,18 +153,25 @@ public partial class CECGameRun
return ObjectSpawner.Instance.InstantiateObject(_monsterPrefab, setThisAsParent: true)
.GetComponent<CECMonster>();
}
public RoleInfo GetSelectedRoleInfo()
{
return l_SelRoleInfo;
}
public void SetSelectedRoleInfo(RoleInfo Info)
{
l_SelRoleInfo = Info;
}
public CECNPCServer GetNPCServer()
{
return ObjectSpawner.Instance.InstantiateObject(_npcServerPrefab, setThisAsParent: true).GetComponent<CECNPCServer>();
}
public async void ShowVfx(string assetAddress,Vector3 position, Transform parent ,float timeLife)
public async void ShowVfx(string assetAddress, Vector3 position, Transform parent, float timeLife)
{
var prefab = await AddressableManager.Instance.LoadPrefabAsync(assetAddress);
if (prefab == null)
{
BMLogger.LogError("Failed to load prefab: "+assetAddress);
BMLogger.LogError("Failed to load prefab: " + assetAddress);
return;
}
if (parent == null)
@@ -307,29 +326,29 @@ public partial class CECGameRun
// TODO: Uncomment when UI manager is available
// Load UI configs / 加载UI配置
//CECGameUIMan pGameUI = m_pUIManager.GetInGameUIMan();
// if (pGameUI != null)
// {
// int iSize = dr.ReadInt();
// byte[] uiConfigData = dr.ReadData(iSize);
// if (!pGameUI.SetUserLayout(uiConfigData, iSize))
// {
// BMLogger.LogError("CECGameRun::LoadConfigsFromServer, Failed to set user layout");
// return false;
// }
// }
CECGameUIMan pGameUI = m_pUIManager.GetInGameUIMan();
/* if (pGameUI != null)
{
int iSize = dr.ReadInt();
byte[] uiConfigData = dr.ReadData(iSize);
if (!pGameUI.SetUserLayout(uiConfigData, iSize))
{
BMLogger.LogError("CECGameRun::LoadConfigsFromServer, Failed to set user layout");
return false;
}
}*/
// Load user settings / 加载用户设置
if (dwVer >= 2)
{
// TODO: Uncomment when game configs are available
// int iSize = dr.ReadInt();
// byte[] settingsData = dr.ReadData(iSize);
// if (!g_pGame.GetConfigs().LoadUserConfigData(settingsData, iSize))
// {
// BMLogger.LogError("CECGameRun::LoadConfigsFromServer, Failed to load user config data");
// return false;
// }
int iSize = dr.ReadInt();
byte[] settingsData = dr.ReadData(iSize);
if (!EC_Game.GetConfigs().LoadUserConfigData(settingsData, iSize))
{
BMLogger.LogError("CECGameRun::LoadConfigsFromServer, Failed to load user config data");
return false;
}
}
}
catch (System.Exception e)
@@ -353,21 +372,21 @@ public partial class CECGameRun
// }
return -1;
}
// Create shortcuts
// Create shortcuts
public bool CreateShortcuts()
{
// // Normal command shortcut set
m_pNormalSCS = new CECShortcutSet();
m_pNormalSCS.Init(8);
CECSCCommand pSC = new CECSCCommand((int)CECSCCommand.CommandID.CMD_SITDOWN);
m_pNormalSCS.SetShortcut(0, pSC);
pSC = new CECSCCommand((int)CECSCCommand.CommandID.CMD_WALKRUN);
m_pNormalSCS.SetShortcut(1, pSC);
pSC = new CECSCCommand((int)CECSCCommand.CommandID.CMD_NORMALATTACK);
m_pNormalSCS.SetShortcut(2, pSC);
pSC = new CECSCCommand((int)CECSCCommand.CommandID.CMD_FINDTARGET);
m_pNormalSCS.SetShortcut(3, pSC);
pSC = new CECSCCommand((int)CECSCCommand.CommandID.CMD_FINDTARGET);
m_pNormalSCS.SetShortcut(3, pSC);
pSC = new CECSCCommand((int)CECSCCommand.CommandID.CMD_ASSISTATTACK);
m_pNormalSCS.SetShortcut(3, pSC);
pSC = new CECSCCommand((int)CECSCCommand.CommandID.CMD_FLY);
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long