130 lines
4.1 KiB
C#
130 lines
4.1 KiB
C#
using UnityEngine;
|
|
|
|
namespace BrewMonster.UI
|
|
{
|
|
//Win_Hpmpxp
|
|
public class DlgHost : AUIDialog
|
|
{
|
|
public const int AUIPROGRESS_MAX = 100;
|
|
private DlgWinPrgs2 _dlgWinPrgs;
|
|
private CECHostPlayer _pHost;
|
|
|
|
public override bool Render()
|
|
{
|
|
// if( m_szName == "Win_Hpmpxp" )
|
|
// RefreshHostStats();
|
|
// else if (m_szName == "Win_HideHP")
|
|
// {
|
|
// a_LogOutput(1,"[Dat Mine] Win_HideHP");
|
|
RefreshStatusBar();
|
|
// }
|
|
|
|
return base.Render();
|
|
}
|
|
|
|
public void RefreshStatusBar()
|
|
{
|
|
bool bActive = true;
|
|
// if( GetGameUIMan()->GetActiveDialog() &&
|
|
// GetGameUIMan()->GetActiveDialog()->GetFocus() &&
|
|
// GetGameUIMan()->GetActiveDialog()->GetFocus()->GetType() == AUIOBJECT_TYPE_EDITBOX )
|
|
// bActive = false;
|
|
//
|
|
// // Flight bar.
|
|
// RefreshFlightBar(bActive);
|
|
//
|
|
// // Oxigen bar.
|
|
// RefreshOxigenBar(bActive);
|
|
|
|
// Gather bar.
|
|
RefreshGatherBar(bActive);
|
|
|
|
// // group these bars, show only one at one time
|
|
// bool bShow = false;
|
|
// // Power bar.
|
|
// bShow |= RefreshPowerBar(bShow, bActive);
|
|
// // Array bar.
|
|
// bShow |= RefreshArrayBar(bShow, bActive);
|
|
// // Incant bar.
|
|
// bShow |= RefreshIncantBar(bShow, bActive);
|
|
//
|
|
// if (GetHostPlayer()->GetCurSkill() && !bShow)
|
|
// {
|
|
// // ´«Ë͵ȷ½Ê½µ¼ÖÂλÖÃÇл»¡¢¼¼ÄÜ£¨Õó¼¼ÄÜ£©ÈÔÈ»ÔÚÊÍ·Å״̬
|
|
// //
|
|
// GetGameSession()->c2s_CmdCancelAction();
|
|
// }
|
|
//
|
|
// // AutoHP bar.
|
|
// RefreshAutoHPBar(bActive);
|
|
//
|
|
// // AutoMP bar.
|
|
// RefreshAutoMPBar(bActive);
|
|
//
|
|
// // pet status
|
|
// RefreshPetStatus();
|
|
//
|
|
// //ELF status
|
|
// RefreshElfStatus();
|
|
}
|
|
|
|
private bool RefreshGatherBar(bool bActive)
|
|
{
|
|
if (_dlgWinPrgs == null)
|
|
{
|
|
var pDlg = GetGameUIMan().GetDialog("Win_Prgs2");
|
|
if (pDlg == null)
|
|
{
|
|
BMLogger.LogError("Null Win_Prgs2");
|
|
return false;
|
|
}
|
|
|
|
if (pDlg is not DlgWinPrgs2 dlgWinPrgs)
|
|
{
|
|
BMLogger.LogError("Can not cast Win_Prgs2");
|
|
return false;
|
|
}
|
|
_dlgWinPrgs = dlgWinPrgs;
|
|
}
|
|
|
|
if (_pHost == null)
|
|
{
|
|
_pHost = GetHostPlayer();
|
|
if (_pHost == null) return false;
|
|
}
|
|
|
|
CECCounter counter = _pHost.GetGatherCnt();
|
|
if (_pHost.IsGathering())
|
|
{
|
|
int nCur = (int)counter.GetCounter();
|
|
int nMax = Mathf.Max((int)counter.GetPeriod(), 1);
|
|
|
|
if (!_dlgWinPrgs.IsShow())
|
|
_dlgWinPrgs.Show(bActive);//true, false, bActive
|
|
|
|
// PAUIPROGRESS pProgress = (PAUIPROGRESS)pDlg.GetDlgItem("Prgs");
|
|
// PAUILABEL pLabel = (PAUILABEL)pDlg.GetDlgItem("1");
|
|
|
|
var percent = AUIPROGRESS_MAX * nCur / nMax;
|
|
_dlgWinPrgs.SetProgressAndText(percent*1.0f/100.0f,$"{percent}%");
|
|
// pLabel.SetText(percent);
|
|
// pProgress.SetProgress(AUIPROGRESS_MAX * nCur / nMax);
|
|
if (percent < 100)
|
|
{
|
|
_dlgWinPrgs.SetActiveProgress(true);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (_dlgWinPrgs.IsShow())
|
|
{
|
|
_dlgWinPrgs.Show(false);
|
|
_dlgWinPrgs.SetActiveProgress(false);
|
|
}
|
|
}
|
|
|
|
return _dlgWinPrgs.IsShow();
|
|
}
|
|
}
|
|
}
|