update process bar

This commit is contained in:
NguyenVanDat
2026-01-05 11:31:22 +07:00
parent 397cb6b98f
commit ce03f2d38a
4 changed files with 35 additions and 7 deletions
@@ -33,8 +33,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.25}
m_AnchorMax: {x: 1, y: 0.75}
m_AnchoredPosition: {x: -5, y: 0}
m_SizeDelta: {x: -20, y: 0}
m_AnchoredPosition: {x: -0.17520142, y: 0}
m_SizeDelta: {x: -10.3504, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &977375840943150650
GameObject:
@@ -271,7 +271,7 @@ RectTransform:
m_Father: {fileID: 2000867345168672731}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 10, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
@@ -535,7 +535,7 @@ MonoBehaviour:
m_MinValue: 0
m_MaxValue: 1
m_WholeNumbers: 0
m_Value: 0
m_Value: 1
m_OnValueChanged:
m_PersistentCalls:
m_Calls: []
@@ -96,7 +96,6 @@ namespace BrewMonster.UI
CECCounter counter = _pHost.GetGatherCnt();
if (_pHost.IsGathering())
{
Debug.LogError($"Counter: {counter.GetCounter()}");
int nCur = (int)counter.GetCounter();
int nMax = Mathf.Max((int)counter.GetPeriod(), 1);
@@ -107,14 +106,25 @@ namespace BrewMonster.UI
// PAUILABEL pLabel = (PAUILABEL)pDlg.GetDlgItem("1");
var percent = AUIPROGRESS_MAX * nCur / nMax;
_dlgWinPrgs.SetProgressAndText(percent,$"{percent}%");
_dlgWinPrgs.SetProgressAndText(percent*1.0f/100.0f,$"{percent}%");
// pLabel.SetText(percent);
// pProgress.SetProgress(AUIPROGRESS_MAX * nCur / nMax);
if (percent >= 100)
{
_dlgWinPrgs.SetActiveProgress(false);
}
else
{
_dlgWinPrgs.SetActiveProgress(true);
}
}
else
{
if (_dlgWinPrgs.IsShow())
{
_dlgWinPrgs.Show(false);
_dlgWinPrgs.SetActiveProgress(false);
}
}
return _dlgWinPrgs.IsShow();
@@ -26,5 +26,10 @@ namespace BrewMonster.UI
progressText.text = text;
}
}
public void SetActiveProgress(bool active)
{
progressSlider.gameObject.SetActive(active);
}
}
}
+14 -1
View File
@@ -5598,6 +5598,19 @@ namespace BrewMonster
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_PICKUP);
m_pWorkMan.FinishRunningWork(Host_work_ID.WORK_USEITEM);
// StopMonsterSpiritConnectGfx();
var pDlg = EC_Game.GetGameRun().GetUIManager().GetInGameUIMan().GetDialog("Win_Prgs2");
if (pDlg == null)
{
BMLogger.LogError("Null Win_Prgs2");
return;
}
if (pDlg is not DlgWinPrgs2 dlgWinPrgs)
{
BMLogger.LogError("Can not cast Win_Prgs2");
return;
}
dlgWinPrgs.SetActiveProgress(false);
}
else if (cmd == CommandID.MINE_GATHERED)
{
@@ -5660,7 +5673,7 @@ namespace BrewMonster
// it->second.Update(iRealTime);
// Gather time counter
if (m_GatherCnt.IncCounter(Time.deltaTime))
if (m_GatherCnt.IncCounter(Time.realtimeSinceStartup))
m_GatherCnt.Reset(true);
// Debug.LogError("Gather counter: "+m_GatherCnt.GetCounter());