Files
SVSimServer/SVSim.BattleEngine/Engine/Wizard/GatheringRuleView.cs
gamer147 0455ff649e feat(battle-engine): EffectType full enum + collection/card/vfx extension copies
Replaces partial EffectMgr.EffectType with all 226 decomp values; copies the
IsNotNullOrEmpty/EquelsID/FindFromCardId/GetAllFuncVfxResults extension files +
UI extensions; adds Renderer/MeshFilter shared-material/mesh/sortingOrder. Compile
loop then closed the revealed deps (3242 files). 9.1k -> 18 errors.
2026-06-05 20:38:56 -04:00

151 lines
4.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Cute;
using UnityEngine;
using Wizard.RoomMatch;
namespace Wizard;
public class GatheringRuleView : MonoBehaviour
{
[SerializeField]
private UILabel _baseType;
[SerializeField]
private UILabel _baseRule;
[SerializeField]
private UILabel _memberCount;
[SerializeField]
private UILabel _ownerName;
[SerializeField]
private UILabel _ownerIsEntryBattle;
[SerializeField]
private UILabel _ownerWatchBattle;
[SerializeField]
private UILabel _timeTitle;
[SerializeField]
private UILabel _startTime;
[SerializeField]
private UILabel _endTime;
[SerializeField]
private UILabel _battlePeriodLabel;
[SerializeField]
private UILabel _battlePeriodLabelSingleLine;
[SerializeField]
private UILabel _isDeckEntryLabel;
[SerializeField]
private GameObject _isDeckEntryRoot;
[SerializeField]
private UILabel _id;
[SerializeField]
private UserPlateBase _ownerPlate;
private List<string> _loadResourcePath = new List<string>();
public void SetGatheringInfo(GatheringInfo info)
{
SystemText systemText = Data.SystemText;
SetRule(info.Rule, info.CurrentMemberCount);
if (_baseType != null)
{
_baseType.text = GatheringUtility.GetGatheringTypeString(info);
}
if (_id != null)
{
_id.text = info.Id;
}
if (_ownerName != null)
{
_ownerName.text = info.OwnerInfo.Name;
}
if (_timeTitle != null)
{
_timeTitle.text = (info.Rule.IsTournament ? systemText.Get("Gathering_0009") : systemText.Get("Gathering_0012"));
}
if (_startTime != null)
{
_startTime.text = info.BattleStartTime;
}
if (_endTime != null)
{
_endTime.text = info.FinishTime;
}
if (_battlePeriodLabel != null && !info.Rule.IsTournament)
{
_battlePeriodLabel.text = systemText.Get("Gathering_Information_0005", info.BattleStartTime, info.FinishTime);
}
if (_battlePeriodLabelSingleLine != null && !info.Rule.IsTournament)
{
_battlePeriodLabelSingleLine.text = systemText.Get("Gathering_Information_0014", info.BattleStartTime, info.FinishTime);
}
if (_ownerWatchBattle != null)
{
switch (info.Rule.WatchSetting)
{
case GatheringRule.eWatchSetting.ALL_MEMBER:
_ownerWatchBattle.text = systemText.Get("Gathering_0016");
break;
case GatheringRule.eWatchSetting.OWNER_ONLY:
_ownerWatchBattle.text = systemText.Get("Gathering_0015");
break;
case GatheringRule.eWatchSetting.NONE:
_ownerWatchBattle.text = systemText.Get("Gathering_0017");
break;
}
}
List<string> loadResourceList = info.OwnerInfo.GetUserAssetPathList().Except(_loadResourcePath).ToList();
UIManager.GetInstance().StartCoroutine(LoadResource(info, loadResourceList));
}
private void OnDestroy()
{
Toolbox.ResourcesManager.RemoveAssetGroup(_loadResourcePath);
_loadResourcePath.Clear();
}
private IEnumerator LoadResource(GatheringInfo info, List<string> loadResourceList)
{
yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadResourceList, delegate
{
_loadResourcePath.AddRange(loadResourceList);
}));
if (_ownerPlate != null)
{
_ownerPlate.InitializeSimplePlate(info.OwnerInfo);
}
}
private void SetRule(GatheringRule rule, int memberCount)
{
SystemText systemText = Data.SystemText;
_baseRule.text = RoomRuleSetting.GetWinTypeString(rule.BattleParameterInstance.Rule) + " " + FormatBehaviorManager.GetFormatName(rule.BattleParameterInstance.DeckFormat);
_memberCount.text = systemText.Get("Gathering_Information_0003", memberCount.ToString(), rule.MaxMember.ToString());
if (_ownerIsEntryBattle != null)
{
_ownerIsEntryBattle.text = (rule.IsOwnerEntryBattle ? systemText.Get("Gathering_Information_0008") : systemText.Get("Gathering_Information_0009"));
}
if (_isDeckEntryRoot != null)
{
_isDeckEntryRoot.SetActive(!rule.IsTournament);
}
if (_isDeckEntryLabel != null)
{
_isDeckEntryLabel.text = (rule.IsEntryDeckOnly ? systemText.Get("Gathering_Information_0022") : systemText.Get("Gathering_Information_0023"));
}
}
}