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:
145
SVSim.BattleEngine/Engine/InPlayViewBase.cs
Normal file
145
SVSim.BattleEngine/Engine/InPlayViewBase.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public abstract class InPlayViewBase
|
||||
{
|
||||
protected readonly InPlayCardControl inPlayCardControl;
|
||||
|
||||
protected readonly List<IBattleCardView> battleCardViewList;
|
||||
|
||||
public InPlayViewBase()
|
||||
{
|
||||
}
|
||||
|
||||
public InPlayViewBase(GameObject inPlayGameObject)
|
||||
{
|
||||
inPlayCardControl = new InPlayCardControl(inPlayGameObject);
|
||||
battleCardViewList = new List<IBattleCardView>();
|
||||
}
|
||||
|
||||
protected abstract void RearrangeInplay(float rearrangeTime);
|
||||
|
||||
public VfxBase OneTimeRearrangeInplay(float rearrangeTime)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
rearrangeTime = 0f;
|
||||
}
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
RearrangeInplay(rearrangeTime);
|
||||
});
|
||||
}
|
||||
|
||||
public void AddCardToView(IBattleCardView cardViewToAdd, float deckRearrangeTime)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
deckRearrangeTime = 0f;
|
||||
}
|
||||
if (!battleCardViewList.Contains(cardViewToAdd))
|
||||
{
|
||||
battleCardViewList.Add(cardViewToAdd);
|
||||
RearrangeInplay(deckRearrangeTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCardsToView(List<IBattleCardView> cardViewsToAdd, float deckRearrangeTime)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
deckRearrangeTime = 0f;
|
||||
}
|
||||
List<IBattleCardView> source = cardViewsToAdd.FindAll((IBattleCardView cardView) => !battleCardViewList.Contains(cardView));
|
||||
if (source.Any())
|
||||
{
|
||||
battleCardViewList.AddRange(source.ToList());
|
||||
RearrangeInplay(deckRearrangeTime);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveCardFromView(IBattleCardView cardViewToRemove, float deckRearrangeTime)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
deckRearrangeTime = 0f;
|
||||
}
|
||||
if (battleCardViewList.Remove(cardViewToRemove))
|
||||
{
|
||||
RearrangeInplay(deckRearrangeTime);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void RemoveCardFromView(IBattleCardView cardViewToRemove)
|
||||
{
|
||||
battleCardViewList.Remove(cardViewToRemove);
|
||||
}
|
||||
|
||||
public virtual void RemoveCardsFromView(List<IBattleCardView> cardViewsToRemove, float deckRearrangeTime)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
deckRearrangeTime = 0f;
|
||||
}
|
||||
if (cardViewsToRemove.FindAll((IBattleCardView cardView) => battleCardViewList.Remove(cardView)).Any())
|
||||
{
|
||||
RearrangeInplay(deckRearrangeTime);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual VfxBase CreateRemoveCardsFromViewVfx(List<IBattleCardView> cardViewsToRemove, float deckRearrangeTime)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
RemoveCardsFromView(cardViewsToRemove, deckRearrangeTime);
|
||||
});
|
||||
}
|
||||
|
||||
public void Replacement(IBattleCardView originalView, IBattleCardView newView)
|
||||
{
|
||||
battleCardViewList.Insert(battleCardViewList.IndexOf(originalView), newView);
|
||||
battleCardViewList.RemoveAt(battleCardViewList.IndexOf(originalView));
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
RearrangeInplay(0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
RearrangeInplay(0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
public void AttachCardView(IBattleCardView cardView)
|
||||
{
|
||||
cardView.Transform.parent = inPlayCardControl.transform;
|
||||
}
|
||||
|
||||
public int GetViewIndex(IBattleCardView viewCard)
|
||||
{
|
||||
return battleCardViewList.IndexOf(viewCard);
|
||||
}
|
||||
|
||||
public Vector3 GetPositionInView(IBattleCardView battleCardView, bool isGlobal)
|
||||
{
|
||||
int viewIndex = GetViewIndex(battleCardView);
|
||||
return GetPositionInView(viewIndex, isGlobal);
|
||||
}
|
||||
|
||||
public Vector3 GetPositionInView(int viewIndex, bool isGlobal)
|
||||
{
|
||||
Vector3 vector = inPlayCardControl.GetPosition(viewIndex);
|
||||
if (isGlobal)
|
||||
{
|
||||
vector = inPlayCardControl.transform.TransformPoint(vector);
|
||||
}
|
||||
return vector;
|
||||
}
|
||||
|
||||
public Vector3 GetPositionInOverflowList(int indexInOverflowList, bool isPlayer)
|
||||
{
|
||||
return inPlayCardControl.GetOverflowPosition(indexInOverflowList, isPlayer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user