feat(battle-engine): full-surface app-type god-object/manager stubs (1692->1586 true)
Make the minimal hand shims partial + generate full member surface for the manager/ task/controller god-objects (LoadingViewManager/DeckUpdateTask/MyPageTask/ReplayController/ PlayerControllerForWatching/WatchDataHandler/EvolutionTouchProcessor/StoryChapterSelection Utility/NonDialogPopup). NonDialogPopup given MonoBehaviour base + hand Close() removed (superseded by full surface). LoadTask dup deleted (already copied verbatim). RoomMatch watch/replay closure types stubbed. Copied 8 more closure files. CS0246-in-generated-signature masking note: 4 such errors were hiding ~1582 — generated CS0246 masks as hard as header CS0246; the real frontier is 1586 (CS7036 base-ctor + member-level), 0 structural. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
399
SVSim.BattleEngine/Engine/LoadingDownLoad.cs
Normal file
399
SVSim.BattleEngine/Engine/LoadingDownLoad.cs
Normal file
@@ -0,0 +1,399 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class LoadingDownLoad : LoadingBase
|
||||
{
|
||||
private class ClassDetail
|
||||
{
|
||||
public Texture TextureBase;
|
||||
|
||||
public string strName;
|
||||
}
|
||||
|
||||
private class ClassPack
|
||||
{
|
||||
public int ID = -1;
|
||||
|
||||
public ClassDetail Detail;
|
||||
}
|
||||
|
||||
private enum eCharacterObjsIndex
|
||||
{
|
||||
Character
|
||||
}
|
||||
|
||||
public enum eType
|
||||
{
|
||||
CardDetail,
|
||||
CharacterDetail,
|
||||
StoryDetail
|
||||
}
|
||||
|
||||
private enum eSide
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider[] _flickColliderArray;
|
||||
|
||||
[SerializeField]
|
||||
private LoadingDownLoadCardView _cardView;
|
||||
|
||||
[SerializeField]
|
||||
private LoadingDownLoadStoryView _storyView;
|
||||
|
||||
[SerializeField]
|
||||
private NguiObjs CharacterDetailObjs;
|
||||
|
||||
[SerializeField]
|
||||
private TweenPosition TweenPosCloseUpTexture;
|
||||
|
||||
[SerializeField]
|
||||
private TweenAlpha TweenAlphaName;
|
||||
|
||||
[SerializeField]
|
||||
private TweenAlpha TweenAlphaDescription;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel LabelClassName;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel LabelClassDesc;
|
||||
|
||||
private readonly string[] CharacterTexturePath = new string[8] { "class_01_base", "class_02_base", "class_03_base", "class_04_base", "class_05_base", "class_06_base", "class_07_base", "class_08_base" };
|
||||
|
||||
private const string PREFIX_FILE_TARGET = "class_03_base";
|
||||
|
||||
[SerializeField]
|
||||
private NguiObjs CharacterSelectCircle;
|
||||
|
||||
public const string loadPrefix = "Images/Loading/";
|
||||
|
||||
private Dictionary<int, ClassPack> m_DicPack;
|
||||
|
||||
private Vector3 m_CharacterDefaultPos = new Vector3(0f, 0f, 0f);
|
||||
|
||||
private Vector3 m_CharacterLeftFromPos = new Vector3(-50f, 0f, 0f);
|
||||
|
||||
private Vector3 m_CharacterRightFromPos = new Vector3(50f, 0f, 0f);
|
||||
|
||||
private int m_SelectCharacterIndex;
|
||||
|
||||
private float _defaultEvoLineRootY;
|
||||
|
||||
private const float CHARACTER_TWEEN_TIME = 0.1f;
|
||||
|
||||
private const int CHARACTER_MAX = 9;
|
||||
|
||||
private const int CHARACTER_ID_START = 1;
|
||||
|
||||
private const int CHARACTER_ID_END = 8;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton[] CursorButton;
|
||||
|
||||
private eType Type;
|
||||
|
||||
public eType LoadingDownLoadImageType;
|
||||
|
||||
private bool _isAnimatingNowCharacterView;
|
||||
|
||||
private bool _canFlick = true;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
setMaxAssetsNum(enable: true, Toolbox.ResourcesManager.GetDownloadMaxSize());
|
||||
base.Start();
|
||||
if (!Data.Load.data._userTutorial.NeedAllResource)
|
||||
{
|
||||
Type = eType.CharacterDetail;
|
||||
}
|
||||
else
|
||||
{
|
||||
Type = LoadingDownLoadImageType;
|
||||
}
|
||||
if (Type == eType.CardDetail && !_cardView.CanView())
|
||||
{
|
||||
Type = eType.CharacterDetail;
|
||||
}
|
||||
isLabelUpdate = false;
|
||||
LoadTitleLabel.text = Data.SystemText.Get("Load_0001");
|
||||
LoadTextLabel.text = Data.SystemText.Get("Load_0002");
|
||||
CursorButton[0].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
ChangeInfoView(eSide.Left);
|
||||
}));
|
||||
CursorButton[1].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
ChangeInfoView(eSide.Right);
|
||||
}));
|
||||
BoxCollider[] flickColliderArray = _flickColliderArray;
|
||||
foreach (BoxCollider obj in flickColliderArray)
|
||||
{
|
||||
UIEventListener uIEventListener = UIEventListener.Get(obj.gameObject);
|
||||
uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, new UIEventListener.VectorDelegate(OnDrag));
|
||||
UIEventListener uIEventListener2 = UIEventListener.Get(obj.gameObject);
|
||||
uIEventListener2.onDragEnd = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onDragEnd, new UIEventListener.VoidDelegate(OnDragEnd));
|
||||
}
|
||||
CharacterDetailObjs.gameObject.SetActive(value: false);
|
||||
_storyView.gameObject.SetActive(value: false);
|
||||
_cardView.gameObject.SetActive(value: false);
|
||||
if (CustomPreference.GetTextLanguage() != Global.LANG_TYPE.Jpn.ToString() && Type == eType.CardDetail)
|
||||
{
|
||||
Type = eType.StoryDetail;
|
||||
}
|
||||
switch (Type)
|
||||
{
|
||||
case eType.CardDetail:
|
||||
_cardView.gameObject.SetActive(value: true);
|
||||
_cardView.Initialize(delegate
|
||||
{
|
||||
base.gameObject.SetActive(value: true);
|
||||
});
|
||||
break;
|
||||
case eType.CharacterDetail:
|
||||
CharacterDetailObjs.gameObject.SetActive(value: true);
|
||||
InitializeCharacterView();
|
||||
break;
|
||||
case eType.StoryDetail:
|
||||
_storyView.gameObject.SetActive(value: true);
|
||||
_storyView.Initialize();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDrag(GameObject g, Vector2 dir)
|
||||
{
|
||||
if (_canFlick && !_isAnimatingNowCharacterView && !_cardView.IsAnimatingNow)
|
||||
{
|
||||
if (dir.x >= 70f)
|
||||
{
|
||||
ChangeInfoView(eSide.Left);
|
||||
_canFlick = false;
|
||||
}
|
||||
else if (dir.x <= -70f)
|
||||
{
|
||||
ChangeInfoView(eSide.Right);
|
||||
_canFlick = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDragEnd(GameObject go)
|
||||
{
|
||||
_canFlick = true;
|
||||
}
|
||||
|
||||
private void InitializeCharacterView()
|
||||
{
|
||||
m_SelectCharacterIndex = 1;
|
||||
IList<int> list = new List<int>();
|
||||
for (int i = 1; i < 9; i++)
|
||||
{
|
||||
list.Add(i);
|
||||
}
|
||||
if (m_DicPack == null)
|
||||
{
|
||||
m_DicPack = new Dictionary<int, ClassPack>();
|
||||
foreach (int item in list)
|
||||
{
|
||||
ClassPack classPack = new ClassPack();
|
||||
classPack.ID = item;
|
||||
classPack.Detail = null;
|
||||
m_DicPack.Add(item, classPack);
|
||||
}
|
||||
foreach (KeyValuePair<int, ClassPack> item2 in m_DicPack)
|
||||
{
|
||||
ClassPack value = item2.Value;
|
||||
ClassDetail classDetail = new ClassDetail
|
||||
{
|
||||
TextureBase = null,
|
||||
strName = null
|
||||
};
|
||||
int key = item2.Key;
|
||||
string text = CharacterTexturePath[key - 1];
|
||||
if (text == "class_03_base")
|
||||
{
|
||||
text += "_1";
|
||||
}
|
||||
classDetail.TextureBase = Resources.Load<Texture>("Images/Loading/" + text);
|
||||
classDetail.strName = getTextCharacterName(key);
|
||||
value.Detail = classDetail;
|
||||
}
|
||||
}
|
||||
SetCharacterDisp(m_DicPack[1]);
|
||||
}
|
||||
|
||||
protected override float CalculateProgress()
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetDownloadCompletedSize() + (float)Toolbox.ResourcesManager.GetLoadingCompleted();
|
||||
}
|
||||
|
||||
public override void fadeOutLoading()
|
||||
{
|
||||
base.fadeOutLoading();
|
||||
_cardView.FadeOutLoading();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
private void ChangeInfoView(eSide side)
|
||||
{
|
||||
if (!UIManager.GetInstance().isOpenDialog())
|
||||
{
|
||||
switch (Type)
|
||||
{
|
||||
case eType.CardDetail:
|
||||
ChangeCardView(side);
|
||||
break;
|
||||
case eType.CharacterDetail:
|
||||
ChangeCharacterView(side);
|
||||
break;
|
||||
case eType.StoryDetail:
|
||||
ChangeStoryView(side);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeCardView(eSide side)
|
||||
{
|
||||
switch (side)
|
||||
{
|
||||
case eSide.Right:
|
||||
_cardView.Next();
|
||||
break;
|
||||
case eSide.Left:
|
||||
_cardView.Prev();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeStoryView(eSide side)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
_storyView.ChangeStoryImage(side == eSide.Right);
|
||||
}
|
||||
|
||||
private void ChangeCharacterView(eSide side)
|
||||
{
|
||||
bool isRight = side == eSide.Right;
|
||||
StartCoroutine(ChangeCharacterAnm(isRight));
|
||||
}
|
||||
|
||||
private IEnumerator ChangeCharacterAnm(bool isRight = true)
|
||||
{
|
||||
_isAnimatingNowCharacterView = true;
|
||||
float time = 0f;
|
||||
if (!isRight)
|
||||
{
|
||||
if (m_SelectCharacterIndex > 1)
|
||||
{
|
||||
m_SelectCharacterIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SelectCharacterIndex = 8;
|
||||
}
|
||||
}
|
||||
else if (m_SelectCharacterIndex < 8)
|
||||
{
|
||||
m_SelectCharacterIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SelectCharacterIndex = 1;
|
||||
}
|
||||
ClassPack characterDisp = m_DicPack[m_SelectCharacterIndex];
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
SetCharacterDisp(characterDisp);
|
||||
TweenPosition tweenPosCloseUpTexture = TweenPosCloseUpTexture;
|
||||
if (isRight)
|
||||
{
|
||||
tweenPosCloseUpTexture.from = m_CharacterRightFromPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
tweenPosCloseUpTexture.from = m_CharacterLeftFromPos;
|
||||
}
|
||||
tweenPosCloseUpTexture.to = m_CharacterDefaultPos;
|
||||
tweenPosCloseUpTexture.duration = 0.1f;
|
||||
tweenPosCloseUpTexture.ResetToBeginning();
|
||||
tweenPosCloseUpTexture.PlayForward();
|
||||
TweenAlpha tweenAlphaName = TweenAlphaName;
|
||||
tweenAlphaName.from = 0f;
|
||||
tweenAlphaName.to = 1f;
|
||||
tweenAlphaName.duration = 0.1f;
|
||||
tweenAlphaName.ResetToBeginning();
|
||||
tweenAlphaName.PlayForward();
|
||||
TweenAlpha tweenAlphaDescription = TweenAlphaDescription;
|
||||
tweenAlphaDescription.from = 0f;
|
||||
tweenAlphaDescription.to = 1f;
|
||||
tweenAlphaDescription.duration = 0.1f;
|
||||
tweenAlphaDescription.ResetToBeginning();
|
||||
tweenAlphaDescription.PlayForward();
|
||||
StartCoroutine(assetSetting());
|
||||
yield return null;
|
||||
do
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
}
|
||||
while (!(time >= 0.1f));
|
||||
_isAnimatingNowCharacterView = false;
|
||||
}
|
||||
|
||||
private void SetCharacterDisp(ClassPack in_Pack)
|
||||
{
|
||||
for (int i = 0; i < CharacterSelectCircle.objs.Count; i++)
|
||||
{
|
||||
CharacterSelectCircle.objs[i].SetActive(value: false);
|
||||
}
|
||||
CharacterSelectCircle.objs[m_SelectCharacterIndex - 1].SetActive(value: true);
|
||||
CharacterDetailObjs.textures[0].mainTexture = in_Pack.Detail.TextureBase;
|
||||
LabelClassName.text = in_Pack.Detail.strName;
|
||||
LabelClassDesc.SetWrapText(getTextClassDescription(m_SelectCharacterIndex));
|
||||
}
|
||||
|
||||
private string getTextClassDescription(int classID)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
return classID switch
|
||||
{
|
||||
1 => systemText.Get("Load_0010"),
|
||||
2 => systemText.Get("Load_0011"),
|
||||
3 => systemText.Get("Load_0012"),
|
||||
4 => systemText.Get("Load_0013"),
|
||||
5 => systemText.Get("Load_0014"),
|
||||
6 => systemText.Get("Load_0015"),
|
||||
7 => systemText.Get("Load_0016"),
|
||||
8 => systemText.Get("Load_0018"),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
private string getTextCharacterName(int classID)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
return classID switch
|
||||
{
|
||||
1 => systemText.Get("Load_0003"),
|
||||
2 => systemText.Get("Load_0004"),
|
||||
3 => systemText.Get("Load_0005"),
|
||||
4 => systemText.Get("Load_0006"),
|
||||
5 => systemText.Get("Load_0007"),
|
||||
6 => systemText.Get("Load_0008"),
|
||||
7 => systemText.Get("Load_0009"),
|
||||
8 => systemText.Get("Load_0017"),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
}
|
||||
447
SVSim.BattleEngine/Engine/LoadingDownLoadCardView.cs
Normal file
447
SVSim.BattleEngine/Engine/LoadingDownLoadCardView.cs
Normal file
@@ -0,0 +1,447 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class LoadingDownLoadCardView : MonoBehaviour
|
||||
{
|
||||
private class LoadSceneCardDataAccessor
|
||||
{
|
||||
public readonly int CardNum;
|
||||
|
||||
private List<LoadSceneCardData> _loadSceneCardDataList;
|
||||
|
||||
public int CurrentIndex { get; private set; }
|
||||
|
||||
public LoadSceneCardData CurrentCardData => _loadSceneCardDataList[CurrentIndex];
|
||||
|
||||
public LoadSceneCardDataAccessor(List<int> cardIdList)
|
||||
{
|
||||
CardNum = cardIdList.Count;
|
||||
_loadSceneCardDataList = new List<LoadSceneCardData>();
|
||||
for (int i = 0; i < CardNum; i++)
|
||||
{
|
||||
_loadSceneCardDataList.Add(new LoadSceneCardData(i, cardIdList[i]));
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateIndexToNext()
|
||||
{
|
||||
if (CurrentIndex < CardNum - 1)
|
||||
{
|
||||
CurrentIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateIndexToPrev()
|
||||
{
|
||||
if (CurrentIndex > 0)
|
||||
{
|
||||
CurrentIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentIndex = CardNum - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class LoadSceneCardData
|
||||
{
|
||||
private static readonly Color DEFAULT_EFFECT_COLOR = Color.white;
|
||||
|
||||
public const string FORMAT_DESC_NORMAL = "CardDescN_{0}";
|
||||
|
||||
public const string FORMAT_DESC_EVO = "CardDescE_{0}";
|
||||
|
||||
private const string FORMAT_EFFECT_COLOR = "CardColor_{0}";
|
||||
|
||||
private Color _cardEffectColor;
|
||||
|
||||
public CardParameter CardParam { get; private set; }
|
||||
|
||||
public string CardName { get; private set; }
|
||||
|
||||
public string CardNormalDesc { get; private set; }
|
||||
|
||||
public string CardEvolDesc { get; private set; }
|
||||
|
||||
public Color CardEffectColor => _cardEffectColor;
|
||||
|
||||
public LoadSceneCardData(int index, int cardId)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
_ = Data.Load.data.ResourceDlViewID;
|
||||
CardParam = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(cardId);
|
||||
bool num = CardParam.CharType == CardBasePrm.CharaType.NORMAL;
|
||||
CardName = systemText.Get($"LoadCard_{cardId}");
|
||||
CardNormalDesc = systemText.Get($"CardDescN_{cardId}");
|
||||
if (num)
|
||||
{
|
||||
CardEvolDesc = systemText.Get($"CardDescE_{cardId}");
|
||||
}
|
||||
else
|
||||
{
|
||||
CardEvolDesc = "";
|
||||
}
|
||||
if (!ColorUtility.TryParseHtmlString(systemText.Get($"CardColor_{(int)CardParam.Clan}"), out _cardEffectColor))
|
||||
{
|
||||
_cardEffectColor = DEFAULT_EFFECT_COLOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Vector3 CARD_SCALE = new Vector3(0.022f, 0.017f, 1f);
|
||||
|
||||
[SerializeField]
|
||||
private Transform CardObjectTransform;
|
||||
|
||||
[SerializeField]
|
||||
private ParticleSystem[] LoadingEffects;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollView _cardDetailScrollView;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _cardNameLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _followerDetailObjctRoot;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _spellOrAmuletDetailObjctRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _followerNormalSkillLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _followerNormalAtkLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _followerNormalLifeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _followerEvoSkillLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _followerEvoAtkLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _followerEvoLifeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _followerEvoTopRootObj;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _spellOrAmuletSkillLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _cardTypeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private ResourceDownloadCardFactory _cardFactory;
|
||||
|
||||
[SerializeField]
|
||||
private UIPanel _cardPanel;
|
||||
|
||||
[SerializeField]
|
||||
private TextLineCreater _normalTextLineCreater;
|
||||
|
||||
[SerializeField]
|
||||
private TextLineCreater _evoTextLineCreater;
|
||||
|
||||
[SerializeField]
|
||||
private TextLineCreater _spellOrAmuletSkillTextLineCreater;
|
||||
|
||||
[SerializeField]
|
||||
private UIToggle indicatorBase;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _blackPanel;
|
||||
|
||||
private Vector3 _defaultPosCardSprite = Vector3.zero;
|
||||
|
||||
private Quaternion _defaultRotCardSprite = Quaternion.identity;
|
||||
|
||||
private List<UIToggle> _indicatorList = new List<UIToggle>();
|
||||
|
||||
private LoadSceneCardDataAccessor _cardDataAccessor;
|
||||
|
||||
private List<int> _cardIdList;
|
||||
|
||||
private List<CardListTemplate> _cardList;
|
||||
|
||||
public const string FORMAT_CARD_NAME = "LoadCard_{0}";
|
||||
|
||||
public bool IsAnimatingNow { get; private set; }
|
||||
|
||||
public void Initialize(Action onReady)
|
||||
{
|
||||
LoadingEffects[2].gameObject.SetActive(value: false);
|
||||
LoadingEffects[3].gameObject.SetActive(value: false);
|
||||
LoadingEffects[4].gameObject.SetActive(value: false);
|
||||
LoadingEffects[0].gameObject.SetActive(value: false);
|
||||
LoadCardResource(delegate
|
||||
{
|
||||
_blackPanel.SetActive(value: false);
|
||||
LoadingEffects[0].gameObject.SetActive(value: true);
|
||||
TweenAlpha.Begin(CardObjectTransform.gameObject, 0f, 1f);
|
||||
_cardDataAccessor = new LoadSceneCardDataAccessor(GetCardIdList());
|
||||
ChangeLoadCardInfo(_cardDataAccessor.CurrentCardData, _cardDataAccessor.CurrentIndex);
|
||||
GameObject gameObject = indicatorBase.transform.parent.gameObject;
|
||||
_indicatorList.Add(indicatorBase);
|
||||
for (int i = 1; i < _cardDataAccessor.CardNum; i++)
|
||||
{
|
||||
_indicatorList.Add(NGUITools.AddChild(gameObject, indicatorBase.gameObject).GetComponent<UIToggle>());
|
||||
}
|
||||
gameObject.GetComponent<UIGrid>().Reposition();
|
||||
UpdateIndicator(_cardDataAccessor.CurrentIndex);
|
||||
onReady.Call();
|
||||
});
|
||||
}
|
||||
|
||||
private List<int> CreateCardIdList()
|
||||
{
|
||||
Dictionary<int, List<int>> dictionary = LoadCardIdList();
|
||||
if (dictionary.TryGetValue(Data.Load.data.RotationLatestCardPackId, out var value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
Debug.LogError($"カードパックID[{Data.Load.data.RotationLatestCardPackId}]が見つかりません");
|
||||
return dictionary.FirstOrDefault().Value;
|
||||
}
|
||||
|
||||
private Dictionary<int, List<int>> LoadCardIdList()
|
||||
{
|
||||
List<string[]> list = Utility.ConvertCSV_Array((Resources.Load("CSV/load_card") as TextAsset).ToString());
|
||||
Dictionary<int, List<int>> dictionary = new Dictionary<int, List<int>>();
|
||||
foreach (string[] item in list)
|
||||
{
|
||||
if (!int.TryParse(item[0], out var result))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
List<int> list2 = new List<int>(list.Count);
|
||||
for (int i = 1; i < item.Length; i++)
|
||||
{
|
||||
if (int.TryParse(item[i], out var result2))
|
||||
{
|
||||
list2.Add(result2);
|
||||
}
|
||||
}
|
||||
dictionary[result] = list2;
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
private List<int> GetCardIdList()
|
||||
{
|
||||
if (_cardIdList == null)
|
||||
{
|
||||
_cardIdList = CreateCardIdList();
|
||||
}
|
||||
return _cardIdList;
|
||||
}
|
||||
|
||||
public bool CanView()
|
||||
{
|
||||
return _cardFactory.CanView(GetCardIdList());
|
||||
}
|
||||
|
||||
private void LoadCardResource(Action onFinish)
|
||||
{
|
||||
_cardFactory.Load(GetCardIdList(), _cardPanel.gameObject, delegate(List<CardListTemplate> cardList)
|
||||
{
|
||||
OnFinishCardLoad(cardList);
|
||||
onFinish();
|
||||
});
|
||||
}
|
||||
|
||||
private void OnFinishCardLoad(List<CardListTemplate> cardList)
|
||||
{
|
||||
for (int i = 0; i < cardList.Count; i++)
|
||||
{
|
||||
CardListTemplate cardListTemplate = cardList[i];
|
||||
cardListTemplate.gameObject.SetActive(i == 0);
|
||||
cardListTemplate.HideNum();
|
||||
cardListTemplate.transform.localScale = CARD_SCALE;
|
||||
}
|
||||
_cardList = cardList;
|
||||
}
|
||||
|
||||
public void FadeOutLoading()
|
||||
{
|
||||
TweenAlpha.Begin(CardObjectTransform.gameObject, 1f, 0f);
|
||||
for (int i = 0; i < LoadingEffects.Length; i++)
|
||||
{
|
||||
LoadingEffects[i].Stop();
|
||||
LoadingEffects[i].Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void Next()
|
||||
{
|
||||
StartCoroutine(ChangeCardAnm(isRight: true));
|
||||
}
|
||||
|
||||
public void Prev()
|
||||
{
|
||||
StartCoroutine(ChangeCardAnm(isRight: false));
|
||||
}
|
||||
|
||||
private void ChangeLoadCardInfo(LoadSceneCardData cardData, int index)
|
||||
{
|
||||
foreach (CardListTemplate card in _cardList)
|
||||
{
|
||||
card.gameObject.SetActive(value: false);
|
||||
}
|
||||
_cardList[index].gameObject.SetActive(value: true);
|
||||
SetCardDetailLabels(cardData, index);
|
||||
ParticleSystem[] componentsInChildren = LoadingEffects[0].gameObject.GetComponentsInChildren<ParticleSystem>();
|
||||
foreach (ParticleSystem obj in componentsInChildren)
|
||||
{
|
||||
ParticleSystem.MainModule main = obj.main;
|
||||
main.startColor = cardData.CardEffectColor;
|
||||
obj.Stop();
|
||||
obj.Play();
|
||||
}
|
||||
componentsInChildren = LoadingEffects[1].gameObject.GetComponentsInChildren<ParticleSystem>();
|
||||
foreach (ParticleSystem obj2 in componentsInChildren)
|
||||
{
|
||||
ParticleSystem.MainModule main2 = obj2.main;
|
||||
main2.startColor = cardData.CardEffectColor;
|
||||
obj2.Stop();
|
||||
obj2.Play();
|
||||
}
|
||||
UpdateIndicator(_cardDataAccessor.CurrentIndex);
|
||||
}
|
||||
|
||||
private void SetCardDetailLabels(LoadSceneCardData cardData, int index)
|
||||
{
|
||||
_cardNameLabel.text = cardData.CardName;
|
||||
_cardTypeLabel.text = GetCardTypeText(cardData);
|
||||
SetCardSkillText(cardData, index);
|
||||
_cardDetailScrollView.ResetPosition();
|
||||
_cardDetailScrollView.UpdateScrollbars(recalculateBounds: true);
|
||||
}
|
||||
|
||||
private string GetCardTypeText(LoadSceneCardData cardData)
|
||||
{
|
||||
return cardData.CardParam.CharType switch
|
||||
{
|
||||
CardBasePrm.CharaType.FIELD => Data.SystemText.Get("Card_0046"),
|
||||
CardBasePrm.CharaType.SPELL => Data.SystemText.Get("Card_0045"),
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
|
||||
private void SetCardSkillText(LoadSceneCardData cardData, int index)
|
||||
{
|
||||
int cardId = GetCardIdList()[index];
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(cardId);
|
||||
if (cardParameterFromId.CharType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
_followerDetailObjctRoot.SetActive(value: true);
|
||||
_spellOrAmuletDetailObjctRoot.SetActive(value: false);
|
||||
_followerNormalAtkLabel.text = cardParameterFromId.Atk.ToString();
|
||||
_followerNormalLifeLabel.text = cardParameterFromId.Life.ToString();
|
||||
_followerEvoAtkLabel.text = cardParameterFromId.EvoAtk.ToString();
|
||||
_followerEvoLifeLabel.text = cardParameterFromId.EvoLife.ToString();
|
||||
SetFollowerText(_cardDataAccessor.CurrentCardData, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
_followerDetailObjctRoot.SetActive(value: false);
|
||||
_spellOrAmuletDetailObjctRoot.SetActive(value: true);
|
||||
SetViewCardText(cardData.CardNormalDesc, _spellOrAmuletSkillLabel, _spellOrAmuletSkillTextLineCreater);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetFollowerText(LoadSceneCardData cardData, int index)
|
||||
{
|
||||
if (_cardList != null)
|
||||
{
|
||||
SetViewCardText(cardData.CardNormalDesc, _followerNormalSkillLabel, _normalTextLineCreater);
|
||||
SetViewCardText(cardData.CardEvolDesc, _followerEvoSkillLabel, _evoTextLineCreater);
|
||||
float y = _followerNormalSkillLabel.transform.localPosition.y - (float)_followerNormalSkillLabel.height - 44f;
|
||||
_followerEvoTopRootObj.transform.localPosition = new Vector3(_followerEvoTopRootObj.transform.localPosition.x, y);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetViewCardText(string cardText, UILabel textLabel, TextLineCreater lineCreater)
|
||||
{
|
||||
textLabel.overflowMethod = UILabel.Overflow.ResizeHeight;
|
||||
textLabel.ProcessText();
|
||||
int textLineCount = Global.GetTextLineCount(Global.GetConvertWrapText(textLabel, cardText));
|
||||
lineCreater.ShowLines(textLineCount);
|
||||
textLabel.SetWrapText(cardText);
|
||||
}
|
||||
|
||||
private IEnumerator ChangeCardAnm(bool isRight)
|
||||
{
|
||||
IsAnimatingNow = true;
|
||||
CardListTemplate currentCard = _cardList[_cardDataAccessor.CurrentIndex];
|
||||
if (!isRight)
|
||||
{
|
||||
_cardDataAccessor.UpdateIndexToPrev();
|
||||
}
|
||||
else
|
||||
{
|
||||
_cardDataAccessor.UpdateIndexToNext();
|
||||
}
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
TweenPosition tp = CardObjectTransform.GetComponent<TweenPosition>();
|
||||
TweenRotation tr = CardObjectTransform.GetComponent<TweenRotation>();
|
||||
_defaultPosCardSprite = CardObjectTransform.transform.localPosition;
|
||||
_defaultRotCardSprite = CardObjectTransform.transform.localRotation;
|
||||
tp.enabled = false;
|
||||
tr.enabled = false;
|
||||
LoadingEffects[1].gameObject.SetActive(value: false);
|
||||
LoadingEffects[2].gameObject.SetActive(value: false);
|
||||
LoadingEffects[2].gameObject.SetActive(value: true);
|
||||
TweenAlpha.Begin(CardObjectTransform.gameObject, 0.2f, 0f);
|
||||
TweenAlpha.Begin(currentCard._nameLabel.gameObject, 0.2f, 0f);
|
||||
if (isRight)
|
||||
{
|
||||
iTween.MoveTo(CardObjectTransform.gameObject, iTween.Hash("position", _defaultPosCardSprite + Vector3.left * 50f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
|
||||
}
|
||||
else
|
||||
{
|
||||
iTween.MoveTo(CardObjectTransform.gameObject, iTween.Hash("position", _defaultPosCardSprite + Vector3.right * 50f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
|
||||
}
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DL_CARD_APPEAR);
|
||||
LoadingEffects[1].gameObject.SetActive(value: true);
|
||||
ChangeLoadCardInfo(_cardDataAccessor.CurrentCardData, _cardDataAccessor.CurrentIndex);
|
||||
LoadingEffects[3].gameObject.SetActive(value: false);
|
||||
LoadingEffects[3].gameObject.SetActive(value: true);
|
||||
LoadingEffects[4].gameObject.SetActive(value: false);
|
||||
LoadingEffects[4].gameObject.SetActive(value: true);
|
||||
TweenAlpha.Begin(CardObjectTransform.gameObject, 0.2f, 1f);
|
||||
TweenAlpha.Begin(currentCard._nameLabel.gameObject, 0.2f, 1f);
|
||||
CardObjectTransform.transform.localPosition = _defaultPosCardSprite + Vector3.down * 20f;
|
||||
CardObjectTransform.transform.localRotation = Quaternion.Euler(new Vector3(0f, 90f, 10f));
|
||||
iTween.MoveTo(CardObjectTransform.gameObject, iTween.Hash("position", _defaultPosCardSprite, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
|
||||
iTween.RotateTo(CardObjectTransform.gameObject, iTween.Hash("rotation", _defaultRotCardSprite.eulerAngles, "time", 0.2f, "easetype", iTween.EaseType.easeOutQuad));
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
CardObjectTransform.transform.localPosition = _defaultPosCardSprite;
|
||||
tp.enabled = true;
|
||||
tr.enabled = true;
|
||||
IsAnimatingNow = false;
|
||||
}
|
||||
|
||||
private void UpdateIndicator(int index)
|
||||
{
|
||||
if (_indicatorList.Count > 1)
|
||||
{
|
||||
_indicatorList[index].value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
664
SVSim.BattleEngine/Engine/TwoPickCardSelectBase.cs
Normal file
664
SVSim.BattleEngine/Engine/TwoPickCardSelectBase.cs
Normal file
@@ -0,0 +1,664 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick;
|
||||
using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick;
|
||||
|
||||
public abstract class TwoPickCardSelectBase : MonoBehaviour
|
||||
{
|
||||
public enum MoveType
|
||||
{
|
||||
LEFT,
|
||||
RIGHT,
|
||||
UP,
|
||||
DOWN
|
||||
}
|
||||
|
||||
public enum PICK_SIDE
|
||||
{
|
||||
LEFT,
|
||||
RIGHT
|
||||
}
|
||||
|
||||
private class CardPosXInfo
|
||||
{
|
||||
public Transform Transform { get; private set; }
|
||||
|
||||
public float PosX { get; private set; }
|
||||
|
||||
public CardPosXInfo(Transform t, float posX)
|
||||
{
|
||||
Transform = t;
|
||||
PosX = posX;
|
||||
}
|
||||
}
|
||||
|
||||
public const int PICK_SIDE_NUM = 2;
|
||||
|
||||
public const int PICK_CARD_NUM = 2;
|
||||
|
||||
protected TwoPickCardSelectView _viewData;
|
||||
|
||||
private int scene_layer = 24;
|
||||
|
||||
private const int maxDrawCard = 4;
|
||||
|
||||
private const float CARD_IN_ANIMATION_TIME = 0.5f;
|
||||
|
||||
private IList<GameObject> LeftObjs = new List<GameObject>();
|
||||
|
||||
private IList<GameObject> RightObjs = new List<GameObject>();
|
||||
|
||||
private List<UIBase_CardManager.CardObjData> cardObjList = new List<UIBase_CardManager.CardObjData>();
|
||||
|
||||
private List<UIBase_CardManager.CardObjData> cardObjListSpell = new List<UIBase_CardManager.CardObjData>();
|
||||
|
||||
private List<string> _loadAssetList = new List<string>();
|
||||
|
||||
protected List<int> _selectedCardList = new List<int>();
|
||||
|
||||
private bool _bOnDestory;
|
||||
|
||||
private int _lastTimeCardNum;
|
||||
|
||||
protected int _followerNum;
|
||||
|
||||
protected int _amuletNum;
|
||||
|
||||
protected int _spellNum;
|
||||
|
||||
private List<GameObject> _tweenObjectList = new List<GameObject>();
|
||||
|
||||
private List<CardPosXInfo> cardPosXInfoList = new List<CardPosXInfo>();
|
||||
|
||||
private bool isCardSetFirst = true;
|
||||
|
||||
private const int DECK_INFO_ICON = 0;
|
||||
|
||||
private const int DECK_INFO_CLASS_NAME = 0;
|
||||
|
||||
private const int DECK_INFO_CARD_NUM = 1;
|
||||
|
||||
private const int DECK_INFO_CARD_MAX = 2;
|
||||
|
||||
private const int DECK_INFO_FOLLOWER_NUM = 3;
|
||||
|
||||
private const int DECK_INFO_SPELL_NUM = 4;
|
||||
|
||||
private const int DECK_INFO_AMULET_NUM = 5;
|
||||
|
||||
private const float DECK_INFO_TWEEN_Y = -151f;
|
||||
|
||||
private readonly Color EFFECT_COLOR_BLUE = new Color(0.2509804f, 0.5019608f, 1f);
|
||||
|
||||
private readonly Color EFFECT_COLOR_ORANGE = new Color(1f, 32f / 85f, 0f);
|
||||
|
||||
private List<Effect> _effects = new List<Effect>();
|
||||
|
||||
public UICardList UiCardList { get; set; }
|
||||
|
||||
public CardDetailUI UiCardDetail { get; set; }
|
||||
|
||||
public int SelectedClassId { get; set; }
|
||||
|
||||
public bool IsButtonEnable { get; set; }
|
||||
|
||||
public bool IsTitleEnable { get; set; }
|
||||
|
||||
public bool IsFirstCardDisp { get; set; }
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
IsButtonEnable = true;
|
||||
IsTitleEnable = true;
|
||||
IsFirstCardDisp = false;
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
isCardSetFirst = true;
|
||||
_viewData = base.transform.GetComponent<TwoPickCardSelectView>();
|
||||
_viewData.TitlePanel.gameObject.SetActive(IsTitleEnable);
|
||||
_viewData.CostCurveClass.Initialize(FormatBehaviorManager.GetDefaultBehaviour(Format.Max).CardMasterId);
|
||||
_viewData.DeckBtnObj.labels[0].text = Data.SystemText.Get("Arena_0009");
|
||||
_viewData.SelectBtnObjs[0].labels[0].text = Data.SystemText.Get("Arena_0029");
|
||||
_viewData.SelectBtnObjs[1].labels[0].text = Data.SystemText.Get("Arena_0029");
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
_viewData.SelectBtnObjs[i].buttons[0].onClick.Clear();
|
||||
_viewData.SelectBtnObjs[i].buttons[0].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
OnClickSelectBtn();
|
||||
}));
|
||||
}
|
||||
_viewData.DeckBtnObj.buttons[0].onClick.Clear();
|
||||
_viewData.DeckBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
DeckViewOpen();
|
||||
}));
|
||||
UiCardList.SetClan(GetSelectedClassId());
|
||||
CardBasePrm.ClanType selectedClassId = GetSelectedClassId();
|
||||
_viewData.DeckInfoObjs.sprites[0].spriteName = ClassCharaPrm.GetIconSpriteName(selectedClassId);
|
||||
_viewData.DeckInfoObjs.labels[0].text = ClassCharaPrm.GetNameText(selectedClassId);
|
||||
ClassCharaPrm.SetClassLabelSetting(_viewData.DeckInfoObjs.labels[0], selectedClassId);
|
||||
_viewData.DeckTypeNameLabel.gameObject.SetActive(value: false);
|
||||
if (GetDeckInfo().cardIds.Length == 0)
|
||||
{
|
||||
_viewData.DeckInfoObjs.labels[1].text = "0";
|
||||
_viewData.DeckInfoObjs.labels[2].text = "/" + 30;
|
||||
_viewData.DeckInfoObjs.labels[3].text = "0";
|
||||
_viewData.DeckInfoObjs.labels[4].text = "0";
|
||||
_viewData.DeckInfoObjs.labels[5].text = "0";
|
||||
}
|
||||
_viewData.TitlePanel.alpha = 0f;
|
||||
_viewData.DeckInfoObjs.GetComponent<UIPanel>().alpha = 0f;
|
||||
TweenAlpha.Begin(base.gameObject, 0f, 1f);
|
||||
LeftObjs = new List<GameObject>();
|
||||
RightObjs = new List<GameObject>();
|
||||
Deck deckInfo = GetDeckInfo();
|
||||
_selectedCardList = new List<int>();
|
||||
if (deckInfo.cardIds.Length != 0)
|
||||
{
|
||||
_selectedCardList.AddRange(deckInfo.cardIds);
|
||||
}
|
||||
for (int num = 0; num < _selectedCardList.Count; num++)
|
||||
{
|
||||
DeckInfoCardNumUpdate(_selectedCardList.Count, 30, _selectedCardList[num]);
|
||||
}
|
||||
if (_selectedCardList.Count == 0)
|
||||
{
|
||||
_viewData.DeckBtnObj.buttons[0].isEnabled = false;
|
||||
_viewData.DeckBtnObj.labels[0].color = LabelDefine.TEXT_COLOR_BUTTON_DISABLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_viewData.DeckBtnObj.buttons[0].isEnabled = true;
|
||||
_viewData.DeckBtnObj.labels[0].color = LabelDefine.TEXT_COLOR_BUTTON_ENABLE;
|
||||
}
|
||||
StartCoroutine(cardChoosePost_NonTask());
|
||||
_viewData.SelectBtnObjs[0].gameObject.SetActive(value: false);
|
||||
_viewData.SelectBtnObjs[1].gameObject.SetActive(value: false);
|
||||
_viewData.CardContainer[0].SetActive(value: false);
|
||||
_viewData.CardContainer[1].SetActive(value: false);
|
||||
TweenAlpha.Begin(_viewData.BaseObj, 0f, 0f);
|
||||
_loadAssetList.Add(Toolbox.ResourcesManager.GetAssetTypePath(GetSelectedSkinId().ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaBase));
|
||||
_viewData.ClassObj.textures[0].mainTexture = null;
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadAssetList, delegate
|
||||
{
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
if (!_bOnDestory)
|
||||
{
|
||||
Texture mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(GetSelectedSkinId().ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true)) as Texture;
|
||||
UITexture obj = _viewData.ClassObj.textures[0];
|
||||
obj.mainTexture = mainTexture;
|
||||
obj.material = null;
|
||||
TweenAlpha.Begin(_viewData.BaseObj, 0f, 1f);
|
||||
}
|
||||
}));
|
||||
_viewData.TitlePanel.alpha = 0f;
|
||||
TweenAlpha.Begin(_viewData.TitlePanel.transform.parent.gameObject, 0.5f, 1f);
|
||||
StartCoroutine(ForceSetCardPosX());
|
||||
}
|
||||
|
||||
public void SetDeckTypeName(string name)
|
||||
{
|
||||
_viewData.DeckTypeNameLabel.gameObject.SetActive(value: true);
|
||||
_viewData.DeckTypeNameLabel.text = name;
|
||||
ClassCharaPrm.SetClassLabelSetting(_viewData.DeckTypeNameLabel, GetSelectedClassId());
|
||||
_viewData.DeckInfoObjs.sprites[0].gameObject.SetActive(value: false);
|
||||
_viewData.DeckInfoObjs.labels[0].gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public virtual void StartDestory()
|
||||
{
|
||||
Object.Destroy(base.gameObject);
|
||||
}
|
||||
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_ARENA_ARCANE_1);
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_ARENA_ARCANE_2);
|
||||
foreach (Effect effect in _effects)
|
||||
{
|
||||
effect.Stop();
|
||||
}
|
||||
_effects.Clear();
|
||||
_bOnDestory = true;
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
|
||||
public void RemoveData()
|
||||
{
|
||||
for (int i = 0; i < LeftObjs.Count; i++)
|
||||
{
|
||||
Object.Destroy(LeftObjs[i]);
|
||||
}
|
||||
LeftObjs.Clear();
|
||||
for (int j = 0; j < RightObjs.Count; j++)
|
||||
{
|
||||
Object.Destroy(RightObjs[j]);
|
||||
}
|
||||
RightObjs.Clear();
|
||||
cardObjList.Clear();
|
||||
cardObjListSpell.Clear();
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadAssetList);
|
||||
_loadAssetList.Clear();
|
||||
}
|
||||
|
||||
private IEnumerator cardChoosePost(int selectedId)
|
||||
{
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
ConnectTask(selectedId);
|
||||
}
|
||||
|
||||
public void NextCardSelect(PICK_SIDE inPickSide)
|
||||
{
|
||||
_selectedCardList.Clear();
|
||||
_selectedCardList.AddRange(Data.RoomTwoPickInfo.deckData.cardIds);
|
||||
_followerNum = 0;
|
||||
_amuletNum = 0;
|
||||
_spellNum = 0;
|
||||
_viewData.CostCurveClass.Refresh();
|
||||
for (int i = 0; i < Data.RoomTwoPickInfo.deckData.cardIds.Length; i++)
|
||||
{
|
||||
DeckInfoCardNumUpdate(_selectedCardList.Count, 30, Data.RoomTwoPickInfo.deckData.cardIds[i]);
|
||||
}
|
||||
CardDecide(inPickSide, isCardListUpdate: false);
|
||||
}
|
||||
|
||||
private IEnumerator cardChoosePost_NonTask()
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
returnPost();
|
||||
}
|
||||
|
||||
private void returnPost()
|
||||
{
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
StartCoroutine(CardSet());
|
||||
}
|
||||
|
||||
private IEnumerator CardSet()
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < _tweenObjectList.Count; i++)
|
||||
{
|
||||
if (_tweenObjectList[i] != null)
|
||||
{
|
||||
iTween.Stop(_tweenObjectList[i]);
|
||||
}
|
||||
}
|
||||
_tweenObjectList.Clear();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
if (_selectedCardList.Count >= 30)
|
||||
{
|
||||
StartCoroutine(RunSceneNext());
|
||||
yield break;
|
||||
}
|
||||
LeftObjs.Clear();
|
||||
RightObjs.Clear();
|
||||
_viewData.CardContainer[0].SetActive(value: true);
|
||||
_viewData.CardContainer[1].SetActive(value: true);
|
||||
if (isCardSetFirst)
|
||||
{
|
||||
isCardSetFirst = false;
|
||||
iTween.MoveTo(_viewData.DeckInfoObjs.gameObject, iTween.Hash("y", -151f, "time", 0.25f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
|
||||
TweenAlpha.Begin(_viewData.DeckInfoObjs.gameObject, 0.25f, 1f);
|
||||
_tweenObjectList.Add(_viewData.DeckInfoObjs.gameObject);
|
||||
}
|
||||
for (int j = 0; j < cardObjList.Count; j++)
|
||||
{
|
||||
Object.Destroy(cardObjList[j].CardObj);
|
||||
}
|
||||
cardObjList.Clear();
|
||||
for (int k = 0; k < cardObjListSpell.Count; k++)
|
||||
{
|
||||
Object.Destroy(cardObjListSpell[k].CardObj);
|
||||
}
|
||||
cardObjListSpell.Clear();
|
||||
cardPosXInfoList.Clear();
|
||||
int[] downloadList = new int[4]
|
||||
{
|
||||
GetCardInfo().candidateCards[0].cardId1,
|
||||
GetCardInfo().candidateCards[0].cardId2,
|
||||
GetCardInfo().candidateCards[1].cardId1,
|
||||
GetCardInfo().candidateCards[1].cardId2
|
||||
};
|
||||
UIManager.GetInstance().CardLoadSelect(base.gameObject, downloadList, scene_layer, is2D: false);
|
||||
while (!UIManager.GetInstance().getUIBase_CardManager().getCreateEndFlag() || !UIManager.GetInstance().getUIBase_CardManager().isAssetAllReady)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
cardObjList = UIManager.GetInstance().getSelectCardListObjs();
|
||||
_loadAssetList.AddRange(Toolbox.ResourcesManager.CardListAssetPathList);
|
||||
Toolbox.ResourcesManager.CardListAssetPathList.Clear();
|
||||
for (int l = 0; l < 4; l++)
|
||||
{
|
||||
GameObject cardObj = cardObjList[l].CardObj;
|
||||
cardObj.transform.parent = base.transform;
|
||||
cardObj.GetComponent<CharIdx>().SetCardId(downloadList[l]);
|
||||
switch (l)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
cardObj.transform.parent = _viewData.CardContainer[0].transform;
|
||||
LeftObjs.Add(cardObj);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
cardObj.transform.parent = _viewData.CardContainer[1].transform;
|
||||
RightObjs.Add(cardObj);
|
||||
break;
|
||||
}
|
||||
cardObj.transform.localPosition = Vector3.up * 100f;
|
||||
cardObj.transform.localRotation = Quaternion.Euler(Vector3.up * 90f);
|
||||
cardObj.transform.localScale = new Vector3(50f, 50f, 50f);
|
||||
cardObj.transform.Find("CardBase").gameObject.AddComponent<UIButton>().onClick.Add(CreateCardDetailEvent(cardObj));
|
||||
cardObj.SetActive(value: false);
|
||||
}
|
||||
StartCoroutine(RunCardIn());
|
||||
}
|
||||
|
||||
private EventDelegate CreateCardDetailEvent(GameObject cardObject)
|
||||
{
|
||||
return new EventDelegate(delegate
|
||||
{
|
||||
UiCardDetail.OnPushCardDetailOn(cardObject);
|
||||
});
|
||||
}
|
||||
|
||||
private IEnumerator RunCardIn()
|
||||
{
|
||||
Vector3[] posList = new Vector3[4]
|
||||
{
|
||||
new Vector3(-100f, 200f, 0f),
|
||||
new Vector3(110f, 160f, 100f),
|
||||
new Vector3(110f, 200f, 0f),
|
||||
new Vector3(-100f, 160f, 100f)
|
||||
};
|
||||
Vector3[] rotList = new Vector3[4]
|
||||
{
|
||||
new Vector3(0f, 0f, 5f),
|
||||
new Vector3(0f, 0f, -5f),
|
||||
new Vector3(0f, 0f, -5f),
|
||||
new Vector3(0f, 0f, 5f)
|
||||
};
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_DL_CARD_APPEAR);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_ARCANE_1, _viewData.CardContainer[0].transform.position);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_ARCANE_2, _viewData.CardContainer[1].transform.position);
|
||||
int i = 0;
|
||||
while (i < 4 && LeftObjs.Count != 0 && RightObjs.Count != 0)
|
||||
{
|
||||
GameObject gameObject;
|
||||
Color color;
|
||||
if (i < 2)
|
||||
{
|
||||
gameObject = LeftObjs[i];
|
||||
color = EFFECT_COLOR_BLUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject = RightObjs[i % 2];
|
||||
color = EFFECT_COLOR_ORANGE;
|
||||
}
|
||||
gameObject.SetActive(value: true);
|
||||
iTween.MoveTo(gameObject, iTween.Hash("position", posList[i], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.RotateTo(gameObject, iTween.Hash("rotation", rotList[i], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo, "oncomplete", ""));
|
||||
iTween.MoveAdd(gameObject, iTween.Hash("y", Random.value * 0.03f + 0.03f, "time", Random.value * 2f + 2f, "looptype", iTween.LoopType.pingPong, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
StartCoroutine(CardInAnimationEndAction(gameObject, posList[i], rotList[i]));
|
||||
Effect effect = ((cardObjList[i].cardType == CardBasePrm.CharaType.NORMAL) ? GameMgr.GetIns().GetEffectMgr().StartBuff(EffectMgr.EffectType.CMN_ARENA_FRAME_1, gameObject) : ((cardObjList[i].cardType != CardBasePrm.CharaType.SPELL) ? GameMgr.GetIns().GetEffectMgr().StartBuff(EffectMgr.EffectType.CMN_ARENA_FRAME_2, gameObject) : GameMgr.GetIns().GetEffectMgr().StartBuff(EffectMgr.EffectType.CMN_ARENA_FRAME_3, gameObject)));
|
||||
if (effect == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
effect.ChangeParticleColor(color);
|
||||
_effects.Add(effect);
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
}
|
||||
int num = i + 1;
|
||||
i = num;
|
||||
}
|
||||
_viewData.SelectBtnObjs[0].gameObject.SetActive(IsButtonEnable);
|
||||
_viewData.SelectBtnObjs[1].gameObject.SetActive(IsButtonEnable);
|
||||
IsFirstCardDisp = true;
|
||||
}
|
||||
|
||||
private IEnumerator CardInAnimationEndAction(GameObject cardObject, Vector3 position, Vector3 rotation)
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
if (cardObject != null)
|
||||
{
|
||||
cardObject.transform.localPosition = position;
|
||||
TweenRotation tweenRotation = cardObject.AddComponent<TweenRotation>();
|
||||
tweenRotation.from = rotation;
|
||||
float x = Random.value * 0.04f - 0.02f;
|
||||
float y = Random.value * 0.08f - 0.04f;
|
||||
float z = Random.value * 0.02f - 0.01f;
|
||||
tweenRotation.to = new Vector3(x, y, z);
|
||||
tweenRotation.style = UITweener.Style.PingPong;
|
||||
tweenRotation.method = UITweener.Method.EaseInOut;
|
||||
tweenRotation.duration = Random.value * 2f + 2f;
|
||||
_tweenObjectList.Add(cardObject);
|
||||
cardPosXInfoList.Add(new CardPosXInfo(cardObject.transform, position.x));
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator RunCardOut(bool isLeft)
|
||||
{
|
||||
if (LeftObjs.Count == 0 || RightObjs.Count == 0)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_ARENA_ARCANE_1);
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_ARENA_ARCANE_2);
|
||||
foreach (Effect effect in _effects)
|
||||
{
|
||||
effect.Stop();
|
||||
}
|
||||
_effects.Clear();
|
||||
int i = 0;
|
||||
while (i < 2)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
}
|
||||
if (LeftObjs.Count == 0 || RightObjs.Count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (isLeft)
|
||||
{
|
||||
_viewData.CardTweenTarget[i].transform.SetParent(LeftObjs[i].transform.parent);
|
||||
_viewData.CardTweenTarget[i].transform.localPosition = LeftObjs[i].transform.localPosition;
|
||||
_viewData.CardTweenTarget[i].transform.rotation = LeftObjs[i].transform.rotation;
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_DECIDE_1, _viewData.CardTweenTarget[i].transform.localPosition, _viewData.CardTweenTarget[i]);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_DECIDE_3, LeftObjs[i].transform.position);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_DECIDE_2, RightObjs[i].transform.position);
|
||||
}
|
||||
else
|
||||
{
|
||||
_viewData.CardTweenTarget[i].transform.SetParent(RightObjs[i].transform.parent);
|
||||
_viewData.CardTweenTarget[i].transform.localPosition = RightObjs[i].transform.localPosition;
|
||||
_viewData.CardTweenTarget[i].transform.rotation = RightObjs[i].transform.rotation;
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_DECIDE_2, LeftObjs[i].transform.position);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_DECIDE_1, _viewData.CardTweenTarget[i].transform.localPosition, _viewData.CardTweenTarget[i]);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_DECIDE_3, RightObjs[i].transform.position);
|
||||
}
|
||||
LeftObjs[i].SetActive(value: false);
|
||||
RightObjs[i].SetActive(value: false);
|
||||
int num = i + 1;
|
||||
i = num;
|
||||
}
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_2PICK_SELECT);
|
||||
try
|
||||
{
|
||||
for (int j = 0; j < _tweenObjectList.Count; j++)
|
||||
{
|
||||
if (_tweenObjectList[j] != null)
|
||||
{
|
||||
iTween.Stop(_tweenObjectList[j]);
|
||||
}
|
||||
}
|
||||
_tweenObjectList.Clear();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
Vector3 vector = new Vector3(100f, 100f, 0f);
|
||||
Vector3 p = new Vector3(340f, 140f, 0f);
|
||||
if (!isLeft)
|
||||
{
|
||||
vector.x *= -1f;
|
||||
p.x *= -1f;
|
||||
}
|
||||
for (int k = 0; k < 2; k++)
|
||||
{
|
||||
Vector3[] bezierQuad = MotionUtils.GetBezierQuad(_viewData.CardTweenTarget[k].transform.localPosition, _viewData.CardTweenTarget[k].transform.localPosition + vector, p, 10);
|
||||
iTween.MoveTo(_viewData.CardTweenTarget[k], iTween.Hash("path", bezierQuad, "time", 0.25f, "islocal", true, "movetopath", false, "easetype", iTween.EaseType.linear));
|
||||
iTween.RotateTo(_viewData.CardTweenTarget[k], iTween.Hash("z", -180f, "time", 0.25f, "islocal", true, "easetype", iTween.EaseType.linear));
|
||||
_tweenObjectList.Add(_viewData.CardTweenTarget[k]);
|
||||
}
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_ARENA_DECK_1, _viewData.DeckInfoObjs.transform.position);
|
||||
}
|
||||
|
||||
private IEnumerator RunSceneNext()
|
||||
{
|
||||
SetUiCardList();
|
||||
TweenAlpha.Begin(base.gameObject, 0.5f, 0f);
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
base.gameObject.SetActive(value: false);
|
||||
CardSelectEndAction();
|
||||
}
|
||||
|
||||
public void DeckInfoCardNumUpdate(int deckNow, int deckMax, int inCardId)
|
||||
{
|
||||
_viewData.DeckInfoObjs.labels[1].text = deckNow.ToString();
|
||||
_viewData.DeckInfoObjs.labels[2].text = "/" + deckMax;
|
||||
switch (CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(inCardId).CharType)
|
||||
{
|
||||
case CardBasePrm.CharaType.NORMAL:
|
||||
_followerNum++;
|
||||
break;
|
||||
case CardBasePrm.CharaType.FIELD:
|
||||
case CardBasePrm.CharaType.CHANT_FIELD:
|
||||
_amuletNum++;
|
||||
break;
|
||||
default:
|
||||
_spellNum++;
|
||||
break;
|
||||
}
|
||||
_viewData.DeckInfoObjs.labels[3].text = _followerNum.ToString();
|
||||
_viewData.DeckInfoObjs.labels[4].text = _spellNum.ToString();
|
||||
_viewData.DeckInfoObjs.labels[5].text = _amuletNum.ToString();
|
||||
_viewData.CostCurveClass.Add(inCardId, withAnim: false);
|
||||
}
|
||||
|
||||
private void OnClickSelectBtn()
|
||||
{
|
||||
if (IsButtonEnable)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
PICK_SIDE inPickSide = ((!(UIButton.current.name == "SelectBtn0")) ? PICK_SIDE.RIGHT : PICK_SIDE.LEFT);
|
||||
CardDecide(inPickSide, isCardListUpdate: true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void CardDecide(PICK_SIDE inPickSide, bool isCardListUpdate)
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
switch (inPickSide)
|
||||
{
|
||||
case PICK_SIDE.LEFT:
|
||||
num = GetCardInfo().candidateCards[0].cardId1;
|
||||
num2 = GetCardInfo().candidateCards[0].cardId2;
|
||||
StartCoroutine(RunCardOut(isLeft: true));
|
||||
StartCoroutine(cardChoosePost(GetCardInfo().candidateCards[0].id));
|
||||
break;
|
||||
case PICK_SIDE.RIGHT:
|
||||
num = GetCardInfo().candidateCards[1].cardId1;
|
||||
num2 = GetCardInfo().candidateCards[1].cardId2;
|
||||
StartCoroutine(RunCardOut(isLeft: false));
|
||||
StartCoroutine(cardChoosePost(GetCardInfo().candidateCards[1].id));
|
||||
break;
|
||||
}
|
||||
if (isCardListUpdate)
|
||||
{
|
||||
_selectedCardList.Add(num);
|
||||
_selectedCardList.Add(num2);
|
||||
DeckInfoCardNumUpdate(_selectedCardList.Count, 30, num);
|
||||
DeckInfoCardNumUpdate(_selectedCardList.Count, 30, num2);
|
||||
}
|
||||
_viewData.SelectBtnObjs[0].gameObject.SetActive(value: false);
|
||||
_viewData.SelectBtnObjs[1].gameObject.SetActive(value: false);
|
||||
_viewData.DeckBtnObj.buttons[0].isEnabled = true;
|
||||
_viewData.DeckBtnObj.labels[0].color = LabelDefine.TEXT_COLOR_BUTTON_ENABLE;
|
||||
}
|
||||
|
||||
private IEnumerator ForceSetCardPosX()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
for (int i = 0; i < cardPosXInfoList.Count; i++)
|
||||
{
|
||||
CardPosXInfo cardPosXInfo = cardPosXInfoList[i];
|
||||
Transform transform = cardPosXInfo.Transform;
|
||||
if (!(transform == null))
|
||||
{
|
||||
Vector3 localPosition = transform.localPosition;
|
||||
localPosition.x = cardPosXInfo.PosX;
|
||||
transform.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract CardBasePrm.ClanType GetSelectedClassId();
|
||||
|
||||
protected abstract int GetSelectedSkinId();
|
||||
|
||||
protected void DeckViewOpen()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
UiCardList.SetActive(in_Active: true);
|
||||
SetUiCardList();
|
||||
UiCardList.ResetScroll();
|
||||
}
|
||||
|
||||
protected void SetUiCardList()
|
||||
{
|
||||
if (_lastTimeCardNum != _selectedCardList.Count)
|
||||
{
|
||||
if (_selectedCardList.Count != 0)
|
||||
{
|
||||
UiCardList.RemoveData();
|
||||
}
|
||||
_selectedCardList = UIManager.GetInstance().getUIBase_CardManager().SortIDList(_selectedCardList, CardMaster.CardMasterId.Default);
|
||||
for (int i = 0; i < _selectedCardList.Count; i++)
|
||||
{
|
||||
UiCardList.addScrollItem(_selectedCardList[i]);
|
||||
}
|
||||
_lastTimeCardNum = _selectedCardList.Count;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Deck GetDeckInfo();
|
||||
|
||||
protected abstract CandidateCardInfo GetCardInfo();
|
||||
|
||||
protected abstract void CardSelectEndAction();
|
||||
|
||||
protected abstract void ConnectTask(int selectedCardId);
|
||||
}
|
||||
24
SVSim.BattleEngine/Engine/TwoPickCardSelectView.cs
Normal file
24
SVSim.BattleEngine/Engine/TwoPickCardSelectView.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class TwoPickCardSelectView : MonoBehaviour
|
||||
{
|
||||
public GameObject BaseObj;
|
||||
|
||||
public NguiObjs ClassObj;
|
||||
|
||||
public NguiObjs DeckBtnObj;
|
||||
|
||||
public NguiObjs[] SelectBtnObjs;
|
||||
|
||||
public GameObject[] CardContainer;
|
||||
|
||||
public UIPanel TitlePanel;
|
||||
|
||||
public NguiObjs DeckInfoObjs;
|
||||
|
||||
public CostCurveUI CostCurveClass;
|
||||
|
||||
public GameObject[] CardTweenTarget;
|
||||
|
||||
public UILabel DeckTypeNameLabel;
|
||||
}
|
||||
27
SVSim.BattleEngine/Engine/Wizard/LoadSceneStoryData.cs
Normal file
27
SVSim.BattleEngine/Engine/Wizard/LoadSceneStoryData.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace Wizard;
|
||||
|
||||
public class LoadSceneStoryData
|
||||
{
|
||||
private const string FORMAT_STORY_TITLE_NAME = "StoryTitle_{0:0000}_1";
|
||||
|
||||
private const string FORMAT_STORY_VALUE_NAME = "StoryText_{0:0000}_1";
|
||||
|
||||
private const string STILL_TEXTURE_NAME = "bg_story_section_{0}";
|
||||
|
||||
public int StoryId { get; private set; }
|
||||
|
||||
public string StoryTitle { get; private set; }
|
||||
|
||||
public string StoryValue { get; private set; }
|
||||
|
||||
public string StillImageName { get; private set; }
|
||||
|
||||
public LoadSceneStoryData(int _storyId)
|
||||
{
|
||||
StoryId = _storyId;
|
||||
SystemText systemText = Data.SystemText;
|
||||
StoryTitle = systemText.Get($"StoryTitle_{StoryId:0000}_1");
|
||||
StoryValue = systemText.Get($"StoryText_{StoryId:0000}_1");
|
||||
StillImageName = "Images/Loading/" + $"bg_story_section_{StoryId}";
|
||||
}
|
||||
}
|
||||
91
SVSim.BattleEngine/Engine/Wizard/LoadingDownLoadStoryView.cs
Normal file
91
SVSim.BattleEngine/Engine/Wizard/LoadingDownLoadStoryView.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class LoadingDownLoadStoryView : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private UITexture _stillTexture;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _storyTitleLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _storyValueLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UIToggle _indicatorBase;
|
||||
|
||||
private List<UIToggle> _indicatorList = new List<UIToggle>();
|
||||
|
||||
private List<LoadSceneStoryData> _loadSceneStoryDatas = new List<LoadSceneStoryData>();
|
||||
|
||||
private const string FORMAT_STORY_NUMBER = "LoadStory_Number_1";
|
||||
|
||||
private int _currentIndex;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_ = Data.SystemText;
|
||||
int result = 0;
|
||||
int.TryParse(Data.SystemText.Get("LoadStory_Number_1"), out result);
|
||||
GameObject gameObject = _indicatorBase.transform.parent.gameObject;
|
||||
for (int i = 1; i <= result; i++)
|
||||
{
|
||||
_loadSceneStoryDatas.Add(new LoadSceneStoryData(i));
|
||||
_indicatorList.Add(NGUITools.AddChild(gameObject, _indicatorBase.gameObject).GetComponent<UIToggle>());
|
||||
}
|
||||
_indicatorBase.gameObject.SetActive(value: false);
|
||||
gameObject.GetComponent<UIGrid>().Reposition();
|
||||
SetStoryInfo(_currentIndex);
|
||||
}
|
||||
|
||||
private void SetStoryInfo(int index)
|
||||
{
|
||||
LoadSceneStoryData loadSceneStoryData = _loadSceneStoryDatas[index];
|
||||
_storyTitleLabel.text = loadSceneStoryData.StoryTitle;
|
||||
_storyValueLabel.text = loadSceneStoryData.StoryValue;
|
||||
_stillTexture.mainTexture = Resources.Load<Texture>(loadSceneStoryData.StillImageName);
|
||||
UpdateIndicator(index);
|
||||
}
|
||||
|
||||
public void ChangeStoryImage(bool isRight)
|
||||
{
|
||||
if (isRight)
|
||||
{
|
||||
UpdateIndexToNext();
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateIndexToPrev();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateIndexToNext()
|
||||
{
|
||||
_currentIndex = (_currentIndex + 1) % _loadSceneStoryDatas.Count;
|
||||
SetStoryInfo(_currentIndex);
|
||||
}
|
||||
|
||||
private void UpdateIndexToPrev()
|
||||
{
|
||||
if (_currentIndex > 0)
|
||||
{
|
||||
_currentIndex--;
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentIndex = _loadSceneStoryDatas.Count - 1;
|
||||
}
|
||||
SetStoryInfo(_currentIndex);
|
||||
}
|
||||
|
||||
private void UpdateIndicator(int index)
|
||||
{
|
||||
if (_indicatorList.Count > 1)
|
||||
{
|
||||
_indicatorList[index].value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
139
SVSim.BattleEngine/Engine/Wizard/ResourceDownloadCardFactory.cs
Normal file
139
SVSim.BattleEngine/Engine/Wizard/ResourceDownloadCardFactory.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class ResourceDownloadCardFactory : MonoBehaviour
|
||||
{
|
||||
private List<string> _loadFileList = new List<string>();
|
||||
|
||||
private static string GetClassIconPath(CardBasePrm.ClanType classType, bool isFetch)
|
||||
{
|
||||
int num = (int)classType;
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("class_card_" + num.ToString("00"), ResourcesManager.AssetLoadPathType.CardFrameClassIcon, isFetch);
|
||||
}
|
||||
|
||||
public bool CanView(List<int> cardIdList)
|
||||
{
|
||||
foreach (string load in GetLoadList(cardIdList, needCardFrame: true))
|
||||
{
|
||||
AssetHandle assetHandle = Toolbox.AssetManager.GetAssetHandle(load);
|
||||
if (load == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (assetHandle.isReDownloadAsset(CustomPreference.IsNormalResource))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private List<string> GetLoadList(List<int> cardIdList, bool needCardFrame)
|
||||
{
|
||||
List<string> cardPath = GetCardPath(cardIdList);
|
||||
if (needCardFrame)
|
||||
{
|
||||
cardPath.Add(UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.CardFrame));
|
||||
}
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
cardPath.Add(GetClassIconPath((CardBasePrm.ClanType)i, isFetch: false));
|
||||
}
|
||||
return cardPath;
|
||||
}
|
||||
|
||||
public void Load(List<int> cardIdList, GameObject parent, Action<List<CardListTemplate>> onFinish)
|
||||
{
|
||||
bool preferSynchronousLoad = true;
|
||||
List<string> loadList = GetLoadList(cardIdList, needCardFrame: false);
|
||||
_loadFileList.AddRange(loadList);
|
||||
loadList.Add(UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.CardFrame));
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroup(loadList, delegate
|
||||
{
|
||||
UIManager.GetInstance().AddResidentAtlas(UIAtlasManager.AssetBundleNames.CardFrame);
|
||||
CreateAllCard(cardIdList, parent, onFinish);
|
||||
}, isProgress: true, preferSynchronousLoad));
|
||||
}
|
||||
|
||||
private List<string> GetCardPath(List<int> cardIdList)
|
||||
{
|
||||
CardMaster.CardMasterId cardMasterId = CardMaster.CardMasterId.Default;
|
||||
List<string> list = new List<string>();
|
||||
foreach (int cardId in cardIdList)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(cardMasterId).GetCardParameterFromId(cardId);
|
||||
string requestPath = GetRequestPath(cardParameterFromId);
|
||||
if (!string.IsNullOrEmpty(requestPath))
|
||||
{
|
||||
list.Add(requestPath);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private string GetRequestPath(CardParameter param)
|
||||
{
|
||||
int resourceCardId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(param.NormalCardId).ResourceCardId;
|
||||
if (param.CharType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath(resourceCardId.ToString(), ResourcesManager.AssetLoadPathType.UnitCardMaterial);
|
||||
}
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath(resourceCardId.ToString(), ResourcesManager.AssetLoadPathType.SpellCardMaterial);
|
||||
}
|
||||
|
||||
private void CreateAllCard(List<int> cardIdList, GameObject parent, Action<List<CardListTemplate>> onFinish)
|
||||
{
|
||||
GameObject prefab = Resources.Load("Prefab/Cards/CardListTemplate") as GameObject;
|
||||
List<CardListTemplate> list = new List<CardListTemplate>();
|
||||
foreach (int cardId in cardIdList)
|
||||
{
|
||||
list.Add(CreateCard(cardId, parent, prefab));
|
||||
}
|
||||
onFinish.Call(list);
|
||||
}
|
||||
|
||||
private CardListTemplate CreateCard(int cardId, GameObject parent, GameObject prefab)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(cardId);
|
||||
CardListTemplate component = NGUITools.AddChild(parent, prefab).GetComponent<CardListTemplate>();
|
||||
component.SetId(cardId);
|
||||
string text = Data.SystemText.Get($"LoadCard_{cardId}");
|
||||
component._nameLabel.text = text;
|
||||
component._newLabel.gameObject.SetActive(value: false);
|
||||
component.RotationOnlyIconVisible = cardParameterFromId.IsResurgentCard;
|
||||
if (cardParameterFromId.CharType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
component._atkLabel.text = cardParameterFromId.Atk.ToString();
|
||||
component._lifeLabel.text = cardParameterFromId.Life.ToString();
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component._atkLabel, cardParameterFromId.IsFoil);
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component._lifeLabel, cardParameterFromId.IsFoil);
|
||||
}
|
||||
component._costLabel.text = cardParameterFromId.Cost.ToString();
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component._costLabel, cardParameterFromId.IsFoil);
|
||||
component._cardTexture.material = UIBase_CardManager.Get2dCardMaterial(cardParameterFromId);
|
||||
component._cardTexture.transform.localPosition += new Vector3(0f, 0f, 3f);
|
||||
component._frameSprite.transform.localPosition += new Vector3(0f, 0f, 1f);
|
||||
component._cardTexture.uvRect = Global.CARD_2D_UV_RECT;
|
||||
component.SetFrame(cardParameterFromId);
|
||||
Global.SetRepositionNameLabel(component._nameLabel, text, is2D: true);
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(component._nameLabel, cardParameterFromId.IsFoil);
|
||||
component._classIconTexture.mainTexture = ClassCharaPrm.GetClassIconTexture((int)cardParameterFromId.Clan);
|
||||
component.SetBossRushIconSprite(string.Empty);
|
||||
return component;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Release();
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList);
|
||||
_loadFileList.Clear();
|
||||
}
|
||||
}
|
||||
114
SVSim.BattleEngine/Engine/Wizard/RoomBattleWatchTaskBase.cs
Normal file
114
SVSim.BattleEngine/Engine/Wizard/RoomBattleWatchTaskBase.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
|
||||
namespace Wizard;
|
||||
|
||||
public class RoomBattleWatchTaskBase : BaseTask
|
||||
{
|
||||
public class UserInfo
|
||||
{
|
||||
public int battlePoint;
|
||||
|
||||
public int degreeId;
|
||||
|
||||
public long emblemId;
|
||||
|
||||
public string countryCode;
|
||||
|
||||
public int rank;
|
||||
|
||||
public string userName;
|
||||
|
||||
public int viewerId;
|
||||
|
||||
public bool IsOfficialUser { get; set; }
|
||||
|
||||
public UserInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public UserInfo(Dictionary<string, object> data)
|
||||
{
|
||||
viewerId = Convert.ToInt32(data["viewerId"]);
|
||||
countryCode = data["country_code"].ToString();
|
||||
userName = data["userName"].ToString();
|
||||
rank = Convert.ToInt32(data["rank"]);
|
||||
battlePoint = Convert.ToInt32(data["battlePoint"]);
|
||||
emblemId = Convert.ToInt32(data["emblemId"]);
|
||||
degreeId = Convert.ToInt32(data["degreeId"]);
|
||||
IsOfficialUser = Convert.ToInt32(data["isOfficial"]) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
public int result_reason;
|
||||
|
||||
public string node_server_url;
|
||||
|
||||
public UserInfo owner_info;
|
||||
|
||||
public UserInfo visitor_info;
|
||||
|
||||
public BattleParameter BattleParameterInstance { get; private set; }
|
||||
|
||||
protected override int Parse()
|
||||
{
|
||||
int num = base.Parse();
|
||||
if (num != 1)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
JsonData jsonData = base.ResponseData["data"];
|
||||
result_reason = jsonData["result_reason"].ToInt();
|
||||
if (result_reason == 0)
|
||||
{
|
||||
if (jsonData.Keys.Contains("owner_info"))
|
||||
{
|
||||
ParseUserInfo(jsonData["owner_info"], ref owner_info);
|
||||
}
|
||||
if (jsonData.Keys.Contains("visitor_info"))
|
||||
{
|
||||
ParseUserInfo(jsonData["visitor_info"], ref visitor_info);
|
||||
}
|
||||
node_server_url = jsonData["node_server_url"].ToString();
|
||||
}
|
||||
if (jsonData.Keys.Contains("is_admin"))
|
||||
{
|
||||
bool flag = Convert.ToBoolean(jsonData["is_admin"].ToInt());
|
||||
GameMgr.GetIns().IsAdmin = flag;
|
||||
GameMgr.GetIns().HasAuthAdmin = flag;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().IsAdmin = false;
|
||||
GameMgr.GetIns().HasAuthAdmin = false;
|
||||
}
|
||||
BattleParameterInstance = BattleParameter.JsonToBattleParameter(base.ResponseData["data"]);
|
||||
if (BattleParameterInstance.BattleType == NetworkDefine.ServerBattleType.RoomTwoPick)
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.RoomTwoPick;
|
||||
GameMgr.GetIns().GetDataMgr().TwoPickFormat = BattleParameterInstance.TwoPickFormat;
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.RoomBattle;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private void ParseUserInfo(JsonData receive, ref UserInfo info)
|
||||
{
|
||||
if (receive != null)
|
||||
{
|
||||
info = new UserInfo();
|
||||
info.viewerId = receive["viewer_id"].ToInt();
|
||||
info.battlePoint = receive["battlePoint"].ToInt();
|
||||
info.degreeId = receive["degreeId"].ToInt();
|
||||
info.emblemId = receive["emblemId"].ToLong();
|
||||
info.countryCode = receive["country_code"].ToString();
|
||||
info.rank = receive["rank"].ToInt();
|
||||
info.userName = receive["userName"].ToString();
|
||||
info.IsOfficialUser = receive["isOfficial"].ToInt() == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user