114 lines
4.2 KiB
C#
114 lines
4.2 KiB
C#
using BrewMonster.Network;
|
|
using BrewMonster.UI;
|
|
using UnityEngine;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
public class CDlgHost : MonoBehaviour
|
|
{
|
|
private void Update()
|
|
{
|
|
RefreshStatusBar();
|
|
}
|
|
public void RefreshStatusBar()
|
|
{
|
|
bool bShow = false;
|
|
bool bActive = true;
|
|
|
|
|
|
bShow |= RefreshIncantBar(bShow, bActive);
|
|
}
|
|
public bool RefreshIncantBar(bool bOtherShown, bool bActive)
|
|
{
|
|
CECHostPlayer pHost = CECGameRun.Instance.GetHostPlayer();
|
|
if(pHost == null) return false;
|
|
CECSkill pCurSkill = pHost.GetCurSkill();
|
|
bool bShow = false;
|
|
float nCur = 1;
|
|
float nMax = 1;
|
|
|
|
AUIDialog pDlg = CECUIManager.Instance.GetInGameUIMan().GetDialog("MagicProgress1");
|
|
if (!bOtherShown)
|
|
{
|
|
uint dwCurTime = 0, dwMaxTime = 0;
|
|
if(pCurSkill != null)
|
|
BMLogger.LogError($"CDlgHost::pHost.IsSpellingMagic()={pHost.IsSpellingMagic()} ; pCurSkill != null{pCurSkill != null}");
|
|
|
|
if (false/*pHost.GetUsingItemTimeCnt(dwCurTime, dwMaxTime)*/)
|
|
{
|
|
/* bShow = true;
|
|
nCur = dwCurTime;
|
|
nMax = dwMaxTime;
|
|
pDlg->GetDlgItem("Txt")->SetText(pHost->IsGatheringMonsterSpirit() ?
|
|
GetStringFromTable(738) : GetStringFromTable(726));*/
|
|
}
|
|
/*else if (pHost->IsOperatingPet())
|
|
{
|
|
bShow = true;
|
|
nCur = pHost->GetPetOptTime().GetCounter();
|
|
nMax = max(pHost->GetPetOptTime().GetPeriod(), 1);
|
|
switch (pHost->IsOperatingPet())
|
|
{
|
|
case 1:
|
|
pDlg->GetDlgItem("Txt")->SetText(GetStringFromTable(791));
|
|
break;
|
|
case 2:
|
|
pDlg->GetDlgItem("Txt")->SetText(GetStringFromTable(792));
|
|
break;
|
|
case 3:
|
|
pDlg->GetDlgItem("Txt")->SetText(GetStringFromTable(793));
|
|
break;
|
|
case 4:
|
|
pDlg->GetDlgItem("Txt")->SetText(GetStringFromTable(794));
|
|
break;
|
|
}
|
|
}*/
|
|
else if (pHost.IsSpellingMagic() && pCurSkill != null)
|
|
{
|
|
BMLogger.LogError("CDlgHost::RefreshIncantBar - IsSpellingMagic");
|
|
bShow = true;
|
|
CECCounter counter = pHost.GetIncantCnt();
|
|
nCur = counter.GetCounter();
|
|
nMax = Mathf.Max(counter.GetPeriod(), 1);
|
|
BMLogger.LogError($"CDlgHost::RefreshIncantBar - nCur=" + nCur + $"nMax={nMax} counter.GetPeriod()={counter.GetPeriod()} ");
|
|
|
|
pDlg.GetSkillNameText().text = (EC_Game.GetSkillDesc().GetWideString(pCurSkill.GetSkillID() * 10));
|
|
BMLogger.LogError("CDlgHost:: = (nCur / nMax)=" + (nCur / nMax));
|
|
BMLogger.LogError("CDlgHost::bShow =" + bShow);
|
|
}
|
|
/* else if (pHost.IsCongregating())
|
|
{
|
|
bShow = true;
|
|
CECCounter counter = pHost->GetCongregateCnt();
|
|
nCur = counter.GetCounter();
|
|
nMax = max(counter.GetPeriod(), 1);
|
|
|
|
int conType = pHost->IsCongregating() - 1;
|
|
pDlg->GetDlgItem("Txt")->SetText(GetStringFromTable(5700 + conType));
|
|
}*/
|
|
}
|
|
|
|
|
|
if (bShow)
|
|
{
|
|
if (!pDlg.IsShow())
|
|
{
|
|
BMLogger.LogError("CDlgHost::bShowbShow");
|
|
pDlg.Show(true);
|
|
}
|
|
pDlg.GetProgressImage().fillAmount = (nCur / nMax);
|
|
}
|
|
else
|
|
{
|
|
if (pDlg.IsShow())
|
|
{
|
|
pDlg.Show(false);
|
|
BMLogger.LogError("CDlgHost::bShowbShow not");
|
|
}
|
|
}
|
|
|
|
return bShow;
|
|
}
|
|
}
|
|
}
|