Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/DegreeHelper.cs
gamer147 957af3d1ec 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.
2026-06-05 17:22:20 -04:00

88 lines
2.6 KiB
C#

using System;
using System.Collections.Generic;
using Cute;
using UnityEngine;
namespace Wizard;
public class DegreeHelper
{
public enum DegreeType
{
SMALL,
MIDDLE
}
private static ResourcesManager.AssetLoadPathType GetResourceType(DegreeType type)
{
if (type == DegreeType.SMALL)
{
return ResourcesManager.AssetLoadPathType.Degree_S;
}
return ResourcesManager.AssetLoadPathType.Degree_M;
}
private static ResourcesManager.AssetLoadPathType GetMaterialType(DegreeType type)
{
if (type == DegreeType.SMALL)
{
return ResourcesManager.AssetLoadPathType.DegreeMaterial_S;
}
return ResourcesManager.AssetLoadPathType.DegreeMaterial_M;
}
public static List<string> GetDegreeResourceList(long id, DegreeType type, bool isFetch)
{
List<string> list = new List<string>();
list.Add(GetDegreePath(id, type, isFetch));
if (Data.Master.DegreeMgr.Get((int)id).IsPremium)
{
list.Add(GetDegreeMaterialPath(id, type, isFetch));
list.Add(GetMaskPath(id, isFetch));
}
return list;
}
private static string GetDegreePath(long id, DegreeType type, bool isFetch)
{
return Toolbox.ResourcesManager.GetAssetTypePath(id.ToString("0000"), GetResourceType(type), isFetch);
}
private static string GetDegreeMaterialPath(long id, DegreeType type, bool isFetch)
{
return Toolbox.ResourcesManager.GetAssetTypePath(id.ToString("0000"), GetMaterialType(type), isFetch);
}
private static string GetMaskPath(long id, bool isFetch)
{
return Toolbox.ResourcesManager.GetAssetTypePath(id.ToString("0000"), ResourcesManager.AssetLoadPathType.DegreeMask, isFetch);
}
public static void InitializeDegree(UITexture texture, long id, DegreeType type)
{
string degreePath = GetDegreePath(id, type, isFetch: true);
texture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(degreePath);
if (Data.Master.DegreeMgr.Get((int)id).IsPremium)
{
string degreeMaterialPath = GetDegreeMaterialPath(id, type, isFetch: true);
texture.material = Toolbox.ResourcesManager.LoadObject<Material>(degreeMaterialPath);
Texture value = Toolbox.ResourcesManager.LoadObject<Texture>(GetMaskPath(id, isFetch: true));
texture.material.SetTexture("_MaskTex", value);
}
else
{
texture.material = null;
}
}
public static void LoadInstant(UITexture texture, long id, DegreeType type, Action<List<string>> onFinish)
{
List<string> path = GetDegreeResourceList(id, type, isFetch: false);
UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupSync(path, delegate
{
InitializeDegree(texture, id, type);
onFinish(path);
}));
}
}