feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
This commit is contained in:
184
SVSim.BattleEngine/Engine/LoadingBase.cs
Normal file
184
SVSim.BattleEngine/Engine/LoadingBase.cs
Normal file
@@ -0,0 +1,184 @@
|
||||
using System.Collections;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class LoadingBase : UIBase
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject mainObj;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel ParLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UIGauge LoadingBar;
|
||||
|
||||
[SerializeField]
|
||||
protected UILabel LoadTitleLabel;
|
||||
|
||||
[SerializeField]
|
||||
protected UILabel LoadTextLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture BGTexture;
|
||||
|
||||
private int loadIndex;
|
||||
|
||||
private string comment = "";
|
||||
|
||||
private Coroutine coroutine;
|
||||
|
||||
protected bool isLabelUpdate = true;
|
||||
|
||||
private float loadAssetsMaxNum;
|
||||
|
||||
public bool IsOpponentWait;
|
||||
|
||||
public float CurrentProgress { get; private set; }
|
||||
|
||||
public bool MaximumValueFixedMode { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
MaximumValueFixedMode = false;
|
||||
CurrentProgress = 0f;
|
||||
}
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
if ((bool)LoadTextLabel)
|
||||
{
|
||||
comment = Data.SystemText.Get("System_0001");
|
||||
}
|
||||
if ((bool)ParLabel)
|
||||
{
|
||||
ParLabel.text = "0%";
|
||||
}
|
||||
if ((bool)mainObj)
|
||||
{
|
||||
mainObj.SetActive(value: false);
|
||||
mainObj.GetComponent<UIAnchor>().uiCamera = UIManager.GetInstance().UIRootLoadingCamera;
|
||||
}
|
||||
OnEnable();
|
||||
}
|
||||
|
||||
public virtual void fadeOutLoading()
|
||||
{
|
||||
}
|
||||
|
||||
public void closeLoading()
|
||||
{
|
||||
if (base.gameObject != null)
|
||||
{
|
||||
Object.Destroy(base.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
if (coroutine == null)
|
||||
{
|
||||
setParLabelActive(isactive: true);
|
||||
coroutine = StartCoroutine(lodingAnimation());
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (coroutine != null)
|
||||
{
|
||||
StopCoroutine(coroutine);
|
||||
coroutine = null;
|
||||
}
|
||||
IsOpponentWait = false;
|
||||
}
|
||||
|
||||
public void setMaxAssetsNum(bool enable, float num)
|
||||
{
|
||||
MaximumValueFixedMode = enable;
|
||||
loadAssetsMaxNum = num;
|
||||
}
|
||||
|
||||
public void setLoadingComment(string comment)
|
||||
{
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public void setParLabelActive(bool isactive)
|
||||
{
|
||||
if ((bool)ParLabel && ParLabel.gameObject.activeSelf != isactive)
|
||||
{
|
||||
ParLabel.gameObject.SetActive(isactive);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator lodingAnimation()
|
||||
{
|
||||
if ((bool)mainObj)
|
||||
{
|
||||
mainObj.SetActive(value: false);
|
||||
}
|
||||
WaitForSeconds waitTime = new WaitForSeconds(0.05f);
|
||||
while (true)
|
||||
{
|
||||
float num = ((!MaximumValueFixedMode) ? (Toolbox.ResourcesManager.GetDownloadMaxSize() + (float)Toolbox.ResourcesManager.GetLoadingMax()) : loadAssetsMaxNum);
|
||||
float num2 = CalculateProgress();
|
||||
CurrentProgress = ((num == 0f) ? 0f : (num2 / num));
|
||||
if (CurrentProgress > 1f)
|
||||
{
|
||||
CurrentProgress = 1f;
|
||||
}
|
||||
if ((bool)ParLabel)
|
||||
{
|
||||
ParLabel.text = $"{CurrentProgress * 100f:f1}%";
|
||||
}
|
||||
if ((bool)LoadingBar)
|
||||
{
|
||||
LoadingBar.Value = CurrentProgress;
|
||||
}
|
||||
string str = "";
|
||||
for (int i = 0; i < loadIndex; i++)
|
||||
{
|
||||
str += ".";
|
||||
}
|
||||
if (Data.SystemText == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
if (isLabelUpdate && (bool)LoadTextLabel)
|
||||
{
|
||||
LoadTextLabel.text = comment + str;
|
||||
}
|
||||
loadIndex++;
|
||||
if (loadIndex >= 4)
|
||||
{
|
||||
loadIndex = 0;
|
||||
}
|
||||
yield return waitTime;
|
||||
if ((bool)mainObj && !mainObj.activeSelf)
|
||||
{
|
||||
mainObj.SetActive(value: true);
|
||||
mainObj.GetComponent<UIAnchor>().enabled = true;
|
||||
}
|
||||
if (IsOpponentWait)
|
||||
{
|
||||
if (CurrentProgress >= 1f)
|
||||
{
|
||||
setLoadingComment(Data.SystemText.Get("Battle_0408"));
|
||||
setParLabelActive(isactive: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
setLoadingComment(Data.SystemText.Get("System_0001"));
|
||||
setParLabelActive(isactive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual float CalculateProgress()
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetLoadingCompleted();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user