Merge remote-tracking branch 'origin/develop' into feature/chat_01
This commit is contained in:
@@ -340,6 +340,14 @@ namespace BrewMonster.UI
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool IsDialogShow(string pszName)
|
||||
{
|
||||
if(m_DlgName.TryGetValue(pszName, out AUIDialog dlg))
|
||||
{
|
||||
return dlg.IsShow();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ImportStringBadWords(string pszFilename)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class AUIBuffIcon : AUIImagePictureBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 200754299bc29436e9c9d608b6927e2d
|
||||
@@ -11,13 +11,9 @@ using UnityEngine.UI;
|
||||
|
||||
namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
{
|
||||
public class AUIImagePicture : MonoBehaviour
|
||||
public class AUIImagePicture : AUIImagePictureBase
|
||||
{
|
||||
[Header("AUIImagePicture(Need Refactor)")]
|
||||
[SerializeField] protected int slotIndex = -1;
|
||||
[SerializeField] protected CECShortcut pSC;
|
||||
[SerializeField] Button skillbutton;
|
||||
[SerializeField] protected Image skillImage;
|
||||
[SerializeField] GameObject borderImage;
|
||||
[SerializeField] int cooldownTime;
|
||||
[SerializeField] AUIClockIcon m_ClockCounter;
|
||||
@@ -28,11 +24,7 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
private bool m_bForceDynamicRender;
|
||||
|
||||
private AUIDialog m_pParent;
|
||||
|
||||
// Hint/tooltip data storage
|
||||
private string m_hintText = string.Empty;
|
||||
|
||||
public virtual void Awake()
|
||||
public override void Awake()
|
||||
{
|
||||
if (skillbutton == null)
|
||||
{
|
||||
@@ -43,25 +35,22 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
skillbutton.onClick.AddListener(Execute);
|
||||
m_pParent = GetComponentInParent<AUIDialog>();
|
||||
}
|
||||
public void SetDataPtr(CECShortcut pvData, string strName = null)
|
||||
{
|
||||
pSC = pvData;
|
||||
}
|
||||
|
||||
public void SetInteract(bool isInteract)
|
||||
{
|
||||
if (isInteract)
|
||||
{
|
||||
skillbutton.interactable = true;
|
||||
skillImage.color = Color.white;
|
||||
disPlayImage.color = Color.white;
|
||||
}
|
||||
else
|
||||
{
|
||||
skillImage.color = Color.gray;
|
||||
disPlayImage.color = Color.gray;
|
||||
|
||||
skillbutton.interactable = false;
|
||||
}
|
||||
}
|
||||
public CECShortcut GetDataPtr() => pSC;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (pSC != null )
|
||||
@@ -89,37 +78,29 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SetSlotIndex(int index)
|
||||
|
||||
public override void SetImage(Sprite sprite)
|
||||
{
|
||||
slotIndex = index;
|
||||
}
|
||||
public virtual void SetImage(Sprite sprite)
|
||||
{
|
||||
if(skillImage == null)
|
||||
if(disPlayImage == null)
|
||||
{
|
||||
Debug.LogError("Skill Image is not assigned in AUIImagePicture");
|
||||
return;
|
||||
}
|
||||
skillImage.sprite = sprite;
|
||||
skillImage.gameObject.SetActive(true);
|
||||
disPlayImage.sprite = sprite;
|
||||
disPlayImage.gameObject.SetActive(true);
|
||||
if(borderImage != null)
|
||||
borderImage.SetActive(true);
|
||||
}
|
||||
private IEnumerator CooldownRoutine()
|
||||
{
|
||||
skillbutton.interactable = false;
|
||||
skillImage.color = Color.gray;
|
||||
disPlayImage.color = Color.gray;
|
||||
yield return new WaitForSeconds(cooldownTime);
|
||||
skillImage.color = Color.white;
|
||||
disPlayImage.color = Color.white;
|
||||
skillbutton.interactable = true;
|
||||
}
|
||||
public AUIClockIcon GetClockIcon() => m_ClockCounter;
|
||||
|
||||
public void SetColor(Color color)
|
||||
{
|
||||
skillImage.color = color;
|
||||
}
|
||||
|
||||
private void UpdateRenderTargert()
|
||||
{
|
||||
if (!NeedDynamicRender())
|
||||
@@ -131,32 +112,19 @@ namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
return m_bUpdateRenderTarget || m_bForceDynamicRender;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set hint/tooltip text that will be displayed when the skill icon is clicked.
|
||||
/// This is typically the skill description with requirements.
|
||||
/// </summary>
|
||||
/// <param name="hint">The hint text to display</param>
|
||||
public void SetHint(string hint)
|
||||
{
|
||||
m_hintText = hint ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the stored hint/tooltip text.
|
||||
/// </summary>
|
||||
/// <returns>The hint text or empty string if none set</returns>
|
||||
public string GetHint()
|
||||
{
|
||||
return m_hintText;
|
||||
}
|
||||
public virtual void Clear()
|
||||
public override 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);
|
||||
base.Clear();
|
||||
if (borderImage != null)
|
||||
{
|
||||
borderImage.SetActive(false);
|
||||
}
|
||||
if (m_ClockCounter != null)
|
||||
{
|
||||
m_ClockCounter.SetProgressRange(0, 1);
|
||||
m_ClockCounter.SetProgressPos(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
public struct OpenSkillUIEvent
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
using BrewMonster.UI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay
|
||||
{
|
||||
public class AUIImagePictureBase : MonoBehaviour
|
||||
{
|
||||
[Header("AUIImagePicture(Need Refactor)")]
|
||||
[SerializeField] protected int slotIndex = -1;
|
||||
[SerializeField] protected CECShortcut pSC;
|
||||
[SerializeField] protected Image disPlayImage;
|
||||
|
||||
// Hint/tooltip data storage
|
||||
protected string m_hintText = string.Empty;
|
||||
|
||||
public virtual void Awake()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void SetDataPtr(CECShortcut pvData, string strName = null)
|
||||
{
|
||||
pSC = pvData;
|
||||
}
|
||||
|
||||
public CECShortcut GetDataPtr() => pSC;
|
||||
|
||||
public void SetSlotIndex(int index)
|
||||
{
|
||||
slotIndex = index;
|
||||
}
|
||||
|
||||
public virtual void SetImage(Sprite sprite)
|
||||
{
|
||||
if (disPlayImage == null)
|
||||
{
|
||||
Debug.LogError("Skill Image is not assigned in AUIImagePicture");
|
||||
return;
|
||||
}
|
||||
|
||||
disPlayImage.sprite = sprite;
|
||||
disPlayImage.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
public void SetColor(Color color)
|
||||
{
|
||||
if (disPlayImage != null)
|
||||
{
|
||||
disPlayImage.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set hint/tooltip text that will be displayed when the skill icon is clicked.
|
||||
/// This is typically the skill description with requirements.
|
||||
/// </summary>
|
||||
/// <param name="hint">The hint text to display</param>
|
||||
public void SetHint(string hint)
|
||||
{
|
||||
m_hintText = hint ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the stored hint/tooltip text.
|
||||
/// </summary>
|
||||
/// <returns>The hint text or empty string if none set</returns>
|
||||
public string GetHint()
|
||||
{
|
||||
return m_hintText;
|
||||
}
|
||||
|
||||
public virtual void Clear()
|
||||
{
|
||||
pSC = null;
|
||||
SetDataPtr(null);
|
||||
if (disPlayImage != null)
|
||||
{
|
||||
disPlayImage.gameObject.SetActive(false);
|
||||
}
|
||||
m_hintText = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c110d8b215614599bdf6a64c9fdc4f6
|
||||
@@ -4,7 +4,7 @@ using UnityEngine.UI;
|
||||
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class AUIToggle : AUIImagePicture
|
||||
public class AUIToggle : AUIImagePictureBase
|
||||
{
|
||||
[Header("SkillToggleUI")]
|
||||
[SerializeField] protected int skillID;
|
||||
@@ -19,15 +19,16 @@ namespace BrewMonster
|
||||
}
|
||||
public override void SetImage(Sprite sprite)
|
||||
{
|
||||
skillImage.sprite = sprite;
|
||||
skillImage.gameObject.SetActive(true);
|
||||
if (disPlayImage == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
disPlayImage.sprite = sprite;
|
||||
disPlayImage.gameObject.SetActive(true);
|
||||
}
|
||||
public override void Clear()
|
||||
{
|
||||
pSC = null;
|
||||
this.SetDataPtr(null);
|
||||
skillImage.gameObject.SetActive(false);
|
||||
return;
|
||||
base.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace BrewMonster.UI
|
||||
|
||||
private const string SKILL_ICONLIST_NAME = "iconlist_skill_multisprite";
|
||||
private const string ACTION_ICONLIST_NAME = "ActionIcon/iconlist_action_multisprite";
|
||||
private const string STATE_ICONLIST_NAME = "iconlist_state";
|
||||
|
||||
public CDlgMiniMap m_pDlgMiniMap;
|
||||
|
||||
@@ -343,8 +344,13 @@ namespace BrewMonster.UI
|
||||
|
||||
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_SKILL] = (SKILL_ICONLIST_NAME, Resources.LoadAll<Sprite>(SKILL_ICONLIST_NAME));
|
||||
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_ACTION] = (ACTION_ICONLIST_NAME, Resources.LoadAll<Sprite>(ACTION_ICONLIST_NAME));
|
||||
m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE] = (STATE_ICONLIST_NAME, Resources.LoadAll<Sprite>(STATE_ICONLIST_NAME));
|
||||
foreach(var icon in m_IconMap[(byte)EC_GAMEUI_ICONS.ICONS_STATE].Item2)
|
||||
{
|
||||
Debug.Log($"Init: icon: {icon.name}");
|
||||
}
|
||||
}
|
||||
public void SetCover(AUIImagePicture pImgPic, string nameImage, EC_GAMEUI_ICONS iCONS_TYPE)
|
||||
public void SetCover(AUIImagePictureBase pImgPic, string nameImage, EC_GAMEUI_ICONS iCONS_TYPE)
|
||||
{
|
||||
pImgPic.SetImage(m_IconMap[(byte)iCONS_TYPE].Item2.FirstOrDefault(s => s.name == nameImage));
|
||||
}
|
||||
@@ -562,6 +568,206 @@ namespace BrewMonster.UI
|
||||
// else if( gs.bAutoReply && cChannel == GP_CHAT_WHISPER ... )
|
||||
// (Skipped)
|
||||
}
|
||||
// bool LoadIconSet()
|
||||
// {
|
||||
// bool bval;
|
||||
// int dwRead;
|
||||
// AFileImage fi;
|
||||
// int h, i, j, nIndex;
|
||||
// A3DRECT *a_rc[ICONS_MAX];
|
||||
// char szFile[MAX_PATH], szLine[AFILE_LINEMAXLEN];
|
||||
// int W = 32, H = 32, a_nCountX[ICONS_MAX], a_nCountY[ICONS_MAX];
|
||||
// GNET::RoleInfo Info = g_pGame->GetGameRun()->GetSelectedRoleInfo();
|
||||
// char a_szIconFile[ICONS_MAX][40] = { "Action", "Skill", "Ivtr", "State", "SkillGrp", "Guild", "Pet", "ELF", "Suite", "Calendar", "PQ" };
|
||||
|
||||
// if( 0 == Info.gender )
|
||||
// strcat(a_szIconFile[ICONS_INVENTORY], "M");
|
||||
// else
|
||||
// strcat(a_szIconFile[ICONS_INVENTORY], "F");
|
||||
|
||||
// for( h = 0; h < ICONS_MAX; h++ )
|
||||
// {
|
||||
// sprintf(szFile, "%s\\Surfaces\\IconSet\\IconList_%s.txt",
|
||||
// af_GetBaseDir(), a_szIconFile[h]);
|
||||
// bval = fi.Open(szFile, AFILE_OPENEXIST | AFILE_TEXT );
|
||||
// if( !bval ) return AUI_ReportError(__LINE__, __FILE__);
|
||||
|
||||
// fi.ReadLine(szLine, sizeof(szLine), &dwRead);
|
||||
// W = atoi(szLine);
|
||||
|
||||
// fi.ReadLine(szLine, sizeof(szLine), &dwRead);
|
||||
// H = atoi(szLine);
|
||||
|
||||
// fi.ReadLine(szLine, sizeof(szLine), &dwRead);
|
||||
// a_nCountY[h] = atoi(szLine);
|
||||
|
||||
// fi.ReadLine(szLine, sizeof(szLine), &dwRead);
|
||||
// a_nCountX[h] = atoi(szLine);
|
||||
|
||||
// a_rc[h] = (A3DRECT*)a_malloc(sizeof(A3DRECT)*(a_nCountX[h] * a_nCountY[h]));
|
||||
// if( !a_rc[h] ) return AUI_ReportError(__LINE__, __FILE__);
|
||||
|
||||
// for( i = 0; i < a_nCountY[h]; i++ )
|
||||
// {
|
||||
// for( j = 0; j < a_nCountX[h]; j++ )
|
||||
// {
|
||||
// nIndex = i * a_nCountX[h] + j;
|
||||
// a_rc[h][nIndex].SetRect(j * W, i * H, j * W + W, i * H + H);
|
||||
|
||||
// bval = fi.ReadLine(szLine, sizeof(szLine), &dwRead);
|
||||
// if( dwRead > 0 && strlen(szLine) > 0 )
|
||||
// m_IconMap[h][AString(szLine)] = nIndex;
|
||||
// }
|
||||
// }
|
||||
|
||||
// fi.Close();
|
||||
|
||||
// m_pA2DSpriteIcons[h] = new A2DSprite;
|
||||
// if( !m_pA2DSpriteIcons[h] )
|
||||
// {
|
||||
// a_free(a_rc[h]);
|
||||
// return AUI_ReportError(__LINE__, __FILE__);
|
||||
// }
|
||||
|
||||
// sprintf(szFile, "IconSet\\IconList_%s.dds", a_szIconFile[h]);
|
||||
// bval = m_pA2DSpriteIcons[h]->Init(m_pA3DDevice, szFile, AUI_COLORKEY);
|
||||
// if( !bval )
|
||||
// {
|
||||
// a_free(a_rc[h]);
|
||||
// return AUI_ReportError(__LINE__, __FILE__);
|
||||
// }
|
||||
|
||||
// m_vecIconList.push_back( m_pA2DSpriteIcons[h] ); // add for imaged hints
|
||||
// }
|
||||
|
||||
// SetImageList(&m_vecIconList); // add for imaged hints
|
||||
|
||||
// for( h = 0; h < ICONS_MAX; h++ )
|
||||
// {
|
||||
// bval = m_pA2DSpriteIcons[h]->ResetItems(
|
||||
// a_nCountX[h] * a_nCountY[h], a_rc[h]);
|
||||
// a_free(a_rc[h]);
|
||||
// if( !bval ) return AUI_ReportError(__LINE__, __FILE__);
|
||||
// }
|
||||
|
||||
// m_pA2DSpriteMask = new A2DSprite;
|
||||
// if( !m_pA2DSpriteMask ) return AUI_ReportError(__LINE__, __FILE__);
|
||||
|
||||
// bval = m_pA2DSpriteMask->Init(m_pA3DDevice,
|
||||
// "InGame\\IconHighlight.dds", AUI_COLORKEY);
|
||||
// if( !bval ) return AUI_ReportError(__LINE__, __FILE__);
|
||||
|
||||
// // load the expire icon cover
|
||||
// m_pA2DSpriteItemExpire = new A2DSprite;
|
||||
// if( !m_pA2DSpriteItemExpire ) return AUI_ReportError(__LINE__, __FILE__);
|
||||
// bval = m_pA2DSpriteItemExpire->Init(m_pA3DDevice, "InGame\\IconItemExpire.dds", AUI_COLORKEY);
|
||||
// if( !bval )
|
||||
// {
|
||||
// delete m_pA2DSpriteItemExpire;
|
||||
// m_pA2DSpriteItemExpire = NULL;
|
||||
// AUI_ReportError(__LINE__, "CECGameUIMan::LoadIconSet(), failed to load InGame\\IconItemExpire.dds");
|
||||
// }
|
||||
|
||||
// // ���ذ���PVP���ͼ��
|
||||
// const char *szFactionPVPMineBase[FACTION_PVP_ICON_NUM] = {
|
||||
// "InGame\\����_С.tga",
|
||||
// "InGame\\����_С_����.tga",
|
||||
// "InGame\\����.tga",
|
||||
// "InGame\\����_����.tga",
|
||||
// "InGame\\����_�״�.tga",
|
||||
// };
|
||||
// for (i = 0; i < FACTION_PVP_ICON_NUM; ++ i){
|
||||
// if (!LoadSprite(szFactionPVPMineBase[i], m_pFactionPVPMineBaseSprite[i])){
|
||||
// AUI_ReportError(__LINE__, 1, "CECGameUIMan::LoadIconSet(), failed to load %s", szFactionPVPMineBase[i]);
|
||||
// }
|
||||
// }
|
||||
// const char *szFactionPVPMine[FACTION_PVP_ICON_NUM] = {
|
||||
// "InGame\\�����_С.tga",
|
||||
// "InGame\\�����_С_����.tga",
|
||||
// "InGame\\�����.tga",
|
||||
// "InGame\\�����_����.tga",
|
||||
// "InGame\\�����_�״�.tga",
|
||||
// };
|
||||
// for (i = 0; i < FACTION_PVP_ICON_NUM; ++ i){
|
||||
// if (!LoadSprite(szFactionPVPMine[i], m_pFactionPVPMineSprite[i])){
|
||||
// AUI_ReportError(__LINE__, 1, "CECGameUIMan::LoadIconSet(), failed to load %s", szFactionPVPMine[i]);
|
||||
// }
|
||||
// }
|
||||
// const char *szFactionPVPHasMine = "InGame\\�п���ʾ.tga";
|
||||
// if (!LoadSprite(szFactionPVPHasMine, m_pA2DSpriteFactionPVPHasMine)){
|
||||
// AUI_ReportError(__LINE__, 1, "CECGameUIMan::LoadIconSet(), failed to load %s", szFactionPVPHasMine);
|
||||
// }
|
||||
|
||||
// // Emotions.�����Ѽ���
|
||||
|
||||
// // Images
|
||||
// char a_szImageFile[GP_CHAT_MAX][40] = { "��ͨ.tga", "����.tga", "���.tga", "����.tga", "����.tga", "", "", "����.tga", "", "ϵͳ.tga", "", "", "�Ž�.tga", "ս��.tga", "����.tga"};
|
||||
// for (i = 0; i < GP_CHAT_MAX; ++ i)
|
||||
// {
|
||||
// AString strFile = AString("InGame\\") + a_szImageFile[i];
|
||||
// AString strFullPath = AString("Surfaces\\") + strFile;
|
||||
// if (af_IsFileExist(strFullPath))
|
||||
// {
|
||||
// A2DSprite *pSprite = new A2DSprite;
|
||||
// if (!pSprite) return AUI_ReportError(__LINE__, __FILE__);
|
||||
// if (pSprite->Init(m_pA3DDevice, strFile, AUI_COLORKEY))
|
||||
// {
|
||||
// m_pA2DSpriteImage.push_back(pSprite);
|
||||
// continue;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// A3DRELEASE(pSprite);
|
||||
// }
|
||||
// }
|
||||
|
||||
// // ����ռλ��
|
||||
// m_pA2DSpriteImage.push_back(NULL);
|
||||
// }
|
||||
|
||||
// PAUIDIALOG pShow = GetDialog("Win_Popface");
|
||||
// pShow->SetData(AUIMANAGER_MAX_EMOTIONGROUPS);
|
||||
// pShow = GetDialog("Win_Popface01");
|
||||
// pShow->SetData(AUIMANAGER_MAX_EMOTIONGROUPS);
|
||||
// pShow = GetDialog("Win_Popface02");
|
||||
// pShow->SetData(AUIMANAGER_MAX_EMOTIONGROUPS);
|
||||
|
||||
// AScriptFile sf;
|
||||
// if( sf.Open("Configs\\Iconsound.txt") )
|
||||
// {
|
||||
// int idSubType;
|
||||
// AString strWave;
|
||||
|
||||
// while( sf.GetNextToken(true) )
|
||||
// {
|
||||
// idSubType = atoi(sf.m_szToken);
|
||||
// sf.GetNextToken(true);
|
||||
// strWave = sf.m_szToken;
|
||||
// m_IconSound[idSubType] = strWave;
|
||||
// }
|
||||
|
||||
// sf.Close();
|
||||
// }
|
||||
|
||||
// for (i=0;i<CECSCSysModule::FM_NUM;i++)
|
||||
// {
|
||||
// const char* pIconFile = res_SysModuleIconFile(i);
|
||||
// A2DSprite *pSprite = new A2DSprite;
|
||||
// if (!pSprite) return AUI_ReportError(__LINE__, __FILE__);
|
||||
// if (!pSprite->Init(m_pA3DDevice, pIconFile, AUI_COLORKEY))
|
||||
// {
|
||||
// A3DRELEASE(pSprite);
|
||||
// a_LogOutput(1, "CECGameUIMan::LoadIconSet , %s",pIconFile);
|
||||
// continue;
|
||||
// }
|
||||
// pSprite->SetLinearFilter(true);
|
||||
|
||||
// m_pSpriteIconSysModule.push_back(pSprite);
|
||||
// }
|
||||
|
||||
// return true;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
public enum EC_GAMEUI_ICONS : byte
|
||||
|
||||
@@ -6,9 +6,11 @@ using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using BrewMonster.Scripts.Skills;
|
||||
using BrewMonster.Scripts;
|
||||
namespace BrewMonster
|
||||
{
|
||||
public class HUDPlayer : MonoBehaviour
|
||||
public class HUDPlayer : MonoBehaviour,ITickable
|
||||
{
|
||||
public TextMeshProUGUI healthText;
|
||||
public TextMeshProUGUI manaText;
|
||||
@@ -21,6 +23,9 @@ namespace BrewMonster
|
||||
public Image expImage;
|
||||
public Image apImage;
|
||||
public List<Toggle> apToggles;
|
||||
private List<AUIBuffIcon> buffIcons;
|
||||
[SerializeField] private AUIBuffIcon buffIconPrefab;
|
||||
|
||||
|
||||
[Tooltip("Optional. Assign to make this area open the character dialog on click. If unset, nothing opens.")]
|
||||
[SerializeField] private Button m_btnOpenCharacter;
|
||||
@@ -33,6 +38,8 @@ namespace BrewMonster
|
||||
EventBus.Subscribe<CECHostPlayer.EXPToUpLevel>(UpdateNeededExp);
|
||||
if (m_btnOpenCharacter != null)
|
||||
m_btnOpenCharacter.onClick.AddListener(OnOpenCharacterClick);
|
||||
buffIcons = new List<AUIBuffIcon>();
|
||||
TickInvoker.Instance.RegisterTickable(this);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
@@ -42,6 +49,11 @@ namespace BrewMonster
|
||||
EventBus.Unsubscribe<CECHostPlayer.EXPToUpLevel>(UpdateNeededExp);
|
||||
}
|
||||
|
||||
public bool Tick(uint dwDeltaTime)
|
||||
{
|
||||
UpdateBuffIcons();
|
||||
return true;
|
||||
}
|
||||
private void UpdateNeededExp(CECHostPlayer.EXPToUpLevel obj)
|
||||
{
|
||||
neededExp = obj.NeededExp;
|
||||
@@ -80,7 +92,36 @@ namespace BrewMonster
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBuffIcons()
|
||||
{
|
||||
var hostPlayer = EC_Game.GetGameRun().GetHostPlayer();
|
||||
if(hostPlayer == null)
|
||||
return;
|
||||
var iconStates = hostPlayer.m_aIconStates;
|
||||
if(buffIcons.Count < iconStates.Count)
|
||||
{
|
||||
for(int i = buffIcons.Count; i < iconStates.Count; i++)
|
||||
{
|
||||
var buffIcon = Instantiate(buffIconPrefab, buffIconPrefab.transform.parent);
|
||||
buffIcons.Add(buffIcon);
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < buffIcons.Count; i++)
|
||||
{
|
||||
if(i < iconStates.Count)
|
||||
{
|
||||
buffIcons[i].gameObject.SetActive(true);
|
||||
var gameUIMan = CECUIManager.Instance.GetInGameUIMan();
|
||||
var szFile = GNET.QueryTeamState(iconStates[i].id).GetIcon();
|
||||
szFile = szFile.ToLower();
|
||||
gameUIMan.SetCover(buffIcons[i], szFile, EC_GAMEUI_ICONS.ICONS_STATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffIcons[i].gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void OnOpenCharacterClick()
|
||||
{
|
||||
// var gameUIMan = EC_Game.GetGameRun()?.GetUIManager()?.GetInGameUIMan();
|
||||
@@ -100,5 +141,6 @@ namespace BrewMonster
|
||||
UnityGameSession.c2s_SendCmdGetExtProps();
|
||||
dlg.ResetPoints();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ namespace BrewMonster
|
||||
{
|
||||
CECShortcut pSC;
|
||||
CECSCSkill pSCSkill;
|
||||
AUIImagePicture pCell;
|
||||
AUIImagePictureBase pCell;
|
||||
CECSkill pSkill = new CECSkill(-1, -1);
|
||||
|
||||
if (a_pSCS == null || a_pSCS.Count < 2)
|
||||
|
||||
Reference in New Issue
Block a user