feat(battle-engine): M1 auto-copy closure (782 battle-logic files)
Compile-driven bulk-copy loop (tools/engine-port/m1_copy_loop.py) pulled the precise reference closure of the battle-core roots, stopping at the classify god-object/View-VFX-UI boundary. 782 files; no re-explosion (M0 had estimated ~order 1000). Residual frontier = 52 shim-classified + 80 external (Unity/BCL) types to author next.
This commit is contained in:
184
SVSim.BattleEngine/Engine/UIBase.cs
Normal file
184
SVSim.BattleEngine/Engine/UIBase.cs
Normal file
@@ -0,0 +1,184 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIBase : MonoBehaviour
|
||||
{
|
||||
private bool loadOk;
|
||||
|
||||
private bool isAssetSetting;
|
||||
|
||||
private bool isOpen;
|
||||
|
||||
private List<string> m_loadBackgroundList = new List<string>();
|
||||
|
||||
private UIManager.ViewScene backSceneSave;
|
||||
|
||||
protected bool IsShowFooterMenu { get; set; }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
IsShowFooterMenu = false;
|
||||
onFirstStart();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
assetBundleSetting();
|
||||
onMove();
|
||||
}
|
||||
|
||||
public virtual bool IsGetOutOfScene(Action backupExec)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool IsUseCommonBackground()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
UnloadBackground();
|
||||
}
|
||||
|
||||
private void assetBundleSetting()
|
||||
{
|
||||
if (!loadOk)
|
||||
{
|
||||
StartCoroutine(assetSetting());
|
||||
loadOk = true;
|
||||
assetBundleEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetloadOk()
|
||||
{
|
||||
return loadOk;
|
||||
}
|
||||
|
||||
public IEnumerator assetSetting()
|
||||
{
|
||||
if (isAssetSetting)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
isAssetSetting = true;
|
||||
bool flag = UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Battle);
|
||||
UIManager.GetInstance().AttachAtlas(base.gameObject, !flag);
|
||||
SetBackground();
|
||||
}
|
||||
|
||||
private void SetBackground()
|
||||
{
|
||||
ResourcesManager resMgr = Toolbox.ResourcesManager;
|
||||
UIBase_Textuer[] componentsInChildren = base.gameObject.GetComponentsInChildren<UIBase_Textuer>(includeInactive: true);
|
||||
foreach (UIBase_Textuer bgTex in componentsInChildren)
|
||||
{
|
||||
string texName = bgTex.TextuerName;
|
||||
string assetTypePath = resMgr.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Background);
|
||||
m_loadBackgroundList.Add(assetTypePath);
|
||||
resMgr.StartCoroutine_LoadAssetGroupAsync(assetTypePath, delegate
|
||||
{
|
||||
if (bgTex != null)
|
||||
{
|
||||
bgTex.GetComponent<UITexture>().mainTexture = resMgr.LoadObject<Texture>(resMgr.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Background, isfetch: true));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void UnloadBackground()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(m_loadBackgroundList);
|
||||
m_loadBackgroundList.Clear();
|
||||
}
|
||||
|
||||
protected void resetAssetBaundleSetting()
|
||||
{
|
||||
loadOk = false;
|
||||
isAssetSetting = false;
|
||||
UnloadBackground();
|
||||
}
|
||||
|
||||
public virtual void onFirstStart()
|
||||
{
|
||||
Open();
|
||||
}
|
||||
|
||||
public void Open()
|
||||
{
|
||||
if (!isOpen)
|
||||
{
|
||||
isOpen = true;
|
||||
if (IsShowFooterMenu)
|
||||
{
|
||||
UIManager.GetInstance().ShowFooterMenu(isShow: true);
|
||||
}
|
||||
}
|
||||
onOpen();
|
||||
}
|
||||
|
||||
protected virtual void onOpen()
|
||||
{
|
||||
if (base.transform.localScale.x != 1f)
|
||||
{
|
||||
base.transform.localScale = new Vector3(1f, 1f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (isOpen)
|
||||
{
|
||||
isOpen = false;
|
||||
if (IsShowFooterMenu)
|
||||
{
|
||||
UIManager.GetInstance().ShowFooterMenu(isShow: false);
|
||||
}
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void onClose()
|
||||
{
|
||||
if (GameMgr.GetIns() != null && GameMgr.GetIns().GetInputMgr() != null)
|
||||
{
|
||||
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void onMove()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void PushTurnButton()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void assetBundleEnd()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void deleteAction()
|
||||
{
|
||||
}
|
||||
|
||||
public void setBackScene(UIManager.ViewScene scene)
|
||||
{
|
||||
backSceneSave = scene;
|
||||
}
|
||||
|
||||
public UIManager.ViewScene getBackScene()
|
||||
{
|
||||
return backSceneSave;
|
||||
}
|
||||
|
||||
public virtual List<NguiObjs> GetButtonList()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user