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:
95
SVSim.BattleEngine/Engine/Wizard/GachaLayoutEffect.cs
Normal file
95
SVSim.BattleEngine/Engine/Wizard/GachaLayoutEffect.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class GachaLayoutEffect : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _effectRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _maskTexture;
|
||||
|
||||
private bool _isCompleteSetup;
|
||||
|
||||
private bool _isChangingPack;
|
||||
|
||||
private GameObject _effectObj;
|
||||
|
||||
private const int EFFECT_SORTING_ORDER = 1;
|
||||
|
||||
public void Setup(string effectName, int stencil, List<string> resourceList)
|
||||
{
|
||||
if (!_isChangingPack)
|
||||
{
|
||||
_isChangingPack = true;
|
||||
if (_isCompleteSetup)
|
||||
{
|
||||
Object.Destroy(_effectObj);
|
||||
_effectObj = null;
|
||||
_isCompleteSetup = false;
|
||||
}
|
||||
if (stencil > 0)
|
||||
{
|
||||
SetupStencilMaskMaterial(stencil);
|
||||
}
|
||||
UIManager.GetInstance().StartCoroutine(SetupEffect(effectName, stencil, resourceList));
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupStencilMaskMaterial(int stencil)
|
||||
{
|
||||
_maskTexture.material = MaterialDefine.CreateNguiStencilMaskMaterial(stencil);
|
||||
}
|
||||
|
||||
private IEnumerator SetupEffect(string effectName, int stencil, List<string> resourceList)
|
||||
{
|
||||
bool isCompleteMaterialSet = false;
|
||||
List<string> effectAssets = new List<string> { Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D) };
|
||||
yield return Toolbox.ResourcesManager.LoadAssetGroup(effectAssets, delegate
|
||||
{
|
||||
resourceList.AddRange(effectAssets);
|
||||
});
|
||||
_effectObj = EffectUtility.CreateEffect2D(new Effect2dCreateParam
|
||||
{
|
||||
Parent = _effectRoot,
|
||||
EffectName = effectName,
|
||||
ColorCode = null,
|
||||
InitActive = false,
|
||||
MaterialSetEndCallback = delegate
|
||||
{
|
||||
isCompleteMaterialSet = true;
|
||||
},
|
||||
UnloadAssetList = resourceList
|
||||
});
|
||||
while (!isCompleteMaterialSet)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
_effectObj.SetActive(value: true);
|
||||
if (stencil > 0)
|
||||
{
|
||||
ParticleSystemRenderer[] componentsInChildren = _effectObj.GetComponentsInChildren<ParticleSystemRenderer>();
|
||||
foreach (ParticleSystemRenderer obj in componentsInChildren)
|
||||
{
|
||||
obj.sortingOrder = 1;
|
||||
obj.material = new Material(obj.material);
|
||||
}
|
||||
GameMgr.GetIns().GetEffectMgr().ChangeMaskShader(_effectObj, stencil);
|
||||
}
|
||||
float num2 = 1f / _effectObj.transform.localScale.x;
|
||||
Transform[] componentsInChildren2 = _effectObj.GetComponentsInChildren<Transform>();
|
||||
foreach (Transform obj2 in componentsInChildren2)
|
||||
{
|
||||
Vector3 localPosition = obj2.localPosition;
|
||||
localPosition *= num2;
|
||||
obj2.localPosition = localPosition;
|
||||
}
|
||||
_effectObj.SetLayer(base.gameObject.layer, isSetChildren: true);
|
||||
_isCompleteSetup = true;
|
||||
_isChangingPack = false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user