179 lines
6.2 KiB
C#
179 lines
6.2 KiB
C#
using BrewMonster.Network;
|
|
using BrewMonster.UI;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
namespace BrewMonster
|
|
{
|
|
public class CDlgHost : MonoBehaviour
|
|
{
|
|
private void Update()
|
|
{
|
|
RefreshStatusBar();
|
|
}
|
|
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 (EC_Game.GetGameRun() != null && EC_Game.GetGameRun().GetHostPlayer() != null
|
|
&& EC_Game.GetGameRun().GetHostPlayer().GetCurSkill() != null && !bShow)
|
|
{
|
|
// 传送等方式导致位置切换、技能(阵技能)仍然在释放状态
|
|
//
|
|
UnityGameSession.c2s_CmdCancelAction();
|
|
}
|
|
|
|
//// AutoHP bar.
|
|
//RefreshAutoHPBar(bActive);
|
|
|
|
//// AutoMP bar.
|
|
//RefreshAutoMPBar(bActive);
|
|
|
|
//// pet status
|
|
//RefreshPetStatus();
|
|
|
|
////ELF status
|
|
//RefreshElfStatus();
|
|
}
|
|
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;
|
|
int? piItem = null;
|
|
if (false /*pHost.GetUsingItemTimeCnt(ref dwCurTime, ref dwMaxTime, ref piItem)*/)
|
|
{
|
|
//bShow = true;
|
|
//nCur = dwCurTime;
|
|
//nMax = dwMaxTime;
|
|
//pDlg.GetSkillNameText().SetText(pHost.IsGatheringMonsterSpirit() ?
|
|
// pDlg.GetStringFromTable(738) : pDlg.GetStringFromTable(726));
|
|
}
|
|
else if (pHost.IsOperatingPet() != 0)
|
|
{
|
|
pDlg.transform.SetAsLastSibling();
|
|
bShow = true;
|
|
nCur = Math.Abs(pHost.GetPetOptTime().GetCounter());
|
|
nMax = Math.Max(pHost.GetPetOptTime().GetPeriod(), 1);
|
|
switch (pHost.IsOperatingPet())
|
|
{
|
|
case 1:
|
|
pDlg.GetSkillNameText().SetText(pDlg.GetStringFromTable(791));
|
|
break;
|
|
case 2:
|
|
pDlg.GetSkillNameText().SetText(pDlg.GetStringFromTable(792));
|
|
break;
|
|
case 3:
|
|
pDlg.GetSkillNameText().SetText(pDlg.GetStringFromTable(793));
|
|
break;
|
|
case 4:
|
|
pDlg.GetSkillNameText().SetText(pDlg.GetStringFromTable(794));
|
|
break;
|
|
}
|
|
}
|
|
else if (pHost.IsSpellingMagic() && pCurSkill != null)
|
|
{
|
|
bShow = true;
|
|
CECCounter counter = pHost.GetIncantCnt();
|
|
nCur = counter.GetCounter();
|
|
nMax = Mathf.Max(counter.GetPeriod(), 1);
|
|
|
|
pDlg.GetSkillNameText().text = (EC_Game.GetSkillDesc().GetWideString(pCurSkill.GetSkillID() * 10));
|
|
}
|
|
//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())
|
|
{
|
|
pDlg.Show(true);
|
|
}
|
|
pDlg.GetProgressImage().fillAmount = (nCur / nMax);
|
|
}
|
|
else
|
|
{
|
|
if (pDlg.IsShow())
|
|
{
|
|
pDlg.Show(false);
|
|
}
|
|
}
|
|
|
|
return bShow;
|
|
}
|
|
|
|
//bool RefreshPowerBar(bool bOtherShown, bool bActive)
|
|
//{
|
|
// CECHostPlayer pHost = EC_Game.GetGameRun().GetHostPlayer();
|
|
// CECSkill pCurSkill = pHost.GetCurSkill();
|
|
|
|
// bool bShow = false;
|
|
|
|
// PAUIDIALOG pDlg = GetGameUIMan().GetDialog("MagicProgress2");
|
|
// if (pCurSkill && pCurSkill.IsCharging() && !bOtherShown)
|
|
// {
|
|
// bShow = true;
|
|
// int nCur = pCurSkill.GetChargingCnt();
|
|
// int nMax = max(pCurSkill.GetChargingMax(), 1);
|
|
|
|
// if (!pDlg.IsShow())
|
|
// pDlg.Show(true, false, bActive);
|
|
|
|
// PAUIPROGRESS pProgress = (PAUIPROGRESS)pDlg.GetDlgItem("Prgs");
|
|
// pProgress.SetProgress(AUIPROGRESS_MAX * nCur / nMax);
|
|
|
|
// ACString strText;
|
|
// strText.Format(GetStringFromTable(605), g_pGame.GetSkillDesc().GetWideString(pCurSkill.GetSkillID() * 10));
|
|
// pDlg.GetDlgItem("Txt").SetText(strText);
|
|
// }
|
|
// else
|
|
// {
|
|
// if (pDlg.IsShow())
|
|
// pDlg.Show(false);
|
|
// }
|
|
|
|
// return bShow;
|
|
//}
|
|
}
|
|
}
|