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:
@@ -0,0 +1,532 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Player.ClassCharacter;
|
||||
|
||||
public class Class3dCharacterBase : ClassCharacterBase
|
||||
{
|
||||
protected Material _class3DMaterial;
|
||||
|
||||
private Camera _norCamera;
|
||||
|
||||
private Camera _evoCamera;
|
||||
|
||||
protected GameObject _root;
|
||||
|
||||
protected Charactor3dInformation _charaInfo;
|
||||
|
||||
private Effect3dInformation _effectInfo;
|
||||
|
||||
private ClassCharaPrm.MotionType _currentMotion = ClassCharaPrm.MotionType.idle;
|
||||
|
||||
protected List<int> _idleStateHash = new List<int>();
|
||||
|
||||
private readonly Vector3 PP_PANEL_POSITION = new Vector3(0f, -34.22f, -29.25f);
|
||||
|
||||
private readonly Vector3 WIDGET_POSITION = new Vector3(0f, 490f, 30f);
|
||||
|
||||
private readonly int WIDGET_OFFSET_TOP = -1162;
|
||||
|
||||
private readonly int WIDGET_OFFSET_BOTTOM = 195;
|
||||
|
||||
private readonly string IDLE_NAME = "Base Layer.idle";
|
||||
|
||||
protected int _classCharacterId = 3604;
|
||||
|
||||
public bool IsPlayer = true;
|
||||
|
||||
protected const int RENDER_QUEUE = 2999;
|
||||
|
||||
protected override Vector3 MessagePosition => _initPosition + new Vector3(0f, -0.3f, 0f);
|
||||
|
||||
public override VfxBase CreateLoadResouceVfx()
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(LoadResouceVfx());
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
private VfxBase LoadResouceVfx()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
int num = (IsPlayer ? dataMgr.GetPlayerSkinId() : dataMgr.GetEnemySkinId());
|
||||
if (_classCharacterId != num)
|
||||
{
|
||||
_classCharacterId = num;
|
||||
}
|
||||
ClassCharacterMasterData charaPrmByCharaId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(_classCharacterId);
|
||||
GameObject gobj = new ClassCardCreator(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath(charaPrmByCharaId.path, ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true))).LoadRootObject();
|
||||
GameObject gameObject = NGUITools.AddChild(BattleManagerBase.GetIns().Battle3DContainer);
|
||||
gameObject.name = "ClassCharacterRoot";
|
||||
GameObject gameObject2 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, gameObject);
|
||||
SetUpAnchor(gameObject);
|
||||
AttachOtherUI(gameObject);
|
||||
GameObject gameObject3 = gameObject2.transform.Find("ClassObj").gameObject;
|
||||
GameObject gameObject4 = gameObject2.transform.Find("Collider").gameObject;
|
||||
base.GameObject = gameObject2;
|
||||
base.GameObject.tag = GetTagName();
|
||||
base.GameObject.transform.localPosition = GetPosition();
|
||||
_initPosition = base.GameObject.transform.position;
|
||||
gameObject3.transform.localScale = Global.CLASS_BATTLE_SCALE;
|
||||
gameObject3.tag = GetTagName();
|
||||
gameObject4.tag = GetTagName();
|
||||
Transform transform = gameObject3.transform.Find("Class");
|
||||
transform.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_uma_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true));
|
||||
MotionUtils.SetLayerAll(transform.gameObject, 15);
|
||||
Transform child = transform.transform.GetChild(0);
|
||||
child.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_uma_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true));
|
||||
MotionUtils.SetLayerAll(child.gameObject, 10);
|
||||
RenderTextureFormat lutFormat = GetLutFormat();
|
||||
RenderTexture renderTexture = new RenderTexture(2048, 2048, 1, lutFormat);
|
||||
Shader shader = Shader.Find("UI/Default");
|
||||
_class3DMaterial = new Material(shader);
|
||||
_class3DMaterial.name = "ClassEvolveMaterial";
|
||||
_class3DMaterial.mainTexture = renderTexture;
|
||||
Material source = new Material(Shader.Find("Custom/ModelShaderBattle"))
|
||||
{
|
||||
name = "ClassFlameMaterial",
|
||||
mainTexture = renderTexture
|
||||
};
|
||||
_root = new GameObject();
|
||||
_root.name = (IsPlayer ? "Player3DChara" : "Enemy3DChara");
|
||||
Transform transform2 = _root.transform;
|
||||
transform2.localPosition = Vector3.zero;
|
||||
float width = (float)Screen.width / (float)Screen.height;
|
||||
_norCamera = new GameObject
|
||||
{
|
||||
name = "Player3DCamera"
|
||||
}.AddComponent<Camera>();
|
||||
_norCamera.backgroundColor = new Color(0f, 0f, 0f, 0f);
|
||||
_norCamera.nearClipPlane = 1f;
|
||||
_norCamera.farClipPlane = 40f;
|
||||
_norCamera.fieldOfView = 33f;
|
||||
_norCamera.transform.parent = transform2;
|
||||
_norCamera.targetTexture = renderTexture;
|
||||
_norCamera.cullingMask = 1;
|
||||
_norCamera.transform.localPosition = new Vector3(0f, 0.09718f, -3.338f);
|
||||
_norCamera.transform.localEulerAngles = new Vector3(2.5f, 0f, 0f);
|
||||
Class3dPostImageEffect class3dPostImageEffect = null;
|
||||
if (IsPlayer)
|
||||
{
|
||||
GameObject gameObject5 = new GameObject
|
||||
{
|
||||
name = "Evo3DCamera"
|
||||
};
|
||||
_evoCamera = gameObject5.AddComponent<Camera>();
|
||||
_evoCamera.backgroundColor = new Color(0f, 0f, 0f, 0f);
|
||||
_evoCamera.nearClipPlane = 1f;
|
||||
_evoCamera.farClipPlane = 40f;
|
||||
_evoCamera.fieldOfView = 21f;
|
||||
_evoCamera.rect = new Rect(0f, 0f, width, 1f);
|
||||
_evoCamera.transform.parent = transform2;
|
||||
_evoCamera.allowMSAA = false;
|
||||
_evoCamera.depth = 30f;
|
||||
_evoCamera.cullingMask = 1;
|
||||
_evoCamera.clearFlags = CameraClearFlags.Depth;
|
||||
_evoCamera.gameObject.SetActive(value: false);
|
||||
_evoCamera.transform.localPosition = new Vector3(0f, 0.12f, 0f);
|
||||
_evoCamera.transform.localEulerAngles = new Vector3(2.5f, 0f, 0f);
|
||||
class3dPostImageEffect = gameObject5.AddComponent<Class3dPostImageEffect>();
|
||||
class3dPostImageEffect.Initialize();
|
||||
}
|
||||
GameObject gameObject6 = null;
|
||||
gameObject6 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(_classCharacterId.ToString(), ResourcesManager.AssetLoadPathType.ClassChara3D, isfetch: true)), transform2) as GameObject;
|
||||
_effectInfo = gameObject6.GetComponent<Effect3dInformation>();
|
||||
_charaInfo = gameObject6.GetComponent<Charactor3dInformation>();
|
||||
_charaInfo.InitializeMesh(this, class3dPostImageEffect);
|
||||
_charaInfo.Quad.SetLayer(15, isSetChildren: true);
|
||||
Transform transform3 = _charaInfo.Quad.transform;
|
||||
transform3.transform.parent = transform.parent;
|
||||
float y = (IsPlayer ? 0.2f : (-0.41f));
|
||||
transform3.localPosition = new Vector3(0f, y, -0.35f);
|
||||
float y2 = (IsPlayer ? 5.7f : 6.1725f);
|
||||
transform3.localScale = new Vector3(5.7f, y2, 1f);
|
||||
Vector3 battleCameraPos = BattleManagerBase.GetIns().Camera.BattleCameraPos;
|
||||
battleCameraPos.x = transform3.position.x;
|
||||
transform3.LookAt(battleCameraPos);
|
||||
MeshRenderer component = _charaInfo.Quad.GetComponent<MeshRenderer>();
|
||||
component.sharedMaterial = new Material(source);
|
||||
component.sharedMaterial.renderQueue = 2999;
|
||||
CardTemplate cardTemplate = gameObject2.AddComponent<CardTemplate>();
|
||||
cardTemplate.CardWrapObjTemp = gameObject3;
|
||||
cardTemplate.Collider = gameObject4.GetComponent<BoxCollider>();
|
||||
Transform transform4 = transform.transform;
|
||||
transform4.localRotation = ConvertBackPanelRotation(transform4.localRotation);
|
||||
GameObject gameObject7 = gameObject3.transform.Find("Shield").gameObject;
|
||||
gameObject7.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true));
|
||||
gameObject7.GetComponent<MeshRenderer>().sharedMaterial = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true));
|
||||
gameObject7.GetComponent<MeshRenderer>().sharedMaterial.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true));
|
||||
gameObject7.transform.localPosition = GetShieldPosition();
|
||||
gameObject7.transform.localScale = new Vector3(1.5f, 1.5f, 1f);
|
||||
GameMgr.GetIns().GetEffectMgr().SetParticleShader(gameObject7);
|
||||
MeshRenderer component2 = transform.GetComponent<MeshRenderer>();
|
||||
MeshRenderer component3 = child.GetComponent<MeshRenderer>();
|
||||
Material material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_uma_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)) as Material;
|
||||
if (material != null)
|
||||
{
|
||||
material.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_uma_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture, isfetch: true));
|
||||
}
|
||||
CardCreatorBase.SetupClassMaterialToCenterCharacterMesh(component2, component3, new Material(Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath(GetTextureName(), ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)))
|
||||
{
|
||||
mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(((int)charaPrmByCharaId.ClassColorId).ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaEncampment, isfetch: true))
|
||||
}, material);
|
||||
gameObject7.SetActive(value: true);
|
||||
SBattleLoad sBattleLoad = BattleManagerBase.GetIns().SBattleLoad;
|
||||
GameObject gameObject8 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_class_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), BattleManagerBase.GetIns().Battle3DContainer);
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(gameObject8, null, isBattle: true, isField: true);
|
||||
gameObject8.transform.parent = gameObject3.transform;
|
||||
gameObject8.transform.localPosition = new Vector3(0f, 0.1f, 0.15f);
|
||||
gameObject8.transform.localRotation = GetMaskImageRotation();
|
||||
gameObject8.transform.localScale = new Vector3(6.4f, 6.4f, 20.48f);
|
||||
gameObject8.SetActive(value: false);
|
||||
cardTemplate.FrameEffectNormal = gameObject8;
|
||||
GameObject gameObject9 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(sBattleLoad.LifePoolIcon, BattleManagerBase.GetIns().Battle3DContainer);
|
||||
gameObject9.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
gameObject9.transform.parent = gameObject7.transform;
|
||||
gameObject9.transform.localPosition = GetLifeIconPosition();
|
||||
gameObject3.transform.localScale = new Vector3(80f, 80f, 25f);
|
||||
gameObject4.transform.localScale = new Vector3(80f, 80f, 25f);
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(0);
|
||||
(cardTemplate.LifeLabelTemp = gameObject9.transform.Find("LifeLabel").GetComponent<UILabel>()).text = cardParameterFromId.Life.ToString();
|
||||
SpriteRenderer spriteRenderer = new GameObject().AddComponent<SpriteRenderer>();
|
||||
spriteRenderer.sprite = Toolbox.ResourcesManager.LoadObject<Sprite>(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_uma_mask", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true));
|
||||
Material material2 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("mt_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)));
|
||||
material2.SetInt("_Stencil", GetStencil());
|
||||
spriteRenderer.material = material2;
|
||||
spriteRenderer.transform.parent = gameObject3.transform;
|
||||
spriteRenderer.transform.localPosition = GetMaskImagePosition();
|
||||
spriteRenderer.transform.localScale = Vector3.one * 0.46f;
|
||||
spriteRenderer.gameObject.SetLayer(15, isSetChildren: true);
|
||||
spriteRenderer.sortingOrder = GetMaskSortingOrder();
|
||||
spriteRenderer.name = "SpineMask";
|
||||
spriteRenderer.transform.localRotation = GetMaskImageRotation();
|
||||
GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EmotionMessage");
|
||||
_emotionLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EmotionMessage"));
|
||||
_emotionLabel.transform.Find("Scale").GetComponent<UIPanel>().depth = GetEmoteLabelDepth();
|
||||
_emotionLabel.SetActive(value: false);
|
||||
GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EnvironmentMessage");
|
||||
_enviromentLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EnvironmentMessage"));
|
||||
_enviromentLabel.SetActive(value: false);
|
||||
base.GameObject.SetActive(value: false);
|
||||
});
|
||||
}
|
||||
|
||||
private RenderTextureFormat GetLutFormat()
|
||||
{
|
||||
RenderTextureFormat renderTextureFormat = RenderTextureFormat.ARGB32;
|
||||
if (!IsRenderTextureFormatSupportedForLinearFiltering(renderTextureFormat))
|
||||
{
|
||||
renderTextureFormat = RenderTextureFormat.ARGB64;
|
||||
if (!IsRenderTextureFormatSupportedForLinearFiltering(renderTextureFormat))
|
||||
{
|
||||
renderTextureFormat = RenderTextureFormat.ARGBHalf;
|
||||
}
|
||||
if (!IsRenderTextureFormatSupportedForLinearFiltering(renderTextureFormat))
|
||||
{
|
||||
Debug.LogError("RenderTexture not Supported.");
|
||||
}
|
||||
}
|
||||
return renderTextureFormat;
|
||||
}
|
||||
|
||||
private static bool IsRenderTextureFormatSupportedForLinearFiltering(RenderTextureFormat format)
|
||||
{
|
||||
return SystemInfo.IsFormatSupported(GraphicsFormatUtility.GetGraphicsFormat(format, RenderTextureReadWrite.Linear), FormatUsage.Linear);
|
||||
}
|
||||
|
||||
public void EnableEvolve(bool enable)
|
||||
{
|
||||
_charaInfo.Quad.SetActive(!enable);
|
||||
_evoCamera.gameObject.SetActive(enable);
|
||||
}
|
||||
|
||||
public override void PlayMotion(ClassCharaPrm.MotionType motionType)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery || !_isAnimation)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_currentMotion = motionType;
|
||||
Animator[] animators = _charaInfo.Animators;
|
||||
foreach (Animator animator in animators)
|
||||
{
|
||||
if (_currentMotion == ClassCharaPrm.MotionType.damage || motionType == ClassCharaPrm.MotionType.damage)
|
||||
{
|
||||
animator.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString());
|
||||
string trigger = ClassCharaPrm.MotionType.damage.ToString();
|
||||
animator.SetTrigger(trigger);
|
||||
}
|
||||
else if (animator.GetCurrentAnimatorStateInfo(0).IsName(IDLE_NAME))
|
||||
{
|
||||
animator.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString());
|
||||
animator.SetTrigger(motionType.ToString());
|
||||
_effectInfo.PlayEffect(motionType);
|
||||
}
|
||||
else
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(WaitMotionEnd(animator, motionType));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ResetMotion()
|
||||
{
|
||||
_currentMotion = ClassCharaPrm.MotionType.idle;
|
||||
Animator[] animators = _charaInfo.Animators;
|
||||
foreach (Animator obj in animators)
|
||||
{
|
||||
obj.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString());
|
||||
obj.SetTrigger(ClassCharaPrm.MotionType.idle.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator WaitMotionEnd(Animator animator, ClassCharaPrm.MotionType motionType)
|
||||
{
|
||||
animator.SetTrigger(ClassCharaPrm.MotionType.idle.ToString());
|
||||
_currentMotion = ClassCharaPrm.MotionType.idle;
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
animator.ResetTrigger(ClassCharaPrm.MotionType.idle.ToString());
|
||||
animator.SetTrigger(motionType.ToString());
|
||||
_effectInfo.PlayEffect(motionType);
|
||||
}
|
||||
|
||||
public override bool IsAnimationEnable()
|
||||
{
|
||||
return _isAnimation;
|
||||
}
|
||||
|
||||
protected override string GetTagName()
|
||||
{
|
||||
return "Enemy";
|
||||
}
|
||||
|
||||
protected override Quaternion ConvertBackPanelRotation(Quaternion originalRotation)
|
||||
{
|
||||
return Quaternion.Euler(0f, -180f, 180f);
|
||||
}
|
||||
|
||||
protected override Vector3 GetPosition()
|
||||
{
|
||||
return Global.CLASS_BATTLE_POSITION_ENEMY;
|
||||
}
|
||||
|
||||
protected override void SetUpAnchor(GameObject o)
|
||||
{
|
||||
o.transform.localPosition = WIDGET_POSITION;
|
||||
UIWidget uIWidget = o.AddComponent<UIWidget>();
|
||||
uIWidget.topAnchor.relative = 1f;
|
||||
uIWidget.topAnchor.absolute = WIDGET_OFFSET_TOP;
|
||||
Transform target = BattleManagerBase.GetIns().Battle3DContainer.transform.Find("Camera");
|
||||
uIWidget.topAnchor.target = target;
|
||||
uIWidget.bottomAnchor.target = target;
|
||||
uIWidget.bottomAnchor.relative = 0.5f;
|
||||
uIWidget.bottomAnchor.absolute = WIDGET_OFFSET_BOTTOM;
|
||||
}
|
||||
|
||||
protected override void AttachOtherUI(GameObject o)
|
||||
{
|
||||
BattleManagerBase.GetIns().BattleEnemy.BattleView.EpPanel.transform.parent = o.transform;
|
||||
EnemyStatusPanelControl enemyStatusPanelControl = BattleManagerBase.GetIns().BattleEnemy.StatusPanelControl as EnemyStatusPanelControl;
|
||||
if ((bool)enemyStatusPanelControl)
|
||||
{
|
||||
enemyStatusPanelControl.ChangePPPanelParent(o.transform, PP_PANEL_POSITION);
|
||||
}
|
||||
}
|
||||
|
||||
public override Vector3 GetSpinePosition()
|
||||
{
|
||||
return new Vector3(0f, -0.36f, 0.17f);
|
||||
}
|
||||
|
||||
public override Vector3 GetMaskImagePosition()
|
||||
{
|
||||
return new Vector3(0f, 0.04f, 0f);
|
||||
}
|
||||
|
||||
protected override Vector3 GetShieldPosition()
|
||||
{
|
||||
return new Vector3(1.86f, 0.48f, 0f);
|
||||
}
|
||||
|
||||
protected override Vector3 GetLifeIconPosition()
|
||||
{
|
||||
return new Vector3(0f, 0f, 0.1f);
|
||||
}
|
||||
|
||||
protected override string GetTextureName()
|
||||
{
|
||||
return "mt_Encampment_Chara_1_Rev";
|
||||
}
|
||||
|
||||
public override Quaternion GetMaskImageRotation()
|
||||
{
|
||||
return Quaternion.Euler(new Vector3(0f, 0f, 180f));
|
||||
}
|
||||
|
||||
public override Vector3 ConvertSpineScale(Vector3 originalScale)
|
||||
{
|
||||
return originalScale;
|
||||
}
|
||||
|
||||
protected int GetSpineSortingOrder()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected int GetMaskSortingOrder()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected override int GetEmoteLabelDepth()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected override int GetCharaId()
|
||||
{
|
||||
return GameMgr.GetIns().GetDataMgr().GetEnemyCharaId();
|
||||
}
|
||||
|
||||
public override int GetSkinId()
|
||||
{
|
||||
return GameMgr.GetIns().GetDataMgr().GetEnemySkinId();
|
||||
}
|
||||
|
||||
public override int GetStencil()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override void SetAnimationEnable(bool enable)
|
||||
{
|
||||
_isAnimation = enable;
|
||||
if (enable)
|
||||
{
|
||||
PlayMotion(ClassCharaPrm.MotionType.idle);
|
||||
SetAnimatorSpeed(1f);
|
||||
return;
|
||||
}
|
||||
Animator[] animators = _charaInfo.Animators;
|
||||
for (int i = 0; i < animators.Length; i++)
|
||||
{
|
||||
animators[i].Play(ClassCharaPrm.MotionType.idle.ToString(), -1, 0f);
|
||||
}
|
||||
SetAnimatorSpeed(0f);
|
||||
}
|
||||
|
||||
private void SetAnimatorSpeed(float speed)
|
||||
{
|
||||
Animator[] animators = _charaInfo.Animators;
|
||||
for (int i = 0; i < animators.Length; i++)
|
||||
{
|
||||
animators[i].speed = speed;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetCurrentClipTime()
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public override bool GetCurrentClipIsName(ClassCharaPrm.MotionType motionType)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override IEnumerator WaitReturnFrame()
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public override void OutFrame()
|
||||
{
|
||||
}
|
||||
|
||||
public override int GetSpineSortingOrder(bool isBack = false)
|
||||
{
|
||||
if (!isBack)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return -9;
|
||||
}
|
||||
|
||||
public override int GetMaskSortingOrder(bool isBack = false)
|
||||
{
|
||||
if (!isBack)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return -9;
|
||||
}
|
||||
|
||||
public override void SetTrigger(string str)
|
||||
{
|
||||
}
|
||||
|
||||
public override IEnumerator WaitChangeFace(ClassCharaPrm.FaceType faceType)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public override IEnumerator WaitMotionEnd()
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
public override void ChangeFace(ClassCharaPrm.FaceType faceType)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ClearResourceObject()
|
||||
{
|
||||
if (_class3DMaterial != null)
|
||||
{
|
||||
Object.Destroy(_class3DMaterial);
|
||||
_class3DMaterial = null;
|
||||
}
|
||||
if (_norCamera != null && _norCamera.targetTexture != null)
|
||||
{
|
||||
_norCamera.targetTexture.Release();
|
||||
_norCamera.targetTexture = null;
|
||||
}
|
||||
if (_effectInfo != null)
|
||||
{
|
||||
_effectInfo.DestroyEffect();
|
||||
_effectInfo = null;
|
||||
}
|
||||
if (_charaInfo != null)
|
||||
{
|
||||
_charaInfo.Destroy();
|
||||
_charaInfo = null;
|
||||
}
|
||||
if (_root != null)
|
||||
{
|
||||
Object.Destroy(_root);
|
||||
_root = null;
|
||||
}
|
||||
Toolbox.ResourcesManager.RemoveAsset(Toolbox.ResourcesManager.GetAssetTypePath(_classCharacterId.ToString(), ResourcesManager.AssetLoadPathType.ClassChara3D));
|
||||
}
|
||||
|
||||
public override ClassCharaPrm.MotionType GetMotion()
|
||||
{
|
||||
return _currentMotion;
|
||||
}
|
||||
|
||||
public override bool IsNoEvolveShift()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsOpponentReverse()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.Sound;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Player.ClassCharacter;
|
||||
|
||||
public abstract class ClassCharacterBase : IClassCharacter
|
||||
{
|
||||
protected const float ENEMY_ORTHO_SCALE_X = 0.934f;
|
||||
|
||||
protected Vector3 _initPosition;
|
||||
|
||||
private LeaderSoundManager _leaderSoundManager;
|
||||
|
||||
protected bool _isAnimation;
|
||||
|
||||
protected GameObject _emotionLabel;
|
||||
|
||||
protected GameObject _enviromentLabel;
|
||||
|
||||
protected abstract Vector3 MessagePosition { get; }
|
||||
|
||||
public GameObject GameObject { get; protected set; }
|
||||
|
||||
public bool IsWaiting { get; private set; }
|
||||
|
||||
public bool IsRecovery { get; private set; }
|
||||
|
||||
protected ClassCharacterBase()
|
||||
{
|
||||
_leaderSoundManager = new LeaderSoundManager();
|
||||
}
|
||||
|
||||
public abstract VfxBase CreateLoadResouceVfx();
|
||||
|
||||
public abstract void ClearResourceObject();
|
||||
|
||||
public abstract void PlayMotion(ClassCharaPrm.MotionType motionType);
|
||||
|
||||
public abstract void ResetMotion();
|
||||
|
||||
public abstract void SetTrigger(string str);
|
||||
|
||||
public abstract IEnumerator WaitMotionEnd();
|
||||
|
||||
public abstract void ChangeFace(ClassCharaPrm.FaceType faceType);
|
||||
|
||||
public abstract IEnumerator WaitChangeFace(ClassCharaPrm.FaceType faceType);
|
||||
|
||||
public abstract void SetAnimationEnable(bool enable);
|
||||
|
||||
public abstract bool IsAnimationEnable();
|
||||
|
||||
public VfxBase CreateLoadVoiceResource(string voiceId)
|
||||
{
|
||||
OpeningVfx.OpenningLogStep = "CreateLoadVoiceResource " + voiceId;
|
||||
return _leaderSoundManager.CreateLoadResouceVfx(voiceId);
|
||||
}
|
||||
|
||||
public VfxBase PlayVoice(string voiceId, bool forcePlay = false)
|
||||
{
|
||||
OpeningVfx.OpenningLogStep = "PlayVoice " + voiceId;
|
||||
return _leaderSoundManager.CreatePlayVfx(voiceId, forcePlay);
|
||||
}
|
||||
|
||||
public VfxBase PlaySkinEvolveSe(string skinId, string suffix)
|
||||
{
|
||||
OpeningVfx.OpenningLogStep = "PlaySe " + skinId + suffix;
|
||||
return _leaderSoundManager.CreateLoadAndPlayEvolveSeVfx(skinId, suffix);
|
||||
}
|
||||
|
||||
public VfxBase ShowVoiceMessage(string text)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
if (GameMgr.GetIns().IsWatchBattle)
|
||||
{
|
||||
if (GameMgr.GetIns().GetDataMgr().Is3DSkin(isPlayer: true))
|
||||
{
|
||||
_emotionLabel.layer = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
_emotionLabel.SetLayer(24, isSetChildren: true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_emotionLabel.layer = 24;
|
||||
}
|
||||
_emotionLabel.SetActive(value: true);
|
||||
_emotionLabel.transform.Find("Scale/MessageLabel").GetComponent<UILabel>().text = text;
|
||||
_emotionLabel.transform.position = MessagePosition;
|
||||
});
|
||||
}
|
||||
|
||||
public VfxBase HideVoiceMessage()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
_emotionLabel.SetActive(value: false);
|
||||
});
|
||||
}
|
||||
|
||||
public VfxBase SetWaiting(bool flag)
|
||||
{
|
||||
IsWaiting = flag;
|
||||
return UpdateEnviromentMessage();
|
||||
}
|
||||
|
||||
public VfxBase SetRecovery(bool flag)
|
||||
{
|
||||
IsRecovery = flag;
|
||||
return UpdateEnviromentMessage();
|
||||
}
|
||||
|
||||
public VfxBase ResetStatusInfo()
|
||||
{
|
||||
IsRecovery = false;
|
||||
IsWaiting = false;
|
||||
return UpdateEnviromentMessage();
|
||||
}
|
||||
|
||||
public VfxBase UpdateEnviromentMessage()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
if (_enviromentLabel != null)
|
||||
{
|
||||
_enviromentLabel.layer = LayerMask.NameToLayer("FrontUI");
|
||||
string text = string.Empty;
|
||||
if (IsRecovery)
|
||||
{
|
||||
text = Data.SystemText.Get("Battle_0473");
|
||||
}
|
||||
else if (IsWaiting)
|
||||
{
|
||||
text = Data.SystemText.Get("Battle_0445");
|
||||
}
|
||||
_enviromentLabel.SetActive(text != string.Empty);
|
||||
_enviromentLabel.transform.Find("Scale/MessageLabel").GetComponent<UILabel>().text = text;
|
||||
_enviromentLabel.transform.position = MessagePosition;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract void OutFrame();
|
||||
|
||||
public void IntoFrame()
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(WaitReturnFrame());
|
||||
}
|
||||
|
||||
protected abstract IEnumerator WaitReturnFrame();
|
||||
|
||||
public abstract float GetCurrentClipTime();
|
||||
|
||||
public abstract bool GetCurrentClipIsName(ClassCharaPrm.MotionType motionType);
|
||||
|
||||
protected abstract string GetTagName();
|
||||
|
||||
protected abstract Quaternion ConvertBackPanelRotation(Quaternion originalRotation);
|
||||
|
||||
protected abstract Vector3 GetPosition();
|
||||
|
||||
protected abstract void SetUpAnchor(GameObject o);
|
||||
|
||||
protected abstract void AttachOtherUI(GameObject o);
|
||||
|
||||
public abstract Vector3 GetSpinePosition();
|
||||
|
||||
public abstract Vector3 GetMaskImagePosition();
|
||||
|
||||
protected abstract Vector3 GetShieldPosition();
|
||||
|
||||
protected abstract Vector3 GetLifeIconPosition();
|
||||
|
||||
protected abstract string GetTextureName();
|
||||
|
||||
public abstract Quaternion GetMaskImageRotation();
|
||||
|
||||
public abstract Vector3 ConvertSpineScale(Vector3 originalScale);
|
||||
|
||||
public abstract int GetSpineSortingOrder(bool isBack = false);
|
||||
|
||||
public abstract int GetMaskSortingOrder(bool isBack = false);
|
||||
|
||||
protected abstract int GetEmoteLabelDepth();
|
||||
|
||||
protected abstract int GetCharaId();
|
||||
|
||||
public abstract int GetSkinId();
|
||||
|
||||
public abstract int GetStencil();
|
||||
|
||||
public abstract ClassCharaPrm.MotionType GetMotion();
|
||||
|
||||
public abstract bool IsNoEvolveShift();
|
||||
|
||||
public abstract bool IsOpponentReverse();
|
||||
}
|
||||
@@ -0,0 +1,447 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using Spine;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.Resource;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
namespace Wizard.Battle.Player.ClassCharacter;
|
||||
|
||||
public abstract class HighRankSpineClassCharacter : ClassCharacterBase
|
||||
{
|
||||
public const string EFFECT_FILE_PATH = "Jpn/Effect/Effects/";
|
||||
|
||||
protected readonly float ScreenWidthFraction = 0.5f;
|
||||
|
||||
protected readonly float ScreenHeightFraction = 0.05f;
|
||||
|
||||
public SpineObject _backSpineObject;
|
||||
|
||||
public SpineObject _frontSpineObject;
|
||||
|
||||
private ClassCharaPrm.MotionType _currentMotion = ClassCharaPrm.MotionType.idle;
|
||||
|
||||
public List<HighRankEffectInfo> EvolveEffects = new List<HighRankEffectInfo>();
|
||||
|
||||
public bool IsEvolveSkin { get; private set; }
|
||||
|
||||
protected override Vector3 MessagePosition => UIManager.GetInstance().getCamera().ScreenToWorldPoint(new Vector3((float)Screen.width * ScreenWidthFraction, (float)Screen.height * ScreenHeightFraction, 0f));
|
||||
|
||||
public HighRankSpineClassCharacter()
|
||||
{
|
||||
}
|
||||
|
||||
public static Vector3 BoneWorldToGlobalPosConsiderRotate(Bone _bone, Transform _position, Vector3 _lossyScale)
|
||||
{
|
||||
return _position.position + Quaternion.Euler(_position.eulerAngles) * (Vector3.Scale(new Vector3(_bone.WorldX, _bone.WorldY, 0f), _lossyScale) - Vector3.Scale(_position.localPosition, _position.lossyScale));
|
||||
}
|
||||
|
||||
public IEnumerator TrackTarget(bool isFront, GameObject effect, Vector3 absolutePosition, bool _followX = true, bool _followY = true, Bone bone = null, bool trackRotation = false, Transform traskScale = null, float _coefficient = 1f)
|
||||
{
|
||||
GameObject spine = (isFront ? _frontSpineObject._spineObject : _backSpineObject._spineObject);
|
||||
Transform transform = effect.transform;
|
||||
Vector3 baseLocalScale = transform.localScale;
|
||||
while (this != null && !(spine == null) && !(transform == null))
|
||||
{
|
||||
if (_followX && _followY)
|
||||
{
|
||||
transform.position = BoneWorldToGlobalPosConsiderRotate(bone, spine.transform, spine.transform.lossyScale);
|
||||
}
|
||||
else if (!_followX)
|
||||
{
|
||||
Vector3 position = transform.position;
|
||||
position.y = BoneWorldToGlobalPosConsiderRotate(bone, spine.transform, spine.transform.lossyScale).y;
|
||||
transform.position = position;
|
||||
}
|
||||
else if (!_followY)
|
||||
{
|
||||
Vector3 position2 = transform.position;
|
||||
position2.x = BoneWorldToGlobalPosConsiderRotate(bone, spine.transform, spine.transform.lossyScale).x;
|
||||
transform.position = position2;
|
||||
}
|
||||
if (trackRotation && bone != null)
|
||||
{
|
||||
float num = (((bone.Skeleton.ScaleX < 0f) ^ (bone.Skeleton.ScaleY < 0f) ^ (spine.transform.localScale.x < 0f)) ? (-1f) : 1f);
|
||||
Vector3 eulerAngles = transform.localRotation.eulerAngles;
|
||||
transform.localRotation = Quaternion.Euler(eulerAngles.x, eulerAngles.y, bone.WorldRotationX * num);
|
||||
}
|
||||
if (traskScale != null)
|
||||
{
|
||||
transform.localScale = Vector3.Scale(baseLocalScale * _coefficient, traskScale.localScale);
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsEvolveMotion(ClassCharaPrm.MotionType motionType)
|
||||
{
|
||||
if (motionType == ClassCharaPrm.MotionType.extra || (uint)(motionType - 15) <= 2u)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsOpponentEvolveMotion(ClassCharaPrm.MotionType motionType)
|
||||
{
|
||||
if ((uint)(motionType - 18) <= 2u)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void PlayMotion(ClassCharaPrm.MotionType motionType)
|
||||
{
|
||||
if ((BattleManagerBase.GetIns() != null && BattleManagerBase.GetIns().IsRecovery) || (_frontSpineObject._animator == null && _backSpineObject._animator == null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!_isAnimation)
|
||||
{
|
||||
if (!IsEvolveSkin)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool num = IsEvolveMotion(motionType);
|
||||
bool flag = IsOpponentEvolveMotion(motionType);
|
||||
if (num || flag)
|
||||
{
|
||||
_currentMotion = motionType;
|
||||
if (_frontSpineObject._animator != null)
|
||||
{
|
||||
Animator animator = _frontSpineObject._animator;
|
||||
animator.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, animator.GetCurrentAnimatorStateInfo(0).normalizedTime);
|
||||
}
|
||||
if (_backSpineObject._animator != null)
|
||||
{
|
||||
Animator animator2 = _backSpineObject._animator;
|
||||
animator2.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, animator2.GetCurrentAnimatorStateInfo(0).normalizedTime);
|
||||
}
|
||||
}
|
||||
else if (motionType == ClassCharaPrm.MotionType.z_idle && _currentMotion != motionType)
|
||||
{
|
||||
_currentMotion = motionType;
|
||||
if (_frontSpineObject._animator != null)
|
||||
{
|
||||
_frontSpineObject._animator.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, 0f);
|
||||
}
|
||||
if (_backSpineObject._animator != null)
|
||||
{
|
||||
_backSpineObject._animator.Play(ClassCharaPrm.MotionType.z_idle.ToString(), 0, 0f);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
_currentMotion = motionType;
|
||||
bool isEvolve = IsEvolveMotion(motionType);
|
||||
if (_frontSpineObject._animator != null && !isEvolve)
|
||||
{
|
||||
_frontSpineObject._animator.SetTrigger(motionType.ToString());
|
||||
}
|
||||
if (_backSpineObject._animator != null && !isEvolve)
|
||||
{
|
||||
_backSpineObject._animator.SetTrigger(motionType.ToString());
|
||||
}
|
||||
BattleCoroutine.GetInstance().StartCoroutine(WaitMotionEnd());
|
||||
if (isEvolve)
|
||||
{
|
||||
float normalizedTime = 1f / _frontSpineObject._animator.GetCurrentAnimatorClipInfo(0)[0].clip.frameRate;
|
||||
if (_frontSpineObject._animator != null)
|
||||
{
|
||||
_frontSpineObject._animator.Play(motionType.ToString(), 0, normalizedTime);
|
||||
}
|
||||
if (_backSpineObject._animator != null)
|
||||
{
|
||||
_backSpineObject._animator.Play(motionType.ToString(), 0, normalizedTime);
|
||||
}
|
||||
}
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
new BattleResourceMgr();
|
||||
}
|
||||
else
|
||||
{
|
||||
_ = BattleManagerBase.GetIns().BattleResourceMgr;
|
||||
}
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
Transform effectTransform = ((_frontSpineObject._spineObject != null) ? _frontSpineObject._spineObject.transform : _backSpineObject._spineObject.transform);
|
||||
foreach (HighRankEffectInfo effect in EvolveEffects)
|
||||
{
|
||||
if (!effect.IsEffectMotion(motionType) || !(effect.Prefab != ""))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Object original = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effect.Prefab, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true));
|
||||
EffectBattle effObject = (Object.Instantiate(original) as GameObject).AddComponent<EffectBattle>();
|
||||
effObject.gameObject.SetActive(value: false);
|
||||
if (!isEvolve)
|
||||
{
|
||||
effObject.transform.SetParent(_frontSpineObject._skeletonMecanim.transform);
|
||||
}
|
||||
SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create();
|
||||
if (BattleManagerBase.GetIns() != null)
|
||||
{
|
||||
if (Global.PreLoadSkinId.Contains(GetSkinId()) && this is PlayerHighRankSpineClassCharacter)
|
||||
{
|
||||
sequentialVfxPlayer2.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().SetOnlyUIParticleShader(effObject.gameObject);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
sequentialVfxPlayer2.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(effObject.gameObject, delegate
|
||||
{
|
||||
}, isBattle: true);
|
||||
}));
|
||||
}
|
||||
}
|
||||
if (effect.Delay > 0)
|
||||
{
|
||||
sequentialVfxPlayer2.Register(WaitVfx.Create((float)effect.Delay / 30f));
|
||||
}
|
||||
sequentialVfxPlayer2.Register(new DelaySetupVfx(() => new SkinEffectVfx(() => effObject, effectTransform, effect.Layer, isEvolve)));
|
||||
if (effect.TargetBoneName != "")
|
||||
{
|
||||
sequentialVfxPlayer2.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(TrackTarget(isFront: true, effObject.gameObject, Vector3.zero, _followX: true, _followY: true, _frontSpineObject._skeletonMecanim.Skeleton.FindBone(effect.TargetBoneName)));
|
||||
}));
|
||||
}
|
||||
parallelVfxPlayer.Register(sequentialVfxPlayer2);
|
||||
}
|
||||
sequentialVfxPlayer.Register(parallelVfxPlayer);
|
||||
if (BattleManagerBase.GetIns() != null)
|
||||
{
|
||||
BattleManagerBase.GetIns().VfxMgr.RegisterImmediateVfx(sequentialVfxPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ResetMotion()
|
||||
{
|
||||
_currentMotion = ClassCharaPrm.MotionType.idle;
|
||||
if (_frontSpineObject._animator != null)
|
||||
{
|
||||
_frontSpineObject._animator.Play(ClassCharaPrm.MotionType.idle.ToString(), 0, 0f);
|
||||
}
|
||||
if (_backSpineObject._animator != null)
|
||||
{
|
||||
_backSpineObject._animator.Play(ClassCharaPrm.MotionType.idle.ToString(), 0, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public override ClassCharaPrm.MotionType GetMotion()
|
||||
{
|
||||
return _currentMotion;
|
||||
}
|
||||
|
||||
private void Load()
|
||||
{
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
ClassCharacterMasterData charaPrmByCharaId = dataMgr.GetCharaPrmByCharaId(GetCharaId());
|
||||
bool isPlayer = this is PlayerHighRankSpineClassCharacter;
|
||||
IsEvolveSkin = dataMgr.IsEvolveSkin(isPlayer);
|
||||
GameObject gobj = new ClassCardCreator(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath(charaPrmByCharaId.path, ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true))).LoadRootObject();
|
||||
int skinId = GetSkinId();
|
||||
GameObject gameObject = NGUITools.AddChild(BattleManagerBase.GetIns().Battle3DContainer);
|
||||
gameObject.name = "ClassCharacterRoot";
|
||||
GameObject gameObject2 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, gameObject);
|
||||
SetUpAnchor(gameObject);
|
||||
AttachOtherUI(gameObject);
|
||||
GameObject gameObject3 = gameObject2.transform.Find("ClassObj").gameObject;
|
||||
GameObject gameObject4 = gameObject2.transform.Find("Collider").gameObject;
|
||||
base.GameObject = gameObject2;
|
||||
base.GameObject.tag = GetTagName();
|
||||
base.GameObject.transform.localPosition = GetPosition();
|
||||
_initPosition = base.GameObject.transform.position;
|
||||
gameObject3.transform.localScale = Global.CLASS_BATTLE_SCALE;
|
||||
gameObject3.tag = GetTagName();
|
||||
gameObject4.tag = GetTagName();
|
||||
Transform transform = gameObject3.transform.Find("Class");
|
||||
transform.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_" + skinId + "_Base", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true));
|
||||
MotionUtils.SetLayerAll(transform.gameObject, 15);
|
||||
Transform child = transform.transform.GetChild(0);
|
||||
child.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_" + skinId + "_Outside", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true));
|
||||
MotionUtils.SetLayerAll(child.gameObject, 10);
|
||||
CardTemplate cardTemplate = gameObject2.AddComponent<CardTemplate>();
|
||||
cardTemplate.CardWrapObjTemp = gameObject3;
|
||||
cardTemplate.Collider = gameObject4.GetComponent<BoxCollider>();
|
||||
Transform transform2 = transform.transform;
|
||||
transform2.localRotation = ConvertBackPanelRotation(transform2.localRotation);
|
||||
GameObject gameObject5 = gameObject3.transform.Find("Shield").gameObject;
|
||||
gameObject5.GetComponent<MeshFilter>().sharedMesh = Toolbox.ResourcesManager.LoadObject<Mesh>(Toolbox.ResourcesManager.GetAssetTypePath("md_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMesh, isfetch: true));
|
||||
gameObject5.GetComponent<MeshRenderer>().sharedMaterial = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true));
|
||||
gameObject5.GetComponent<MeshRenderer>().sharedMaterial.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_Shield", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true));
|
||||
gameObject5.transform.localPosition = GetShieldPosition();
|
||||
gameObject5.transform.localScale = new Vector3(1.5f, 1.5f, 1f);
|
||||
GameMgr.GetIns().GetEffectMgr().SetParticleShader(gameObject5);
|
||||
MeshRenderer component = transform.GetComponent<MeshRenderer>();
|
||||
MeshRenderer component2 = child.GetComponent<MeshRenderer>();
|
||||
Material material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("mt_Encampment_" + skinId + "_Frame", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)) as Material;
|
||||
if (material != null)
|
||||
{
|
||||
material.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath("tx_Encampment_" + skinId + "_Frame", ResourcesManager.AssetLoadPathType.ClassCharaFrameTexture, isfetch: true));
|
||||
}
|
||||
Material material2 = Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath(GetTextureName(), ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true));
|
||||
material2.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(((int)charaPrmByCharaId.ClassColorId).ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaEncampment, isfetch: true));
|
||||
CardCreatorBase.SetupClassMaterialToCenterCharacterMesh(component, component2, material2, material);
|
||||
gameObject5.SetActive(value: true);
|
||||
SBattleLoad sBattleLoad = BattleManagerBase.GetIns().SBattleLoad;
|
||||
GameObject gameObject6 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath("cmn_frame_class_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)), BattleManagerBase.GetIns().Battle3DContainer);
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(gameObject6, null, isBattle: true, isField: true);
|
||||
gameObject6.transform.parent = gameObject3.transform;
|
||||
gameObject6.transform.localPosition = new Vector3(0f, 0.1f, 0.15f);
|
||||
gameObject6.transform.localRotation = GetMaskImageRotation();
|
||||
gameObject6.transform.localScale = new Vector3(6.4f, 6.4f, 20.48f);
|
||||
gameObject6.SetActive(value: false);
|
||||
cardTemplate.FrameEffectNormal = gameObject6;
|
||||
GameObject gameObject7 = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(sBattleLoad.LifePoolIcon, BattleManagerBase.GetIns().Battle3DContainer);
|
||||
gameObject7.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
||||
gameObject7.transform.parent = gameObject5.transform;
|
||||
gameObject7.transform.localPosition = GetLifeIconPosition();
|
||||
gameObject3.transform.localScale = new Vector3(80f, 80f, 25f);
|
||||
gameObject4.transform.localScale = new Vector3(80f, 80f, 25f);
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(0);
|
||||
(cardTemplate.LifeLabelTemp = gameObject7.transform.Find("LifeLabel").GetComponent<UILabel>()).text = cardParameterFromId.Life.ToString();
|
||||
_frontSpineObject = new SpineObject();
|
||||
_frontSpineObject.LoadAndSet(skinId.ToString(), this, gameObject3.transform);
|
||||
_backSpineObject = new SpineObject();
|
||||
_backSpineObject.LoadAndSet(skinId.ToString(), this, gameObject3.transform, isBack: true);
|
||||
string key = "class_" + skinId;
|
||||
if (Data.Master.HighRankEffect.ContainsKey(key))
|
||||
{
|
||||
EvolveEffects = Data.Master.HighRankEffect[key];
|
||||
}
|
||||
GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EmotionMessage");
|
||||
_emotionLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EmotionMessage"));
|
||||
_emotionLabel.transform.Find("Scale").GetComponent<UIPanel>().depth = GetEmoteLabelDepth();
|
||||
_emotionLabel.SetActive(value: false);
|
||||
GameMgr.GetIns().GetPrefabMgr().Load("UI/Battle/EnvironmentMessage");
|
||||
_enviromentLabel = NGUITools.AddChild(BattleManagerBase.GetIns().BtlUIContainer, GameMgr.GetIns().GetPrefabMgr().Get("UI/Battle/EnvironmentMessage"));
|
||||
_enviromentLabel.SetActive(value: false);
|
||||
base.GameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public override VfxBase CreateLoadResouceVfx()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
Load();
|
||||
});
|
||||
}
|
||||
|
||||
public override void ClearResourceObject()
|
||||
{
|
||||
if (_frontSpineObject != null)
|
||||
{
|
||||
_frontSpineObject.Clear();
|
||||
}
|
||||
if (_backSpineObject != null)
|
||||
{
|
||||
_backSpineObject.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerator WaitReturnFrame()
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(_backSpineObject.WaitReturnFrame(GetSpinePosition(), isHighRank: true));
|
||||
yield return _frontSpineObject.WaitReturnFrame(GetSpinePosition(), isHighRank: true);
|
||||
}
|
||||
|
||||
public override void OutFrame()
|
||||
{
|
||||
if (_isAnimation)
|
||||
{
|
||||
_frontSpineObject.OutFrame(isHighRank: true);
|
||||
_backSpineObject.OutFrame(isHighRank: true);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetTrigger(string str)
|
||||
{
|
||||
_frontSpineObject._animator.SetTrigger(str);
|
||||
_backSpineObject._animator.SetTrigger(str);
|
||||
}
|
||||
|
||||
public override IEnumerator WaitChangeFace(ClassCharaPrm.FaceType faceType)
|
||||
{
|
||||
yield return null;
|
||||
string faceStr = faceType.ToString();
|
||||
_frontSpineObject.WaitChangeFace(faceStr);
|
||||
_backSpineObject.WaitChangeFace(faceStr);
|
||||
}
|
||||
|
||||
public override void SetAnimationEnable(bool enable)
|
||||
{
|
||||
bool isAnimation = _isAnimation;
|
||||
_isAnimation = enable;
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
bool isPlayer = this is PlayerHighRankSpineClassCharacter;
|
||||
bool isEvolved = false;
|
||||
if (ins != null)
|
||||
{
|
||||
isEvolved = ins.GetBattlePlayer(isPlayer).IsSkinEvolved;
|
||||
}
|
||||
_frontSpineObject.SetAnimationEnable(_isAnimation, isAnimation, IsEvolveSkin, isEvolved);
|
||||
_backSpineObject.SetAnimationEnable(_isAnimation, isAnimation, IsEvolveSkin, isEvolved);
|
||||
}
|
||||
|
||||
public override bool IsAnimationEnable()
|
||||
{
|
||||
return _isAnimation;
|
||||
}
|
||||
|
||||
public override IEnumerator WaitMotionEnd()
|
||||
{
|
||||
yield return null;
|
||||
float num = 0f;
|
||||
if (_frontSpineObject._animator != null)
|
||||
{
|
||||
num = ((!GetCurrentClipIsName(ClassCharaPrm.MotionType.idle)) ? _frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).length : (_frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).length * 0.5f));
|
||||
}
|
||||
num -= Time.deltaTime * 2f;
|
||||
yield return new WaitForSeconds(num);
|
||||
ChangeFace(ClassCharaPrm.FaceType.skin_01);
|
||||
}
|
||||
|
||||
public override void ChangeFace(ClassCharaPrm.FaceType faceType)
|
||||
{
|
||||
if (BattleManagerBase.GetIns() != null && !BattleManagerBase.GetIns().IsRecovery && _isAnimation && !(_frontSpineObject._skeletonMecanim == null))
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(WaitChangeFace(faceType));
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetCurrentClipTime()
|
||||
{
|
||||
if (_frontSpineObject._animator == null)
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
return _frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).length;
|
||||
}
|
||||
|
||||
public override bool GetCurrentClipIsName(ClassCharaPrm.MotionType motionType)
|
||||
{
|
||||
if (_frontSpineObject._animator == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _frontSpineObject._animator.GetCurrentAnimatorStateInfo(0).IsName(motionType.ToString());
|
||||
}
|
||||
|
||||
public override bool IsNoEvolveShift()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsOpponentReverse()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using Spine;
|
||||
using Spine.Unity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard.Battle.Player.ClassCharacter;
|
||||
|
||||
public class SpineObject
|
||||
{
|
||||
protected readonly string ANIMATION_TRANSFORM_NAME = "AnimationTransform";
|
||||
|
||||
public const float SPINE_CORRECTION_SCALE = 1.003125f;
|
||||
|
||||
public const float SPINE_ORTHO_SCALE_Y = 1.1207f;
|
||||
|
||||
protected readonly Vector3 SPINE_DEFAULT_SCALE = new Vector3(6.4f, 6.4f, 20.48f) * 1.003125f;
|
||||
|
||||
protected readonly Vector3 SPINE_EVOLVE_ROTATION = new Vector3(-29f, 0f, 0f);
|
||||
|
||||
protected readonly Vector3 OUT_OF_FRAME_POSITION = new Vector3(3f, 2f, -6f);
|
||||
|
||||
public static readonly Vector3 BILLBOARD_ROTATE = new Vector3(-12f, 0f, 0f);
|
||||
|
||||
public static readonly Vector3 BILLBOARD_ROTATE_REVERSE_VERTICAL = new Vector3(-12f, 0f, 180f);
|
||||
|
||||
protected readonly Vector3 BILLBOARD_ROTATE_EVOLVE = new Vector3(-29f, 0f, 0f);
|
||||
|
||||
protected readonly Vector3 SPINE_EVOLVE_SCALE = new Vector3(5.8f, 6.5f, 20.48f) * 1.003125f;
|
||||
|
||||
public static readonly Vector3 OPPONENT_MECANIM_POSITION = new Vector3(0f, -0.2f, 0f);
|
||||
|
||||
public GameObject _spineObject;
|
||||
|
||||
protected Transform _animationTransform;
|
||||
|
||||
protected SpriteRenderer _maskOutSprite;
|
||||
|
||||
protected Material _spineMaterial;
|
||||
|
||||
protected Material _maskMaterial;
|
||||
|
||||
protected Vector3 _spineEvolveScale;
|
||||
|
||||
protected ClassCharacterBase _character;
|
||||
|
||||
public SkeletonMecanim _skeletonMecanim { get; private set; }
|
||||
|
||||
public Animator _animator { get; private set; }
|
||||
|
||||
public SpriteRenderer _maskSprite { get; protected set; }
|
||||
|
||||
public bool IsBack { get; private set; }
|
||||
|
||||
public bool IsNoEvolveShift { get; private set; }
|
||||
|
||||
public bool IsOpponentReverse { get; private set; }
|
||||
|
||||
private string MaskTextureName(string skinId)
|
||||
{
|
||||
if (_character is HighRankSpineClassCharacter)
|
||||
{
|
||||
return "tx_Encampment_" + skinId + "_mask";
|
||||
}
|
||||
if (Global.IsSnCollabSkin(int.Parse(skinId)))
|
||||
{
|
||||
return "tx_Encampment_sn_mask";
|
||||
}
|
||||
return "tx_encampment_mask";
|
||||
}
|
||||
|
||||
private void SetMaterialInfo(MeshRenderer meshRenderer, int stencil)
|
||||
{
|
||||
_spineMaterial = Object.Instantiate(meshRenderer.material);
|
||||
_spineMaterial.SetInt("_Stencil", stencil);
|
||||
meshRenderer.material = _spineMaterial;
|
||||
for (int i = 0; i < meshRenderer.materials.Length; i++)
|
||||
{
|
||||
Material material = meshRenderer.materials[i];
|
||||
if (material != null && material.GetInt("_Stencil") != stencil)
|
||||
{
|
||||
meshRenderer.materials[i] = Object.Instantiate(material);
|
||||
meshRenderer.materials[i].SetInt("_Stencil", stencil);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadAndSetTest(string skinId, ClassCharacterBase character, Transform wrapObject, bool isBack = false)
|
||||
{
|
||||
_spineObject = null;
|
||||
_character = character;
|
||||
IsBack = isBack;
|
||||
IsNoEvolveShift = _character.IsNoEvolveShift();
|
||||
GameObject gameObject = Resources.Load<GameObject>("Jpn/Ui/ClassChar/Prefab/class_" + skinId);
|
||||
if (!(gameObject != null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
_maskSprite = new GameObject().AddComponent<SpriteRenderer>();
|
||||
_maskSprite.sprite = Resources.Load<Sprite>("Jpn/Ui/ClassChar/Textures/" + MaskTextureName(skinId));
|
||||
_maskMaterial = Object.Instantiate(Resources.Load<Material>("Jpn/Ui/ClassChar/Materials/mt_encampment_mask"));
|
||||
_maskMaterial.SetInt("_Stencil", character.GetStencil());
|
||||
_maskSprite.material = _maskMaterial;
|
||||
_maskSprite.transform.parent = wrapObject;
|
||||
_maskSprite.transform.localPosition = character.GetMaskImagePosition();
|
||||
_maskSprite.transform.localScale = Vector3.one * 0.46f;
|
||||
_maskSprite.gameObject.layer = 15;
|
||||
_maskSprite.sortingOrder = character.GetMaskSortingOrder(IsBack);
|
||||
_maskSprite.name = "SpineMask";
|
||||
_maskSprite.transform.localRotation = character.GetMaskImageRotation();
|
||||
_maskOutSprite = new GameObject().AddComponent<SpriteRenderer>();
|
||||
_maskOutSprite.sprite = Resources.Load<Sprite>("Jpn/Ui/ClassChar/Textures/tx_encampment_mask_out");
|
||||
_maskOutSprite.material = _maskMaterial;
|
||||
_maskOutSprite.transform.parent = wrapObject;
|
||||
_maskOutSprite.transform.localPosition = character.GetMaskImagePosition();
|
||||
_maskOutSprite.transform.localScale = new Vector3(30f, 30f, 1f);
|
||||
_maskOutSprite.gameObject.layer = 10;
|
||||
_maskOutSprite.sortingOrder = character.GetMaskSortingOrder(IsBack);
|
||||
_maskOutSprite.name = "SpineMaskOut";
|
||||
_maskOutSprite.gameObject.SetActive(value: false);
|
||||
if (character is HighRankSpineClassCharacter)
|
||||
{
|
||||
GameObject gameObject2 = null;
|
||||
foreach (Transform item in gameObject.transform)
|
||||
{
|
||||
if (item.gameObject.name == (IsBack ? "back" : "front"))
|
||||
{
|
||||
gameObject2 = item.gameObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(gameObject2 != null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
gameObject = gameObject2;
|
||||
}
|
||||
_spineObject = Object.Instantiate(gameObject);
|
||||
_animationTransform = _spineObject.transform.Find(ANIMATION_TRANSFORM_NAME);
|
||||
Transform transform2 = _spineObject.transform;
|
||||
MotionUtils.SetLayerAll(_spineObject, 15);
|
||||
transform2.parent = wrapObject;
|
||||
transform2.localPosition = character.GetSpinePosition();
|
||||
transform2.localScale = character.ConvertSpineScale(transform2.localScale);
|
||||
transform2.localEulerAngles = GetDefaultRotate();
|
||||
_skeletonMecanim = transform2.GetComponentInChildren<SkeletonMecanim>();
|
||||
if (IsOpponentReverse)
|
||||
{
|
||||
_skeletonMecanim.transform.localPosition = OPPONENT_MECANIM_POSITION;
|
||||
}
|
||||
MeshRenderer component = _skeletonMecanim.GetComponent<MeshRenderer>();
|
||||
component.sortingOrder = character.GetSpineSortingOrder(IsBack);
|
||||
_animator = transform2.GetComponentInChildren<Animator>();
|
||||
_animator.speed = 1f;
|
||||
SetMaterialInfo(component, character.GetStencil());
|
||||
_spineEvolveScale = new Vector3(SPINE_DEFAULT_SCALE.x * Mathf.Abs(_animationTransform.localScale.x), SPINE_DEFAULT_SCALE.y * Mathf.Abs(_animationTransform.localScale.y) * 1.1207f, SPINE_DEFAULT_SCALE.z * Mathf.Abs(_animationTransform.localScale.z)) * 1.3f;
|
||||
}
|
||||
|
||||
public void LoadAndSet(string skinId, ClassCharacterBase character, Transform wrapObject, bool isBack = false)
|
||||
{
|
||||
IsBack = isBack;
|
||||
_character = character;
|
||||
IsNoEvolveShift = _character.IsNoEvolveShift();
|
||||
IsOpponentReverse = _character.IsOpponentReverse();
|
||||
_maskSprite = new GameObject().AddComponent<SpriteRenderer>();
|
||||
_maskSprite.sprite = Toolbox.ResourcesManager.LoadObject<Sprite>(Toolbox.ResourcesManager.GetAssetTypePath(MaskTextureName(skinId), ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true));
|
||||
_maskMaterial = Object.Instantiate(Toolbox.ResourcesManager.LoadObject<Material>(Toolbox.ResourcesManager.GetAssetTypePath("mt_encampment_mask", ResourcesManager.AssetLoadPathType.ClassCharaMaterial, isfetch: true)));
|
||||
_maskMaterial.SetInt("_Stencil", character.GetStencil());
|
||||
_maskSprite.material = _maskMaterial;
|
||||
_maskSprite.transform.parent = wrapObject;
|
||||
_maskSprite.transform.localPosition = character.GetMaskImagePosition();
|
||||
_maskSprite.transform.localScale = Vector3.one * 0.46f;
|
||||
_maskSprite.gameObject.layer = 15;
|
||||
_maskSprite.sortingOrder = character.GetMaskSortingOrder(IsBack);
|
||||
_maskSprite.name = "SpineMask";
|
||||
_maskSprite.transform.localRotation = character.GetMaskImageRotation();
|
||||
_maskOutSprite = new GameObject().AddComponent<SpriteRenderer>();
|
||||
_maskOutSprite.sprite = Toolbox.ResourcesManager.LoadObject<Sprite>(Toolbox.ResourcesManager.GetAssetTypePath("tx_encampment_mask_out", ResourcesManager.AssetLoadPathType.ClassCharaTexture, isfetch: true));
|
||||
_maskOutSprite.material = _maskMaterial;
|
||||
_maskOutSprite.transform.parent = wrapObject;
|
||||
_maskOutSprite.transform.localPosition = character.GetMaskImagePosition();
|
||||
_maskOutSprite.transform.localScale = new Vector3(30f, 30f, 1f);
|
||||
_maskOutSprite.gameObject.layer = 10;
|
||||
_maskOutSprite.sortingOrder = character.GetMaskSortingOrder(IsBack);
|
||||
_maskOutSprite.name = "SpineMaskOut";
|
||||
_maskOutSprite.gameObject.SetActive(value: false);
|
||||
_spineObject = null;
|
||||
GameObject gameObject = Toolbox.ResourcesManager.LoadObject<GameObject>(Toolbox.ResourcesManager.GetAssetTypePath(skinId, ResourcesManager.AssetLoadPathType.ClassCharaSpine, isfetch: true));
|
||||
if (!(gameObject != null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (character is HighRankSpineClassCharacter)
|
||||
{
|
||||
GameObject gameObject2 = null;
|
||||
foreach (Transform item in gameObject.transform)
|
||||
{
|
||||
if (item.gameObject.name == (IsBack ? "back" : "front"))
|
||||
{
|
||||
gameObject2 = item.gameObject;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!(gameObject2 != null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
gameObject = gameObject2;
|
||||
}
|
||||
_spineObject = Object.Instantiate(gameObject);
|
||||
_animationTransform = _spineObject.transform.Find(ANIMATION_TRANSFORM_NAME);
|
||||
MotionUtils.SetLayerAll(_spineObject, 15);
|
||||
Transform transform2 = _spineObject.transform;
|
||||
transform2.parent = wrapObject;
|
||||
transform2.localPosition = character.GetSpinePosition();
|
||||
transform2.localScale = character.ConvertSpineScale(transform2.localScale);
|
||||
transform2.localEulerAngles = GetDefaultRotate();
|
||||
_skeletonMecanim = transform2.GetComponentInChildren<SkeletonMecanim>();
|
||||
if (IsOpponentReverse)
|
||||
{
|
||||
_skeletonMecanim.transform.localPosition = OPPONENT_MECANIM_POSITION;
|
||||
}
|
||||
MeshRenderer component = _skeletonMecanim.GetComponent<MeshRenderer>();
|
||||
component.sortingOrder = character.GetSpineSortingOrder(IsBack);
|
||||
_animator = transform2.GetComponentInChildren<Animator>();
|
||||
_animator.speed = 1f;
|
||||
SetMaterialInfo(component, character.GetStencil());
|
||||
_spineEvolveScale = new Vector3(SPINE_DEFAULT_SCALE.x * Mathf.Abs(_animationTransform.localScale.x), SPINE_DEFAULT_SCALE.y * Mathf.Abs(_animationTransform.localScale.y) * 1.1207f, SPINE_DEFAULT_SCALE.z * Mathf.Abs(_animationTransform.localScale.z)) * 1.3f;
|
||||
}
|
||||
|
||||
private Vector3 GetDefaultRotate()
|
||||
{
|
||||
if (!IsOpponentReverse)
|
||||
{
|
||||
return BILLBOARD_ROTATE;
|
||||
}
|
||||
return BILLBOARD_ROTATE_REVERSE_VERTICAL;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
if (_spineObject != null)
|
||||
{
|
||||
Object.Destroy(_spineObject);
|
||||
}
|
||||
_spineObject = null;
|
||||
_skeletonMecanim = null;
|
||||
_animator = null;
|
||||
_spineMaterial = null;
|
||||
_maskMaterial = null;
|
||||
}
|
||||
|
||||
public void WaitChangeFace(string faceStr)
|
||||
{
|
||||
if (_skeletonMecanim != null)
|
||||
{
|
||||
_ = _skeletonMecanim.skeleton;
|
||||
if (_skeletonMecanim.skeleton.Data.Skins.Any((Skin a) => a.Name == faceStr))
|
||||
{
|
||||
_skeletonMecanim.skeleton.SetSkin(faceStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OutFrame(bool isHighRank)
|
||||
{
|
||||
if (_maskOutSprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_maskOutSprite.gameObject.SetActive(value: true);
|
||||
if (!(_spineObject != null))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (isHighRank)
|
||||
{
|
||||
_maskOutSprite.gameObject.layer = 13;
|
||||
_spineObject.layer = 13;
|
||||
_skeletonMecanim.gameObject.layer = 13;
|
||||
if (_character is PlayerHighRankSpineClassCharacter)
|
||||
{
|
||||
iTween.RotateTo(_spineObject, iTween.Hash("rotation", BILLBOARD_ROTATE_EVOLVE, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.ScaleTo(_spineObject, iTween.Hash("scale", SPINE_EVOLVE_SCALE, "time", 0.3f, "easetype", iTween.EaseType.easeOutExpo));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (_skeletonMecanim != null)
|
||||
{
|
||||
_spineObject.layer = 10;
|
||||
_skeletonMecanim.gameObject.layer = 10;
|
||||
_skeletonMecanim.gameObject.GetComponent<MeshRenderer>().sortingOrder = 1000;
|
||||
_maskOutSprite.sortingOrder = 1000;
|
||||
}
|
||||
if (IsNoEvolveShift)
|
||||
{
|
||||
_maskOutSprite.gameObject.layer = 13;
|
||||
_spineObject.layer = 13;
|
||||
_skeletonMecanim.gameObject.layer = 13;
|
||||
return;
|
||||
}
|
||||
iTween.MoveTo(_spineObject, iTween.Hash("position", OUT_OF_FRAME_POSITION + _animationTransform.localPosition, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.ScaleTo(_spineObject, iTween.Hash("scale", _spineEvolveScale, "time", 0.3f, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.RotateTo(_spineObject, iTween.Hash("rotation", SPINE_EVOLVE_ROTATION, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
}
|
||||
|
||||
public void SetAnimationEnable(bool isAnimation, bool previous, bool isEvolveSkin = false, bool isEvolved = false)
|
||||
{
|
||||
if (_animator == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (isEvolveSkin)
|
||||
{
|
||||
if (previous != isAnimation)
|
||||
{
|
||||
_animator.Play(((!isEvolved) ? ClassCharaPrm.MotionType.idle : ClassCharaPrm.MotionType.z_idle).ToString(), 0, 0f);
|
||||
}
|
||||
_animator.speed = (isAnimation ? 1 : 0);
|
||||
return;
|
||||
}
|
||||
_animator.gameObject.SetActive(value: false);
|
||||
_animator.gameObject.SetActive(value: true);
|
||||
if (isAnimation)
|
||||
{
|
||||
_animator.enabled = true;
|
||||
return;
|
||||
}
|
||||
_animator.enabled = false;
|
||||
string faceStr = ClassCharaPrm.FaceType.skin_01.ToString();
|
||||
if (_skeletonMecanim.skeleton.Data.Skins.Any((Skin a) => a.Name == faceStr))
|
||||
{
|
||||
_skeletonMecanim.skeleton.SetSkin(faceStr);
|
||||
}
|
||||
_skeletonMecanim.skeleton.Update(Time.deltaTime);
|
||||
}
|
||||
|
||||
public IEnumerator WaitReturnFrame(Vector3 position, bool isHighRank)
|
||||
{
|
||||
if (_spineObject != null && !IsNoEvolveShift)
|
||||
{
|
||||
if (!isHighRank)
|
||||
{
|
||||
iTween.MoveTo(_spineObject, iTween.Hash("position", position, "time", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
|
||||
}
|
||||
iTween.ScaleTo(_spineObject, iTween.Hash("scale", SPINE_DEFAULT_SCALE, "time", isHighRank ? 0.24f : 0.3f, "easetype", iTween.EaseType.easeInExpo));
|
||||
iTween.RotateTo(_spineObject, iTween.Hash("rotation", GetDefaultRotate(), "time", isHighRank ? 0.24f : 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
|
||||
}
|
||||
yield return new WaitForSeconds(isHighRank ? 0.3f : 0.33f);
|
||||
if (!IsNoEvolveShift)
|
||||
{
|
||||
SetDefaultLayer(isHighRank);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetDefaultLayer(bool isHighRank)
|
||||
{
|
||||
if (_spineObject != null)
|
||||
{
|
||||
if (isHighRank || IsNoEvolveShift)
|
||||
{
|
||||
_maskOutSprite.gameObject.layer = 10;
|
||||
}
|
||||
_spineObject.layer = 15;
|
||||
_skeletonMecanim.gameObject.layer = 15;
|
||||
}
|
||||
if (_skeletonMecanim != null)
|
||||
{
|
||||
_skeletonMecanim.gameObject.GetComponent<MeshRenderer>().sortingOrder = _character.GetSpineSortingOrder(IsBack);
|
||||
_maskOutSprite.sortingOrder = _character.GetMaskSortingOrder(IsBack);
|
||||
_maskSprite.sortingOrder = _character.GetMaskSortingOrder(IsBack);
|
||||
}
|
||||
if (_maskOutSprite != null)
|
||||
{
|
||||
_maskOutSprite.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user