fix the issue with terrain holder and TickTask

This commit is contained in:
Le Duc Anh
2026-02-27 17:47:26 +07:00
parent 17633d74c6
commit 469e3f0204
5 changed files with 18 additions and 17 deletions
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: d0c06c588e2a6442488a3542551fb243
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -24,7 +24,7 @@ namespace BrewMonster.Scripts.Task
public static void OnTaskCheckStatus(TaskInterface pTask)
{
// 版本与交付合法性检查 // Version and deliver legality check
// 版本与交付合法性检查 // Version and deliver legality check
// CheckVersion not exposed on TaskInterface; skipping version check
if (pTask == null ||
!pTask.CheckVersion() ||
@@ -202,6 +202,7 @@ namespace BrewMonster.Scripts.Task
var uiMan = EC_Game.GetGameRun()?.GetUIManager()?.GetInGameUIMan();
if (uiMan != null)
{
// check if this is the main thread
uiMan.PopupTaskFinishDialog(pTempl.GetID(), pTalk);
s_finishDlgShownTime = ulCurTime;
}
@@ -1,18 +1,12 @@
using BrewMonster.Assets.PerfectWorld.Scripts.UI.GamePlay;
using BrewMonster.Common;
using BrewMonster.Managers;
using BrewMonster.Network;
using BrewMonster.Scripts.Task;
using BrewMonster.Scripts.Task.UI;
using BrewMonster.Scripts.UI;
using ModelRenderer.Scripts.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using static UnityEngine.Rendering.DebugUI;
namespace BrewMonster.UI
{
@@ -23,6 +23,7 @@ namespace BrewMonster
private List<AddressableObject> _candidatesForLoading = new List<AddressableObject>();
private List<AddressableObject> _objectsToUnload = new List<AddressableObject>();
private CECHostPlayer _hostPlayer;
private Vector3 _lastHostPosOxz;
private bool _hasLastHostPos = false;
private Vector3 _currentHostPosOxz;
@@ -108,11 +109,17 @@ namespace BrewMonster
while (!destroyToken.IsCancellationRequested)
{
if (!_hostPosReady)
{
await UniTask.Delay(1000, cancellationToken: destroyToken);
continue;
}
if (_hasLastHostPos)
{
if ((_currentHostPosOxz - _lastHostPosOxz).sqrMagnitude < minMoveSqr)
{
await UniTask.Delay(10, cancellationToken: destroyToken);
await UniTask.Delay(1000, cancellationToken: destroyToken);
continue;
}
}
@@ -191,6 +198,12 @@ namespace BrewMonster
private void UpdateGlobalDataForStreaming()
{
_realTimeSinceStartUp = Time.realtimeSinceStartup;
if (_hostPlayer == null)
{
_hostPlayer = CECGameRun.Instance.GetHostPlayer();
}
if (_hostPlayer == null) return;
_currentHostPosOxz = CECGameRun.Instance.GetHostPlayer().GetPosVector3();
_currentHostPosOxz.y = 0f;
_hostPosReady = true;
+1 -1
View File
@@ -333,7 +333,7 @@ namespace BrewMonster
m_PetOptCnt.Reset(true);
// run a process on background to keep track of task status.
UniTask.RunOnThreadPool(TickTask, false, this.GetCancellationTokenOnDestroy()).Forget();
TickTask().Forget();
}
public bool LoadResources()