feat(battle-engine): close the AI-simulation subsystem (verbatim)
Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
6
SVSim.BattleEngine/Engine/AISendIntervalTrigger.cs
Normal file
6
SVSim.BattleEngine/Engine/AISendIntervalTrigger.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
public class AISendIntervalTrigger : SendIntervalTrigger
|
||||
{
|
||||
public override void SendDataCheck(NetworkBattleManagerBase networkBattleManager, NetworkBattleDefine.NetworkBattleURI sendUri)
|
||||
{
|
||||
}
|
||||
}
|
||||
58
SVSim.BattleEngine/Engine/AITurnControl.cs
Normal file
58
SVSim.BattleEngine/Engine/AITurnControl.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using Cute;
|
||||
using Wizard;
|
||||
|
||||
public class AITurnControl
|
||||
{
|
||||
private DateTime _startTime;
|
||||
|
||||
private bool _isStartTimer;
|
||||
|
||||
public AITurnControl()
|
||||
{
|
||||
_isStartTimer = false;
|
||||
}
|
||||
|
||||
public void StartTurnTimer()
|
||||
{
|
||||
_isStartTimer = true;
|
||||
_startTime = TimeUtil.GetAbsoluteTime();
|
||||
}
|
||||
|
||||
public void SetAndStartTurnTimer(DateTime time)
|
||||
{
|
||||
_isStartTimer = true;
|
||||
_startTime = time;
|
||||
}
|
||||
|
||||
public void Update(IEnemyAI ai)
|
||||
{
|
||||
if (ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive && !ai.IsConnectNetwork)
|
||||
{
|
||||
ai.Reconnect();
|
||||
}
|
||||
if (!_isStartTimer || !ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive)
|
||||
{
|
||||
if (_isStartTimer && ai.IsConnectNetwork)
|
||||
{
|
||||
ai.Disconnect();
|
||||
}
|
||||
}
|
||||
else if ((float)NetworkUtility.GetTimeSpanSecond(_startTime.Ticks) >= 90f)
|
||||
{
|
||||
if (ai.IsStackAction)
|
||||
{
|
||||
ai.CleanupStackedAction();
|
||||
}
|
||||
if (!ai.IsStackAction)
|
||||
{
|
||||
ai.TurnEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopTurnTimer()
|
||||
{
|
||||
_isStartTimer = false;
|
||||
}
|
||||
}
|
||||
20
SVSim.BattleEngine/Engine/AddHealModifierInfo.cs
Normal file
20
SVSim.BattleEngine/Engine/AddHealModifierInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
public class AddHealModifierInfo : HealModifier
|
||||
{
|
||||
public int AddHealAmount { get; private set; }
|
||||
|
||||
public AddHealModifierInfo(int addHealAmount, int order, BattleCardBase owner)
|
||||
{
|
||||
AddHealAmount = addHealAmount;
|
||||
base.OrderCount = order;
|
||||
_owner = owner;
|
||||
}
|
||||
|
||||
public override int Calc(int healAmount, BattleCardBase healOwner, BattleCardBase target)
|
||||
{
|
||||
if (healOwner.IsPlayer != _owner.IsPlayer)
|
||||
{
|
||||
return healAmount;
|
||||
}
|
||||
return healAmount + AddHealAmount;
|
||||
}
|
||||
}
|
||||
95
SVSim.BattleEngine/Engine/AreaBGInfo.cs
Normal file
95
SVSim.BattleEngine/Engine/AreaBGInfo.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AreaBGInfo : MonoBehaviour
|
||||
{
|
||||
private readonly List<ChapterExtraData> _chapterExtraDatas = new List<ChapterExtraData>
|
||||
{
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 2,
|
||||
ExtraTextureChapter = 10,
|
||||
BGExtraEffectPath = "scn_map_change_1",
|
||||
SeType = Se.TYPE.SE_MAP_TREE_EFFECT
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 2,
|
||||
ExtraTextureChapter = 11,
|
||||
ExtraTextureIndex = { 1, 2 },
|
||||
BGSuffix = "b"
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 2,
|
||||
ExtraTextureChapter = 12,
|
||||
ExtraTextureIndex = { 1, 2 },
|
||||
BGSuffix = "b"
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 1,
|
||||
ExtraTextureChapter = 4,
|
||||
BGExtraEffectPath = "scn_map_change_1",
|
||||
SeType = Se.TYPE.SE_MAP_TREE_EFFECT,
|
||||
ClanType = CardBasePrm.ClanType.NEMESIS
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 1,
|
||||
ExtraTextureChapter = 5,
|
||||
ExtraTextureIndex = { 1, 2 },
|
||||
BGSuffix = "b",
|
||||
ClanType = CardBasePrm.ClanType.NEMESIS
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 1,
|
||||
ExtraTextureChapter = 6,
|
||||
ExtraTextureIndex = { 1, 2 },
|
||||
BGSuffix = "b",
|
||||
ClanType = CardBasePrm.ClanType.NEMESIS
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 9,
|
||||
ExtraTextureChapter = 1,
|
||||
BGSectionId = 4,
|
||||
BGExtraEffectPath = "scn_map_change_4",
|
||||
BGFirstClearEffectPath = "scn_map_change_2",
|
||||
FirstClearSeType = Se.TYPE.SE_MAP_SECTION9_CHAPTER1,
|
||||
SeType = Se.TYPE.SE_MAP_SECTION9_CHANGE_CHAPTER,
|
||||
ChapterMoveTime = 0f,
|
||||
FirstClearEffectDelayTime = 1.2f,
|
||||
FirstClearMoveOutDelayTime = 0.5f
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 9,
|
||||
ExtraTextureChapter = 2,
|
||||
BGSectionId = 7,
|
||||
BGExtraEffectPath = "scn_map_change_4",
|
||||
BGFirstClearEffectPath = "scn_map_change_3",
|
||||
FirstClearSeType = Se.TYPE.SE_MAP_SECTION9_CHAPTER2,
|
||||
SeType = Se.TYPE.SE_MAP_SECTION9_CHANGE_CHAPTER,
|
||||
FirstClearEffectDelayTime = 1.2f,
|
||||
FirstClearMoveDelayTime = 1f
|
||||
},
|
||||
new ChapterExtraData
|
||||
{
|
||||
SectionId = 9003,
|
||||
ExtraTextureIndex = { 1, 2 },
|
||||
BGSuffix = "c"
|
||||
}
|
||||
};
|
||||
|
||||
public List<ChapterExtraData> GetExtraChapters(int sectionId, int? selectStoryClassId)
|
||||
{
|
||||
List<ChapterExtraData> list = _chapterExtraDatas.FindAll((ChapterExtraData item) => item.SectionId == sectionId);
|
||||
if (sectionId == 20)
|
||||
{
|
||||
list.AddRange(AreaBGInfoSection20.GetChapterExtraDatas());
|
||||
}
|
||||
return list.FindAll((ChapterExtraData item) => (CardBasePrm.ClanType?)item.ClanType == (CardBasePrm.ClanType?)selectStoryClassId || item.ClanType == CardBasePrm.ClanType.NONE);
|
||||
}
|
||||
}
|
||||
489
SVSim.BattleEngine/Engine/AreaSelectBG.cs
Normal file
489
SVSim.BattleEngine/Engine/AreaSelectBG.cs
Normal file
@@ -0,0 +1,489 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class AreaSelectBG
|
||||
{
|
||||
private const float BGTEXTURE_WIDTH = 1024f;
|
||||
|
||||
private const float BGTEXTURE_HEIGHT = 1024f;
|
||||
|
||||
private const int BGTEXTURE_NUM_X = 4;
|
||||
|
||||
private const int BGTEXTURE_NUM_Y = 3;
|
||||
|
||||
private const float BGTEXTURE_WIDTH_HALF_LEFT = 2048f;
|
||||
|
||||
private const float BGTEXTURE_WIDTH_HALF_RIGHT = 2560f;
|
||||
|
||||
private const float BGTEXTURE_HEIGHT_HALF_UP = 1536f;
|
||||
|
||||
private const float BGTEXTURE_HEIGHT_HALF_BOTTOM = 1536f;
|
||||
|
||||
private const float BGTEXTURE_DRAG_MARGIN = 5f;
|
||||
|
||||
private const float BGTEXTURE_DRAG_DECELERATION = 0.875f;
|
||||
|
||||
private const float BGTEXTURE_DRAGARROW_ANIM_SPEED = 1f;
|
||||
|
||||
private const float BGDRAG_SEC_MAXSPEED = 0.25f;
|
||||
|
||||
private const float BGDRAG_SEC_RESETUPTOTIME_MAX = 0.5f;
|
||||
|
||||
private AreaSelectUI _areaSelectUI;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _BGRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture[] _BGTexture;
|
||||
|
||||
[SerializeField]
|
||||
private AreaBGInfo _areaBGInfo;
|
||||
|
||||
private ParticleSystem _bgEffect;
|
||||
|
||||
private AreaSelectEffectControlBase _bgEffectControl;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _BGDragCollision;
|
||||
|
||||
private Vector2 _BGDragDelta = Vector2.zero;
|
||||
|
||||
private bool _isBGDragEnable;
|
||||
|
||||
private float _BGDragSec;
|
||||
|
||||
private float _BGDragSecResetUpToTime;
|
||||
|
||||
private List<string> _loadedResources = new List<string>();
|
||||
|
||||
private bool _isLoadEndBGTexture = true;
|
||||
|
||||
private bool _isLoadEndParticle = true;
|
||||
|
||||
private StorySectionData _sectionData;
|
||||
|
||||
private int? _sectionClassId;
|
||||
|
||||
private List<ChapterExtraData> _extraChapters = new List<ChapterExtraData>();
|
||||
|
||||
private bool _isNormalBgSet = true;
|
||||
|
||||
private bool _changeChapterFirstCall = true;
|
||||
|
||||
private float _currentAspectRatio;
|
||||
|
||||
private Vector3 _currentBGScale = Vector3.one;
|
||||
|
||||
private Vector3 _currentParentPos = Vector3.zero;
|
||||
|
||||
private Vector2 _minMovablePos = Vector3.one;
|
||||
|
||||
private Vector2 _maxMovablePos = Vector3.one;
|
||||
|
||||
public ChapterExtraData ChapterExtraData { get; private set; }
|
||||
|
||||
public ChapterExtraData TransitionChapterExtraData { get; private set; }
|
||||
|
||||
public int BeforeChapterId { get; private set; }
|
||||
|
||||
public GameObject GetBGRoot()
|
||||
{
|
||||
return _BGRoot;
|
||||
}
|
||||
|
||||
public bool GetLoadEnd()
|
||||
{
|
||||
if (_isLoadEndBGTexture)
|
||||
{
|
||||
return _isLoadEndParticle;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetActiveBGEffect(bool isActive)
|
||||
{
|
||||
_bgEffect.gameObject.SetActive(isActive);
|
||||
if (_bgEffectControl != null)
|
||||
{
|
||||
_bgEffectControl.SetActiveBGEffect(isActive);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsBGDragEnable()
|
||||
{
|
||||
return _isBGDragEnable;
|
||||
}
|
||||
|
||||
public void Init(AreaSelectUI areaSelectUI)
|
||||
{
|
||||
_areaSelectUI = areaSelectUI;
|
||||
UIEventListener component = _BGDragCollision.GetComponent<UIEventListener>();
|
||||
if (null != component)
|
||||
{
|
||||
component.onDrag = OnDragBG;
|
||||
}
|
||||
SetBGDragEnable(enable: false);
|
||||
}
|
||||
|
||||
public void Term()
|
||||
{
|
||||
int i = 0;
|
||||
for (int num = _BGTexture.Length; i < num; i++)
|
||||
{
|
||||
_BGTexture[i].mainTexture = null;
|
||||
}
|
||||
}
|
||||
|
||||
private string GetBackGroundPath(int backGroundId, int index, bool isFetch = false)
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("bg_story_" + backGroundId.ToString("00") + "_" + (index + 1).ToString("00"), ResourcesManager.AssetLoadPathType.Background, isFetch);
|
||||
}
|
||||
|
||||
private string GetExtraBackGroundPath(StorySectionData sectionData, int index, string suffix, bool isFetch = false)
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("bg_story_" + sectionData.BackGroundId.ToString("00") + "_" + (index + 1).ToString("00") + suffix, ResourcesManager.AssetLoadPathType.Background, isFetch);
|
||||
}
|
||||
|
||||
private string GetExtraBackGroundPath(int backgroundId, int index, string suffix, bool isFetch = false)
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("bg_story_" + backgroundId.ToString("00") + "_" + (index + 1).ToString("00") + suffix, ResourcesManager.AssetLoadPathType.Background, isFetch);
|
||||
}
|
||||
|
||||
private string GetMapEffectPath(int backGroundId, bool isFetch = false)
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("scn_map_world_" + backGroundId, ResourcesManager.AssetLoadPathType.Effect2D, isFetch);
|
||||
}
|
||||
|
||||
private string GetTreeEffectPath(int backGroundId, bool isFetch = false)
|
||||
{
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("scn_map_world_tree_" + backGroundId, ResourcesManager.AssetLoadPathType.Effect2D, isFetch);
|
||||
}
|
||||
|
||||
public void LoadBG(StorySectionData sectionData, int? sectionClassId)
|
||||
{
|
||||
_sectionData = sectionData;
|
||||
_sectionClassId = sectionClassId;
|
||||
_extraChapters = _areaBGInfo.GetExtraChapters(_sectionData.Id, sectionClassId);
|
||||
_loadedResources.Add(GetMapEffectPath(sectionData.BackGroundId));
|
||||
_isLoadEndBGTexture = false;
|
||||
for (int i = 0; i < _BGTexture.Length; i++)
|
||||
{
|
||||
_loadedResources.Add(GetBackGroundPath(sectionData.BackGroundId, i));
|
||||
}
|
||||
foreach (ChapterExtraData extraChapter in _extraChapters)
|
||||
{
|
||||
int num = sectionData.BackGroundId;
|
||||
if (extraChapter.IsUseOtherSectionBG())
|
||||
{
|
||||
num = extraChapter.BGSectionId;
|
||||
for (int j = 0; j < _BGTexture.Length; j++)
|
||||
{
|
||||
_loadedResources.Add(GetBackGroundPath(num, j));
|
||||
}
|
||||
_loadedResources.Add(GetMapEffectPath(num));
|
||||
if (extraChapter.AddTreeEffect)
|
||||
{
|
||||
_loadedResources.Add(GetTreeEffectPath(num));
|
||||
}
|
||||
}
|
||||
foreach (int item in extraChapter.ExtraTextureIndex)
|
||||
{
|
||||
_loadedResources.Add(GetExtraBackGroundPath(num, item, extraChapter.BGSuffix));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(extraChapter.BGExtraEffectPath))
|
||||
{
|
||||
_loadedResources.Add(Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGExtraEffectPath, ResourcesManager.AssetLoadPathType.Effect2D));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(extraChapter.BGFirstClearEffectPath))
|
||||
{
|
||||
_loadedResources.Add(Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGFirstClearEffectPath, ResourcesManager.AssetLoadPathType.Effect2D));
|
||||
}
|
||||
}
|
||||
_areaSelectUI.StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadedResources, _OnLoadEndBG));
|
||||
_isLoadEndParticle = false;
|
||||
}
|
||||
|
||||
public void UnLoadBG()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResources);
|
||||
_loadedResources.Clear();
|
||||
_sectionData = null;
|
||||
_sectionClassId = null;
|
||||
}
|
||||
|
||||
private void _OnLoadEndBG()
|
||||
{
|
||||
List<GameObject> list = new List<GameObject>();
|
||||
_bgEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetMapEffectPath(_sectionData.BackGroundId, isFetch: true)) as GameObject).GetComponent<ParticleSystem>();
|
||||
Vector3 localScale = _bgEffect.transform.localScale;
|
||||
_bgEffect.transform.parent = _BGRoot.transform;
|
||||
_bgEffect.transform.localScale = localScale;
|
||||
_bgEffect.transform.localPosition = Vector3.zero;
|
||||
_bgEffectControl = _bgEffect.gameObject.GetComponent<AreaSelectEffectControlBase>();
|
||||
list.Add(_bgEffect.gameObject);
|
||||
if (_bgEffectControl != null)
|
||||
{
|
||||
_bgEffectControl._backGroundEffects.Add(_bgEffectControl.BASE_EFFECT_INDEX, _bgEffect);
|
||||
_bgEffectControl._backGroundEffects.Add(_sectionData.BackGroundId, _bgEffect);
|
||||
}
|
||||
for (int i = 0; i < _BGTexture.Length; i++)
|
||||
{
|
||||
_BGTexture[i].mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(_sectionData.BackGroundId, i, isFetch: true)) as Texture;
|
||||
}
|
||||
foreach (ChapterExtraData extraChapter in _extraChapters)
|
||||
{
|
||||
Dictionary<int, Texture> bGTexture = extraChapter.BGTexture;
|
||||
int num = _sectionData.BackGroundId;
|
||||
if (extraChapter.IsUseOtherSectionBG())
|
||||
{
|
||||
num = extraChapter.BGSectionId;
|
||||
for (int j = 0; j < _BGTexture.Length; j++)
|
||||
{
|
||||
bGTexture.Add(j, Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(num, j, isFetch: true)) as Texture);
|
||||
}
|
||||
if (num != _sectionData.BackGroundId && !_bgEffectControl._backGroundEffects.ContainsKey(num))
|
||||
{
|
||||
ParticleSystem particleSystem = InitParticle(num, extraChapter.AddTreeEffect);
|
||||
_bgEffectControl._backGroundEffects.Add(num, particleSystem);
|
||||
list.Add(particleSystem.gameObject);
|
||||
}
|
||||
}
|
||||
foreach (int item in extraChapter.ExtraTextureIndex)
|
||||
{
|
||||
if (!bGTexture.ContainsKey(item))
|
||||
{
|
||||
bGTexture.Add(item, Toolbox.ResourcesManager.LoadObject(GetExtraBackGroundPath(num, item, extraChapter.BGSuffix, isFetch: true)) as Texture);
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(extraChapter.BGExtraEffectPath))
|
||||
{
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGExtraEffectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true);
|
||||
extraChapter.ExtraEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(assetTypePath) as GameObject);
|
||||
if (extraChapter.AttachExtraEffectToBgRoot)
|
||||
{
|
||||
extraChapter.ExtraEffect.transform.parent = _BGRoot.transform;
|
||||
extraChapter.ExtraEffect.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
extraChapter.ExtraEffect.transform.parent = _areaSelectUI.transform;
|
||||
}
|
||||
extraChapter.ExtraEffect.SetActive(value: false);
|
||||
List<string> collection = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(extraChapter.ExtraEffect, null);
|
||||
_loadedResources.AddRange(collection);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(extraChapter.BGFirstClearEffectPath))
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGFirstClearEffectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true);
|
||||
extraChapter.FirstClearEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(assetTypePath2) as GameObject);
|
||||
extraChapter.FirstClearEffect.transform.parent = _areaSelectUI.transform;
|
||||
extraChapter.FirstClearEffect.SetActive(value: false);
|
||||
List<string> collection2 = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(extraChapter.FirstClearEffect, null);
|
||||
_loadedResources.AddRange(collection2);
|
||||
}
|
||||
}
|
||||
List<string> collection3 = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list, delegate
|
||||
{
|
||||
_isLoadEndParticle = true;
|
||||
});
|
||||
_loadedResources.AddRange(collection3);
|
||||
_isLoadEndBGTexture = true;
|
||||
}
|
||||
|
||||
private ParticleSystem InitParticle(int bgId, bool addTreeEffect = false)
|
||||
{
|
||||
Vector3 vector = default(Vector3);
|
||||
ParticleSystem component = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetMapEffectPath(bgId, isFetch: true)) as GameObject).GetComponent<ParticleSystem>();
|
||||
vector = component.transform.localScale;
|
||||
component.transform.parent = _BGRoot.transform;
|
||||
component.transform.localScale = vector;
|
||||
component.transform.localPosition = Vector3.zero;
|
||||
if (addTreeEffect)
|
||||
{
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetTreeEffectPath(bgId, isFetch: true)) as GameObject);
|
||||
gameObject.transform.parent = component.transform;
|
||||
gameObject.transform.localScale = Vector3.one;
|
||||
gameObject.transform.localPosition = Vector3.zero;
|
||||
}
|
||||
return component;
|
||||
}
|
||||
|
||||
public void OnChangeSelectChapter(StoryChapterData chapterData, bool isFirstClear)
|
||||
{
|
||||
TransitionChapterExtraData = null;
|
||||
if (_extraChapters.Count > 0)
|
||||
{
|
||||
int intChapterId = int.Parse(chapterData.ChapterId);
|
||||
ChapterExtraData = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == intChapterId);
|
||||
}
|
||||
if (_bgEffectControl != null)
|
||||
{
|
||||
_bgEffectControl.OnChangeSelectChapter(this, _sectionData, _sectionClassId, chapterData, isFirstClear);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetExtraTexture(int chapterId)
|
||||
{
|
||||
if (_extraChapters.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ChapterExtraData chapterExtraData = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == chapterId || n.SectionId == 9003);
|
||||
if (chapterExtraData != null && chapterExtraData.IsChangeBG())
|
||||
{
|
||||
int num = _sectionData.BackGroundId;
|
||||
if (chapterExtraData.IsUseOtherSectionBG())
|
||||
{
|
||||
num = chapterExtraData.BGSectionId;
|
||||
for (int num2 = 0; num2 < _BGTexture.Length; num2++)
|
||||
{
|
||||
_BGTexture[num2].mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(num, num2, isFetch: true)) as Texture;
|
||||
}
|
||||
}
|
||||
foreach (int item in chapterExtraData.ExtraTextureIndex)
|
||||
{
|
||||
_BGTexture[item].mainTexture = Toolbox.ResourcesManager.LoadObject(GetExtraBackGroundPath(num, item, chapterExtraData.BGSuffix, isFetch: true)) as Texture;
|
||||
}
|
||||
_isNormalBgSet = false;
|
||||
}
|
||||
else if (!_isNormalBgSet)
|
||||
{
|
||||
for (int num3 = 0; num3 < _BGTexture.Length; num3++)
|
||||
{
|
||||
_BGTexture[num3].mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(_sectionData.BackGroundId, num3, isFetch: true)) as Texture;
|
||||
}
|
||||
_isNormalBgSet = true;
|
||||
}
|
||||
}
|
||||
|
||||
public List<int> GetChaptersWithDifferentBackgroundFrom(int chapterId)
|
||||
{
|
||||
ChapterExtraData chapterExtra = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == chapterId);
|
||||
IEnumerable<ChapterExtraData> source = ((chapterExtra == null || !chapterExtra.IsUseOtherSectionBG()) ? _extraChapters.Where((ChapterExtraData c) => c.IsUseOtherSectionBG() && c.BGSectionId != _sectionData.BackGroundId) : _extraChapters.Where((ChapterExtraData c) => c.BGSectionId != chapterExtra.BGSectionId));
|
||||
return source.Select((ChapterExtraData s) => s.ExtraTextureChapter).ToList();
|
||||
}
|
||||
|
||||
public void SetExtraEffect(int chapterId, bool isFirstClear = false)
|
||||
{
|
||||
if (_extraChapters.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<ChapterExtraData> list = new List<ChapterExtraData>();
|
||||
list = ((BeforeChapterId >= chapterId) ? _extraChapters.FindAll((ChapterExtraData n) => n.ExtraTextureChapter != 0 && BeforeChapterId > n.ExtraTextureChapter && n.ExtraTextureChapter >= chapterId) : _extraChapters.FindAll((ChapterExtraData n) => n.ExtraTextureChapter != 0 && BeforeChapterId <= n.ExtraTextureChapter && n.ExtraTextureChapter < chapterId));
|
||||
BeforeChapterId = chapterId;
|
||||
TransitionChapterExtraData = list.FirstOrDefault((ChapterExtraData n) => n.ExtraEffect != null);
|
||||
if (isFirstClear)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (list.Count() == 0 || TransitionChapterExtraData == null)
|
||||
{
|
||||
_changeChapterFirstCall = false;
|
||||
return;
|
||||
}
|
||||
TransitionChapterExtraData = list.FirstOrDefault((ChapterExtraData n) => n.ExtraEffect != null);
|
||||
if (!_changeChapterFirstCall && TransitionChapterExtraData != null && TransitionChapterExtraData.ExtraEffect != null)
|
||||
{
|
||||
TransitionChapterExtraData.ExtraEffect.SetActive(value: false);
|
||||
TransitionChapterExtraData.ExtraEffect.SetActive(value: true);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(TransitionChapterExtraData.SeType);
|
||||
}
|
||||
_changeChapterFirstCall = false;
|
||||
}
|
||||
|
||||
public IEnumerator SetClearEffect()
|
||||
{
|
||||
ChapterExtraData clearChapterExtraData = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == BeforeChapterId);
|
||||
if (clearChapterExtraData != null && clearChapterExtraData.FirstClearEffect != null)
|
||||
{
|
||||
yield return new WaitForSeconds(clearChapterExtraData.FirstClearEffectDelayTime);
|
||||
clearChapterExtraData.FirstClearEffect.SetActive(value: false);
|
||||
clearChapterExtraData.FirstClearEffect.SetActive(value: true);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(clearChapterExtraData.FirstClearSeType);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupEnd()
|
||||
{
|
||||
if (_bgEffectControl != null)
|
||||
{
|
||||
_bgEffectControl.SetupEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDragBG(GameObject obj, Vector2 delta)
|
||||
{
|
||||
_BGDragSecResetUpToTime = 0.5f;
|
||||
_BGDragSec += Time.deltaTime;
|
||||
_BGDragSec = Mathf.Min(_BGDragSec, 0.25f);
|
||||
float t = Mathf.Clamp(_BGDragSec / 0.25f, 0f, 1f);
|
||||
_BGDragDelta = Vector2.Lerp(Vector2.zero, delta, t);
|
||||
}
|
||||
|
||||
public void UpdateBGDrag()
|
||||
{
|
||||
if (_BGDragSecResetUpToTime > 0f)
|
||||
{
|
||||
_BGDragSecResetUpToTime -= Time.deltaTime;
|
||||
if (_BGDragSecResetUpToTime < 0f)
|
||||
{
|
||||
_BGDragSecResetUpToTime = 0f;
|
||||
_BGDragSec = 0f;
|
||||
}
|
||||
}
|
||||
if (!Mathf.Approximately(_BGDragDelta.x, 0f) || !Mathf.Approximately(_BGDragDelta.y, 0f))
|
||||
{
|
||||
_BGDragDelta.x *= 0.875f;
|
||||
_BGDragDelta.y *= 0.875f;
|
||||
Vector3 localPosition = _BGRoot.transform.localPosition;
|
||||
localPosition.x += _BGDragDelta.x;
|
||||
localPosition.y += _BGDragDelta.y;
|
||||
UpdateMovableRange();
|
||||
localPosition.x = Mathf.Clamp(localPosition.x, _minMovablePos.x, _maxMovablePos.x);
|
||||
localPosition.y = Mathf.Clamp(localPosition.y, _minMovablePos.y, _maxMovablePos.y);
|
||||
_BGRoot.transform.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBGDragEnable(bool enable)
|
||||
{
|
||||
_isBGDragEnable = enable;
|
||||
_BGDragCollision.SetActive(enable);
|
||||
_BGDragDelta = Vector2.zero;
|
||||
}
|
||||
|
||||
private void UpdateMovableRange()
|
||||
{
|
||||
float num = (float)Screen.width / (float)Screen.height;
|
||||
Vector3 localScale = _BGRoot.transform.localScale;
|
||||
Vector3 localPosition = _BGRoot.transform.parent.transform.localPosition;
|
||||
if (!(localScale == _currentBGScale) || num != _currentAspectRatio || !(localPosition == _currentParentPos))
|
||||
{
|
||||
float num2 = UIManager.GetInstance().UIManagerRoot.manualHeight;
|
||||
if (1.7777778f > num)
|
||||
{
|
||||
num2 *= 1.7777778f / num;
|
||||
}
|
||||
float num3 = num2 * num * 0.5f;
|
||||
float num4 = num2 * 0.5f;
|
||||
float num5 = 2048f * localScale.x;
|
||||
float num6 = 2560f * localScale.x;
|
||||
float num7 = 1536f * localScale.y;
|
||||
float num8 = 1536f * localScale.y;
|
||||
_minMovablePos.x = 0f - num6 + num3 + 5f - localPosition.x;
|
||||
_maxMovablePos.x = num5 - num3 - 5f - localPosition.x;
|
||||
_minMovablePos.y = 0f - num7 + num4 + 5f - localPosition.y;
|
||||
_maxMovablePos.y = num8 - num4 - 5f - localPosition.y;
|
||||
_currentAspectRatio = num;
|
||||
_currentBGScale = localScale;
|
||||
_currentParentPos = localPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
136
SVSim.BattleEngine/Engine/AreaSelectChapterEffect.cs
Normal file
136
SVSim.BattleEngine/Engine/AreaSelectChapterEffect.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class AreaSelectChapterEffect
|
||||
{
|
||||
private static readonly Vector3 EFFECT_SCALE = new Vector3(320f, 320f, 320f);
|
||||
|
||||
private AreaSelectUI _areaSelectUI;
|
||||
|
||||
private List<string> _loadedResources = new List<string>();
|
||||
|
||||
private bool _isLoadEnd = true;
|
||||
|
||||
private Transform _effectParent;
|
||||
|
||||
private Dictionary<string, ParticleSystem> _effectList = new Dictionary<string, ParticleSystem>();
|
||||
|
||||
private string _playingEffect = "";
|
||||
|
||||
public bool GetLoadEnd()
|
||||
{
|
||||
return _isLoadEnd;
|
||||
}
|
||||
|
||||
public void Init(AreaSelectUI areaselectUI, Transform effectParent)
|
||||
{
|
||||
_areaSelectUI = areaselectUI;
|
||||
_effectParent = effectParent;
|
||||
_playingEffect = "";
|
||||
}
|
||||
|
||||
public void Term()
|
||||
{
|
||||
foreach (KeyValuePair<string, ParticleSystem> effect in _effectList)
|
||||
{
|
||||
ParticleSystem value = effect.Value;
|
||||
if (!(null == value))
|
||||
{
|
||||
Object.Destroy(value.gameObject);
|
||||
}
|
||||
}
|
||||
_effectList.Clear();
|
||||
_playingEffect = "";
|
||||
}
|
||||
|
||||
public void LoadEffect(List<StoryChapterData> chapterDataList)
|
||||
{
|
||||
_isLoadEnd = false;
|
||||
string path = "";
|
||||
int i = 0;
|
||||
for (int count = chapterDataList.Count; i < count; i++)
|
||||
{
|
||||
path = chapterDataList[i].ChapterEffectPath;
|
||||
if (!string.IsNullOrEmpty(path) && !_effectList.ContainsKey(path))
|
||||
{
|
||||
_effectList.Add(path, null);
|
||||
_loadedResources.Add(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.Effect2D));
|
||||
}
|
||||
}
|
||||
_areaSelectUI.StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadedResources, delegate
|
||||
{
|
||||
List<GameObject> list = new List<GameObject>(_effectList.Count);
|
||||
int j = 0;
|
||||
for (int count2 = chapterDataList.Count; j < count2; j++)
|
||||
{
|
||||
path = chapterDataList[j].ChapterEffectPath;
|
||||
if (!string.IsNullOrEmpty(path) && !(null != _effectList[path]))
|
||||
{
|
||||
GameObject gameObject = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject;
|
||||
if (!(null == gameObject))
|
||||
{
|
||||
_effectList[path] = Object.Instantiate(gameObject).GetComponent<ParticleSystem>();
|
||||
_effectList[path].transform.parent = _effectParent;
|
||||
_effectList[path].transform.localPosition = Vector3.zero;
|
||||
_effectList[path].transform.localScale = EFFECT_SCALE;
|
||||
_effectList[path].gameObject.SetActive(value: false);
|
||||
list.Add(_effectList[path].gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
_loadedResources.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list, delegate
|
||||
{
|
||||
_isLoadEnd = true;
|
||||
}));
|
||||
}));
|
||||
}
|
||||
|
||||
public void UnLoadEffect()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResources);
|
||||
_loadedResources.Clear();
|
||||
}
|
||||
|
||||
public void PlayEffect(string path, Vector3 pos)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path) && !(_playingEffect == path) && _effectList.ContainsKey(path) && !(null == _effectList[path]))
|
||||
{
|
||||
_effectList[path].gameObject.SetActive(value: true);
|
||||
_effectList[path].Play();
|
||||
_effectList[path].transform.localPosition = pos;
|
||||
_playingEffect = path;
|
||||
SetParticleSystemsSpeed(1f);
|
||||
}
|
||||
}
|
||||
|
||||
public void StopEffect(float? simulationSpeedAfterStop)
|
||||
{
|
||||
if (_effectList.ContainsKey(_playingEffect) && !(null == _effectList[_playingEffect]))
|
||||
{
|
||||
if (simulationSpeedAfterStop.HasValue)
|
||||
{
|
||||
SetParticleSystemsSpeed(simulationSpeedAfterStop.Value);
|
||||
}
|
||||
_effectList[_playingEffect].Stop();
|
||||
_playingEffect = "";
|
||||
}
|
||||
}
|
||||
|
||||
public string GetPlayingEffect()
|
||||
{
|
||||
return _playingEffect;
|
||||
}
|
||||
|
||||
private void SetParticleSystemsSpeed(float speed)
|
||||
{
|
||||
ParticleSystem.MainModule main = _effectList[_playingEffect].main;
|
||||
main.simulationSpeed = speed;
|
||||
ParticleSystem[] componentsInChildren = _effectList[_playingEffect].GetComponentsInChildren<ParticleSystem>();
|
||||
for (int i = 0; i < componentsInChildren.Length; i++)
|
||||
{
|
||||
ParticleSystem.MainModule main2 = componentsInChildren[i].main;
|
||||
main2.simulationSpeed = speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
SVSim.BattleEngine/Engine/AreaSelectEffectControlBase.cs
Normal file
27
SVSim.BattleEngine/Engine/AreaSelectEffectControlBase.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AreaSelectEffectControlBase : MonoBehaviour
|
||||
{
|
||||
[NonSerialized]
|
||||
public Dictionary<int, ParticleSystem> _backGroundEffects = new Dictionary<int, ParticleSystem>();
|
||||
|
||||
[NonSerialized]
|
||||
public readonly int BASE_EFFECT_INDEX = -1;
|
||||
|
||||
protected bool IsSetupEnd { get; private set; }
|
||||
|
||||
public virtual void SetupEnd()
|
||||
{
|
||||
IsSetupEnd = true;
|
||||
}
|
||||
|
||||
public virtual void OnChangeSelectChapter(AreaSelectBG areaSelectBG, StorySectionData sectionData, int? sectionClassId, StoryChapterData chapterData, bool isFirstClear)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void SetActiveBGEffect(bool effect)
|
||||
{
|
||||
}
|
||||
}
|
||||
138
SVSim.BattleEngine/Engine/AreaSelectMapIcon.cs
Normal file
138
SVSim.BattleEngine/Engine/AreaSelectMapIcon.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class AreaSelectMapIcon
|
||||
{
|
||||
public const int MAPICONLIST_CAPACITY_DEFAULT = 8;
|
||||
|
||||
private readonly string MAP_ICON_EFFECT_NAME_CIRCLE4 = "ef_circle4_add_nor_1";
|
||||
|
||||
private readonly string MAP_ICON_EFFECT_NAME_TWINKLE1 = "ef_twinkle1_add_nor_1";
|
||||
|
||||
private readonly Color32 MAP_ICON_EFFECT_COLOR_CLEARED = new Color32(byte.MaxValue, 192, 64, byte.MaxValue);
|
||||
|
||||
private readonly Color32 MAP_ICON_EFFECT_COLOR_ALREADY_READ_CIRCLE4 = new Color32(78, 95, 125, byte.MaxValue);
|
||||
|
||||
private readonly Color32 MAP_ICON_EFFECT_COLOR_ALREADY_READ_TWINKLE1 = new Color32(190, 218, 242, byte.MaxValue);
|
||||
|
||||
[SerializeField]
|
||||
private GameObject MapIconRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite MapIconOriginal;
|
||||
|
||||
private List<UISprite> MapIconList;
|
||||
|
||||
private GameObject MapIconEffect;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
}
|
||||
|
||||
public void Term()
|
||||
{
|
||||
MapIconEffect = null;
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED);
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_NOTCLEARED);
|
||||
}
|
||||
|
||||
public void SetupMapIcon(List<StoryChapterData> chapterDataList)
|
||||
{
|
||||
if (MapIconList != null)
|
||||
{
|
||||
int i = 0;
|
||||
for (int count = MapIconList.Count; i < count; i++)
|
||||
{
|
||||
UnityEngine.Object.Destroy(MapIconList[i].gameObject);
|
||||
}
|
||||
}
|
||||
MapIconList = new List<UISprite>(8);
|
||||
UISprite uISprite = null;
|
||||
for (int j = 0; j < chapterDataList.Count; j++)
|
||||
{
|
||||
if (chapterDataList[j].IsReleased)
|
||||
{
|
||||
uISprite = UnityEngine.Object.Instantiate(MapIconOriginal);
|
||||
if (!(null == uISprite))
|
||||
{
|
||||
uISprite.transform.parent = MapIconRoot.transform;
|
||||
uISprite.transform.localPosition = new Vector3(chapterDataList[j].MapIconPos.x, chapterDataList[j].MapIconPos.y);
|
||||
uISprite.transform.localScale = Vector3.one;
|
||||
uISprite.name = "mapicon_" + j;
|
||||
uISprite.gameObject.SetActive(chapterDataList[j].IsDisplayMapIcon);
|
||||
MapIconList.Add(uISprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
MapIconOriginal.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public Vector3 GetMapIconPos(int chapterIndex, bool isLocal)
|
||||
{
|
||||
if (MapIconList == null)
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
if (chapterIndex < 0 || chapterIndex >= MapIconList.Count)
|
||||
{
|
||||
return Vector3.zero;
|
||||
}
|
||||
if (!isLocal)
|
||||
{
|
||||
return MapIconList[chapterIndex].transform.position;
|
||||
}
|
||||
return MapIconList[chapterIndex].transform.localPosition;
|
||||
}
|
||||
|
||||
public void SetActiveMapIcon(int chapterIndex, bool isActive)
|
||||
{
|
||||
if (chapterIndex >= 0 && chapterIndex < MapIconList.Count)
|
||||
{
|
||||
MapIconList[chapterIndex].gameObject.SetActive(isActive);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartMapIconEffect(StoryChapterData.ChapterClearStatus clearState, int chapterIndex)
|
||||
{
|
||||
Effect effect = null;
|
||||
switch (clearState)
|
||||
{
|
||||
case StoryChapterData.ChapterClearStatus.Cleared:
|
||||
effect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED);
|
||||
effect.ChangeParticleColor(MAP_ICON_EFFECT_COLOR_CLEARED);
|
||||
break;
|
||||
case StoryChapterData.ChapterClearStatus.AlreadyRead:
|
||||
effect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED);
|
||||
MotionUtils.ChangeParticleSystemColor(effect.transform.Find(MAP_ICON_EFFECT_NAME_CIRCLE4).gameObject, MAP_ICON_EFFECT_COLOR_ALREADY_READ_CIRCLE4);
|
||||
MotionUtils.ChangeParticleSystemColor(effect.transform.Find(MAP_ICON_EFFECT_NAME_TWINKLE1).gameObject, MAP_ICON_EFFECT_COLOR_ALREADY_READ_TWINKLE1);
|
||||
break;
|
||||
default:
|
||||
effect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MAP_MAPICON_NOTCLEARED);
|
||||
break;
|
||||
}
|
||||
MapIconEffect = effect.GetGameObjIns();
|
||||
UpdateMapIconEffectPos(chapterIndex);
|
||||
}
|
||||
|
||||
public void StopMapIconEffect()
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED);
|
||||
GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_NOTCLEARED);
|
||||
}
|
||||
|
||||
public void UpdateMapIconEffectPos(int chapterIndex)
|
||||
{
|
||||
if (MapIconList != null && chapterIndex >= 0 && chapterIndex < MapIconList.Count && !(null == MapIconEffect))
|
||||
{
|
||||
Vector3 position = MapIconList[chapterIndex].transform.position;
|
||||
MapIconEffect.transform.position = position;
|
||||
}
|
||||
}
|
||||
|
||||
public GameObject GetMapIconObject(int chapterIndex)
|
||||
{
|
||||
return MapIconList[chapterIndex].gameObject;
|
||||
}
|
||||
}
|
||||
1406
SVSim.BattleEngine/Engine/AreaSelectUI.cs
Normal file
1406
SVSim.BattleEngine/Engine/AreaSelectUI.cs
Normal file
File diff suppressed because it is too large
Load Diff
158
SVSim.BattleEngine/Engine/ArenaEntryBase.cs
Normal file
158
SVSim.BattleEngine/Engine/ArenaEntryBase.cs
Normal file
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public abstract class ArenaEntryBase : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
protected GameObject ArenaEntryDialog;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject CompetitionEntryDialog;
|
||||
|
||||
[SerializeField]
|
||||
protected UIButton ButtonEntry;
|
||||
|
||||
[SerializeField]
|
||||
protected UIButton ButtonResume;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject HeadLineObject;
|
||||
|
||||
private UIWidget[] _headlineWidgetArray;
|
||||
|
||||
private Color[] _headlineWidgetDefaultColorArray;
|
||||
|
||||
private Coroutine _initCoroutine;
|
||||
|
||||
protected bool _isFreeEntry;
|
||||
|
||||
protected bool _isCompetition;
|
||||
|
||||
protected string[] _labelsText;
|
||||
|
||||
protected string _entryDialogTitleText;
|
||||
|
||||
protected Action _initFunc;
|
||||
|
||||
protected Action _resumeFunc;
|
||||
|
||||
protected Func<bool> _isJoinFunc;
|
||||
|
||||
protected Action _freeEntryFunc;
|
||||
|
||||
protected Action _freeBattleFunc;
|
||||
|
||||
protected Func<bool> _isFreeBattleCompetition;
|
||||
|
||||
protected Action _entryFunc;
|
||||
|
||||
private const float GLAY_SCALE = 0.33f;
|
||||
|
||||
protected abstract void EntryDialogCreate(GameObject inDialog);
|
||||
|
||||
protected virtual void EntryBaseInit(GameObject costRootObject)
|
||||
{
|
||||
_headlineWidgetArray = costRootObject.transform.GetComponentsInChildren<UIWidget>();
|
||||
_headlineWidgetDefaultColorArray = new Color[_headlineWidgetArray.Length];
|
||||
for (int i = 0; i < _headlineWidgetArray.Length; i++)
|
||||
{
|
||||
_headlineWidgetDefaultColorArray[i] = _headlineWidgetArray[i].color;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
UpdateMenu();
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_initCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_initCoroutine);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateMenu()
|
||||
{
|
||||
_initCoroutine = UIManager.GetInstance().StartCoroutine(_InitCoroutine());
|
||||
}
|
||||
|
||||
protected virtual IEnumerator _InitCoroutine()
|
||||
{
|
||||
while (!MyPageMenu.IsMyPageRequestEnd)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
if (_initFunc != null)
|
||||
{
|
||||
_initFunc();
|
||||
}
|
||||
ButtonEntry.onClick.Clear();
|
||||
ButtonEntry.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
if (_entryFunc != null)
|
||||
{
|
||||
_entryFunc();
|
||||
}
|
||||
else if (_isFreeEntry)
|
||||
{
|
||||
_freeEntryFunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogBase.Size size = ((Data.ArenaData.CompetitionData.CostType != ArenaCompetition.EntryCostType.EntryWithCost) ? DialogBase.Size.M : DialogBase.Size.XL);
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(size);
|
||||
dialogBase.SetTitleLabel(_entryDialogTitleText);
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(_isCompetition ? CompetitionEntryDialog : ArenaEntryDialog);
|
||||
EntryDialogCreate(gameObject);
|
||||
if (_isCompetition && Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithCost)
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID, Data.ArenaData.CompetitionData.CompetitionId);
|
||||
Data.MyPageNotifications.data.IsCompetitionBadge = false;
|
||||
UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon();
|
||||
UpdateCompetitionEntryBadge();
|
||||
}
|
||||
gameObject.GetComponent<ArenaEntryDialogBase>().ParentDialog = dialogBase;
|
||||
dialogBase.SetObj(gameObject.gameObject);
|
||||
DialogBase.ButtonLayout buttonLayout = DialogBase.ButtonLayout.CloseBtn;
|
||||
dialogBase.SetButtonLayout(buttonLayout);
|
||||
}
|
||||
}));
|
||||
ButtonResume.onClick.Clear();
|
||||
ButtonResume.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
_resumeFunc();
|
||||
}));
|
||||
UpdateEntryResumeButton();
|
||||
}
|
||||
|
||||
protected virtual void UpdateCompetitionEntryBadge()
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual void UpdateEntryResumeButton()
|
||||
{
|
||||
bool flag = _isJoinFunc();
|
||||
ButtonEntry.gameObject.SetActive(!flag);
|
||||
ButtonResume.gameObject.SetActive(flag);
|
||||
if (flag)
|
||||
{
|
||||
for (int i = 0; i < _headlineWidgetArray.Length; i++)
|
||||
{
|
||||
_headlineWidgetArray[i].color = new Color(_headlineWidgetDefaultColorArray[i].r * 0.33f, _headlineWidgetDefaultColorArray[i].g * 0.33f, _headlineWidgetDefaultColorArray[i].b * 0.33f, 255f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < _headlineWidgetArray.Length; j++)
|
||||
{
|
||||
_headlineWidgetArray[j].color = _headlineWidgetDefaultColorArray[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
SVSim.BattleEngine/Engine/AspectCameraPerspective.cs
Normal file
44
SVSim.BattleEngine/Engine/AspectCameraPerspective.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AspectCameraPerspective : MonoBehaviour
|
||||
{
|
||||
private Camera m_camera;
|
||||
|
||||
private bool m_isSetFOV;
|
||||
|
||||
public void UpdateFov()
|
||||
{
|
||||
m_isSetFOV = false;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_camera = GetComponent<Camera>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!m_isSetFOV && GameMgr.GetIns() != null && m_camera != null)
|
||||
{
|
||||
float num = 0f;
|
||||
float num2 = 0f;
|
||||
if (Screen.width > Screen.height)
|
||||
{
|
||||
num = Screen.width;
|
||||
num2 = Screen.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = Screen.height;
|
||||
num2 = Screen.width;
|
||||
}
|
||||
float num3 = num / num2;
|
||||
if (num3 > 1.7777778f)
|
||||
{
|
||||
num3 = 1.7777778f;
|
||||
}
|
||||
m_camera.fieldOfView = Mathf.Atan2(1f, num3) * 57.29578f * 2f;
|
||||
m_isSetFOV = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
54
SVSim.BattleEngine/Engine/AssetBundleEditorTag.cs
Normal file
54
SVSim.BattleEngine/Engine/AssetBundleEditorTag.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
public class AssetBundleEditorTag
|
||||
{
|
||||
public enum BUNDLE_CATEGORY
|
||||
{
|
||||
BG,
|
||||
CARD,
|
||||
EFFECT,
|
||||
MASTER,
|
||||
STORY,
|
||||
UI,
|
||||
UIDOWNLOAD,
|
||||
TUTORIAL,
|
||||
PACKBOX,
|
||||
UILANG,
|
||||
STORYLANG,
|
||||
FONT,
|
||||
SLEEVE,
|
||||
MAX
|
||||
}
|
||||
|
||||
public enum CardStatType
|
||||
{
|
||||
CARD_STAT_NORMAL,
|
||||
CARD_STAT_FOIL,
|
||||
CARD_STAT_PROMOTION
|
||||
}
|
||||
|
||||
public struct categoryProps
|
||||
{
|
||||
public string name;
|
||||
|
||||
public categoryProps(string in_name)
|
||||
{
|
||||
name = in_name;
|
||||
}
|
||||
}
|
||||
|
||||
public static categoryProps[] categoryNameList = new categoryProps[13]
|
||||
{
|
||||
new categoryProps("bg"),
|
||||
new categoryProps("card"),
|
||||
new categoryProps("effect"),
|
||||
new categoryProps("master"),
|
||||
new categoryProps("story"),
|
||||
new categoryProps("ui"),
|
||||
new categoryProps("uidownload"),
|
||||
new categoryProps("tutorial"),
|
||||
new categoryProps("packbox"),
|
||||
new categoryProps("uilang"),
|
||||
new categoryProps("storylang"),
|
||||
new categoryProps("font"),
|
||||
new categoryProps("sleeve")
|
||||
};
|
||||
}
|
||||
7
SVSim.BattleEngine/Engine/AudioList.cs
Normal file
7
SVSim.BattleEngine/Engine/AudioList.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioList : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public string[] GimicAudioList;
|
||||
}
|
||||
23
SVSim.BattleEngine/Engine/BaseCardIDComp.cs
Normal file
23
SVSim.BattleEngine/Engine/BaseCardIDComp.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using Wizard.Battle;
|
||||
|
||||
internal class BaseCardIDComp : EqualityComparer<IReadOnlyBattleCardInfo>
|
||||
{
|
||||
public override bool Equals(IReadOnlyBattleCardInfo x, IReadOnlyBattleCardInfo y)
|
||||
{
|
||||
if (x == y)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (x.BaseParameter.BaseCardId == y.BaseParameter.BaseCardId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetHashCode(IReadOnlyBattleCardInfo obj)
|
||||
{
|
||||
return obj.BaseParameter.BaseCardId;
|
||||
}
|
||||
}
|
||||
163
SVSim.BattleEngine/Engine/BingoBall.cs
Normal file
163
SVSim.BattleEngine/Engine/BingoBall.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class BingoBall : MonoBehaviour
|
||||
{
|
||||
public const string NUM_SPRITE_NAME_HEAD = "bingo_ball_";
|
||||
|
||||
public const string TEXTURE_BINGOBALL_BACK = "bingo_ball_back";
|
||||
|
||||
public const string TEXTURE_BINGOBALL_FRONT = "bingo_ball_front";
|
||||
|
||||
public const float NUM_SPACE = 11f;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _numSpriteLeft;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _numSpriteRight;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _ballSprite;
|
||||
|
||||
[SerializeField]
|
||||
private Transform _bottomPos;
|
||||
|
||||
[SerializeField]
|
||||
private TweenPositionX _tweenPositionX;
|
||||
|
||||
[SerializeField]
|
||||
private TweenPositionY _tweenPositionY;
|
||||
|
||||
[SerializeField]
|
||||
private Vector2 _ballMovement;
|
||||
|
||||
private GameObject _effectObject;
|
||||
|
||||
private GameObject _dustEffect1;
|
||||
|
||||
private GameObject _dustEffect2;
|
||||
|
||||
private int _ballNum;
|
||||
|
||||
private List<Coroutine> _inProcessCoroutines = new List<Coroutine>();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_numSpriteLeft.gameObject.SetActive(value: false);
|
||||
_numSpriteRight.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public void SetBallNum(int num)
|
||||
{
|
||||
_ballNum = num;
|
||||
}
|
||||
|
||||
public void SetNumSprite()
|
||||
{
|
||||
if (_ballNum >= 0 && _ballNum <= 9)
|
||||
{
|
||||
_numSpriteRight.gameObject.SetActive(value: false);
|
||||
_numSpriteLeft.gameObject.SetActive(value: true);
|
||||
_numSpriteLeft.transform.localPosition = Vector3.zero;
|
||||
_numSpriteLeft.spriteName = "bingo_ball_" + _ballNum;
|
||||
}
|
||||
else if (_ballNum >= 10)
|
||||
{
|
||||
_numSpriteRight.gameObject.SetActive(value: true);
|
||||
_numSpriteLeft.gameObject.SetActive(value: true);
|
||||
_numSpriteLeft.spriteName = "bingo_ball_" + _ballNum / 10;
|
||||
_numSpriteRight.spriteName = "bingo_ball_" + _ballNum % 10;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBallSprite(bool isFront)
|
||||
{
|
||||
_ballSprite.spriteName = (isFront ? "bingo_ball_front" : "bingo_ball_back");
|
||||
}
|
||||
|
||||
public List<string> PlayEffect(string effectName, bool isOnBottom)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
if (_effectObject != null)
|
||||
{
|
||||
Object.Destroy(_effectObject);
|
||||
}
|
||||
_effectObject = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject);
|
||||
_effectObject.transform.parent = base.gameObject.transform;
|
||||
list.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_effectObject, null));
|
||||
_effectObject.transform.localPosition = (isOnBottom ? _bottomPos.transform.localPosition : Vector3.zero);
|
||||
_effectObject.SetActive(value: true);
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<string> PlayDustEffect(string effectName, GameObject dustEffectContainer, float fallTime, float endWorldPosY, float delayTime)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
_dustEffect1 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject);
|
||||
_dustEffect2 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject);
|
||||
list.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_dustEffect1, null));
|
||||
list.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_dustEffect2, null));
|
||||
_dustEffect1.transform.parent = dustEffectContainer.transform;
|
||||
_dustEffect2.transform.parent = dustEffectContainer.transform;
|
||||
_dustEffect1.SetActive(value: false);
|
||||
_dustEffect2.SetActive(value: false);
|
||||
_inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayDustEffect(fallTime, endWorldPosY, delayTime)));
|
||||
return list;
|
||||
}
|
||||
|
||||
private IEnumerator PlayDustEffect(float fallTime, float endWorldPosY, float delayTime)
|
||||
{
|
||||
yield return new WaitForSeconds(delayTime + fallTime * 0.164f);
|
||||
Vector3 position = base.gameObject.transform.position;
|
||||
position.y = endWorldPosY - (base.gameObject.transform.position.y - _bottomPos.transform.position.y) * 0.95f;
|
||||
_dustEffect1.transform.position = position;
|
||||
_dustEffect1.SetActive(value: true);
|
||||
yield return new WaitForSeconds(fallTime * 0.323f);
|
||||
position = base.gameObject.transform.position;
|
||||
position.y = endWorldPosY - (base.gameObject.transform.position.y - _bottomPos.transform.position.y) * 0.98f;
|
||||
_dustEffect2.transform.position = position;
|
||||
_dustEffect2.SetActive(value: true);
|
||||
yield return new WaitForSeconds(0.4f);
|
||||
Object.Destroy(_dustEffect1);
|
||||
Object.Destroy(_dustEffect2);
|
||||
}
|
||||
|
||||
public void StopCoroutine()
|
||||
{
|
||||
if (_inProcessCoroutines.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (Coroutine inProcessCoroutine in _inProcessCoroutines)
|
||||
{
|
||||
if (inProcessCoroutine != null)
|
||||
{
|
||||
UIManager.GetInstance().StopCoroutine(inProcessCoroutine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayTweenAnimation(Vector3 from, float delay)
|
||||
{
|
||||
_tweenPositionX.from = from.x;
|
||||
_tweenPositionX.to = from.x + _ballMovement.x;
|
||||
_tweenPositionY.from = from.y;
|
||||
_tweenPositionY.to = from.y + _ballMovement.y;
|
||||
_inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayBallFallAnimation(delay)));
|
||||
}
|
||||
|
||||
private IEnumerator PlayBallFallAnimation(float delay)
|
||||
{
|
||||
yield return new WaitForSeconds(delay);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_bng_ballfall_01", "se_sys_bng_ballfall_01", 0f, 0L);
|
||||
base.gameObject.SetActive(value: true);
|
||||
}
|
||||
|
||||
public Vector2 GetBallMovement()
|
||||
{
|
||||
return _ballMovement;
|
||||
}
|
||||
}
|
||||
152
SVSim.BattleEngine/Engine/BingoSheetBlock.cs
Normal file
152
SVSim.BattleEngine/Engine/BingoSheetBlock.cs
Normal file
@@ -0,0 +1,152 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class BingoSheetBlock : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private UISprite _numSpriteLeft;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _numSpriteRight;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _blockSprite;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _treasureBoxSprite;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _stampTexutre;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _lightSprite;
|
||||
|
||||
[SerializeField]
|
||||
private TweenAlpha _lightTextureAlpha;
|
||||
|
||||
private List<Coroutine> _inProcessCoroutines = new List<Coroutine>();
|
||||
|
||||
private const string NUM_SPRITE_NAME_HEAD = "bingo_square_";
|
||||
|
||||
private const float LINES_NUM_SPRITE_SPACE = 16.65f;
|
||||
|
||||
public void SetNumLabel(int num, int maxPerLine)
|
||||
{
|
||||
if (num >= 0 && num <= 9)
|
||||
{
|
||||
_numSpriteRight.gameObject.SetActive(value: false);
|
||||
_numSpriteLeft.gameObject.SetActive(value: true);
|
||||
_numSpriteLeft.transform.localPosition = Vector3.zero;
|
||||
_numSpriteLeft.spriteName = "bingo_square_" + num;
|
||||
}
|
||||
else if (num >= 10)
|
||||
{
|
||||
_numSpriteRight.gameObject.SetActive(value: true);
|
||||
_numSpriteLeft.gameObject.SetActive(value: true);
|
||||
_numSpriteLeft.spriteName = "bingo_square_" + num / 10;
|
||||
_numSpriteRight.spriteName = "bingo_square_" + num % 10;
|
||||
Vector3 zero = Vector3.zero;
|
||||
zero.x = -16.65f;
|
||||
_numSpriteLeft.transform.localPosition = zero;
|
||||
zero.x = 16.65f;
|
||||
_numSpriteRight.transform.localPosition = zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBlockScale(float blockScale)
|
||||
{
|
||||
base.transform.localScale *= blockScale;
|
||||
}
|
||||
|
||||
public void SetPartsVisible(bool blockVisible, int treasureBoxGrade, bool isOpen)
|
||||
{
|
||||
_blockSprite.gameObject.SetActive(blockVisible);
|
||||
SetTreasureBoxSprite(treasureBoxGrade, isOpen);
|
||||
SetStampVisible(isOpen);
|
||||
}
|
||||
|
||||
public void SetStampTexture(Texture texture)
|
||||
{
|
||||
_stampTexutre.mainTexture = texture;
|
||||
}
|
||||
|
||||
public void SetTreasureBoxSprite(int treasureBoxGrade, bool isOpen)
|
||||
{
|
||||
if (!isOpen)
|
||||
{
|
||||
_treasureBoxSprite.spriteName = string.Format("box_2pick_0{0}{1}", (treasureBoxGrade - 1).ToString(), "_close");
|
||||
_treasureBoxSprite.gameObject.SetActive(treasureBoxGrade > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
_treasureBoxSprite.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStampVisible(bool visible)
|
||||
{
|
||||
_stampTexutre.gameObject.SetActive(visible);
|
||||
}
|
||||
|
||||
public void StampDown(float delay)
|
||||
{
|
||||
iTween.ScaleTo(_stampTexutre.gameObject, iTween.Hash("scale", Vector3.one * 1f, "delay", delay, "time", 0.15f, "islocal", true, "easetype", iTween.EaseType.easeOutCubic));
|
||||
_inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(ChangeAlpha(_stampTexutre.gameObject, delay)));
|
||||
}
|
||||
|
||||
public void LightOn(float delay)
|
||||
{
|
||||
_lightTextureAlpha.SetOnFinished(delegate
|
||||
{
|
||||
_lightSprite.alpha = 0f;
|
||||
_lightTextureAlpha.ResetToBeginning();
|
||||
_lightTextureAlpha.from = 0f;
|
||||
});
|
||||
_inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(LightOn(_lightTextureAlpha, delay)));
|
||||
}
|
||||
|
||||
public void PlaySe(int lineNum, float delay)
|
||||
{
|
||||
_inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlaySeCoroutine(lineNum, delay)));
|
||||
}
|
||||
|
||||
private IEnumerator PlaySeCoroutine(int lineNum, float delay)
|
||||
{
|
||||
yield return new WaitForSeconds(delay);
|
||||
string text = string.Format("se_sys_bng_line_{0}", Mathf.Clamp(lineNum + 1, 1, 12).ToString("00"));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr(text, text, 0f, 0L);
|
||||
}
|
||||
|
||||
private IEnumerator ChangeAlpha(GameObject obj, float delay)
|
||||
{
|
||||
yield return new WaitForSeconds(delay);
|
||||
TweenAlpha.Begin(obj, 0.15f, 1f);
|
||||
}
|
||||
|
||||
private IEnumerator LightOn(TweenAlpha tweenAlpha, float delay)
|
||||
{
|
||||
_lightTextureAlpha.ResetToBeginning();
|
||||
yield return new WaitForSeconds(delay);
|
||||
tweenAlpha.PlayForward();
|
||||
}
|
||||
|
||||
public void CancelAnimations()
|
||||
{
|
||||
_lightSprite.alpha = 0f;
|
||||
if (_inProcessCoroutines.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (Coroutine inProcessCoroutine in _inProcessCoroutines)
|
||||
{
|
||||
UIManager.GetInstance().StopCoroutine(inProcessCoroutine);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetStampTexture()
|
||||
{
|
||||
_stampTexutre.gameObject.transform.localScale = Vector3.one * 1.5f;
|
||||
_stampTexutre.alpha = 0f;
|
||||
}
|
||||
}
|
||||
203
SVSim.BattleEngine/Engine/ByteReader.cs
Normal file
203
SVSim.BattleEngine/Engine/ByteReader.cs
Normal file
@@ -0,0 +1,203 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
public class ByteReader
|
||||
{
|
||||
private byte[] mBuffer;
|
||||
|
||||
private int mOffset;
|
||||
|
||||
private static BetterList<string> mTemp = new BetterList<string>();
|
||||
|
||||
public bool canRead
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mBuffer != null)
|
||||
{
|
||||
return mOffset < mBuffer.Length;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ByteReader(byte[] bytes)
|
||||
{
|
||||
mBuffer = bytes;
|
||||
}
|
||||
|
||||
public ByteReader(TextAsset asset)
|
||||
{
|
||||
mBuffer = asset.bytes;
|
||||
}
|
||||
|
||||
public static ByteReader Open(string path)
|
||||
{
|
||||
FileStream fileStream = File.OpenRead(path);
|
||||
if (fileStream != null)
|
||||
{
|
||||
fileStream.Seek(0L, SeekOrigin.End);
|
||||
byte[] array = new byte[fileStream.Position];
|
||||
fileStream.Seek(0L, SeekOrigin.Begin);
|
||||
fileStream.Read(array, 0, array.Length);
|
||||
fileStream.Close();
|
||||
return new ByteReader(array);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static string ReadLine(byte[] buffer, int start, int count)
|
||||
{
|
||||
return Encoding.UTF8.GetString(buffer, start, count);
|
||||
}
|
||||
|
||||
public string ReadLine()
|
||||
{
|
||||
return ReadLine(skipEmptyLines: true);
|
||||
}
|
||||
|
||||
public string ReadLine(bool skipEmptyLines)
|
||||
{
|
||||
int num = mBuffer.Length;
|
||||
if (skipEmptyLines)
|
||||
{
|
||||
while (mOffset < num && mBuffer[mOffset] < 32)
|
||||
{
|
||||
mOffset++;
|
||||
}
|
||||
}
|
||||
int num2 = mOffset;
|
||||
if (num2 < num)
|
||||
{
|
||||
int num3;
|
||||
do
|
||||
{
|
||||
if (num2 < num)
|
||||
{
|
||||
num3 = mBuffer[num2++];
|
||||
continue;
|
||||
}
|
||||
num2++;
|
||||
break;
|
||||
}
|
||||
while (num3 != 10 && num3 != 13);
|
||||
string result = ReadLine(mBuffer, mOffset, num2 - mOffset - 1);
|
||||
mOffset = num2;
|
||||
return result;
|
||||
}
|
||||
mOffset = num;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Dictionary<string, string> ReadDictionary()
|
||||
{
|
||||
Dictionary<string, string> dictionary = new Dictionary<string, string>();
|
||||
char[] separator = new char[1] { '=' };
|
||||
while (canRead)
|
||||
{
|
||||
string text = ReadLine();
|
||||
if (text == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (!text.StartsWith("//"))
|
||||
{
|
||||
string[] array = text.Split(separator, 2, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (array.Length == 2)
|
||||
{
|
||||
string key = array[0].Trim();
|
||||
string value = array[1].Trim().Replace("\\n", "\n");
|
||||
dictionary[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public BetterList<string> ReadCSV()
|
||||
{
|
||||
mTemp.Clear();
|
||||
string text = "";
|
||||
bool flag = false;
|
||||
int num = 0;
|
||||
while (canRead)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
string text2 = ReadLine(skipEmptyLines: false);
|
||||
if (text2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
text2 = text2.Replace("\\n", "\n");
|
||||
text = text + "\n" + text2;
|
||||
}
|
||||
else
|
||||
{
|
||||
text = ReadLine(skipEmptyLines: true);
|
||||
if (text == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
text = text.Replace("\\n", "\n");
|
||||
num = 0;
|
||||
}
|
||||
int i = num;
|
||||
for (int length = text.Length; i < length; i++)
|
||||
{
|
||||
switch (text[i])
|
||||
{
|
||||
case ',':
|
||||
if (!flag)
|
||||
{
|
||||
mTemp.Add(text.Substring(num, i - num));
|
||||
num = i + 1;
|
||||
}
|
||||
break;
|
||||
case '"':
|
||||
if (flag)
|
||||
{
|
||||
if (i + 1 >= length)
|
||||
{
|
||||
mTemp.Add(text.Substring(num, i - num).Replace("\"\"", "\""));
|
||||
return mTemp;
|
||||
}
|
||||
if (text[i + 1] != '"')
|
||||
{
|
||||
mTemp.Add(text.Substring(num, i - num).Replace("\"\"", "\""));
|
||||
flag = false;
|
||||
if (text[i + 1] == ',')
|
||||
{
|
||||
i++;
|
||||
num = i + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num = i + 1;
|
||||
flag = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num < text.Length)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
mTemp.Add(text.Substring(num, text.Length - num));
|
||||
}
|
||||
return mTemp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
57
SVSim.BattleEngine/Engine/ChapterExtraData.cs
Normal file
57
SVSim.BattleEngine/Engine/ChapterExtraData.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ChapterExtraData
|
||||
{
|
||||
public int SectionId { get; set; }
|
||||
|
||||
public int ExtraTextureChapter { get; set; }
|
||||
|
||||
public CardBasePrm.ClanType ClanType { get; set; } = CardBasePrm.ClanType.NONE;
|
||||
|
||||
public string BGSuffix { get; set; } = string.Empty;
|
||||
|
||||
public List<int> ExtraTextureIndex { get; set; } = new List<int>();
|
||||
|
||||
public int BGSectionId { get; set; } = -1;
|
||||
|
||||
public Dictionary<int, Texture> BGTexture { get; set; } = new Dictionary<int, Texture>();
|
||||
|
||||
public string BGExtraEffectPath { get; set; } = string.Empty;
|
||||
|
||||
public bool AttachExtraEffectToBgRoot { get; set; }
|
||||
|
||||
public GameObject ExtraEffect { get; set; }
|
||||
|
||||
public Se.TYPE SeType { get; set; }
|
||||
|
||||
public float ChapterMoveTime { get; set; } = 1.5f;
|
||||
|
||||
public string BGFirstClearEffectPath { get; set; } = string.Empty;
|
||||
|
||||
public GameObject FirstClearEffect { get; set; }
|
||||
|
||||
public Se.TYPE FirstClearSeType { get; set; }
|
||||
|
||||
public float FirstClearEffectDelayTime { get; set; }
|
||||
|
||||
public float FirstClearMoveDelayTime { get; set; }
|
||||
|
||||
public float FirstClearMoveOutDelayTime { get; set; }
|
||||
|
||||
public bool AddTreeEffect { get; set; }
|
||||
|
||||
public bool IsUseOtherSectionBG()
|
||||
{
|
||||
return BGSectionId != -1;
|
||||
}
|
||||
|
||||
public bool IsChangeBG()
|
||||
{
|
||||
if (!IsUseOtherSectionBG())
|
||||
{
|
||||
return ExtraTextureIndex.Count > 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
68
SVSim.BattleEngine/Engine/ClassBasicCardList.cs
Normal file
68
SVSim.BattleEngine/Engine/ClassBasicCardList.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
public class ClassBasicCardList
|
||||
{
|
||||
private static int[] AllBasicCardList = new int[8] { 100011010, 100011020, 100011030, 100011040, 100011050, 100012010, 100031010, 100031020 };
|
||||
|
||||
private static int[] ElfBasicCardList = new int[11]
|
||||
{
|
||||
100111010, 100111020, 100111030, 100111040, 100111050, 100111060, 100111070, 100114010, 100121010, 100121020,
|
||||
100121030
|
||||
};
|
||||
|
||||
private static int[] RoyalBasicCardList = new int[11]
|
||||
{
|
||||
100211010, 100211020, 100211030, 100211040, 100211050, 100211060, 100214010, 100214020, 100221010, 100221020,
|
||||
100222010
|
||||
};
|
||||
|
||||
private static int[] WitchBasicCardList = new int[11]
|
||||
{
|
||||
100311010, 100314010, 100314020, 100314030, 100314040, 100314050, 100314060, 100314070, 100321010, 100321020,
|
||||
100321030
|
||||
};
|
||||
|
||||
private static int[] DragonBasicCardList = new int[11]
|
||||
{
|
||||
100411010, 100411020, 100411030, 100411040, 100411050, 100414010, 100414020, 100414030, 100421010, 100421020,
|
||||
100424010
|
||||
};
|
||||
|
||||
private static int[] NecroBasicCardList = new int[11]
|
||||
{
|
||||
100511010, 100511020, 100511030, 100511040, 100511050, 100511060, 100514010, 100514020, 100521010, 100521020,
|
||||
100521030
|
||||
};
|
||||
|
||||
private static int[] VampireBasicCardList = new int[11]
|
||||
{
|
||||
100611010, 100611020, 100611030, 100611040, 100611050, 100614010, 100614020, 100614030, 100621010, 100621020,
|
||||
100624010
|
||||
};
|
||||
|
||||
private static int[] BishopBasicCardList = new int[11]
|
||||
{
|
||||
100711010, 100711020, 100713010, 100713020, 100713030, 100714010, 100714020, 100714030, 100721010, 100721020,
|
||||
100723010
|
||||
};
|
||||
|
||||
private static int[] NemesisBasicCardList = new int[11]
|
||||
{
|
||||
100811010, 100811020, 100811030, 100811040, 100811050, 100811060, 100811070, 100814010, 100821010, 100821020,
|
||||
100824010
|
||||
};
|
||||
|
||||
public static int[] GetRandomBasicCardId(CardBasePrm.ClanType classType)
|
||||
{
|
||||
return classType switch
|
||||
{
|
||||
CardBasePrm.ClanType.MIN => ElfBasicCardList,
|
||||
CardBasePrm.ClanType.ROYAL => RoyalBasicCardList,
|
||||
CardBasePrm.ClanType.WITCH => WitchBasicCardList,
|
||||
CardBasePrm.ClanType.DRAGON => DragonBasicCardList,
|
||||
CardBasePrm.ClanType.NECRO => NecroBasicCardList,
|
||||
CardBasePrm.ClanType.VAMPIRE => VampireBasicCardList,
|
||||
CardBasePrm.ClanType.BISHOP => BishopBasicCardList,
|
||||
CardBasePrm.ClanType.NEMESIS => NemesisBasicCardList,
|
||||
_ => AllBasicCardList,
|
||||
};
|
||||
}
|
||||
}
|
||||
9
SVSim.BattleEngine/Engine/ClassCardCreator.cs
Normal file
9
SVSim.BattleEngine/Engine/ClassCardCreator.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ClassCardCreator : CardCreatorBase
|
||||
{
|
||||
public ClassCardCreator(GameObject rootObject)
|
||||
: base(rootObject)
|
||||
{
|
||||
}
|
||||
}
|
||||
478
SVSim.BattleEngine/Engine/ClassSkillApplyInformation.cs
Normal file
478
SVSim.BattleEngine/Engine/ClassSkillApplyInformation.cs
Normal file
@@ -0,0 +1,478 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class ClassSkillApplyInformation : SkillApplyInformation
|
||||
{
|
||||
public class LifeInfomation
|
||||
{
|
||||
public int Life { get; private set; }
|
||||
|
||||
public int MaxLife { get; private set; }
|
||||
|
||||
public int BeforeLife { get; private set; }
|
||||
|
||||
public int BeforeMaxLife { get; private set; }
|
||||
|
||||
public LifeInfomation(int life, int maxLife, int beforeLife, int beforeMaxLife)
|
||||
{
|
||||
Life = life;
|
||||
MaxLife = maxLife;
|
||||
BeforeLife = beforeLife;
|
||||
BeforeMaxLife = beforeMaxLife;
|
||||
}
|
||||
}
|
||||
|
||||
public class PpModifyInformation
|
||||
{
|
||||
public int AddPpValue { get; private set; }
|
||||
|
||||
public PpModifyInformation(int addPpValue)
|
||||
{
|
||||
AddPpValue = addPpValue;
|
||||
}
|
||||
}
|
||||
|
||||
public event Action<RegisterActionBase.ActionBaseParameter, LifeInfomation> OnLifeChange;
|
||||
|
||||
public event Action<RegisterActionBase.ActionBaseParameter, PpModifyInformation> OnPpChange;
|
||||
|
||||
public ClassSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator)
|
||||
: base(card, vfxCreator)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DamageLife(int damage, int turn, bool isSelfTurn)
|
||||
{
|
||||
int life = _card.Life;
|
||||
int maxLife = _card.MaxLife;
|
||||
base.DamageLife(damage, turn, isSelfTurn);
|
||||
if (this.OnLifeChange != null)
|
||||
{
|
||||
this.OnLifeChange(RegisterActionBase.ActionBaseParameter.damage, new LifeInfomation(_card.Life, _card.MaxLife, life, maxLife));
|
||||
}
|
||||
}
|
||||
|
||||
public override void HealLife(int healAmount, int turn, bool isSelfTurn)
|
||||
{
|
||||
int life = _card.Life;
|
||||
int maxLife = _card.MaxLife;
|
||||
base.HealLife(healAmount, turn, isSelfTurn);
|
||||
if (this.OnLifeChange != null)
|
||||
{
|
||||
this.OnLifeChange(RegisterActionBase.ActionBaseParameter.heal, new LifeInfomation(_card.Life, _card.MaxLife, life, maxLife));
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddPp(int addPp, int currentTurn, bool isSelfTurn)
|
||||
{
|
||||
base.AddPp(addPp, currentTurn, isSelfTurn);
|
||||
if (this.OnPpChange != null)
|
||||
{
|
||||
this.OnPpChange(RegisterActionBase.ActionBaseParameter.addPP, new PpModifyInformation(addPp));
|
||||
}
|
||||
}
|
||||
|
||||
public override VfxBase GiveForceBerserk(SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
VfxBase vfx = SetForceBerserkCount(base.ForceBerserkCount + 1, skillProcessor);
|
||||
sequentialVfxPlayer.Register(((ClassBattleCardBase)_card).GetOnBerserkCheck(base.ForceBerserkCount == 1 && _card.Life > 10));
|
||||
sequentialVfxPlayer.Register(vfx);
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase DepriveForceBerserk(SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(SetForceBerserkCount(base.ForceBerserkCount - 1, skillProcessor));
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnBerserkCheck(flg: false), NullVfx.GetInstance(), InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveForceBerserk(SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(SetForceBerserkCount(0, skillProcessor));
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnBerserkCheck(flg: false), NullVfx.GetInstance(), InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
private VfxBase SetForceBerserkCount(int count, SkillProcessor skillProcessor)
|
||||
{
|
||||
base.ForceBerserkCount = count;
|
||||
base.IsForceBerserk = base.ForceBerserkCount > 0;
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
if (skillProcessor != null)
|
||||
{
|
||||
sequentialVfxPlayer.Register(base.Player.StartSkillWhenChangeClassLife(skillProcessor));
|
||||
}
|
||||
((ClassBattleCardBase)_card).CallOnForceBerserkChange(base.ForceBerserkCount);
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase GiveForceAvarice(SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
SetForceAvariceCount(base.ForceAvariceCount + 1);
|
||||
sequentialVfxPlayer.Register(((ClassBattleCardBase)_card).GetOnAvariceCheck(base.ForceAvariceCount == 1 && base.Player.TurnDrawCards.Count() > 2));
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase DepriveForceAvarice()
|
||||
{
|
||||
SequentialVfxPlayer result = SequentialVfxPlayer.Create();
|
||||
SetForceAvariceCount(base.ForceAvariceCount - 1);
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnAvariceCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return result;
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveForceAvarice()
|
||||
{
|
||||
SequentialVfxPlayer result = SequentialVfxPlayer.Create();
|
||||
SetForceAvariceCount(0);
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnAvariceCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SetForceAvariceCount(int count)
|
||||
{
|
||||
base.ForceAvariceCount = count;
|
||||
base.IsForceAvarice = base.ForceAvariceCount > 0;
|
||||
((ClassBattleCardBase)_card).CallOnForceAvariceChange(base.ForceAvariceCount);
|
||||
}
|
||||
|
||||
public override VfxBase GiveForceWrath(SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
SetForceWrathCount(base.ForceWrathCount + 1);
|
||||
sequentialVfxPlayer.Register(((ClassBattleCardBase)_card).GetOnWrathCheck(base.ForceWrathCount == 1 && base.Player.SkillInfoClass.DamagedCounter.GetDamageCount(selfTurn: true) > 7));
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase DepriveForceWrath()
|
||||
{
|
||||
SequentialVfxPlayer result = SequentialVfxPlayer.Create();
|
||||
SetForceWrathCount(base.ForceWrathCount - 1);
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnWrathCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return result;
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveForceWrath()
|
||||
{
|
||||
SequentialVfxPlayer result = SequentialVfxPlayer.Create();
|
||||
SetForceWrathCount(0);
|
||||
base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnWrathCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate
|
||||
{
|
||||
base.Player.UpdateHandCardsPlayability();
|
||||
})));
|
||||
return result;
|
||||
}
|
||||
|
||||
private void SetForceWrathCount(int count)
|
||||
{
|
||||
base.ForceWrathCount = count;
|
||||
base.IsForceWrath = base.ForceWrathCount > 0;
|
||||
((ClassBattleCardBase)_card).CallOnForceWrathChange(base.ForceWrathCount);
|
||||
}
|
||||
|
||||
public override VfxBase GiveCantActivateFanfare(string type)
|
||||
{
|
||||
if (type == "unit")
|
||||
{
|
||||
base.CantActivateFanfareUnitCount++;
|
||||
}
|
||||
else if (type == "field")
|
||||
{
|
||||
base.CantActivateFanfareFieldCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.CantActivateFanfareUnitCount++;
|
||||
base.CantActivateFanfareFieldCount++;
|
||||
}
|
||||
base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0;
|
||||
base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase SetCantActivateFanfareCount(int count)
|
||||
{
|
||||
base.CantActivateFanfareUnitCount = count;
|
||||
base.CantActivateFanfareFieldCount = count;
|
||||
base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0;
|
||||
base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase DepriveCantActivateFanfare(string type)
|
||||
{
|
||||
if (type == "unit")
|
||||
{
|
||||
base.CantActivateFanfareUnitCount--;
|
||||
}
|
||||
else if (type == "field")
|
||||
{
|
||||
base.CantActivateFanfareFieldCount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.CantActivateFanfareUnitCount--;
|
||||
base.CantActivateFanfareFieldCount--;
|
||||
}
|
||||
base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0;
|
||||
base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveCantActivateFanfare(string type)
|
||||
{
|
||||
if (type == "unit")
|
||||
{
|
||||
base.CantActivateFanfareUnitCount = 0;
|
||||
}
|
||||
else if (type == "field")
|
||||
{
|
||||
base.CantActivateFanfareFieldCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.CantActivateFanfareUnitCount = 0;
|
||||
base.CantActivateFanfareFieldCount = 0;
|
||||
}
|
||||
base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0;
|
||||
base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase GiveCantActivateShortageDeckWin()
|
||||
{
|
||||
base.CantActivateShortageDeckWinCount++;
|
||||
base.IsCantActivateShortageDeckWin = base.CantActivateShortageDeckWinCount > 0;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase DepriveCantActivateShortageDeckWin()
|
||||
{
|
||||
base.CantActivateShortageDeckWinCount--;
|
||||
base.IsCantActivateShortageDeckWin = base.CantActivateShortageDeckWinCount > 0;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveCantActivateShortageDeckWin()
|
||||
{
|
||||
base.CantActivateShortageDeckWinCount = 0;
|
||||
base.IsCantActivateShortageDeckWin = false;
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase GiveRepeatSkill(string repeatTiming, string repeatTarget, SkillBase skill)
|
||||
{
|
||||
base.RepeatSkillTimingList.Add(new RepeatSkillInfo(repeatTiming, repeatTarget, skill));
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase DepriveRepeatSkill(string repeatTiming, string repeatTarget, bool reservation, bool isProcess, SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
List<RepeatSkillInfo> list = new List<RepeatSkillInfo>();
|
||||
for (int i = 0; i < base.RepeatSkillTimingList.Count; i++)
|
||||
{
|
||||
if (base.RepeatSkillTimingList[i].Timing == repeatTiming && base.RepeatSkillTimingList[i].Target == repeatTarget)
|
||||
{
|
||||
if (reservation)
|
||||
{
|
||||
base.RepeatSkillTimingList[i].IsRemoveReservation = true;
|
||||
}
|
||||
else if (isProcess || !base.RepeatSkillTimingList.Any((RepeatSkillInfo s) => s.IsRemoveReservation && s.Timing == repeatTiming && s.Target == repeatTarget))
|
||||
{
|
||||
sequentialVfxPlayer.Register(base.RepeatSkillTimingList[i].Skill.Stop(skillProcessor));
|
||||
list.Add(base.RepeatSkillTimingList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (list.Count != 0 && !reservation)
|
||||
{
|
||||
for (int num = 0; num < list.Count; num++)
|
||||
{
|
||||
base.RepeatSkillTimingList.Remove(list[num]);
|
||||
}
|
||||
}
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase ReservationAllDepriveRepeatSkill()
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
List<RepeatSkillInfo> list = new List<RepeatSkillInfo>();
|
||||
for (int i = 0; i < base.RepeatSkillTimingList.Count; i++)
|
||||
{
|
||||
if (base.RepeatSkillTimingList[i].IsRemoveReservation)
|
||||
{
|
||||
sequentialVfxPlayer.Register(base.RepeatSkillTimingList[i].Skill.Stop(null));
|
||||
list.Add(base.RepeatSkillTimingList[i]);
|
||||
}
|
||||
}
|
||||
if (list.Count != 0)
|
||||
{
|
||||
for (int j = 0; j < list.Count; j++)
|
||||
{
|
||||
base.RepeatSkillTimingList.Remove(list[j]);
|
||||
}
|
||||
}
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveRepeatSkill()
|
||||
{
|
||||
base.RepeatSkillTimingList.Clear();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase GiveCantPlay(CantPlayCardFilterInfo cantPlayCardFilter)
|
||||
{
|
||||
base.CantPlayFilterList.Add(cantPlayCardFilter);
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
foreach (BattleCardBase handCard in _card.SelfBattlePlayer.HandCardList)
|
||||
{
|
||||
handCard.BattleCardView.UpdateMovability();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override VfxBase DepriveCantPlay(CantPlayCardFilterInfo cantPlayCardFilter)
|
||||
{
|
||||
base.CantPlayFilterList.Remove(cantPlayCardFilter);
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
foreach (BattleCardBase handCard in _card.SelfBattlePlayer.HandCardList)
|
||||
{
|
||||
handCard.BattleCardView.UpdateMovability();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveCantPlay()
|
||||
{
|
||||
base.CantPlayFilterList.Clear();
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
foreach (BattleCardBase handCard in _card.SelfBattlePlayer.HandCardList)
|
||||
{
|
||||
handCard.BattleCardView.UpdateMovability();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public override VfxBase GiveAddTarget(AddTargetInfo info)
|
||||
{
|
||||
base.AddTargetList.Add(info);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase DepriveAddTarget(AddTargetInfo info)
|
||||
{
|
||||
base.AddTargetList.Remove(info);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveAddTarget()
|
||||
{
|
||||
base.AddTargetList.Clear();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase GiveDecreaseTurnStartPP(int value)
|
||||
{
|
||||
base.DecreaseTurnStartPPList.Add(value);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase DepriveDecreaseTurnStartPP(int value)
|
||||
{
|
||||
base.DecreaseTurnStartPPList.Remove(value);
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveDecreaseTurnStartPP()
|
||||
{
|
||||
base.DecreaseTurnStartPPList.Clear();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public override VfxBase GiveCombatValueModifier(ICardOffenseModifier offenseModifier, ICardLifeModifier lifeModifier, SkillProcessor skillProcessor)
|
||||
{
|
||||
int life = _card.Life;
|
||||
int maxLife = _card.MaxLife;
|
||||
VfxBase vfxBase = base.GiveCombatValueModifier(offenseModifier, lifeModifier, skillProcessor);
|
||||
VfxBase vfxBase2 = _card.SelfBattlePlayer.StartSkillWhenChangeClassLife(skillProcessor);
|
||||
if (this.OnLifeChange != null)
|
||||
{
|
||||
this.OnLifeChange(RegisterActionBase.ActionBaseParameter.set, new LifeInfomation(_card.Life, _card.MaxLife, life, maxLife));
|
||||
}
|
||||
return SequentialVfxPlayer.Create(vfxBase, vfxBase2);
|
||||
}
|
||||
|
||||
public override VfxBase DepriveCombatValueModifire(ICardOffenseModifier offenseModifier, ICardLifeModifier lifeModifier)
|
||||
{
|
||||
VfxBase vfxBase = base.DepriveCombatValueModifire(offenseModifier, lifeModifier);
|
||||
return SequentialVfxPlayer.Create(vfxBase);
|
||||
}
|
||||
|
||||
public override VfxBase ForceDepriveCombatValueModifire()
|
||||
{
|
||||
VfxBase vfxBase = base.ForceDepriveCombatValueModifire();
|
||||
return SequentialVfxPlayer.Create(vfxBase);
|
||||
}
|
||||
|
||||
protected override VfxBase CombatModifierChangeCalc(bool isOldAtkBuff, bool isNowAtkBuff, bool isOldMaxLifeBuff, bool isNowMaxLifeBuff, bool isOldAtkDebuff, bool isNowAtkDebuff, bool isOldMaxLifeDebuff, bool isNowMaxLifeDebuff, bool isSkillPowerDown = false, bool isNoBuff = false, bool skipWait = false)
|
||||
{
|
||||
return _vfxCreator.CreateParameterChange(_card.CreateParameterChangeInfo());
|
||||
}
|
||||
|
||||
public override void AddTokenDrawModifier(TokenDrawModifier modifier)
|
||||
{
|
||||
base.TokenDrawModifiers.Add(modifier);
|
||||
}
|
||||
|
||||
public override void RemoveTokenDrawModifier(TokenDrawModifier modifier)
|
||||
{
|
||||
foreach (TokenDrawModifier tokenDrawModifier in base.TokenDrawModifiers)
|
||||
{
|
||||
if (tokenDrawModifier.Equals(modifier))
|
||||
{
|
||||
base.TokenDrawModifiers.Remove(tokenDrawModifier);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16
SVSim.BattleEngine/Engine/ClipboardHelper.cs
Normal file
16
SVSim.BattleEngine/Engine/ClipboardHelper.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ClipboardHelper
|
||||
{
|
||||
public static string Clipboard
|
||||
{
|
||||
get
|
||||
{
|
||||
return GUIUtility.systemCopyBuffer;
|
||||
}
|
||||
set
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
SVSim.BattleEngine/Engine/ColorOverwrite.cs
Normal file
27
SVSim.BattleEngine/Engine/ColorOverwrite.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ColorOverwrite : MonoBehaviour
|
||||
{
|
||||
public enum Change
|
||||
{
|
||||
No,
|
||||
Yes,
|
||||
UseDeckColorSet,
|
||||
UseBingoButtonSet
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private Change _change;
|
||||
|
||||
[SerializeField]
|
||||
private bool _dontChangeEffectDistance;
|
||||
|
||||
[SerializeField]
|
||||
private bool _dontChangeEffectStyle;
|
||||
|
||||
public Change ColorChange => _change;
|
||||
|
||||
public bool DontChangeEffectDistance => _dontChangeEffectDistance;
|
||||
|
||||
public bool DontChangeEffectStyle => _dontChangeEffectStyle;
|
||||
}
|
||||
190
SVSim.BattleEngine/Engine/ColosseumCardPanel.cs
Normal file
190
SVSim.BattleEngine/Engine/ColosseumCardPanel.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
internal class ColosseumCardPanel : MyPageCardPanel
|
||||
{
|
||||
private const string DEFAULT_GRAND_PRIX_ID = "0";
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _infoRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _infoTitleLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _infoNextRoundLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _infoTimeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _nameLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _freeEntryIcon;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _panelLineSprite;
|
||||
|
||||
private const int SECONDS_PER_MINUTE = 60;
|
||||
|
||||
private const float SECONDS_TASK_END_NEXT_INTERVAL = 0.5f;
|
||||
|
||||
private float _updateTimer;
|
||||
|
||||
private bool _isFreeEntryIconDisplayPermission;
|
||||
|
||||
public GameObject MyPageFreeEntryIcon { private get; set; }
|
||||
|
||||
public override void CheckMaintenanceType()
|
||||
{
|
||||
base.CheckMaintenanceType();
|
||||
if (Data.MaintenanceCodeList.Contains(maintenanceType))
|
||||
{
|
||||
_infoRoot.SetActive(value: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_infoRoot.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetIconDisplayPermission(bool isPermission)
|
||||
{
|
||||
_isFreeEntryIconDisplayPermission = isPermission;
|
||||
NowUpdate();
|
||||
}
|
||||
|
||||
public override string GetResourcePath(bool isfetch)
|
||||
{
|
||||
if (Data.ArenaData.ColosseumData.ColorCodeId == "0")
|
||||
{
|
||||
return base.GetResourcePath(isfetch);
|
||||
}
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("menu_arena_colosseum_gp_" + Data.ArenaData.ColosseumData.ColorCodeId, ResourcesManager.AssetLoadPathType.CardMenu, isfetch);
|
||||
}
|
||||
|
||||
public void NowUpdate()
|
||||
{
|
||||
_updateTimer = 0f;
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
NowUpdate();
|
||||
}
|
||||
|
||||
private void OnApplicationPause(bool pause)
|
||||
{
|
||||
if (!pause)
|
||||
{
|
||||
NowUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
ArenaColosseum colosseumData = Data.ArenaData.ColosseumData;
|
||||
if (colosseumData.IsColosseumPeriod)
|
||||
{
|
||||
_updateTimer -= Time.deltaTime;
|
||||
if (_updateTimer < 0f)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
double num = colosseumData.RemainingServerUnixTime + (double)Time.realtimeSinceStartup - (double)colosseumData.RemainingSinceTime;
|
||||
_updateTimer = (float)(60.0 - num % 60.0);
|
||||
_nameLabel.text = colosseumData.Name;
|
||||
string id;
|
||||
string id2;
|
||||
string id3;
|
||||
if (colosseumData.IsRoundPeriod)
|
||||
{
|
||||
id = "Colosseum_0044";
|
||||
id2 = "Colosseum_0057";
|
||||
id3 = "Colosseum_0058";
|
||||
}
|
||||
else
|
||||
{
|
||||
id = "Colosseum_0059";
|
||||
id2 = "Colosseum_0060";
|
||||
id3 = "Colosseum_0061";
|
||||
}
|
||||
string text;
|
||||
if (num > colosseumData.RemainingUnixTime)
|
||||
{
|
||||
text = systemText.Get(id3, "0");
|
||||
if (colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage || (!colosseumData.IsRoundPeriod && colosseumData.IsColosseumPeriod))
|
||||
{
|
||||
ColosseumEntryInfoTask task = new ColosseumEntryInfoTask();
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, ColosseumEntryInfoTaskSuccess));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
double num2 = colosseumData.RemainingUnixTime - num;
|
||||
text = ((num2 < 3600.0) ? systemText.Get(id3, ((int)(num2 / 60.0) + 1).ToString()) : ((!(num2 < 86400.0)) ? systemText.Get(id, ((int)(num2 / 86400.0)).ToString()) : systemText.Get(id2, ((int)(num2 / 3600.0)).ToString())));
|
||||
}
|
||||
if (colosseumData.IsRoundPeriod)
|
||||
{
|
||||
string text2 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage) ? systemText.Get("Colosseum_0062", systemText.Get("Colosseum_0007", ((int)colosseumData.StageNo).ToString())) : systemText.Get("Colosseum_0062", systemText.Get("Colosseum_0008")));
|
||||
_infoTitleLabel.text = text2;
|
||||
_infoNextRoundLabel.text = systemText.Get("Colosseum_0043");
|
||||
_infoTimeLabel.text = text;
|
||||
if (_isFreeEntryIconDisplayPermission)
|
||||
{
|
||||
_freeEntryIcon.SetActive(colosseumData.IsFreeEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
_freeEntryIcon.SetActive(value: false);
|
||||
}
|
||||
UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon();
|
||||
MyPageFreeEntryIcon.SetActive(colosseumData.IsFreeEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
string text3 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.Stage1) ? systemText.Get("Colosseum_0045") : systemText.Get("Colosseum_0041"));
|
||||
string text4 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage) ? systemText.Get("Colosseum_0042", systemText.Get("Colosseum_0007", ((int)colosseumData.StageNo).ToString())) : systemText.Get("Colosseum_0042", systemText.Get("Colosseum_0008")));
|
||||
_infoTitleLabel.text = text3;
|
||||
_infoNextRoundLabel.text = text4;
|
||||
_infoTimeLabel.text = text;
|
||||
_freeEntryIcon.SetActive(value: false);
|
||||
UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon();
|
||||
MyPageFreeEntryIcon.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
SetUILabelParam();
|
||||
}
|
||||
|
||||
private void ColosseumEntryInfoTaskSuccess(NetworkTask.ResultCode inResult)
|
||||
{
|
||||
_updateTimer = 0.5f;
|
||||
}
|
||||
|
||||
private void SetUILabelParam()
|
||||
{
|
||||
string colorCodeId = Data.ArenaData.ColosseumData.ColorCodeId;
|
||||
if (colorCodeId == "0")
|
||||
{
|
||||
_panelLineSprite.color = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_LINE_SPRITE_COLOR);
|
||||
base.TitleLabel.applyGradient = true;
|
||||
base.TitleLabel.gradientTop = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_TITLE_GRAD_TOP);
|
||||
base.TitleLabel.gradientBottom = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_TITLE_GRAD_BOTTOM);
|
||||
base.TitleLabel.effectStyle = UILabel.Effect.Outline8;
|
||||
base.TitleLabel.effectColor = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_TITLE_OUTLINE);
|
||||
_infoTitleLabel.effectStyle = UILabel.Effect.None;
|
||||
}
|
||||
else
|
||||
{
|
||||
_panelLineSprite.color = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_LINE_SPRITE_COLOR");
|
||||
base.TitleLabel.gradientTop = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_TITLE_GRAD_TOP");
|
||||
base.TitleLabel.gradientBottom = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_TITLE_GRAD_BOTTOM");
|
||||
base.TitleLabel.effectStyle = UILabel.Effect.Outline8;
|
||||
base.TitleLabel.effectColor = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_TITLE_OUTLINE");
|
||||
_infoTitleLabel.effectStyle = UILabel.Effect.Outline8;
|
||||
_infoTitleLabel.effectColor = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_ROUND_INFO_OUTLINE");
|
||||
}
|
||||
}
|
||||
}
|
||||
270
SVSim.BattleEngine/Engine/ColosseumDetail.cs
Normal file
270
SVSim.BattleEngine/Engine/ColosseumDetail.cs
Normal file
@@ -0,0 +1,270 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.ErrorDialog;
|
||||
|
||||
public class ColosseumDetail : MonoBehaviour
|
||||
{
|
||||
private enum eTitleLabel
|
||||
{
|
||||
StageName,
|
||||
TimeStart,
|
||||
TimeEnd,
|
||||
Max
|
||||
}
|
||||
|
||||
private enum eGroupLabel
|
||||
{
|
||||
Group,
|
||||
BattleNum,
|
||||
BreakThrough,
|
||||
Retry
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _formatLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _timeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _ownStatusLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round1TitleLabels;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round2TitleLabels;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round3TitleLabels;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round1GroupLabels;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round2GroupALabels;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round2GroupBLabels;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round3GroupALabels;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel[] _round3GroupBLabels;
|
||||
|
||||
public void Init(DialogBase inDialog)
|
||||
{
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
ArenaColosseum colosseumData = Wizard.Data.ArenaData.ColosseumData;
|
||||
inDialog.SetSize(DialogBase.Size.M);
|
||||
inDialog.SetTitleLabel(systemText.Get("Common_0022"));
|
||||
inDialog.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn_GrayBtn);
|
||||
inDialog.SetButtonText(systemText.Get("Colosseum_0023"), systemText.Get("Colosseum_0025"));
|
||||
inDialog.onPushButton1 = delegate
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Wizard.Data.ArenaData.ColosseumData.AnnounceNo))
|
||||
{
|
||||
UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(Wizard.Data.ArenaData.ColosseumData.AnnounceNo);
|
||||
}
|
||||
else
|
||||
{
|
||||
Dialog.Create(4416);
|
||||
}
|
||||
};
|
||||
inDialog.onPushButton2 = delegate
|
||||
{
|
||||
if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.Avatar)
|
||||
{
|
||||
UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.HeroesGrandPrix);
|
||||
}
|
||||
else if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.WindFall)
|
||||
{
|
||||
UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.ColosseumWindFall);
|
||||
}
|
||||
else if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos)
|
||||
{
|
||||
UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.Colosseum2PickChaos, null, 0, Wizard.Data.ArenaData.ColosseumData.ChaoseTipsId);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.ColosseumInfo);
|
||||
}
|
||||
};
|
||||
inDialog.isNotCloseWindowButton1 = true;
|
||||
inDialog.isNotCloseWindowButton2 = true;
|
||||
string text = colosseumData.Rule switch
|
||||
{
|
||||
ArenaColosseum.eRule.TwoPick => (colosseumData.IsNormalTwoPick ? systemText.Get("Arena_0002") : systemText.Get("Colosseum_0105")) + " " + systemText.Get("Colosseum_0093"),
|
||||
ArenaColosseum.eRule.TwoPickChaos => systemText.Get("Chaos_FormatName"),
|
||||
ArenaColosseum.eRule.HOF => systemText.Get("Colosseum_0108"),
|
||||
ArenaColosseum.eRule.WindFall => systemText.Get("Colosseum_0115"),
|
||||
ArenaColosseum.eRule.Crossover => systemText.Get("Common_0166"),
|
||||
ArenaColosseum.eRule.MyRotation => systemText.Get("Common_0178"),
|
||||
ArenaColosseum.eRule.Avatar => systemText.Get("HeroesBattle_0001"),
|
||||
_ => ((colosseumData.DeckFormat == Format.Rotation) ? systemText.Get("Common_0154") : systemText.Get("Common_0155")) + systemText.Get("Colosseum_0093"),
|
||||
};
|
||||
_formatLabel.text = systemText.Get("Colosseum_0054", text);
|
||||
_timeLabel.text = systemText.Get("Colosseum_0084", colosseumData.ColosseumTimeText);
|
||||
OwnStatusLabelUpdate();
|
||||
List<UILabel[]> list = new List<UILabel[]>();
|
||||
list.Add(_round1TitleLabels);
|
||||
list.Add(_round2TitleLabels);
|
||||
list.Add(_round3TitleLabels);
|
||||
for (int num = 1; num < 4; num++)
|
||||
{
|
||||
UILabel[] array = list[num - 1];
|
||||
ArenaColosseum.eRound eRound = (ArenaColosseum.eStageNo)num switch
|
||||
{
|
||||
ArenaColosseum.eStageNo.Stage1 => ArenaColosseum.eRound.Round1,
|
||||
ArenaColosseum.eStageNo.Stage2 => ArenaColosseum.eRound.Round2A,
|
||||
_ => ArenaColosseum.eRound.FinalA,
|
||||
};
|
||||
UILabel uILabel = array[0];
|
||||
if (num == 3)
|
||||
{
|
||||
uILabel.text = systemText.Get("Colosseum_0008");
|
||||
}
|
||||
else
|
||||
{
|
||||
uILabel.text = systemText.Get("Colosseum_0007", num.ToString());
|
||||
}
|
||||
UILabel uILabel2 = array[1];
|
||||
uILabel2.text = colosseumData.DetailData[(int)(eRound - 1)].RoundTimeStartText;
|
||||
UILabel uILabel3 = array[2];
|
||||
uILabel3.text = colosseumData.DetailData[(int)(eRound - 1)].RoundTimeEndText;
|
||||
if (num == (int)colosseumData.FocusStageNo)
|
||||
{
|
||||
uILabel.text = AddColorCode(uILabel.text);
|
||||
uILabel2.text = AddColorCode(uILabel2.text);
|
||||
uILabel3.text = AddColorCode(uILabel3.text);
|
||||
}
|
||||
}
|
||||
List<UILabel[]> list2 = new List<UILabel[]>();
|
||||
list2.Add(_round1GroupLabels);
|
||||
list2.Add(_round2GroupBLabels);
|
||||
list2.Add(_round2GroupALabels);
|
||||
list2.Add(_round3GroupBLabels);
|
||||
list2.Add(_round3GroupALabels);
|
||||
for (int num2 = 1; num2 < 6; num2++)
|
||||
{
|
||||
UILabel[] array = list2[num2 - 1];
|
||||
array[0].text = colosseumData.DetailData[num2 - 1].GroupName;
|
||||
array[1].text = systemText.Get("Colosseum_0075", colosseumData.DetailData[num2 - 1].MaxBattleNum.ToString());
|
||||
if (num2 >= 4)
|
||||
{
|
||||
array[3].text = systemText.Get("Colosseum_0088", colosseumData.DetailData[num2 - 1].MaxEntryNum.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
array[3].text = systemText.Get("Colosseum_0078", colosseumData.DetailData[num2 - 1].MaxEntryNum.ToString());
|
||||
}
|
||||
UILabel uILabel4 = array[2];
|
||||
if (num2 == 1)
|
||||
{
|
||||
string text2 = systemText.Get("Colosseum_0076", colosseumData.DetailData[num2 - 1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0020"));
|
||||
string text3 = systemText.Get("Colosseum_0080", (colosseumData.DetailData[num2 - 1].BreakThroughNum - 1).ToString(), systemText.Get("Colosseum_0021"));
|
||||
uILabel4.text = text2 + "\n" + text3;
|
||||
}
|
||||
else if (num2 >= 4)
|
||||
{
|
||||
uILabel4.text = systemText.Get("Colosseum_0104", colosseumData.FinalRoundEliminateCount.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (num2)
|
||||
{
|
||||
case 3:
|
||||
{
|
||||
string text4 = systemText.Get("Colosseum_0076_Group", colosseumData.DetailData[num2 - 1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0020"));
|
||||
string text5 = systemText.Get("Colosseum_0076_Group", colosseumData.DetailData[1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0021"));
|
||||
uILabel4.text = text4 + "\n" + text5;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
uILabel4.text = systemText.Get("Colosseum_0076_Group", colosseumData.DetailData[num2 - 1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0021"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (colosseumData.GetStageNoFromRoundId((ArenaColosseum.eRound)num2) == colosseumData.FocusStageNo)
|
||||
{
|
||||
for (int num3 = 0; num3 < array.Length; num3++)
|
||||
{
|
||||
array[num3].text = AddColorCode(array[num3].text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OwnStatusLabelUpdate()
|
||||
{
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
ArenaColosseum colosseumData = Wizard.Data.ArenaData.ColosseumData;
|
||||
_ownStatusLabel.text = string.Empty;
|
||||
if (colosseumData.IsClear)
|
||||
{
|
||||
_ownStatusLabel.text = systemText.Get("Colosseum_0038", colosseumData.Name);
|
||||
}
|
||||
else if (colosseumData.IsFinalRound())
|
||||
{
|
||||
_ownStatusLabel.text = string.Empty;
|
||||
}
|
||||
else if (!colosseumData.IsRoundPeriod && colosseumData.StageNo == ArenaColosseum.eStageNo.Stage1)
|
||||
{
|
||||
_ownStatusLabel.text = string.Empty;
|
||||
}
|
||||
else if (!colosseumData.IsRoundPeriod)
|
||||
{
|
||||
if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2)
|
||||
{
|
||||
if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B)
|
||||
{
|
||||
_ownStatusLabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
}
|
||||
else if (colosseumData.StageNo == ArenaColosseum.eStageNo.FinalStage)
|
||||
{
|
||||
if (colosseumData.NextRound == ArenaColosseum.eRound.Undecided || colosseumData.NextRound == ArenaColosseum.eRound.Lose)
|
||||
{
|
||||
_ownStatusLabel.text = systemText.Get("Colosseum_0052");
|
||||
}
|
||||
else if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB)
|
||||
{
|
||||
_ownStatusLabel.text = systemText.Get("Colosseum_0037_Group", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (colosseumData.Round == ArenaColosseum.eRound.Round1)
|
||||
{
|
||||
if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B)
|
||||
{
|
||||
_ownStatusLabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
}
|
||||
else if ((colosseumData.Round == ArenaColosseum.eRound.Round2A || colosseumData.Round == ArenaColosseum.eRound.Round2B) && colosseumData.NextRound != ArenaColosseum.eRound.Lose)
|
||||
{
|
||||
if (colosseumData.NextRound == ArenaColosseum.eRound.Undecided)
|
||||
{
|
||||
_ownStatusLabel.text = systemText.Get("Colosseum_0052");
|
||||
}
|
||||
else if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB)
|
||||
{
|
||||
_ownStatusLabel.text = systemText.Get("Colosseum_0037_Group", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_ownStatusLabel.text = string.Empty;
|
||||
}
|
||||
if (_ownStatusLabel.text != string.Empty)
|
||||
{
|
||||
_ownStatusLabel.text = AddColorCode(_ownStatusLabel.text);
|
||||
}
|
||||
}
|
||||
|
||||
private string AddColorCode(string inOriginalText)
|
||||
{
|
||||
return "[fcd24a]" + inOriginalText + "[-]";
|
||||
}
|
||||
}
|
||||
580
SVSim.BattleEngine/Engine/ColosseumEntry.cs
Normal file
580
SVSim.BattleEngine/Engine/ColosseumEntry.cs
Normal file
@@ -0,0 +1,580 @@
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class ColosseumEntry : ArenaEntryBase
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _detailPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private MyPageItemArena _myPageItemArena;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _costRoot;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _entryStatusRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _entryStatusLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _entryButton;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _infoBase;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _formatLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _periodLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _ownStatusLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _twoPickRound1InfoBase;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickFormatLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickPoolLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickPeriodLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickStatusLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _twoPickRound2InfoBase;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickRound2FormatLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickRound2PoolLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickRound2PeriodLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _twoPickRound2StatusLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _retryNumberLabel;
|
||||
|
||||
[SerializeField]
|
||||
public GameObject _freeEntryIcon;
|
||||
|
||||
private const string ORANGE_COLOR_CODE = "[fcd24a]";
|
||||
|
||||
private const int FORMAT_LABEL_UP_Y = 49;
|
||||
|
||||
private const int FORMAT_LABEL_CENTER_Y = 14;
|
||||
|
||||
private const int FORMAT_LABEL_UP_Y_FIVE_LINES = 56;
|
||||
|
||||
private const int FORMAT_LABEL_CENTER_FIVE_LINES = 30;
|
||||
|
||||
private const string DECK_DECISION_COLOSSEUM_PATH = "UI/DeckList/DeckDecisionColosseum";
|
||||
|
||||
private const string DECK_DECISION_COLOSSEUM_FINAL_PATH = "UI/DeckList/DeckDecisionColosseumFinal";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
EntryBaseInit(_costRoot);
|
||||
}
|
||||
|
||||
protected override void EntryBaseInit(GameObject costRootObject)
|
||||
{
|
||||
base.EntryBaseInit(costRootObject);
|
||||
SystemText systemText = Data.SystemText;
|
||||
_entryDialogTitleText = systemText.Get("Colosseum_0003");
|
||||
_resumeFunc = Resume;
|
||||
_isJoinFunc = IsJoin;
|
||||
_initFunc = Init;
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
if (Data.ArenaData.ColosseumData.IsFreeEntry)
|
||||
{
|
||||
_isFreeEntry = true;
|
||||
_freeEntryFunc = FreeEntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isFreeEntry = false;
|
||||
}
|
||||
EntryStatusLabelInit();
|
||||
UIManager.SetObjectToGrey(_entryButton.gameObject, !isEntryPossible());
|
||||
UILabel componentInChildren = _entryButton.GetComponentInChildren<UILabel>();
|
||||
if (isEntryPossible() && _isFreeEntry)
|
||||
{
|
||||
componentInChildren.text = Data.SystemText.Get("Colosseum_0103");
|
||||
}
|
||||
else
|
||||
{
|
||||
componentInChildren.text = Data.SystemText.Get("Arena_0034");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void EntryDialogCreate(GameObject inDialogObject)
|
||||
{
|
||||
inDialogObject.AddComponent<ColosseumEntryDialog>().ColosseumEntryClass = this;
|
||||
}
|
||||
|
||||
private void Resume()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS);
|
||||
if (Data.ArenaData.ColosseumData.IsDeckEntry)
|
||||
{
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Colosseum);
|
||||
}
|
||||
else
|
||||
{
|
||||
EntryTaskSuccess(NetworkTask.ResultCode.Success);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsJoin()
|
||||
{
|
||||
return Data.ArenaData.ColosseumData.isJoin;
|
||||
}
|
||||
|
||||
public void OnClickDetailButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
OpenDetail();
|
||||
}
|
||||
|
||||
private void FreeEntry()
|
||||
{
|
||||
ColosseumEntryTask colosseumEntryTask = new ColosseumEntryTask();
|
||||
colosseumEntryTask.SetParameter(ArenaData.eARENA_PAY.Free);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(colosseumEntryTask, FreeEntryTaskSuccess));
|
||||
}
|
||||
|
||||
private void FreeEntryTaskSuccess(NetworkTask.ResultCode inResult)
|
||||
{
|
||||
EntryTaskSuccess(inResult);
|
||||
Data.ArenaData.ColosseumData.IsFreeEntry = false;
|
||||
_myPageItemArena._colosseumCardPanel.GetComponent<ColosseumCardPanel>().NowUpdate();
|
||||
}
|
||||
|
||||
public void EntryTaskSuccess(NetworkTask.ResultCode inResult)
|
||||
{
|
||||
Data.ArenaData.ColosseumData.isJoin = true;
|
||||
if (Data.ArenaData.ColosseumData.IsTwoPickRule || Data.ArenaData.ColosseumData.DeckFormat == Format.Avatar)
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumTwoPick;
|
||||
Data.CurrentFormat = Format.Max;
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Colosseum);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateEntryResumeButton();
|
||||
GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumNormal;
|
||||
Data.CurrentFormat = Data.ArenaData.ColosseumData.DeckFormat;
|
||||
DeckInfoTask task = new DeckInfoTask();
|
||||
task.SetParameter(Data.ArenaData.ColosseumData.DeckFormat);
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
if (!RunSpecialDeckSelectEntry())
|
||||
{
|
||||
DeckSelectUI.InitOptions initOptions = new DeckSelectUI.InitOptions
|
||||
{
|
||||
CanUseNonPossessionCard = Data.ArenaData.ColosseumData.CanUseNonPossessionCard
|
||||
};
|
||||
DeckSelectUIDialog.Create(Data.SystemText.Get("Battle_0488"), task.DeckGroupListData, Data.ArenaData.ColosseumData.DeckFormat, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: true, CreateDeckSelectConfirmDialog, initOptions);
|
||||
}
|
||||
}));
|
||||
}
|
||||
HeadLineObject.GetComponent<ColosseumHeadLine>().UpdateHeadLine();
|
||||
}
|
||||
|
||||
private bool RunSpecialDeckSelectEntry()
|
||||
{
|
||||
if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.HOF)
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumHof;
|
||||
ColosseumHOFDeckInfoTask task = new ColosseumHOFDeckInfoTask();
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
List<DeckGroup> deckGroupList = new List<DeckGroup>
|
||||
{
|
||||
new DeckGroup(task.DeckList, Format.Max, DeckAttributeType.CustomDeck)
|
||||
};
|
||||
DeckSelectUIDialog.Create(Data.SystemText.Get("Colosseum_0109"), new DeckGroupListData(deckGroupList), Format.Max, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: false, CreateDeckSelectConfirmDialog);
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.WindFall)
|
||||
{
|
||||
GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumWindFall;
|
||||
ColosseumWindFallDeckInfoTask task2 = new ColosseumWindFallDeckInfoTask();
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task2, delegate
|
||||
{
|
||||
List<DeckGroup> deckGroupList = new List<DeckGroup>
|
||||
{
|
||||
new DeckGroup(task2.DeckList, Format.Max, DeckAttributeType.CustomDeck)
|
||||
};
|
||||
DeckSelectUIDialog.Create(Data.SystemText.Get("Colosseum_0117"), new DeckGroupListData(deckGroupList), Format.Max, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: false, CreateDeckSelectConfirmDialog);
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void CreateDeckSelectConfirmDialog(DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
if (!deck.IsUsable(Data.ArenaData.ColosseumData.CanUseNonPossessionCard))
|
||||
{
|
||||
InCompleteDeckDecideDialog.Create(dialogDeckList, deck);
|
||||
return;
|
||||
}
|
||||
CompleteDeckDecideDialog completeDeckDecideDialog = CompleteDeckDecideDialog.CreateForSingleDeck(dialogDeckList, deck, showSimpleStageOption: true, delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
DeckSetAndMoveColosseum(deck);
|
||||
});
|
||||
completeDeckDecideDialog.DecisionUI.CardDetailCustomize = delegate(CardDetailUI detailUI)
|
||||
{
|
||||
detailUI.IsShowFlavorTextButton = false;
|
||||
detailUI.IsShowVoiceButton = false;
|
||||
detailUI.IsShowEvolutionButton = false;
|
||||
};
|
||||
completeDeckDecideDialog.DecisionUI.CardListCustomize = delegate(UICardList cardList)
|
||||
{
|
||||
if (Data.ArenaData.ColosseumData.IsSpecialDeckSelectRule)
|
||||
{
|
||||
cardList.SetShareButtonUse(isUse: false);
|
||||
}
|
||||
if (Data.ArenaData.ColosseumData.IsDeckMaxNumberChange)
|
||||
{
|
||||
cardList.SetMaxCardNum(Data.ArenaData.ColosseumData.DeckMaxNumber);
|
||||
}
|
||||
};
|
||||
if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.HOF)
|
||||
{
|
||||
completeDeckDecideDialog.DecisionUI.IsCanShowQRCode = false;
|
||||
}
|
||||
if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.ColosseumNormal)
|
||||
{
|
||||
completeDeckDecideDialog.DecisionUI.gameObject.GetComponent<UIWidget>().alpha = 0f;
|
||||
DeckDecisionColosseum deckDecisionColosseum = Object.Instantiate(Toolbox.ResourcesManager.LoadObject<DeckDecisionColosseum>("UI/DeckList/DeckDecisionColosseum", isServerResources: false));
|
||||
completeDeckDecideDialog.Dialog.SetObj(deckDecisionColosseum.gameObject);
|
||||
deckDecisionColosseum.Init(deck);
|
||||
completeDeckDecideDialog.DecisionUI.transform.SetParent(deckDecisionColosseum.transform.parent.transform);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeckSetAndMoveColosseum(DeckData inDeckData)
|
||||
{
|
||||
Data.ArenaData.ColosseumData.DeckList.Clear();
|
||||
Data.ArenaData.ColosseumData.DeckList.Add(inDeckData);
|
||||
if (!Data.ArenaData.ColosseumData.IsSpecialDeckSelectRule)
|
||||
{
|
||||
DeckListUtility.SaveLastSelectDeck(inDeckData.GetDeckID(), isDefaultDeck: false, isTrialDeck: false, Data.ArenaData.ColosseumData.DeckFormat);
|
||||
}
|
||||
BaseTask baseTask = null;
|
||||
if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.HOF)
|
||||
{
|
||||
((ColosseumDeckEntryHOFTask)(baseTask = new ColosseumDeckEntryHOFTask())).SetParameter(Data.ArenaData.ColosseumData.DeckList);
|
||||
}
|
||||
else if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.WindFall)
|
||||
{
|
||||
((ColosseumWindFallDeckEntry)(baseTask = new ColosseumWindFallDeckEntry())).SetParameter(Data.ArenaData.ColosseumData.DeckList);
|
||||
}
|
||||
else if (Data.ArenaData.ColosseumData.DeckFormat == Format.Avatar)
|
||||
{
|
||||
((ColosseumDeckEntryAvatarTask)(baseTask = new ColosseumDeckEntryAvatarTask())).SetParameter(Data.ArenaData.ColosseumData.DeckList);
|
||||
}
|
||||
else
|
||||
{
|
||||
((ColosseumDeckEntryTask)(baseTask = new ColosseumDeckEntryTask())).SetParameter(Data.ArenaData.ColosseumData.DeckList, isPublished: false);
|
||||
}
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(baseTask, delegate
|
||||
{
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Colosseum);
|
||||
}));
|
||||
}
|
||||
|
||||
public void OpenDetail()
|
||||
{
|
||||
ColosseumDetailTask task = new ColosseumDetailTask();
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, DetailTaskSuccess));
|
||||
}
|
||||
|
||||
private void DetailTaskSuccess(NetworkTask.ResultCode inResultCode)
|
||||
{
|
||||
Data.ArenaData.ColosseumData.CreateDetailDialog(_detailPrefab);
|
||||
}
|
||||
|
||||
private bool isEntryPossible()
|
||||
{
|
||||
ArenaColosseum colosseumData = Data.ArenaData.ColosseumData;
|
||||
if ((!colosseumData.IsRetry || colosseumData.IsClear || colosseumData.IsFinalRoundTry) && !colosseumData.isJoin)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void EntryStatusLabelInit()
|
||||
{
|
||||
InfoTextUpdate();
|
||||
EntryTextUpdate();
|
||||
}
|
||||
|
||||
private void ColosseumDeckDeletedDialogMessageReceiver()
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(DialogBase.Size.S);
|
||||
if (Data.ArenaData.ColosseumData.IsTwoPickRule)
|
||||
{
|
||||
dialogBase.SetText(Data.SystemText.Get("Colosseum_0102"));
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogBase.SetText(Data.SystemText.Get("Error_4403"));
|
||||
}
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0021"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
Data.ArenaData.ColosseumData.IsDeckDeleted = false;
|
||||
}
|
||||
|
||||
private void InfoTextUpdate()
|
||||
{
|
||||
ArenaColosseum colosseumData = Data.ArenaData.ColosseumData;
|
||||
SystemText systemText = Data.SystemText;
|
||||
UILabel uILabel = null;
|
||||
string text = colosseumData.Rule switch
|
||||
{
|
||||
ArenaColosseum.eRule.TwoPick => (colosseumData.IsNormalTwoPick ? systemText.Get("Arena_0002") : systemText.Get("Colosseum_0105")) + " " + systemText.Get("Colosseum_0093"),
|
||||
ArenaColosseum.eRule.TwoPickChaos => systemText.Get("Chaos_FormatName") + " " + systemText.Get("Colosseum_0093"),
|
||||
ArenaColosseum.eRule.HOF => systemText.Get("Colosseum_0108"),
|
||||
ArenaColosseum.eRule.WindFall => systemText.Get("Colosseum_0116"),
|
||||
_ => UIUtil.GetFormatName(colosseumData.DeckFormat) + systemText.Get("Colosseum_0093"),
|
||||
};
|
||||
UILabel uILabel2;
|
||||
UILabel uILabel3;
|
||||
UILabel uILabel4;
|
||||
if (colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos)
|
||||
{
|
||||
if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2)
|
||||
{
|
||||
_infoBase.SetActive(value: false);
|
||||
_twoPickRound1InfoBase.SetActive(value: false);
|
||||
_twoPickRound2InfoBase.SetActive(value: true);
|
||||
uILabel2 = _twoPickRound2FormatLabel;
|
||||
uILabel3 = _twoPickRound2PoolLabel;
|
||||
uILabel4 = _twoPickRound2PeriodLabel;
|
||||
uILabel = _twoPickRound2StatusLabel;
|
||||
}
|
||||
else
|
||||
{
|
||||
_infoBase.SetActive(value: false);
|
||||
_twoPickRound1InfoBase.SetActive(value: true);
|
||||
_twoPickRound2InfoBase.SetActive(value: false);
|
||||
uILabel2 = _twoPickFormatLabel;
|
||||
uILabel3 = _twoPickPoolLabel;
|
||||
uILabel4 = _twoPickPeriodLabel;
|
||||
uILabel = _twoPickStatusLabel;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_infoBase.SetActive(value: true);
|
||||
_twoPickRound1InfoBase.SetActive(value: false);
|
||||
_twoPickRound2InfoBase.SetActive(value: false);
|
||||
uILabel2 = _formatLabel;
|
||||
uILabel3 = null;
|
||||
uILabel4 = _periodLabel;
|
||||
uILabel = _ownStatusLabel;
|
||||
}
|
||||
uILabel2.text = systemText.Get("Colosseum_0054", text);
|
||||
if (colosseumData.IsRoundPeriod)
|
||||
{
|
||||
uILabel4.text = colosseumData.NowRoundTimeText;
|
||||
}
|
||||
else
|
||||
{
|
||||
string text2 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage) ? systemText.Get("Colosseum_0007", ((int)colosseumData.StageNo).ToString()) : systemText.Get("Colosseum_0008"));
|
||||
uILabel4.text = text2 + systemText.Get("Colosseum_0101") + colosseumData.NowRoundTimeText;
|
||||
}
|
||||
if (colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos)
|
||||
{
|
||||
uILabel3.text = systemText.Get("Arena_0142", colosseumData.CardPool);
|
||||
}
|
||||
_ownStatusLabel.text = string.Empty;
|
||||
_twoPickStatusLabel.text = string.Empty;
|
||||
_twoPickRound2StatusLabel.text = string.Empty;
|
||||
if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage1)
|
||||
{
|
||||
if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B)
|
||||
{
|
||||
uILabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
}
|
||||
else if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2)
|
||||
{
|
||||
string text3 = string.Empty;
|
||||
string text4 = string.Empty;
|
||||
if (colosseumData.IsRoundPeriod)
|
||||
{
|
||||
if (colosseumData.Round == ArenaColosseum.eRound.Round2A || colosseumData.Round == ArenaColosseum.eRound.Round2B)
|
||||
{
|
||||
text3 = systemText.Get("Colosseum_0100", colosseumData.GetGroupText(colosseumData.Round));
|
||||
}
|
||||
if (colosseumData.NextRound == ArenaColosseum.eRound.Undecided)
|
||||
{
|
||||
text4 = systemText.Get("Colosseum_0052");
|
||||
}
|
||||
else if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB)
|
||||
{
|
||||
text4 = systemText.Get("Colosseum_0037_Group", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
uILabel.text = text3 + "\n" + text4;
|
||||
}
|
||||
else if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B)
|
||||
{
|
||||
uILabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
}
|
||||
else if (colosseumData.StageNo == ArenaColosseum.eStageNo.FinalStage && colosseumData.Round != ArenaColosseum.eRound.Lose)
|
||||
{
|
||||
if (colosseumData.IsClear)
|
||||
{
|
||||
uILabel.text = systemText.Get("Colosseum_0038", colosseumData.Name);
|
||||
}
|
||||
else if (!colosseumData.IsFinalRoundTry)
|
||||
{
|
||||
string text5 = string.Empty;
|
||||
if (colosseumData.IsRoundPeriod)
|
||||
{
|
||||
if (colosseumData.Round == ArenaColosseum.eRound.FinalA || colosseumData.Round == ArenaColosseum.eRound.FinalB)
|
||||
{
|
||||
text5 = systemText.Get("Colosseum_0100", colosseumData.GetGroupText(colosseumData.Round));
|
||||
}
|
||||
uILabel.text = text5;
|
||||
}
|
||||
else if (colosseumData.NextRound == ArenaColosseum.eRound.Lose)
|
||||
{
|
||||
uILabel.text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB)
|
||||
{
|
||||
text5 = systemText.Get("Colosseum_0100", colosseumData.GetGroupText(colosseumData.NextRound));
|
||||
}
|
||||
uILabel.text = text5 + "\n" + systemText.Get("Colosseum_0037");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (uILabel.text == string.Empty)
|
||||
{
|
||||
if ((colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) && colosseumData.StageNo == ArenaColosseum.eStageNo.FinalStage)
|
||||
{
|
||||
uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 30f);
|
||||
}
|
||||
else
|
||||
{
|
||||
uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 14f);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ((colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) && colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2)
|
||||
{
|
||||
uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 56f);
|
||||
}
|
||||
else
|
||||
{
|
||||
uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 49f);
|
||||
}
|
||||
uILabel.text = "[fcd24a]" + uILabel.text + "[-]";
|
||||
}
|
||||
|
||||
private void EntryTextUpdate()
|
||||
{
|
||||
ArenaColosseum colosseumData = Data.ArenaData.ColosseumData;
|
||||
SystemText systemText = Data.SystemText;
|
||||
if (!isEntryPossible())
|
||||
{
|
||||
_costRoot.SetActive(value: false);
|
||||
_entryStatusRoot.SetActive(value: true);
|
||||
_entryStatusLabel.text = string.Empty;
|
||||
if (colosseumData.IsClear || colosseumData.IsFinalRoundTry)
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0086");
|
||||
}
|
||||
else if (colosseumData.Round == ArenaColosseum.eRound.Lose)
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0022");
|
||||
}
|
||||
else if (!colosseumData.IsRoundPeriod)
|
||||
{
|
||||
if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage1)
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0064");
|
||||
}
|
||||
else if (colosseumData.NextRound == ArenaColosseum.eRound.Lose)
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0022");
|
||||
}
|
||||
else
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0056");
|
||||
}
|
||||
}
|
||||
else if (!colosseumData.IsRetry)
|
||||
{
|
||||
if (colosseumData.IsLastDay)
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0068");
|
||||
}
|
||||
else
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0067");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (colosseumData.IsFreeEntry || colosseumData.IsFinalRound())
|
||||
{
|
||||
_costRoot.SetActive(value: false);
|
||||
_entryStatusRoot.SetActive(value: true);
|
||||
if (!colosseumData.IsFinalRound())
|
||||
{
|
||||
string id = "Colosseum_0047";
|
||||
if (colosseumData.IsLastDay)
|
||||
{
|
||||
id = "Colosseum_0050";
|
||||
}
|
||||
_entryStatusLabel.text = "[fcd24a]" + systemText.Get(id, colosseumData.RetryRemainingNum.ToString()) + "[-]\n\n" + systemText.Get("Colosseum_0026");
|
||||
}
|
||||
else
|
||||
{
|
||||
_entryStatusLabel.text = systemText.Get("Colosseum_0092");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_costRoot.SetActive(value: true);
|
||||
_entryStatusRoot.SetActive(value: false);
|
||||
}
|
||||
if (colosseumData.IsLastDay)
|
||||
{
|
||||
_retryNumberLabel.text = systemText.Get("Colosseum_0050", colosseumData.RetryRemainingNum.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
_retryNumberLabel.text = systemText.Get("Colosseum_0047", colosseumData.RetryRemainingNum.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
166
SVSim.BattleEngine/Engine/CommonBackGround.cs
Normal file
166
SVSim.BattleEngine/Engine/CommonBackGround.cs
Normal file
@@ -0,0 +1,166 @@
|
||||
using System;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class CommonBackGround : UIBase
|
||||
{
|
||||
public enum eBGType
|
||||
{
|
||||
NONE,
|
||||
MORNING,
|
||||
DAYTIME,
|
||||
NIGHTTIME
|
||||
}
|
||||
|
||||
private const string LAYER_NAME_FRONT = "FrontUI";
|
||||
|
||||
private const int MorningStartTime = 4;
|
||||
|
||||
private const int DayStartTime = 10;
|
||||
|
||||
private const int NightStartTime = 18;
|
||||
|
||||
private const string MorningTimeBGStr = "bg_mypage_morning";
|
||||
|
||||
private const string DayTimeBGStr = "bg_mypage_day";
|
||||
|
||||
private const string NightTimeBGStr = "bg_mypage_night";
|
||||
|
||||
private static CommonBackGround _instance;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture MypageBG;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject MagicCircle;
|
||||
|
||||
[SerializeField]
|
||||
public ParticleSystem[] BgEffects;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _effectRoot;
|
||||
|
||||
private eBGType _BGType;
|
||||
|
||||
private bool _bgFinishLoad;
|
||||
|
||||
private string _bgPath;
|
||||
|
||||
private EffectSetUp _currentEffectSetup;
|
||||
|
||||
public static CommonBackGround Instance => _instance;
|
||||
|
||||
public eBGType BGType => _BGType;
|
||||
|
||||
public bool IsFinishLod => _bgFinishLoad;
|
||||
|
||||
public bool EffectVisible
|
||||
{
|
||||
set
|
||||
{
|
||||
_effectRoot.SetActive(value);
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
protected override void onOpen()
|
||||
{
|
||||
base.onOpen();
|
||||
ChangeMyPageBG();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
_instance = null;
|
||||
ReleaseMyPageBG();
|
||||
_BGType = eBGType.NONE;
|
||||
MagicCircle.GetComponent<UITexture>().mainTexture = null;
|
||||
}
|
||||
|
||||
private void ReleaseMyPageBG()
|
||||
{
|
||||
MypageBG.mainTexture = null;
|
||||
Toolbox.ResourcesManager.RemoveAsset(_bgPath);
|
||||
_bgPath = "";
|
||||
}
|
||||
|
||||
public void ChangeMyPageBG()
|
||||
{
|
||||
int hour = DateTime.Now.Hour;
|
||||
eBGType eBGType;
|
||||
string newBgStr;
|
||||
if (hour >= 4 && hour < 10)
|
||||
{
|
||||
eBGType = eBGType.MORNING;
|
||||
newBgStr = "bg_mypage_morning";
|
||||
}
|
||||
else if (hour >= 10 && hour < 18)
|
||||
{
|
||||
eBGType = eBGType.DAYTIME;
|
||||
newBgStr = "bg_mypage_day";
|
||||
}
|
||||
else
|
||||
{
|
||||
eBGType = eBGType.NIGHTTIME;
|
||||
newBgStr = "bg_mypage_night";
|
||||
}
|
||||
if (_BGType == eBGType)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_bgFinishLoad = false;
|
||||
_BGType = eBGType;
|
||||
ResourcesManager resMgr = Toolbox.ResourcesManager;
|
||||
string newBgPath = resMgr.GetAssetTypePath(newBgStr, ResourcesManager.AssetLoadPathType.Background);
|
||||
resMgr.StartCoroutine_LoadAssetGroupAsync(newBgPath, delegate
|
||||
{
|
||||
_bgFinishLoad = true;
|
||||
MypageBG.mainTexture = resMgr.LoadObject(resMgr.GetAssetTypePath(newBgStr, ResourcesManager.AssetLoadPathType.Background, isfetch: true)) as Texture;
|
||||
if (_bgPath != null)
|
||||
{
|
||||
resMgr.RemoveAsset(_bgPath);
|
||||
}
|
||||
_bgPath = newBgPath;
|
||||
ChangeBgEffect();
|
||||
});
|
||||
}
|
||||
|
||||
private void ChangeBgEffect()
|
||||
{
|
||||
BgEffects[0].gameObject.SetActive(value: false);
|
||||
BgEffects[1].gameObject.SetActive(value: false);
|
||||
BgEffects[2].gameObject.SetActive(value: false);
|
||||
ParticleSystem bgEffectNow = GetBgEffectNow(_BGType);
|
||||
bgEffectNow.gameObject.SetActive(value: true);
|
||||
_currentEffectSetup = bgEffectNow.GetComponent<EffectSetUp>();
|
||||
}
|
||||
|
||||
public ParticleSystem GetBgEffectNow(eBGType myPageBgType)
|
||||
{
|
||||
return myPageBgType switch
|
||||
{
|
||||
eBGType.MORNING => BgEffects[2],
|
||||
eBGType.DAYTIME => BgEffects[0],
|
||||
_ => BgEffects[1],
|
||||
};
|
||||
}
|
||||
|
||||
public void SetMagicCircle(bool isVisible)
|
||||
{
|
||||
MagicCircle.SetActive(isVisible);
|
||||
}
|
||||
|
||||
public bool IsFinishEffectLoading()
|
||||
{
|
||||
if (_currentEffectSetup != null)
|
||||
{
|
||||
return _currentEffectSetup.isFinished;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
10
SVSim.BattleEngine/Engine/ConsistencyReportButtonAction.cs
Normal file
10
SVSim.BattleEngine/Engine/ConsistencyReportButtonAction.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Wizard;
|
||||
using Wizard.UI.ReportToManagement;
|
||||
|
||||
public static class ConsistencyReportButtonAction
|
||||
{
|
||||
public static void CreateReportConfirmWindow()
|
||||
{
|
||||
DialogReportToManagement.Create(ToolboxGame.RealTimeNetworkAgent.GetBattleId());
|
||||
}
|
||||
}
|
||||
13
SVSim.BattleEngine/Engine/Convention/Offline.cs
Normal file
13
SVSim.BattleEngine/Engine/Convention/Offline.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Convention;
|
||||
|
||||
public class Offline
|
||||
{
|
||||
public const int CARD_NUMBER_OF_POSSESSION = 3;
|
||||
|
||||
public static bool IsConventionMode { get; set; }
|
||||
|
||||
public static void OnSoftwareReset()
|
||||
{
|
||||
IsConventionMode = false;
|
||||
}
|
||||
}
|
||||
19
SVSim.BattleEngine/Engine/CostHalfRoundDownModifier.cs
Normal file
19
SVSim.BattleEngine/Engine/CostHalfRoundDownModifier.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
public class CostHalfRoundDownModifier : CostHalfModifier
|
||||
{
|
||||
public CostHalfRoundDownModifier(bool isResidentModifier)
|
||||
: base(isResidentModifier)
|
||||
{
|
||||
}
|
||||
|
||||
public override int CalcCost(int cost)
|
||||
{
|
||||
return (int)Math.Floor((float)cost / 2f);
|
||||
}
|
||||
|
||||
public override ICardCostModifier Clone()
|
||||
{
|
||||
return new CostHalfRoundDownModifier(base.IsResidentModifier);
|
||||
}
|
||||
}
|
||||
564
SVSim.BattleEngine/Engine/CreateItemList.cs
Normal file
564
SVSim.BattleEngine/Engine/CreateItemList.cs
Normal file
@@ -0,0 +1,564 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class CreateItemList : MonoBehaviour
|
||||
{
|
||||
private static CreateItemList main;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject ItemListObj;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject BirthInputObj;
|
||||
|
||||
[SerializeField]
|
||||
private NguiObjs BuyButtons;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollView CrystalScrollView;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollBar ScrollBar;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject ButtonBase;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject OneButtonBase;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BtnInfo0Label;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BtnInfo1Label;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel OneButtonLabel;
|
||||
|
||||
[SerializeField]
|
||||
private TweenAlpha ItemListWindowAlpha;
|
||||
|
||||
[SerializeField]
|
||||
private TweenAlpha BirthWindowAlpha;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel MyCrystalNumLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject BtnFundSettlementObj;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject BtnLegalObj;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BirthLabel1;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BirthLabel2;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BirthAgeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BirthLimitLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BirthPriceLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel BirthWarnLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel InputExampleLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UIInput UIInputObject;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _noInputCollider;
|
||||
|
||||
public static int BirthDayUpdateServerTime;
|
||||
|
||||
public static float BirthDayUpdateRealTime;
|
||||
|
||||
private string productId = "";
|
||||
|
||||
private int ProductIndex;
|
||||
|
||||
private string DateOfBirth = "";
|
||||
|
||||
private NetworkManager networkManager;
|
||||
|
||||
private DateTime NowTime;
|
||||
|
||||
private List<NguiObjs> _itemObjectList;
|
||||
|
||||
private List<string> _notDispItemList = new List<string>();
|
||||
|
||||
[HideInInspector]
|
||||
public DialogBase ParentDialogBase;
|
||||
|
||||
private const int BIRTH_DAY_NUMBER_DIGITS = 6;
|
||||
|
||||
private const int CHILD_YEAR = 18;
|
||||
|
||||
private const int CRYSTAL_LIMIT_UNDER = 2500;
|
||||
|
||||
private const int CRYSTAL_LIMIT_TOP = 5000;
|
||||
|
||||
private const int EN_LIMIT_UNDER = 5000;
|
||||
|
||||
private const int EN_LIMIT_TOP = 10000;
|
||||
|
||||
private const int ERROR_WINDOW_DEPTH = 50;
|
||||
|
||||
private const string DEFAULT_BIRTH_DAY = "0";
|
||||
|
||||
private const string FORMAT_CONVERT_DATE_BIRTH = "{0}/{1}/15";
|
||||
|
||||
private const int NGUI_SEPARATOR = 0;
|
||||
|
||||
private const int NGUI_ITEM_SPRITE = 0;
|
||||
|
||||
public string ScrollToProductId;
|
||||
|
||||
private Vector3 _lastScrollPosition;
|
||||
|
||||
private const float SCROLL_OFFSET = 10f;
|
||||
|
||||
private const float SCROLL_DELAY = 0f;
|
||||
|
||||
private const float SCROLL_DELAY_LONG = 0f;
|
||||
|
||||
private const float SCROLL_TIME = 0f;
|
||||
|
||||
public bool IsOnlyInputBirthday { get; set; }
|
||||
|
||||
public Action OnFinishUpdateBirthday { get; set; }
|
||||
|
||||
public static CreateItemList GetInstance()
|
||||
{
|
||||
return main;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
main = this;
|
||||
if (networkManager == null)
|
||||
{
|
||||
networkManager = Toolbox.NetworkManager;
|
||||
}
|
||||
SystemText systemText = Data.SystemText;
|
||||
PaymentPC instance = PaymentPC.GetInstance();
|
||||
instance.ConsumePurchaseSucceeded += PaymentSuccessed;
|
||||
BirthLabel1.text = systemText.Get("Shop_0029");
|
||||
BirthLabel2.text = systemText.Get("Shop_0030");
|
||||
BirthAgeLabel.text = systemText.Get("Shop_0035") + "\n" + systemText.Get("Shop_0036") + "\n" + systemText.Get("Shop_0037");
|
||||
BirthLimitLabel.text = systemText.Get("Shop_0038") + "\n" + systemText.Get("Shop_0038") + "\n" + systemText.Get("Shop_0040");
|
||||
string text;
|
||||
string text2;
|
||||
if (Data.SystemText.RegionCode == Global.LANG_TYPE.Ger.ToString())
|
||||
{
|
||||
CultureInfo cultureInfo = new CultureInfo("de-de");
|
||||
text = 2500.ToString("N0", cultureInfo);
|
||||
text2 = 5000.ToString("N0", cultureInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = $"{2500:N0}";
|
||||
text2 = $"{5000:N0}";
|
||||
}
|
||||
BirthPriceLabel.text = systemText.Get("Shop_0039", text) + "\n" + systemText.Get("Shop_0039", text2);
|
||||
BirthWarnLabel.text = systemText.Get("Shop_0031");
|
||||
InputExampleLabel.text = systemText.Get("Shop_0068");
|
||||
InputExampleLabel.gameObject.SetActive(value: true);
|
||||
ParentDialogBase.SetButtonDisable(isEnableOK: true);
|
||||
Dictionary<string, string> productPurchaseLimitList = instance.ProductPurchaseLimitList;
|
||||
Dictionary<string, string> productPurchaseNumberList = instance.ProductPurchaseNumberList;
|
||||
Dictionary<string, string> productCsvIdList = instance.ProductCsvIdList;
|
||||
_notDispItemList.Clear();
|
||||
if (productPurchaseNumberList.Count != 0)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> item in productCsvIdList)
|
||||
{
|
||||
if (productPurchaseNumberList.ContainsKey(item.Value) && int.Parse(productPurchaseLimitList[item.Value]) <= int.Parse(productPurchaseNumberList[item.Value]))
|
||||
{
|
||||
_notDispItemList.Add(item.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
InitScrollView(_notDispItemList);
|
||||
UpdateCrystalCount();
|
||||
if (IsBirthdayNotInput())
|
||||
{
|
||||
BirthInputObj.SetActive(value: true);
|
||||
BirthWindowAlpha.PlayForward();
|
||||
return;
|
||||
}
|
||||
ItemListObj.SetActive(value: true);
|
||||
ItemListWindowAlpha.PlayForward();
|
||||
ParentDialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
||||
ParentDialogBase.SetButtonDisable(isEnableOK: false);
|
||||
ParentDialogBase.onPushButton1 = delegate
|
||||
{
|
||||
ParentDialogBase.Close();
|
||||
};
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
CrystalScrollView.ResetPosition();
|
||||
ScrollBar.value = 0f;
|
||||
}
|
||||
|
||||
public static bool IsBirthdayNotInput()
|
||||
{
|
||||
return PlayerStaticData.UserBirthDay == "0";
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
CheckScrollToItem(0f);
|
||||
if (PlayerStaticData.UserBirthDay.Length != 6)
|
||||
{
|
||||
if (UIInputObject.isSelected)
|
||||
{
|
||||
InputExampleLabel.gameObject.SetActive(value: false);
|
||||
}
|
||||
else if (UIInputObject.value.Length == 0)
|
||||
{
|
||||
InputExampleLabel.gameObject.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void InitScrollView(List<string> inDeleteIdList = null)
|
||||
{
|
||||
PaymentPC instance = PaymentPC.GetInstance();
|
||||
List<string> productIdList = instance.ProductIdList;
|
||||
Dictionary<string, string> productCsvIdList = instance.ProductCsvIdList;
|
||||
Dictionary<string, string> productNameList = instance.ProductNameList;
|
||||
Dictionary<string, string> formatProductPriceList = instance.FormatProductPriceList;
|
||||
Dictionary<string, string> productImageNameList = instance.ProductImageNameList;
|
||||
Dictionary<string, bool> productIsSpecialShop = instance.ProductIsSpecialShop;
|
||||
SystemText systemText = Data.SystemText;
|
||||
float num = 0f;
|
||||
float num2 = 0f;
|
||||
int num3 = 0;
|
||||
_itemObjectList = new List<NguiObjs>(productIdList.Count);
|
||||
for (int i = 0; i < productIdList.Count; i++)
|
||||
{
|
||||
string key = productIdList[i];
|
||||
if ((inDeleteIdList == null || !inDeleteIdList.Contains(productCsvIdList[key])) && !productIsSpecialShop[key] && productNameList.ContainsKey(key) && formatProductPriceList.ContainsKey(key))
|
||||
{
|
||||
NguiObjs component = NGUITools.AddChild(CrystalScrollView.gameObject, BuyButtons.gameObject).GetComponent<NguiObjs>();
|
||||
_itemObjectList.Add(component);
|
||||
component.gameObject.SetActive(value: true);
|
||||
component.labels[0].text = productNameList[key];
|
||||
component.labels[1].text = systemText.Get("Shop_0083") + "$" + formatProductPriceList[key];
|
||||
component.labels[2].text = systemText.Get("Shop_0041");
|
||||
component.buttons[0].gameObject.name = i.ToString();
|
||||
UIEventListener uIEventListener = UIEventListener.Get(component.buttons[0].gameObject);
|
||||
uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, new UIEventListener.VoidDelegate(BuyCrystalButtonClickCallBack));
|
||||
num2 = component.GetComponent<UISprite>().height;
|
||||
num = (float)num3 * num2;
|
||||
component.transform.localPosition = new Vector3(0f, 0f - num, 0f);
|
||||
component.sprites[0].spriteName = productImageNameList[key];
|
||||
if (i == productIdList.Count - 1)
|
||||
{
|
||||
component.objs[0].SetActive(value: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.objs[0].SetActive(value: true);
|
||||
}
|
||||
num3++;
|
||||
}
|
||||
}
|
||||
OneButtonBase.SetActive(value: false);
|
||||
ButtonBase.SetActive(value: false);
|
||||
if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Kor.ToString())
|
||||
{
|
||||
OneButtonBase.SetActive(value: true);
|
||||
OneButtonBase.transform.localPosition = new Vector3(0f, 0f - (num + num2 / 2f), 0f);
|
||||
OneButtonLabel.text = systemText.Get("Shop_0125");
|
||||
}
|
||||
CrystalScrollView.ResetPosition();
|
||||
ScrollBar.value = 0f;
|
||||
}
|
||||
|
||||
private void _PaymentListErrorDialog()
|
||||
{
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0094"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Shop_0093"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetPanelDepth(100);
|
||||
}
|
||||
}
|
||||
|
||||
public void BirthUpdateButtonClickCallBack()
|
||||
{
|
||||
DateOfBirth = UIInputObject.value;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetReturnMsg(base.gameObject, "BirthUpdateTask");
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0070"));
|
||||
if (DateTime.TryParse($"{DateOfBirth.Substring(0, 4)}/{DateOfBirth.Substring(4, 2)}/15", out var result))
|
||||
{
|
||||
result = TimeZoneInfo.ConvertTimeToUtc(result);
|
||||
string text = ConvertTime.ToLocal(result, ConvertTime.FORMAT.YEAR_MONTH);
|
||||
dialogBase.SetText(Data.SystemText.Get("Shop_0071", text));
|
||||
}
|
||||
else
|
||||
{
|
||||
dialogBase.SetText(Data.SystemText.Get("Shop_0071", DateOfBirth));
|
||||
}
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetButtonText(Data.SystemText.Get("Dia_BuyCrystal_002_Button"));
|
||||
dialogBase.SetPanelDepth(100);
|
||||
}
|
||||
|
||||
private void BirthUpdateTask()
|
||||
{
|
||||
UpdateBirthTask updateBirthTask = new UpdateBirthTask();
|
||||
updateBirthTask.SetParameter(DateOfBirth);
|
||||
StartCoroutine(networkManager.Connect(updateBirthTask, OnUpdateBirthFinished));
|
||||
}
|
||||
|
||||
private void OnUpdateBirthFinished(NetworkTask.ResultCode code)
|
||||
{
|
||||
PlayerStaticData.UserBirthDay = UIInputObject.value;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuyCrystal_003_Title"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Shop_0069"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetPanelDepth(100);
|
||||
if (!IsOnlyInputBirthday)
|
||||
{
|
||||
dialogBase.OnClose = BirthCloseAndItemOpen;
|
||||
return;
|
||||
}
|
||||
dialogBase.OnClose = delegate
|
||||
{
|
||||
OnFinishUpdateBirthday.Call();
|
||||
};
|
||||
}
|
||||
|
||||
protected void BirthCloseAndItemOpen()
|
||||
{
|
||||
BirthWindowAlpha.PlayReverse();
|
||||
if (IsChildCheckDialog())
|
||||
{
|
||||
ChildWarningDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActivateItemList();
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateItemList()
|
||||
{
|
||||
ItemListObj.SetActive(value: true);
|
||||
ParentDialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
||||
ParentDialogBase.SetButtonDisable(isEnableOK: false);
|
||||
ParentDialogBase.onPushButton1 = delegate
|
||||
{
|
||||
ParentDialogBase.Close();
|
||||
};
|
||||
ItemListWindowAlpha.PlayForward();
|
||||
CheckScrollToItem(0f);
|
||||
}
|
||||
|
||||
public void BirthCancelButtonClickCallBack()
|
||||
{
|
||||
ParentDialogBase.CloseWithoutSelect();
|
||||
}
|
||||
|
||||
public void BirthInputOnChange()
|
||||
{
|
||||
if (UIInputObject.value.Length == 6)
|
||||
{
|
||||
ParentDialogBase.SetButtonDisable(isEnableOK: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ParentDialogBase.SetButtonDisable(isEnableOK: true);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChildWarningDialog()
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0078"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Shop_0079"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetPanelDepth(100);
|
||||
dialogBase.OnClose = ActivateItemList;
|
||||
}
|
||||
|
||||
private void BuyCrystalButtonClickCallBack(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
ProductIndex = int.Parse(g.name);
|
||||
StartPaymentDialog();
|
||||
}
|
||||
|
||||
private void StartPaymentDialog()
|
||||
{
|
||||
productId = PaymentPC.GetInstance().ProductIdList[ProductIndex];
|
||||
Dictionary<string, string> productNameList = PaymentPC.GetInstance().ProductNameList;
|
||||
if (PlayerStaticData.IsPurchaseNotificationOfLootBox())
|
||||
{
|
||||
LootBoxDialogUtility.CreatePurchaseNotificationLootBoxDialog(Data.SystemText.Get("Dia_BuyCrystal_004_Title"), productNameList[productId], StartPayment, CancelPayment);
|
||||
return;
|
||||
}
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuyCrystal_004_Title"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Shop_0017", productNameList[productId]));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetButtonText(Data.SystemText.Get("Dia_BuyCrystal_004_Button"));
|
||||
dialogBase.SetReturnMsg(base.gameObject, "StartPayment", "CancelPayment");
|
||||
dialogBase.SetPanelDepth(100);
|
||||
}
|
||||
|
||||
private void CancelPayment()
|
||||
{
|
||||
UIManager.GetInstance().WebViewHelper.DestroyWebView();
|
||||
}
|
||||
|
||||
private void StartPayment()
|
||||
{
|
||||
PaymentPC.GetInstance().purchaceStart(productId);
|
||||
}
|
||||
|
||||
private void PaymentSuccessed()
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> productPurchaseLimitList = PaymentPC.GetInstance().ProductPurchaseLimitList;
|
||||
string lastPaymentId = Data.Load.data._userCrystalCount._lastPaymentId;
|
||||
int lastPaymentItemBuyNumber = Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber;
|
||||
if (lastPaymentId != null && int.Parse(productPurchaseLimitList[lastPaymentId]) <= lastPaymentItemBuyNumber)
|
||||
{
|
||||
if (!_notDispItemList.Contains(lastPaymentId))
|
||||
{
|
||||
_notDispItemList.Add(lastPaymentId);
|
||||
}
|
||||
for (int i = 0; i < _itemObjectList.Count; i++)
|
||||
{
|
||||
UnityEngine.Object.Destroy(_itemObjectList[i].gameObject);
|
||||
}
|
||||
_itemObjectList.Clear();
|
||||
InitScrollView(_notDispItemList);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LocalLog.AccumulateTraceLog("Payment suceeded but exception is captured :" + ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateCrystalCount()
|
||||
{
|
||||
MyCrystalNumLabel.text = PlayerStaticData.UserCrystalCount.ToString();
|
||||
}
|
||||
|
||||
public void FundSettlementButtonClickCallBack()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.FUND_SETTLEMENT);
|
||||
}
|
||||
|
||||
public void LegalButtonClickCallBack()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.LEGALTEXT);
|
||||
}
|
||||
|
||||
public void OneButtonClickCallBack()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Kor.ToString())
|
||||
{
|
||||
UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.KOREA_CRYSTAL_PAGE);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsChildCheckDialog()
|
||||
{
|
||||
if (BirthDayUpdateServerTime != 0)
|
||||
{
|
||||
int year = int.Parse(PlayerStaticData.UserBirthDay.Substring(0, 4));
|
||||
int month = int.Parse(PlayerStaticData.UserBirthDay.Substring(4, 2));
|
||||
DateTime dateTime = new DateTime(year, month, 1);
|
||||
DateTime dateTime2 = UnixTimeToDateTime(BirthDayUpdateServerTime + (int)(Time.realtimeSinceStartup - BirthDayUpdateRealTime));
|
||||
DateTime dateTime3 = new DateTime(1, 1, 1);
|
||||
TimeSpan timeSpan = dateTime2 - dateTime;
|
||||
int num = (dateTime3 + timeSpan).Year - 1;
|
||||
int num2 = (dateTime3 + timeSpan).Month - 1;
|
||||
if (num < 18 || (num == 18 && num2 == 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected DateTime UnixTimeToDateTime(int unixTime)
|
||||
{
|
||||
return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unixTime);
|
||||
}
|
||||
|
||||
private void StartScrollToIndex(int index, float delay)
|
||||
{
|
||||
Vector3 localPosition = CrystalScrollView.transform.localPosition;
|
||||
Vector3 vector = localPosition - _itemObjectList[index].transform.localPosition;
|
||||
vector.y += 10f;
|
||||
_lastScrollPosition = localPosition;
|
||||
_noInputCollider.SetActive(value: true);
|
||||
iTween.ValueTo(base.gameObject, iTween.Hash("from", localPosition, "to", vector, "delay", delay, "time", 0f, "easetype", iTween.EaseType.easeInOutQuad, "onupdate", "ScrollViewUpdate", "oncomplete", "DeactivateCollider"));
|
||||
}
|
||||
|
||||
private void ScrollViewUpdate(Vector3 v)
|
||||
{
|
||||
CrystalScrollView.MoveRelative(v - _lastScrollPosition);
|
||||
CrystalScrollView.RestrictWithinBounds(instant: true);
|
||||
_lastScrollPosition = v;
|
||||
}
|
||||
|
||||
private void DeactivateCollider()
|
||||
{
|
||||
_noInputCollider.SetActive(value: false);
|
||||
}
|
||||
|
||||
private int GetIndexFromProductId(string id)
|
||||
{
|
||||
List<string> idList = PaymentPC.GetInstance().IdList;
|
||||
if (_notDispItemList != null)
|
||||
{
|
||||
for (int i = 0; i < _notDispItemList.Count; i++)
|
||||
{
|
||||
idList.Remove(_notDispItemList[i]);
|
||||
}
|
||||
}
|
||||
return idList.FindIndex((string x) => x == id);
|
||||
}
|
||||
|
||||
private void CheckScrollToItem(float delay)
|
||||
{
|
||||
if (CrystalScrollView.isActiveAndEnabled && !string.IsNullOrEmpty(ScrollToProductId))
|
||||
{
|
||||
int indexFromProductId = GetIndexFromProductId(ScrollToProductId);
|
||||
if (indexFromProductId > 0)
|
||||
{
|
||||
StartScrollToIndex(indexFromProductId, delay);
|
||||
}
|
||||
ScrollToProductId = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cute.Payment;
|
||||
|
||||
public interface IPaymentCommonCallback
|
||||
{
|
||||
void OnInitializeSucceeded();
|
||||
|
||||
void OnInitializeFailed(int errorCode, string errorMessage);
|
||||
|
||||
void OnPurchaseFailed(string error);
|
||||
|
||||
void OnPurchaseFailed(int errorCode, string message);
|
||||
|
||||
void OnPurchaseCancelled(string productId, string price, string currencyCode);
|
||||
|
||||
void OnGetProductListSucceeded(List<PaymentSkuInfo> productInfo, bool waitUnfinishedTransaction);
|
||||
|
||||
void OnGetProductListFailed(int errorCode, string errorMessage);
|
||||
|
||||
void OnConsumePurchaseSucceeded();
|
||||
|
||||
void OnConsumePurchaseFailed(int errorCode, string errorMessage);
|
||||
}
|
||||
61
SVSim.BattleEngine/Engine/Cute/AchievementManager.cs
Normal file
61
SVSim.BattleEngine/Engine/Cute/AchievementManager.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public static class AchievementManager
|
||||
{
|
||||
private static IAchievementCallback mCallback;
|
||||
|
||||
public static void Initialize(IAchievementCallback callback)
|
||||
{
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
public static void ShowAchievementsUI()
|
||||
{
|
||||
Social.ShowAchievementsUI();
|
||||
}
|
||||
|
||||
public static void ReleaseAchievement(string id)
|
||||
{
|
||||
Social.ReportProgress(id, 100.0, delegate(bool success)
|
||||
{
|
||||
if (mCallback != null)
|
||||
{
|
||||
mCallback.OnReleaseAchievement(success);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void ProceedAchievement(string id, float value)
|
||||
{
|
||||
Social.ReportProgress(id, value, delegate(bool success)
|
||||
{
|
||||
if (mCallback != null)
|
||||
{
|
||||
mCallback.OnProceedAchievement(success);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void ResetAchievements(Action<bool> callback)
|
||||
{
|
||||
}
|
||||
|
||||
public static void LoadAchievements()
|
||||
{
|
||||
if (mCallback != null)
|
||||
{
|
||||
Social.LoadAchievements(mCallback.OnLoadAchievements);
|
||||
}
|
||||
}
|
||||
|
||||
public static void LoadAchievementDescriptions()
|
||||
{
|
||||
if (mCallback != null)
|
||||
{
|
||||
Social.LoadAchievementDescriptions(mCallback.OnLoadAchievementDescriptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
SVSim.BattleEngine/Engine/Cute/AdjustManager.cs
Normal file
22
SVSim.BattleEngine/Engine/Cute/AdjustManager.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace Cute;
|
||||
|
||||
public static class AdjustManager
|
||||
{
|
||||
private const string _viewerIDEventToken = "qxq65x";
|
||||
|
||||
private const string _tutorialEventToken = "wlojkf";
|
||||
|
||||
private const string _paymentEventToken = "sgqjsc";
|
||||
|
||||
public static void ViewerIDEvent()
|
||||
{
|
||||
}
|
||||
|
||||
public static void TutorialCompleteEvent()
|
||||
{
|
||||
}
|
||||
|
||||
public static void PaymentEvent(double price, string currencycode, string transactionId, string itemTitle, string productId)
|
||||
{
|
||||
}
|
||||
}
|
||||
75
SVSim.BattleEngine/Engine/Cute/BootApp.cs
Normal file
75
SVSim.BattleEngine/Engine/Cute/BootApp.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class BootApp : MonoBehaviour
|
||||
{
|
||||
public static string BootScene;
|
||||
|
||||
private Coroutine _logCoroutine;
|
||||
|
||||
private string _logMsg = "";
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
_logCoroutine = StartCoroutine(WaitToAccumulateTraceLog());
|
||||
_logMsg += "start";
|
||||
createMutex();
|
||||
restrainOSXProcess();
|
||||
startSteamClient();
|
||||
while (Toolbox.BootSystem == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += "start2";
|
||||
CultureInfo.DefaultThreadCurrentUICulture = (CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("ja-JP", useUserOverride: false));
|
||||
Toolbox.AssetManager.createSavePath();
|
||||
yield return StartCoroutine(FontChanger.FontTryChangePersistant(null));
|
||||
_logMsg += "start3";
|
||||
_logMsg += "start4";
|
||||
StopCoroutine(_logCoroutine);
|
||||
changeScene();
|
||||
}
|
||||
|
||||
private IEnumerator WaitToAccumulateTraceLog()
|
||||
{
|
||||
yield return new WaitForSeconds(5f);
|
||||
LocalLog.AccumulateTraceInquiryLog("BootApp " + _logMsg);
|
||||
}
|
||||
|
||||
private void createMutex()
|
||||
{
|
||||
Toolbox.mute = new Mutex(initiallyOwned: false, "Global\\ShadowversePcPlatformGlobalThread");
|
||||
if (Toolbox.mute != null && !Toolbox.mute.WaitOne(0, exitContext: false))
|
||||
{
|
||||
Toolbox.mute.Close();
|
||||
Toolbox.mute = null;
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
private void startSteamClient()
|
||||
{
|
||||
_ = SteamManager.Initialized;
|
||||
}
|
||||
|
||||
private void restrainOSXProcess()
|
||||
{
|
||||
}
|
||||
|
||||
private void changeScene()
|
||||
{
|
||||
if (BootScene != null)
|
||||
{
|
||||
Toolbox.SceneManager.ChangeScene(BootScene);
|
||||
}
|
||||
else
|
||||
{
|
||||
Toolbox.SceneManager.ChangeScene(SceneType._Splash);
|
||||
}
|
||||
}
|
||||
}
|
||||
74
SVSim.BattleEngine/Engine/Cute/DataMigration.cs
Normal file
74
SVSim.BattleEngine/Engine/Cute/DataMigration.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class DataMigration
|
||||
{
|
||||
public enum status
|
||||
{
|
||||
NONE,
|
||||
OVER,
|
||||
FAIL
|
||||
}
|
||||
|
||||
private static bool inProgress;
|
||||
|
||||
public static bool canCombine()
|
||||
{
|
||||
if (Certification.ViewerId != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void CombineStart(string url)
|
||||
{
|
||||
BrowserURL.Open(url);
|
||||
inProgress = true;
|
||||
}
|
||||
|
||||
public static bool isCombineSucceed()
|
||||
{
|
||||
if (Toolbox.SavedataManager.GetInt("COMBINED") != 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool isProgressing()
|
||||
{
|
||||
return inProgress;
|
||||
}
|
||||
|
||||
public static void ProgressOver()
|
||||
{
|
||||
inProgress = false;
|
||||
URLScheme.Clear();
|
||||
}
|
||||
|
||||
public static void CombineSucceed()
|
||||
{
|
||||
Toolbox.SavedataManager.SetInt("COMBINED", 1);
|
||||
}
|
||||
|
||||
public static void CombineFailed()
|
||||
{
|
||||
}
|
||||
|
||||
public static void MigrationStart(string url)
|
||||
{
|
||||
BrowserURL.Open(url);
|
||||
inProgress = true;
|
||||
}
|
||||
|
||||
public static void MigrationSucceed()
|
||||
{
|
||||
CombineSucceed();
|
||||
}
|
||||
|
||||
public static void MigrationFailed()
|
||||
{
|
||||
}
|
||||
}
|
||||
106
SVSim.BattleEngine/Engine/Cute/LeanThreadPool.cs
Normal file
106
SVSim.BattleEngine/Engine/Cute/LeanThreadPool.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class LeanThreadPool
|
||||
{
|
||||
private static LeanThreadPool _instance;
|
||||
|
||||
private Thread[] _threads;
|
||||
|
||||
private Semaphore _semaphore;
|
||||
|
||||
private object _jobsLock;
|
||||
|
||||
private object _convergeLock;
|
||||
|
||||
private List<ParallelJob> _jobs;
|
||||
|
||||
private bool _quit;
|
||||
|
||||
private int _convergeCount;
|
||||
|
||||
public static LeanThreadPool Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new LeanThreadPool();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public int ThreadsCount => _threads.Length;
|
||||
|
||||
private LeanThreadPool()
|
||||
{
|
||||
int processorCount = SystemInfo.processorCount;
|
||||
_jobs = new List<ParallelJob>();
|
||||
_jobsLock = new object();
|
||||
_convergeLock = new object();
|
||||
_semaphore = new Semaphore(0, int.MaxValue);
|
||||
_threads = new Thread[processorCount];
|
||||
for (int i = 0; i < _threads.Length; i++)
|
||||
{
|
||||
_threads[i] = new Thread(ThreadFunction);
|
||||
_threads[i].Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void ThreadFunction()
|
||||
{
|
||||
ParallelJob parallelJob = null;
|
||||
while (!_quit)
|
||||
{
|
||||
_semaphore.WaitOne();
|
||||
lock (_jobsLock)
|
||||
{
|
||||
if (_jobs.Count > 0)
|
||||
{
|
||||
parallelJob = _jobs[0];
|
||||
_jobs.Remove(parallelJob);
|
||||
}
|
||||
}
|
||||
if (parallelJob != null)
|
||||
{
|
||||
parallelJob.Run();
|
||||
parallelJob = null;
|
||||
}
|
||||
}
|
||||
lock (_convergeLock)
|
||||
{
|
||||
_convergeCount++;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator KillAll(Action callback = null)
|
||||
{
|
||||
_quit = true;
|
||||
_convergeCount = 0;
|
||||
lock (_jobsLock)
|
||||
{
|
||||
_jobs.Clear();
|
||||
}
|
||||
_semaphore.Release(_threads.Length);
|
||||
while (_convergeCount < _threads.Length)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
callback.Call();
|
||||
}
|
||||
|
||||
public void AddJob(ParallelJob job)
|
||||
{
|
||||
lock (_jobsLock)
|
||||
{
|
||||
_jobs.Add(job);
|
||||
}
|
||||
_semaphore.Release();
|
||||
}
|
||||
}
|
||||
10
SVSim.BattleEngine/Engine/Cute/PCPlatform.cs
Normal file
10
SVSim.BattleEngine/Engine/Cute/PCPlatform.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using LitJson;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public abstract class PCPlatform
|
||||
{
|
||||
public abstract void Parse(JsonData response);
|
||||
|
||||
public abstract PaymentPCStartParams SetParameter(string productId, bool isAlertAgree, bool isAlertActive);
|
||||
}
|
||||
34
SVSim.BattleEngine/Engine/Cute/PCPlatformSTEAM.cs
Normal file
34
SVSim.BattleEngine/Engine/Cute/PCPlatformSTEAM.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using LitJson;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class PCPlatformSTEAM : PCPlatform
|
||||
{
|
||||
protected PaymentPCStartParamsSTEAM _postParams = new PaymentPCStartParamsSTEAM();
|
||||
|
||||
public static string State { get; private set; }
|
||||
|
||||
public static string Country { get; private set; }
|
||||
|
||||
public static string Currency { get; private set; }
|
||||
|
||||
public static string Status { get; private set; }
|
||||
|
||||
public override PaymentPCStartParams SetParameter(string productId, bool isAlertAgree, bool isAlertActive)
|
||||
{
|
||||
_postParams.product_id = productId;
|
||||
_postParams.price = PaymentPC.GetInstance().ProductPriceList[productId];
|
||||
_postParams.ip_address = Toolbox.DeviceManager.GetIpAddress();
|
||||
_postParams.isalertagree = (isAlertAgree ? 1 : 0);
|
||||
_postParams.isalertactive = (isAlertActive ? 1 : 0);
|
||||
return _postParams;
|
||||
}
|
||||
|
||||
public override void Parse(JsonData response)
|
||||
{
|
||||
State = response["steam_user_info"]["state"].ToString();
|
||||
Country = response["steam_user_info"]["country"].ToString();
|
||||
Currency = response["steam_user_info"]["currency"].ToString();
|
||||
Status = response["steam_user_info"]["status"].ToString();
|
||||
}
|
||||
}
|
||||
12
SVSim.BattleEngine/Engine/Cute/PaymentPCStartParams.cs
Normal file
12
SVSim.BattleEngine/Engine/Cute/PaymentPCStartParams.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Cute;
|
||||
|
||||
public class PaymentPCStartParams : PostParams
|
||||
{
|
||||
public string product_id = "";
|
||||
|
||||
public string price = "";
|
||||
|
||||
public int isalertagree;
|
||||
|
||||
public int isalertactive;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Cute;
|
||||
|
||||
public class PaymentPCStartParamsSTEAM : PaymentPCStartParams
|
||||
{
|
||||
public string ip_address = "";
|
||||
}
|
||||
42
SVSim.BattleEngine/Engine/Cute/PaymentPCStartTask.cs
Normal file
42
SVSim.BattleEngine/Engine/Cute/PaymentPCStartTask.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
namespace Cute;
|
||||
|
||||
public class PaymentPCStartTask : NetworkTask
|
||||
{
|
||||
protected PCPlatform _platform;
|
||||
|
||||
protected CuteNetworkDefine.ApiType _apiType = CuteNetworkDefine.ApiType.PaymentPCStart;
|
||||
|
||||
public PaymentBase.RefundWarningType NeedRefundWarningType { get; private set; }
|
||||
|
||||
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[_apiType]}";
|
||||
|
||||
public PaymentPCStartTask()
|
||||
{
|
||||
_platform = new PCPlatformSTEAM();
|
||||
}
|
||||
|
||||
public void SetParameter(string ProductId, bool isAlertAgree, bool isAlertActive)
|
||||
{
|
||||
base.Params = _platform.SetParameter(ProductId, isAlertAgree, isAlertActive);
|
||||
}
|
||||
|
||||
protected override int Parse()
|
||||
{
|
||||
int num = base.Parse();
|
||||
if (num != 1)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
if (base.ResponseData["data"].Count > 0)
|
||||
{
|
||||
_platform.Parse(base.ResponseData["data"]);
|
||||
NeedRefundWarningType = (PaymentBase.RefundWarningType)base.ResponseData["data"]["refund_penalty_type"].ToInt();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public PCPlatform getPCPlatform()
|
||||
{
|
||||
return _platform;
|
||||
}
|
||||
}
|
||||
210
SVSim.BattleEngine/Engine/Cute/SocialServiceUtility.cs
Normal file
210
SVSim.BattleEngine/Engine/Cute/SocialServiceUtility.cs
Normal file
@@ -0,0 +1,210 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Facebook.Unity;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class SocialServiceUtility : MonoBehaviour
|
||||
{
|
||||
private bool isLogin_;
|
||||
|
||||
private bool isCountTime;
|
||||
|
||||
private float timer;
|
||||
|
||||
public bool IsRunning { get; protected set; }
|
||||
|
||||
public bool IsLoggedIn
|
||||
{
|
||||
get
|
||||
{
|
||||
return isLogin_;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
isLogin_ = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string SocialServiceUserId { get; private set; }
|
||||
|
||||
public string FirebaseIdToken { get; private set; }
|
||||
|
||||
public string FaceBookAccountId { get; private set; }
|
||||
|
||||
public string FaceBookAuthenticationToken { get; private set; }
|
||||
|
||||
public bool FaceBookIsLoggedIn => FB.IsLoggedIn;
|
||||
|
||||
public static SocialServiceUtility Instance { get; private set; }
|
||||
|
||||
public static SocialServiceUtility CreateInstance()
|
||||
{
|
||||
if (null == Instance)
|
||||
{
|
||||
Instance = new GameObject(typeof(SocialServiceUtility).Name).AddComponent<SocialServiceUtility>();
|
||||
UnityEngine.Object.DontDestroyOnLoad(Instance);
|
||||
}
|
||||
return Instance;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isCountTime)
|
||||
{
|
||||
checkTimeOut();
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
}
|
||||
|
||||
private void AndroidInit()
|
||||
{
|
||||
}
|
||||
|
||||
private void FbInit()
|
||||
{
|
||||
}
|
||||
|
||||
public void FbSignIn(string nonce, Action<bool> onetimeCallback)
|
||||
{
|
||||
if (IsRunning)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (FaceBookIsLoggedIn && FaceBookAccountId != null)
|
||||
{
|
||||
if (onetimeCallback != null)
|
||||
{
|
||||
onetimeCallback(FaceBookIsLoggedIn);
|
||||
}
|
||||
return;
|
||||
}
|
||||
IsRunning = true;
|
||||
INetworkUI networkUI = Toolbox.NetworkManager.NetworkUI;
|
||||
networkUI.StartLoading();
|
||||
FB.LogInWithReadPermissions(new List<string> { "public_profile" }, delegate(ILoginResult result)
|
||||
{
|
||||
IsRunning = false;
|
||||
networkUI.StopLoading();
|
||||
if (result == null)
|
||||
{
|
||||
onetimeCallback(obj: false);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(result.Error))
|
||||
{
|
||||
onetimeCallback(obj: false);
|
||||
}
|
||||
else if (result.Cancelled)
|
||||
{
|
||||
onetimeCallback(obj: false);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(result.RawResult))
|
||||
{
|
||||
FaceBookAccountId = AccessToken.CurrentAccessToken.TokenString;
|
||||
FaceBookAuthenticationToken = "";
|
||||
onetimeCallback(obj: true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public IEnumerator SignIn(Action<bool> onetimeCallback)
|
||||
{
|
||||
if (IsRunning)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
if (IsLoggedIn && SocialServiceUserId != null)
|
||||
{
|
||||
onetimeCallback?.Invoke(IsLoggedIn);
|
||||
yield break;
|
||||
}
|
||||
IsRunning = true;
|
||||
INetworkUI networkUI = Toolbox.NetworkManager.NetworkUI;
|
||||
networkUI.StartLoading();
|
||||
StartTimeCount();
|
||||
UnitySocialPlatformSingIn(networkUI);
|
||||
while (IsRunning)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
onetimeCallback(IsLoggedIn);
|
||||
}
|
||||
|
||||
public void UnitySocialPlatformSingIn(INetworkUI networkUI)
|
||||
{
|
||||
Social.localUser.Authenticate(delegate(bool result)
|
||||
{
|
||||
if (IsRunning && !result)
|
||||
{
|
||||
IsLoggedIn = false;
|
||||
IsRunning = false;
|
||||
StopTimeCount();
|
||||
networkUI.StopLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getFirebaseIdToken(INetworkUI networkUI)
|
||||
{
|
||||
}
|
||||
|
||||
public void FbSignOut()
|
||||
{
|
||||
if (FaceBookIsLoggedIn)
|
||||
{
|
||||
FB.LogOut();
|
||||
FaceBookAccountId = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void SignOut(Action onetimeCallback = null)
|
||||
{
|
||||
if (IsLoggedIn && !IsRunning)
|
||||
{
|
||||
IsRunning = true;
|
||||
IsRunning = false;
|
||||
IsLoggedIn = false;
|
||||
onetimeCallback?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetSocialServiceName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public static int GetSocialServiceType()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void StartTimeCount()
|
||||
{
|
||||
isCountTime = true;
|
||||
}
|
||||
|
||||
public void StopTimeCount()
|
||||
{
|
||||
isCountTime = false;
|
||||
timer = 0f;
|
||||
}
|
||||
|
||||
private void checkTimeOut()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
if (timer >= 30f)
|
||||
{
|
||||
timer = 0f;
|
||||
INetworkUI networkUI = Toolbox.NetworkManager.NetworkUI;
|
||||
networkUI.StopLoading();
|
||||
StopTimeCount();
|
||||
networkUI.OpenSocialServiceNoResponseErrorPopup();
|
||||
IsRunning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
638
SVSim.BattleEngine/Engine/DeckCreateMenuUI.cs
Normal file
638
SVSim.BattleEngine/Engine/DeckCreateMenuUI.cs
Normal file
@@ -0,0 +1,638 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.DeckCardEdit;
|
||||
using Wizard.Dialog.Setting;
|
||||
|
||||
public class DeckCreateMenuUI : MonoBehaviour
|
||||
{
|
||||
private enum DeckCopyCodeType
|
||||
{
|
||||
QRCode,
|
||||
DeckCode
|
||||
}
|
||||
|
||||
public const int DECK_CODE_LENGTH_MIN = 4;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnCreateNew;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnCopy;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnDeckCode;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_btnAutoDeck;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _btnCamera;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _btnLibrary;
|
||||
|
||||
[SerializeField]
|
||||
private DeckCopyDialog _deckCopyDialogPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private DeckCopyDialog _useSubClassDeckCopyDialogPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private SubClassSelectDialog _subClassSelectDialogPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private ItemToggle _foilPreferred;
|
||||
|
||||
[SerializeField]
|
||||
private ItemToggle _isPrizePreferred;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _centerSeparatorLine;
|
||||
|
||||
private DialogBase _parentDialog;
|
||||
|
||||
private Format _format;
|
||||
|
||||
private ConventionDeckList _conventionDeckList;
|
||||
|
||||
private IFormatBehavior _formatBehavior;
|
||||
|
||||
private Action _onStartChangeViewScene;
|
||||
|
||||
private const float CENTER_SEPARATOR_LINE_OFFSET = -70f;
|
||||
|
||||
private static readonly Version ENABLE_USE_CAMERA_LIBRARY_IOS_VERSION = new Version("11.0");
|
||||
|
||||
public static void ShowDeckCreateMenu(DeckData deck, ConventionDeckList conventionDeckList, Action onStartChangeViewScene = null)
|
||||
{
|
||||
Format format = deck.Format;
|
||||
DeckCardEditUI.SetDeckEditParameter(deck, conventionDeckList);
|
||||
DeckCreateMenuUI menu = UnityEngine.Object.Instantiate(UIManager.GetInstance()._deckCreateMenuOriginal);
|
||||
UnityEngine.Object.Destroy(menu._btnCamera.gameObject);
|
||||
menu._btnLibrary.gameObject.transform.SetSiblingIndex(0);
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0108"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetPanelDepth(10);
|
||||
if (conventionDeckList == null)
|
||||
{
|
||||
menu._foilPreferred.gameObject.SetActive(value: true);
|
||||
menu._foilPreferred.SetTitleLabel("プレミアムカード優先");
|
||||
menu._foilPreferred.SetValue(Data.Load.data._userConfig.IsFoilPreferred);
|
||||
menu._foilPreferred.SetActive_SeparatorLine(isActive: true);
|
||||
menu._foilPreferred.AddChangeCallback(delegate
|
||||
{
|
||||
DeckCardEditUI.SendConfigUpdateFoilPreferred(menu._foilPreferred.GetValue());
|
||||
});
|
||||
menu._isPrizePreferred.gameObject.SetActive(value: true);
|
||||
menu._isPrizePreferred.SetTitleLabel("絵違いカード優先");
|
||||
menu._isPrizePreferred.SetValue(Data.Load.data._userConfig.IsPrizePreferred);
|
||||
menu._isPrizePreferred.SetActive_SeparatorLine(isActive: true);
|
||||
menu._isPrizePreferred.AddChangeCallback(delegate
|
||||
{
|
||||
DeckCardEditUI.SendConfigUpdatePrizePreferred(menu._isPrizePreferred.GetValue());
|
||||
});
|
||||
}
|
||||
dialogBase.SetObj(menu.gameObject);
|
||||
if (conventionDeckList != null)
|
||||
{
|
||||
Vector3 localPosition = menu.transform.localPosition;
|
||||
localPosition.y = -70f;
|
||||
menu.transform.localPosition = localPosition;
|
||||
menu._centerSeparatorLine.gameObject.SetActive(value: false);
|
||||
}
|
||||
DeckCreateMenuUI component = menu.GetComponent<DeckCreateMenuUI>();
|
||||
component.SetParentDialog(dialogBase);
|
||||
component._format = format;
|
||||
component._conventionDeckList = conventionDeckList;
|
||||
component._formatBehavior = FormatBehaviorManager.Create(format, conventionDeckList);
|
||||
component._onStartChangeViewScene = onStartChangeViewScene;
|
||||
}
|
||||
|
||||
private void OnSelectFinally()
|
||||
{
|
||||
DeckCardEditUI.CurrentDeckName = null;
|
||||
if (_parentDialog != null)
|
||||
{
|
||||
_parentDialog.CloseWithoutSelect();
|
||||
_parentDialog = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UIEventListener.Get(m_btnCreateNew.gameObject).onClick = OnClickCreateNew;
|
||||
UIEventListener.Get(m_btnCopy.gameObject).onClick = OnClickCopy;
|
||||
UIEventListener.Get(m_btnDeckCode.gameObject).onClick = OnClickDeckCode;
|
||||
UIEventListener.Get(m_btnAutoDeck.gameObject).onClick = OnClickAutoDeck;
|
||||
UIEventListener.Get(_btnCamera.gameObject).onClick = OnClickFromCamera;
|
||||
UIEventListener.Get(_btnLibrary.gameObject).onClick = OnClickFromLibrary;
|
||||
}
|
||||
|
||||
private void SetParentDialog(DialogBase dialog)
|
||||
{
|
||||
_parentDialog = dialog;
|
||||
}
|
||||
|
||||
private void OnClickCreateNew(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList());
|
||||
ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam);
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnClickCopy(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
Format format = _format;
|
||||
if (format == Format.Crossover)
|
||||
{
|
||||
format = Format.All;
|
||||
}
|
||||
DeckInfoTask task = new DeckInfoTask();
|
||||
task.SetParameterForCopySrcGet(Format.All, format);
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
DeckGroupListData deckGroupListData = task.DeckGroupListData;
|
||||
if (!_formatBehavior.UseSubClass)
|
||||
{
|
||||
deckGroupListData.RemoveUseSubClassDeckList();
|
||||
}
|
||||
if (_format != Format.MyRotation)
|
||||
{
|
||||
deckGroupListData.RemoveFormat(Format.MyRotation);
|
||||
}
|
||||
deckGroupListData.ForceVisiblePreRotation(Prerelease.Status != Prerelease.eStatus.NONE);
|
||||
Format value = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT);
|
||||
DeckSelectUIDialog.Create(Data.SystemText.Get("Card_0109"), deckGroupListData, value, DeckSelectUIDialog.eFormatChangeUIType.UseOtherCategory, isVisibleCreateNew: false, returnDeckSelect, new DeckSelectUI.InitOptions
|
||||
{
|
||||
OnUpdateDeckUICustomize = OnUpdateDeckUIForConvention
|
||||
}).SetPanelDepth(12);
|
||||
_parentDialog.Close();
|
||||
}));
|
||||
}
|
||||
|
||||
private void OnUpdateDeckUIForConvention(DeckUI deckUI)
|
||||
{
|
||||
if (_conventionDeckList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!deckUI.Deck.IsUsable(canUseNonPossessionCard: true))
|
||||
{
|
||||
deckUI.SetSelectable(isSelectable: false);
|
||||
return;
|
||||
}
|
||||
bool flag = _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckClassID());
|
||||
if (_formatBehavior.UseSubClass && _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckSubClassID()))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
deckUI.SetTextCenterLabe(Data.SystemText.Get("RoomBattle_0085"));
|
||||
deckUI.SetSelectable(isSelectable: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickDeckCode(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
DialogBase nameEditDialog = InputDialog.Create(16, 16, UIInput.KeyboardType.EmailAddress);
|
||||
nameEditDialog.InputAreaObjs.labels[2].text = Data.SystemText.Get("Card_0110");
|
||||
nameEditDialog.InputAreaObjs.labels[3].text = "";
|
||||
nameEditDialog.SetTitleLabel(Data.SystemText.Get("Card_0111"));
|
||||
if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.QuestSelectionPage))
|
||||
{
|
||||
AllLabelColorChanger.ChangeAllLabel(nameEditDialog.InputAreaObjs.gameObject);
|
||||
}
|
||||
Action method_btn = delegate
|
||||
{
|
||||
string text = nameEditDialog.InputAreaObjs.labels[0].text;
|
||||
GetDeckDataFromCodeTask getDeckDataFromCodeTask = new GetDeckDataFromCodeTask();
|
||||
getDeckDataFromCodeTask.SetParameter(text);
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(getDeckDataFromCodeTask, OnSuccessDeckCodeInfo, OnFailedDeckCodeInfo, OnFailedDeckCodeInfo, encrypt: false));
|
||||
};
|
||||
nameEditDialog.SetButtonDelegate(method_btn);
|
||||
nameEditDialog.SetPanelDepth(2000);
|
||||
nameEditDialog.SetButtonDisable(isEnableOK: true);
|
||||
UIInput deckCodeInput = nameEditDialog.GetComponentInChildren<UIInput>();
|
||||
if (deckCodeInput != null)
|
||||
{
|
||||
deckCodeInput.onChange.Add(new EventDelegate(delegate
|
||||
{
|
||||
nameEditDialog.SetButtonDisable(deckCodeInput.value.Length < 4);
|
||||
}));
|
||||
}
|
||||
_parentDialog.Close();
|
||||
}
|
||||
|
||||
private void OnClickAutoDeck(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.AUTO_DECK_CREATE))
|
||||
{
|
||||
ButtonMaintenance();
|
||||
return;
|
||||
}
|
||||
bool canUseNonPossessionCard = _conventionDeckList == null;
|
||||
DeckCardEditUI.SetCreateAutoParameter(_format, canUseNonPossessionCard);
|
||||
ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList());
|
||||
ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam);
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnClickFromCamera(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE))
|
||||
{
|
||||
ButtonMaintenance();
|
||||
return;
|
||||
}
|
||||
GameObject qrCameraObject = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefab/UI/QrCamera"));
|
||||
QrCamera qrCamera = qrCameraObject.GetComponent<QrCamera>();
|
||||
UIButton backButton = qrCamera.backButton;
|
||||
qrCamera.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo);
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
UIManager.GetInstance().StartCoroutine(qrCamera.StartQRCamera(qrCameraObject, _formatBehavior.CardMasterId, delegate
|
||||
{
|
||||
_parentDialog.Close();
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
backButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL);
|
||||
qrCamera.StopQRCamera();
|
||||
UnityEngine.Object.Destroy(qrCameraObject);
|
||||
}));
|
||||
}, delegate
|
||||
{
|
||||
qrCamera.StopQRCamera();
|
||||
UnityEngine.Object.Destroy(qrCameraObject);
|
||||
FailedToStartQRCamera();
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
_parentDialog.Close();
|
||||
}));
|
||||
}
|
||||
|
||||
private void OnClickFromLibrary(GameObject g)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE))
|
||||
{
|
||||
ButtonMaintenance();
|
||||
return;
|
||||
}
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load<GameObject>("Prefab/UI/QrCamera"));
|
||||
QrCamera component = gameObject.GetComponent<QrCamera>();
|
||||
component.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo);
|
||||
component.StartGetQRCodeFromImageFile(gameObject, _formatBehavior.CardMasterId);
|
||||
UnityEngine.Object.Destroy(gameObject);
|
||||
_parentDialog.Close();
|
||||
}
|
||||
|
||||
private void FailedToStartQRCamera()
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0270"));
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
|
||||
private void ButtonMaintenance()
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0266"));
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
}
|
||||
|
||||
private DialogBase CreateDeckCopyDialog(DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
bool flag = _formatBehavior.UseSubClass && FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass;
|
||||
if (_format == Format.MyRotation)
|
||||
{
|
||||
if (deck.Format == Format.MyRotation)
|
||||
{
|
||||
return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck);
|
||||
}
|
||||
return DeckCopyDialog.CreateDeckCopyDialogForMyRotation(_deckCopyDialogPrefab, deck);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return DeckCopyDialog.CreateDeckCopyDialogUseSubClass(_useSubClassDeckCopyDialogPrefab, deck);
|
||||
}
|
||||
return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck);
|
||||
}
|
||||
|
||||
private void returnDeckSelect(DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
DialogBase dialog = CreateDeckCopyDialog(dialogDeckList, deck);
|
||||
dialog.onPushButton1 = delegate
|
||||
{
|
||||
if (!_formatBehavior.UseSubClass)
|
||||
{
|
||||
OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
|
||||
}
|
||||
else if (FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS))
|
||||
{
|
||||
OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnSelectSubClassFromDeckCopy(dialog, dialogDeckList, deck);
|
||||
}
|
||||
};
|
||||
dialog.SetPanelDepth(100);
|
||||
}
|
||||
|
||||
private void OnSelectSubClassFromDeckCopy(DialogBase dialog, DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
dialog.Close();
|
||||
SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId)
|
||||
{
|
||||
deck.SetDeckSubClassID(classId);
|
||||
OnChangeViewSceneFromDeckCopy(dialogDeckList, deck);
|
||||
});
|
||||
}
|
||||
|
||||
private void OnChangeViewSceneFromDeckCopy(DialogBase dialogDeckList, DeckData deck)
|
||||
{
|
||||
bool isCopySubClass = FormatBehaviorManager.Create(deck.Format, _conventionDeckList).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS);
|
||||
MyRotationInfo myRotationInfo = null;
|
||||
if (_format == Format.MyRotation)
|
||||
{
|
||||
myRotationInfo = ((deck.Format != Format.MyRotation) ? deck.GetMyRotationInfoFromCardList() : Data.MyRotationAllInfo.Get(deck.MyRotationId));
|
||||
}
|
||||
DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: false, isCopySubClass, _conventionDeckList, myRotationInfo);
|
||||
dialogDeckList.CloseWithoutSelect();
|
||||
ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnSuccessDeckCodeInfo(NetworkTask.ResultCode errorcode)
|
||||
{
|
||||
OnSuccessCodeDeckInfo(DeckCopyCodeType.DeckCode);
|
||||
}
|
||||
|
||||
private void OnSuccessQRCodeDeckInfo()
|
||||
{
|
||||
OnSuccessCodeDeckInfo(DeckCopyCodeType.QRCode);
|
||||
}
|
||||
|
||||
private void OnSuccessCodeDeckInfo(DeckCopyCodeType copyCodeType)
|
||||
{
|
||||
bool flag = false;
|
||||
SetCodeCopyDeckParam(copyCodeType, out var clanId, out var subClanId, out var isSubClassSet, out var cardIds, out var myRotationInfo);
|
||||
if (_conventionDeckList != null)
|
||||
{
|
||||
List<int> conventionDeckClassList = _conventionDeckList.GetConventionDeckClassList();
|
||||
for (int i = 0; i < conventionDeckClassList.Count; i++)
|
||||
{
|
||||
if (conventionDeckClassList[i] == clanId)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_formatBehavior.UseSubClass)
|
||||
{
|
||||
for (int j = 0; j < conventionDeckClassList.Count; j++)
|
||||
{
|
||||
if (conventionDeckClassList[j] == subClanId)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isDeckcodeIncludingNonExistentCard(cardIds))
|
||||
{
|
||||
string title = Data.SystemText.Get("Card_0196");
|
||||
string text = Data.SystemText.Get("Card_0197");
|
||||
CreateErrorDialog(title, text).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else if (flag)
|
||||
{
|
||||
string title2 = Data.SystemText.Get("ErrorHeader_10002");
|
||||
string text2 = Data.SystemText.Get("Arena_0067");
|
||||
if (_formatBehavior.UseSubClass)
|
||||
{
|
||||
text2 = Data.SystemText.Get("Arena_0141");
|
||||
}
|
||||
CreateErrorDialog(title2, text2).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else if (!_formatBehavior.UseSubClass && isSubClassSet)
|
||||
{
|
||||
string title3 = Data.SystemText.Get("Card_0196");
|
||||
string text3 = "";
|
||||
switch (copyCodeType)
|
||||
{
|
||||
case DeckCopyCodeType.QRCode:
|
||||
text3 = Data.SystemText.Get("Card_0285");
|
||||
break;
|
||||
case DeckCopyCodeType.DeckCode:
|
||||
text3 = Data.SystemText.Get("Card_0295");
|
||||
break;
|
||||
}
|
||||
CreateErrorDialog(title3, text3).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else if (myRotationInfo != null && _format != Format.MyRotation)
|
||||
{
|
||||
string title4 = Data.SystemText.Get("Card_0196");
|
||||
string text4 = "";
|
||||
switch (copyCodeType)
|
||||
{
|
||||
case DeckCopyCodeType.QRCode:
|
||||
text4 = Data.SystemText.Get("MyRotation_ID_17");
|
||||
break;
|
||||
case DeckCopyCodeType.DeckCode:
|
||||
text4 = Data.SystemText.Get("MyRotation_ID_18");
|
||||
break;
|
||||
}
|
||||
CreateErrorDialog(title4, text4).OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
DeckData deck = CreateDeckFromCopyCode(clanId, subClanId, isSubClassSet, cardIds, myRotationInfo);
|
||||
if (_formatBehavior.UseSubClass && !isSubClassSet)
|
||||
{
|
||||
OnCreateDeckFromCodeSelectSubClass(deck);
|
||||
}
|
||||
else
|
||||
{
|
||||
OnCreateDeckFromCode(deck);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCodeCopyDeckParam(DeckCopyCodeType deckCopyCodeTypeout, out int clanId, out int subClanId, out bool isSubClassSet, out int[] cardIds, out MyRotationInfo myRotationInfo)
|
||||
{
|
||||
clanId = 10;
|
||||
subClanId = 10;
|
||||
isSubClassSet = false;
|
||||
cardIds = null;
|
||||
myRotationInfo = null;
|
||||
switch (deckCopyCodeTypeout)
|
||||
{
|
||||
case DeckCopyCodeType.QRCode:
|
||||
clanId = (int)QRCodeUtility.deckDataFromQRCode.ClanId;
|
||||
subClanId = (int)QRCodeUtility.deckDataFromQRCode.SubClanId;
|
||||
isSubClassSet = QRCodeUtility.deckDataFromQRCode.IsSubClassSet;
|
||||
cardIds = QRCodeUtility.deckDataFromQRCode.CardIds;
|
||||
myRotationInfo = QRCodeUtility.deckDataFromQRCode.MyRotationInfo;
|
||||
break;
|
||||
case DeckCopyCodeType.DeckCode:
|
||||
clanId = Data.DeckDataFromDeckCode.ClanId;
|
||||
subClanId = Data.DeckDataFromDeckCode.SubClanId;
|
||||
isSubClassSet = Data.DeckDataFromDeckCode.IsSubClanSet;
|
||||
cardIds = Data.DeckDataFromDeckCode.CardIds;
|
||||
if (Data.DeckDataFromDeckCode.MyRotationId != null)
|
||||
{
|
||||
myRotationInfo = Data.MyRotationAllInfo.Get(Data.DeckDataFromDeckCode.MyRotationId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private DeckData CreateDeckFromCopyCode(int clanId, int subClanId, bool isSubClassSet, int[] cardIds, MyRotationInfo myRotationInfo)
|
||||
{
|
||||
DeckData deckData = new DeckData(_format);
|
||||
deckData.SetDeckClassID(clanId);
|
||||
if (isSubClassSet)
|
||||
{
|
||||
deckData.SetDeckSubClassID(subClanId);
|
||||
}
|
||||
deckData.SetDeckName("");
|
||||
deckData.SetDeckSleeveID(3000011L);
|
||||
deckData.SetDeckIsComplete(isComplete: true);
|
||||
deckData.SetCardIdList(cardIds.ToList());
|
||||
if (myRotationInfo != null)
|
||||
{
|
||||
deckData.MyRotationId = myRotationInfo.Id;
|
||||
}
|
||||
return deckData;
|
||||
}
|
||||
|
||||
private DialogBase CreateErrorDialog(string title, string text)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetTitleLabel(title);
|
||||
dialogBase.SetText(text);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
return dialogBase;
|
||||
}
|
||||
|
||||
private void OnFailedQRCodeDeckInfo(string message)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(message);
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.OnClose = delegate
|
||||
{
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
|
||||
private void OnCreateDeckFromCode(DeckData deck)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetPanelDepth(2000);
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0142"));
|
||||
dialogBase.SetText(Data.SystemText.Get("Card_0115"));
|
||||
if (_format == Format.MyRotation && Data.MyRotationAllInfo.Get(deck.MyRotationId) == null)
|
||||
{
|
||||
MyRotationInfo myRotationInfoFromCardList = deck.GetMyRotationInfoFromCardList();
|
||||
deck.MyRotationId = myRotationInfoFromCardList.Id;
|
||||
}
|
||||
dialogBase.OnCloseStart = delegate
|
||||
{
|
||||
DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: true, _conventionDeckList);
|
||||
ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
|
||||
OnSelectFinally();
|
||||
};
|
||||
}
|
||||
|
||||
private void OnCreateDeckFromCodeSelectSubClass(DeckData deck)
|
||||
{
|
||||
SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId)
|
||||
{
|
||||
deck.SetDeckSubClassID(classId);
|
||||
DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: false, _conventionDeckList);
|
||||
ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null);
|
||||
OnSelectFinally();
|
||||
});
|
||||
}
|
||||
|
||||
private bool isDeckcodeIncludingNonExistentCard(int[] targetDeckCardIds)
|
||||
{
|
||||
List<int> allCardIds = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetAllCardIds();
|
||||
int num = targetDeckCardIds.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
int item = targetDeckCardIds[i];
|
||||
if (!allCardIds.Contains(item))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnFailedDeckCodeInfo(NetworkTask.ResultCode errorcode)
|
||||
{
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private void OnFailedDeckCodeInfo(int errorcode)
|
||||
{
|
||||
OnSelectFinally();
|
||||
}
|
||||
|
||||
private List<int> GetConventionUsedClassIdList()
|
||||
{
|
||||
List<int> result = new List<int>();
|
||||
if (_conventionDeckList == null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
return _conventionDeckList.GetConventionDeckClassList();
|
||||
}
|
||||
|
||||
private void ChangeViewScene(UIManager.ViewScene viewScene, object sceneParam)
|
||||
{
|
||||
_onStartChangeViewScene.Call();
|
||||
if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Battle))
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().BattleEnd(viewScene, null, null, sceneParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.GetInstance().ChangeViewScene(viewScene, null, sceneParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
10
SVSim.BattleEngine/Engine/DeckFrame.cs
Normal file
10
SVSim.BattleEngine/Engine/DeckFrame.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class DeckFrame
|
||||
{
|
||||
public int DeckId { get; set; }
|
||||
|
||||
public Transform Transform { get; set; }
|
||||
|
||||
public Vector3 TweenTargetPosition { get; set; }
|
||||
}
|
||||
552
SVSim.BattleEngine/Engine/DeckIntroduction.cs
Normal file
552
SVSim.BattleEngine/Engine/DeckIntroduction.cs
Normal file
@@ -0,0 +1,552 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.UI.Common;
|
||||
using Wizard.UI.Profile;
|
||||
|
||||
public class DeckIntroduction : MonoBehaviour
|
||||
{
|
||||
private const int MAX_WIDTH_ANNOTATION_LABEL = 210;
|
||||
|
||||
private const Format DEFAULT_FORMAT = Format.Rotation;
|
||||
|
||||
private static readonly Vector2 FORMAT_CHANGE_UI_POSITION = new Vector2(-466f, 246f);
|
||||
|
||||
private static readonly Dictionary<Format, FormatChangeUI.FormatCategory> FORMAT_TO_FORMAT_CATEGORY = new Dictionary<Format, FormatChangeUI.FormatCategory>
|
||||
{
|
||||
{
|
||||
Format.Rotation,
|
||||
FormatChangeUI.FormatCategory.Rotation
|
||||
},
|
||||
{
|
||||
Format.Unlimited,
|
||||
FormatChangeUI.FormatCategory.Unlimited
|
||||
},
|
||||
{
|
||||
Format.Crossover,
|
||||
FormatChangeUI.FormatCategory.Crossover
|
||||
}
|
||||
};
|
||||
|
||||
[SerializeField]
|
||||
private TabList _tabList;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _classIcon;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _classCharaTexture;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _className;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _classBG;
|
||||
|
||||
private Format _formatState;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelAnnotation;
|
||||
|
||||
private UIAtlas _classIconAtlas;
|
||||
|
||||
private List<string> _resourceList = new List<string>();
|
||||
|
||||
private List<string> _loadTopCardAssetList = new List<string>();
|
||||
|
||||
private List<string> _loadCardAssetList;
|
||||
|
||||
private List<DeckIntroductionItem> _deckIntroductionItem = new List<DeckIntroductionItem>();
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _dialogAttachRoot;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _deckViewPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _cardDetailPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _introductionItemPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private UIGrid _deckListGrid;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollView _scrollView;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _confirmLabelForRotation;
|
||||
|
||||
private DialogBase _dialog;
|
||||
|
||||
private DeckIntroductionTask _introductionTask;
|
||||
|
||||
private GameObject _deckViewObj;
|
||||
|
||||
private UICardList _cardList;
|
||||
|
||||
private GameObject _cardDetailObj;
|
||||
|
||||
private CardDetailUI _cardDetail;
|
||||
|
||||
private CardBasePrm.ClanType _classType = CardBasePrm.ClanType.NONE;
|
||||
|
||||
private bool _isUpdateDeckList = true;
|
||||
|
||||
private FormatChangeUI _formatChangeUI;
|
||||
|
||||
private Vector3 _anotationLabelDefaultPosition;
|
||||
|
||||
private int _seriesId;
|
||||
|
||||
public const int LATEST_SERIES_ID = -1;
|
||||
|
||||
public static void Create(GameObject prefab, GameObject parent, int seriesId = -1, Format format = Format.Max)
|
||||
{
|
||||
GameObject obj = NGUITools.AddChild(parent, prefab);
|
||||
DeckIntroduction component = obj.GetComponent<DeckIntroduction>();
|
||||
component.SetSeriesId(seriesId);
|
||||
component._formatState = format;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.AddButton(DialogBase.ButtonType.Gray, isReflect: false, Data.SystemText.Get("OtherTop_0065"));
|
||||
dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE;
|
||||
dialogBase.isNotCloseWindowButton1 = true;
|
||||
dialogBase.onPushButton1 = component.CreateSelectSeriesIdDialog;
|
||||
dialogBase.AddButton(DialogBase.ButtonType.Close);
|
||||
dialogBase.TitleOnOff(flag: false);
|
||||
dialogBase.CloseOnOff(flag: false);
|
||||
dialogBase.SetSize(DialogBase.Size.XL);
|
||||
dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate
|
||||
{
|
||||
UnityEngine.Object.Destroy(obj);
|
||||
});
|
||||
dialogBase.SetObj(component._dialogAttachRoot);
|
||||
component._dialog = dialogBase;
|
||||
dialogBase.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
private void SetSeriesId(int seriesId)
|
||||
{
|
||||
_seriesId = seriesId;
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
_anotationLabelDefaultPosition = _labelAnnotation.transform.localPosition;
|
||||
yield return LoadAtlas();
|
||||
yield return StartCoroutine(StartDeckIntroductionTask());
|
||||
SetSeriesId(_introductionTask.DisplaySeriesId);
|
||||
yield return LoadResource();
|
||||
_dialog.gameObject.SetActive(value: true);
|
||||
if (_formatState == Format.Max)
|
||||
{
|
||||
_formatState = _introductionTask.DisplayFormat;
|
||||
}
|
||||
InitFormatBtn(_formatState);
|
||||
InitClassTab(_introductionTask);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
ReleaseResource();
|
||||
}
|
||||
|
||||
private IEnumerator StartDeckIntroductionTask()
|
||||
{
|
||||
_introductionTask = new DeckIntroductionTask();
|
||||
if (_seriesId != -1)
|
||||
{
|
||||
_introductionTask.SetParameter(_seriesId);
|
||||
}
|
||||
bool isSuccess = false;
|
||||
yield return StartCoroutine(Toolbox.NetworkManager.Connect(_introductionTask, delegate
|
||||
{
|
||||
isSuccess = true;
|
||||
}));
|
||||
while (!isSuccess)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReleaseResource()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_resourceList);
|
||||
_resourceList.Clear();
|
||||
RemoveTopCardResource();
|
||||
}
|
||||
|
||||
private IEnumerator LoadAtlas()
|
||||
{
|
||||
string sceneAssetPath = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null);
|
||||
_resourceList.Add(sceneAssetPath);
|
||||
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(sceneAssetPath, null));
|
||||
sceneAssetPath = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null, isload: true);
|
||||
_classIconAtlas = Toolbox.ResourcesManager.LoadObject<GameObject>(sceneAssetPath).GetComponent<UIAtlas>();
|
||||
}
|
||||
|
||||
private static string GetClassBGPath(CardBasePrm.ClanType classType, bool isFetch)
|
||||
{
|
||||
int num = (int)classType;
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath("bg_deck_info_" + num.ToString("00"), ResourcesManager.AssetLoadPathType.Background, isFetch);
|
||||
}
|
||||
|
||||
private string GetClassCharaPath(CardBasePrm.ClanType classType, bool isFetch)
|
||||
{
|
||||
string charaTexName = ClassPage.GetCharaTexName(GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId((int)classType, isCurrentChara: false)
|
||||
.skin_id);
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath(charaTexName, ResourcesManager.AssetLoadPathType.ClassCharaProfile, isFetch);
|
||||
}
|
||||
|
||||
private IEnumerator LoadResource()
|
||||
{
|
||||
List<string> loadList = new List<string>();
|
||||
int num = 9;
|
||||
for (int i = 1; i < num; i++)
|
||||
{
|
||||
loadList.Add(GetClassCharaPath((CardBasePrm.ClanType)i, isFetch: false));
|
||||
loadList.Add(GetClassBGPath((CardBasePrm.ClanType)i, isFetch: false));
|
||||
}
|
||||
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null));
|
||||
_resourceList.AddRange(loadList);
|
||||
}
|
||||
|
||||
private IEnumerator LoadTopCardResource(CardBasePrm.ClanType classType, Action<CardBasePrm.ClanType> onFinish)
|
||||
{
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
List<string> tempLoadList = new List<string>(_loadTopCardAssetList);
|
||||
_loadTopCardAssetList.Clear();
|
||||
for (int i = 0; i < _introductionTask._result.Count; i++)
|
||||
{
|
||||
DeckIntroductionTask.IntroductionData introductionData = _introductionTask._result[i];
|
||||
string cardMaterialPath = DeckIntroductionItem.GetCardMaterialPath(introductionData.TopCardId);
|
||||
if (introductionData.Deck.Format == _formatState && introductionData.Deck.GetDeckClassID() == (int)classType && !_loadTopCardAssetList.Contains(cardMaterialPath))
|
||||
{
|
||||
_loadTopCardAssetList.Add(cardMaterialPath);
|
||||
}
|
||||
}
|
||||
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadTopCardAssetList, null));
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(tempLoadList);
|
||||
onFinish.Call(classType);
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
|
||||
private void RemoveTopCardResource()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadTopCardAssetList);
|
||||
_loadTopCardAssetList.Clear();
|
||||
}
|
||||
|
||||
private void InitClassTab(DeckIntroductionTask task)
|
||||
{
|
||||
_classIcon.atlas = _classIconAtlas;
|
||||
int num = 9;
|
||||
CardBasePrm.ClanType clanType = CardBasePrm.ClanType.NONE;
|
||||
for (int i = 1; i < num; i++)
|
||||
{
|
||||
CardBasePrm.ClanType classType = (CardBasePrm.ClanType)i;
|
||||
Tab tab = _tabList.AddTab(delegate
|
||||
{
|
||||
ChangePage(classType);
|
||||
}, "class_tab_" + i.ToString("00"));
|
||||
if (task.IsExistClass(classType, _formatState))
|
||||
{
|
||||
if (clanType == CardBasePrm.ClanType.NONE)
|
||||
{
|
||||
clanType = classType;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tabList.SetTabToGrayByIndex(i - 1, disable: true);
|
||||
}
|
||||
tab.name = "Class_" + i + "(Clone)";
|
||||
}
|
||||
_tabList.Reset();
|
||||
_tabList.SelectTabByIndex((int)(clanType - 1), isForceSet: true);
|
||||
}
|
||||
|
||||
private bool NeedResurgentConfirmLabel()
|
||||
{
|
||||
if ((_seriesId == 34 || _seriesId == 33 || _seriesId == 9) && _formatState == Format.Rotation)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ChangePage(CardBasePrm.ClanType classType)
|
||||
{
|
||||
if (_classType == classType && !_isUpdateDeckList)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_classType = classType;
|
||||
_isUpdateDeckList = false;
|
||||
ClassCharacterMasterData charaPrmByClassId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId((int)classType, isCurrentChara: false);
|
||||
_className.text = charaPrmByClassId._className;
|
||||
ClassCharaPrm.SetClassLabelSetting(_className, classType);
|
||||
_classCharaTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(GetClassCharaPath(classType, isFetch: true)) as Texture;
|
||||
_classBG.mainTexture = Toolbox.ResourcesManager.LoadObject(GetClassBGPath(classType, isFetch: true)) as Texture;
|
||||
_confirmLabelForRotation.SetActive(NeedResurgentConfirmLabel());
|
||||
_labelAnnotation.transform.localPosition = _anotationLabelDefaultPosition;
|
||||
string value;
|
||||
if (IsNotCopyToUnlimited(classType) && _formatState == Format.Rotation)
|
||||
{
|
||||
_labelAnnotation.gameObject.SetActive(value: false);
|
||||
}
|
||||
else if (_introductionTask.AlternativeFormatAndSeries != null && _introductionTask.AlternativeFormatAndSeries.TryGetValue(_formatState, out value))
|
||||
{
|
||||
_labelAnnotation.gameObject.SetActive(value: true);
|
||||
SetAnnotationText(value);
|
||||
if (NeedResurgentConfirmLabel())
|
||||
{
|
||||
_labelAnnotation.transform.localPosition = new Vector3(_anotationLabelDefaultPosition.x, 209f, _anotationLabelDefaultPosition.z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_labelAnnotation.gameObject.SetActive(value: false);
|
||||
}
|
||||
StartCoroutine(LoadTopCardResource(classType, InitDeckList));
|
||||
}
|
||||
|
||||
private bool IsNotCopyToUnlimited(CardBasePrm.ClanType classType)
|
||||
{
|
||||
for (int i = 0; i < _introductionTask._result.Count; i++)
|
||||
{
|
||||
DeckData deck = _introductionTask._result[i].Deck;
|
||||
if (deck.HasResurgentCard() && deck.IsOutOfRotationFormat && deck.GetDeckClassID() == (int)classType)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void InitDeckList(CardBasePrm.ClanType classType)
|
||||
{
|
||||
for (int i = 0; i < _deckIntroductionItem.Count; i++)
|
||||
{
|
||||
_deckIntroductionItem[i].gameObject.SetActive(value: false);
|
||||
}
|
||||
List<DeckIntroductionTask.IntroductionData> list = new List<DeckIntroductionTask.IntroductionData>();
|
||||
for (int j = 0; j < _introductionTask._result.Count; j++)
|
||||
{
|
||||
DeckIntroductionTask.IntroductionData introductionData = _introductionTask._result[j];
|
||||
if (introductionData.Deck.GetDeckClassID() == (int)classType && introductionData.Deck.Format == _formatState)
|
||||
{
|
||||
list.Add(introductionData);
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < list.Count; k++)
|
||||
{
|
||||
DeckIntroductionItem deckIntroductionItem = null;
|
||||
if (k < _deckIntroductionItem.Count)
|
||||
{
|
||||
deckIntroductionItem = _deckIntroductionItem[k];
|
||||
deckIntroductionItem.gameObject.SetActive(value: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
deckIntroductionItem = NGUITools.AddChild(_deckListGrid.gameObject, _introductionItemPrefab).GetComponent<DeckIntroductionItem>();
|
||||
_deckIntroductionItem.Add(deckIntroductionItem);
|
||||
}
|
||||
deckIntroductionItem.Initialize(list[k]);
|
||||
deckIntroductionItem.OnClick = delegate(DeckIntroductionTask.IntroductionData data)
|
||||
{
|
||||
OnClickDeck(data);
|
||||
};
|
||||
}
|
||||
_deckListGrid.Reposition();
|
||||
_scrollView.ResetPosition();
|
||||
}
|
||||
|
||||
private void InitFormatBtn(Format format)
|
||||
{
|
||||
_formatState = format;
|
||||
FormatChangeUI.FormatCategory defaultFormatCategory = FORMAT_TO_FORMAT_CATEGORY[_formatState];
|
||||
FormatChangeUI.FormatCategory anotherFormatCategory = (_introductionTask.IsExistFormat(Format.Crossover) ? FORMAT_TO_FORMAT_CATEGORY[Format.Crossover] : FormatChangeUI.FormatCategory.Invalid);
|
||||
_formatChangeUI = FormatChangeUI.Create(defaultFormatCategory, anotherFormatCategory, OnClickFormatBtn);
|
||||
_formatChangeUI.ShowOldRotationIcon();
|
||||
_dialog.SetObj(_formatChangeUI.gameObject, FORMAT_CHANGE_UI_POSITION);
|
||||
}
|
||||
|
||||
private void SetAnnotationText(string serieasName)
|
||||
{
|
||||
_labelAnnotation.overflowMethod = UILabel.Overflow.ResizeFreely;
|
||||
_labelAnnotation.text = Data.SystemText.Get("OtherTop_0068", serieasName);
|
||||
_labelAnnotation.ProcessText();
|
||||
if (_labelAnnotation.width > 210)
|
||||
{
|
||||
_labelAnnotation.overflowMethod = UILabel.Overflow.ShrinkContent;
|
||||
_labelAnnotation.width = 210;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickDeck(DeckIntroductionTask.IntroductionData data)
|
||||
{
|
||||
ShowDeckView(data.Deck);
|
||||
}
|
||||
|
||||
private void ShowDeckView(DeckData deck)
|
||||
{
|
||||
string text = "Detail";
|
||||
if (_cardDetailObj == null)
|
||||
{
|
||||
_cardDetailObj = NGUITools.AddChild(base.gameObject, _cardDetailPrefab);
|
||||
_cardDetail = _cardDetailObj.GetComponent<CardDetailUI>();
|
||||
_cardDetail.Initialize(LayerMask.NameToLayer(text), CardMaster.CardMasterId.Default);
|
||||
_cardDetailObj.SetActive(value: false);
|
||||
}
|
||||
if (_deckViewObj == null)
|
||||
{
|
||||
_deckViewObj = UnityEngine.Object.Instantiate(_deckViewPrefab);
|
||||
_cardList = _deckViewObj.GetComponent<UICardList>();
|
||||
_cardList.Init(base.gameObject, _cardDetail, null, OnCloseDeckView, text, in_DetailCameraUse: true, null, 40);
|
||||
_deckViewObj.SetActive(value: false);
|
||||
}
|
||||
_scrollView.DisableSpring();
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
StartCoroutine(CardLoadCoroutine(deck));
|
||||
}
|
||||
|
||||
private IEnumerator CardLoadCoroutine(DeckData deck)
|
||||
{
|
||||
IList<int> cardIdList = deck.GetCardIdList();
|
||||
_cardList.RemoveData();
|
||||
_loadCardAssetList = _cardList.GetLoadFileList(cardIdList as List<int>);
|
||||
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadCardAssetList, null));
|
||||
_cardList.IsEnableMyRotationDisplay = false;
|
||||
_cardList.IsConventionDeckIntroduction = true;
|
||||
_cardList.SetDeck(deck, null);
|
||||
if (deck.Format == Format.Rotation)
|
||||
{
|
||||
_cardList.SetFormatIcon("icon_rotation_s");
|
||||
}
|
||||
_cardList.UpdateShortageRedEther();
|
||||
_cardList.SetShortageCardVisible(_cardList.IsEnableShortageCardVisible);
|
||||
_cardList.SetActiveDeckIntroductionObj(isActive: true);
|
||||
yield return null;
|
||||
_dialog.SetDisp(inDisp: false);
|
||||
_deckViewObj.SetActive(value: true);
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
|
||||
private void OnCloseDeckView()
|
||||
{
|
||||
_dialog.SetDisp(inDisp: true);
|
||||
_deckViewObj.SetActive(value: false);
|
||||
_scrollView.UpdatePosition();
|
||||
if (_loadCardAssetList != null)
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList);
|
||||
_loadCardAssetList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateSelectSeriesIdDialog()
|
||||
{
|
||||
int prevSeriesId = _seriesId;
|
||||
List<int> seriesIdList = _introductionTask.ResultDeckSeriesIdList;
|
||||
_ = _introductionTask.ResultDeckSeriesNameList;
|
||||
seriesIdList.IndexOf(_seriesId);
|
||||
DialogBase dialogBase = DeckIntroductionPeriodSelectDialog.Create(_seriesId, _introductionTask, delegate(int newId)
|
||||
{
|
||||
_seriesId = newId;
|
||||
});
|
||||
int num = _dialogAttachRoot.GetComponentInChildren<UIPanel>().depth + 5;
|
||||
dialogBase.SetPanelDepth(num);
|
||||
dialogBase.InsideObject.GetComponent<UIPanel>().depth = num + 1;
|
||||
UIPanel[] componentsInChildren = dialogBase.InsideObject.GetComponentsInChildren<UIPanel>();
|
||||
for (int num2 = 0; num2 < componentsInChildren.Length; num2++)
|
||||
{
|
||||
componentsInChildren[num2].depth += num + 2;
|
||||
}
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("OtherTop_0066"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn);
|
||||
dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE;
|
||||
dialogBase.onPushButton1 = delegate
|
||||
{
|
||||
if (_seriesId != prevSeriesId)
|
||||
{
|
||||
StartCoroutine(ChangeDeckIntroductionSeries());
|
||||
}
|
||||
};
|
||||
dialogBase.onCloseWithoutSelect = delegate
|
||||
{
|
||||
_seriesId = prevSeriesId;
|
||||
};
|
||||
}
|
||||
|
||||
private IEnumerator ChangeDeckIntroductionSeries()
|
||||
{
|
||||
yield return StartCoroutine(StartDeckIntroductionTask());
|
||||
UpdateFormatChangeUI();
|
||||
UpdateClassTab();
|
||||
}
|
||||
|
||||
private void UpdateClassTab()
|
||||
{
|
||||
_isUpdateDeckList = true;
|
||||
CardBasePrm.ClanType clanType = CardBasePrm.ClanType.NONE;
|
||||
for (int i = 1; i < 9; i++)
|
||||
{
|
||||
CardBasePrm.ClanType clanType2 = (CardBasePrm.ClanType)i;
|
||||
if (_introductionTask.IsExistClass(clanType2, _formatState))
|
||||
{
|
||||
if (clanType == CardBasePrm.ClanType.NONE)
|
||||
{
|
||||
clanType = clanType2;
|
||||
}
|
||||
_tabList.SetTabToGrayByIndex(i - 1, disable: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_tabList.SetTabToGrayByIndex(i - 1, disable: true);
|
||||
}
|
||||
}
|
||||
_tabList.Reset();
|
||||
_tabList.SelectTabByIndex((int)(clanType - 1), isForceSet: true);
|
||||
}
|
||||
|
||||
private void OnClickFormatBtn(FormatChangeUI.FormatCategory formatCategory)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON);
|
||||
Format key = FORMAT_TO_FORMAT_CATEGORY.First((KeyValuePair<Format, FormatChangeUI.FormatCategory> data) => data.Value == formatCategory).Key;
|
||||
if (_formatState != key)
|
||||
{
|
||||
_formatState = key;
|
||||
UpdateClassTab();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFormatChangeUI()
|
||||
{
|
||||
bool flag = _introductionTask.IsExistFormat(Format.Rotation);
|
||||
bool flag2 = _introductionTask.IsExistFormat(Format.Unlimited);
|
||||
bool flag3 = _introductionTask.IsExistFormat(Format.Crossover);
|
||||
_formatChangeUI.SetEnableFormatButton(FORMAT_TO_FORMAT_CATEGORY[Format.Rotation], flag);
|
||||
_formatChangeUI.SetEnableFormatButton(FORMAT_TO_FORMAT_CATEGORY[Format.Unlimited], flag2);
|
||||
_formatChangeUI.UpdateAnotherFormatButton(flag3 ? FORMAT_TO_FORMAT_CATEGORY[Format.Crossover] : FormatChangeUI.FormatCategory.Invalid);
|
||||
if (_formatState == Format.Crossover && !flag3)
|
||||
{
|
||||
_formatState = Format.Rotation;
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
_formatState = Format.Unlimited;
|
||||
}
|
||||
else if (!flag2)
|
||||
{
|
||||
_formatState = Format.Rotation;
|
||||
}
|
||||
_formatChangeUI.ChangeFormat(FORMAT_TO_FORMAT_CATEGORY[_formatState]);
|
||||
}
|
||||
}
|
||||
147
SVSim.BattleEngine/Engine/DeckIntroductionCopyDialog.cs
Normal file
147
SVSim.BattleEngine/Engine/DeckIntroductionCopyDialog.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.DeckCardEdit;
|
||||
using Wizard.Dialog.Setting;
|
||||
|
||||
public class DeckIntroductionCopyDialog : MonoBehaviour
|
||||
{
|
||||
private const float GRID_Y_WITH_MY_ROTATION = -15f;
|
||||
|
||||
private const float HINT_Y_WITH_MY_ROTATION = 53f;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelCopyConfirm;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelHint;
|
||||
|
||||
[SerializeField]
|
||||
private ItemToggle _copyToMyRotation;
|
||||
|
||||
[SerializeField]
|
||||
private ItemToggle _premium;
|
||||
|
||||
[SerializeField]
|
||||
private ItemToggle _prize;
|
||||
|
||||
[SerializeField]
|
||||
private UIGrid _grid;
|
||||
|
||||
public bool IsMyRotationDeck;
|
||||
|
||||
public bool IsResurgentToMyRotationDeck;
|
||||
|
||||
private bool _isRotationPeriod;
|
||||
|
||||
public bool IsCopyToMyRotation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!IsMyRotationDeck)
|
||||
{
|
||||
if (DisplayCopyToMyRotation)
|
||||
{
|
||||
return _copyToMyRotation.GetValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public string LabelCopyConfirm
|
||||
{
|
||||
set
|
||||
{
|
||||
_labelCopyConfirm.text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string LabelHint
|
||||
{
|
||||
set
|
||||
{
|
||||
_labelHint.text = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool DisplayCopyToMyRotation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Data.MyRotationAllInfo.IsWithinCopyDeckIntroductionPeriod && !IsMyRotationDeck)
|
||||
{
|
||||
return !IsDisableMyRotation;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDisableMyRotation { get; set; }
|
||||
|
||||
private KeyValuePair<string, int> MyRotationSaveDataKey
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_isRotationPeriod)
|
||||
{
|
||||
return PlayerPrefsWrapper.DECK_INTRO_IS_MYROTATION_COPY_NOT_EQUAL_PERIOD;
|
||||
}
|
||||
return PlayerPrefsWrapper.DECK_INTRO_IS_MYROTATION_COPY_EQUAL_PERIOD;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(bool isRotationPeriod)
|
||||
{
|
||||
_isRotationPeriod = isRotationPeriod;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (IsResurgentToMyRotationDeck)
|
||||
{
|
||||
_copyToMyRotation.gameObject.SetActive(value: false);
|
||||
_copyToMyRotation.SetValue(value: false);
|
||||
_copyToMyRotation.SetActive_SeparatorLine(isActive: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_copyToMyRotation.gameObject.SetActive(DisplayCopyToMyRotation);
|
||||
_copyToMyRotation.SetValue(DisplayCopyToMyRotation);
|
||||
_copyToMyRotation.SetActive_SeparatorLine(isActive: true);
|
||||
_copyToMyRotation.SetValue(PlayerPrefsWrapper.GetBool(MyRotationSaveDataKey));
|
||||
_copyToMyRotation.AddChangeCallback(delegate
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(MyRotationSaveDataKey, _copyToMyRotation.GetValue() ? 1 : 0);
|
||||
});
|
||||
if (DisplayCopyToMyRotation)
|
||||
{
|
||||
ChangeY(_grid.transform, -15f);
|
||||
ChangeY(_labelHint.transform, 53f);
|
||||
}
|
||||
}
|
||||
ItemToggle itemPremium = _premium;
|
||||
itemPremium.SetValue(Data.Load.data._userConfig.IsFoilPreferred);
|
||||
itemPremium.AddChangeCallback(delegate
|
||||
{
|
||||
DeckCardEditUI.SendConfigUpdateFoilPreferred(itemPremium.GetValue());
|
||||
});
|
||||
itemPremium.SetActive_SeparatorLine(isActive: true);
|
||||
ItemToggle itemPrize = _prize;
|
||||
itemPrize.SetValue(Data.Load.data._userConfig.IsPrizePreferred);
|
||||
itemPrize.AddChangeCallback(delegate
|
||||
{
|
||||
DeckCardEditUI.SendConfigUpdatePrizePreferred(itemPrize.GetValue());
|
||||
});
|
||||
itemPrize.SetActive_SeparatorLine(isActive: true);
|
||||
_grid.Reposition();
|
||||
}
|
||||
|
||||
private static void ChangeY(Transform trans, float y)
|
||||
{
|
||||
Vector3 localPosition = trans.localPosition;
|
||||
localPosition.y = y;
|
||||
trans.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
172
SVSim.BattleEngine/Engine/DeckIntroductionItem.cs
Normal file
172
SVSim.BattleEngine/Engine/DeckIntroductionItem.cs
Normal file
@@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class DeckIntroductionItem : MonoBehaviour
|
||||
{
|
||||
private const int WIDTH_DECK_NAME_LABEL_NORMAL = 284;
|
||||
|
||||
private const int WIDTH_DECK_NAME_LABEL_USE_SUBCLASS = 242;
|
||||
|
||||
[SerializeField]
|
||||
private CostCurveUI _costCurve;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _deckName;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _formatIcon;
|
||||
|
||||
[SerializeField]
|
||||
private ClassInfoParts _classInfoParts;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _playerName;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _deckDetail;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _followerCount;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _amuletCount;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _spellCount;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _cardTexture;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _button;
|
||||
|
||||
[SerializeField]
|
||||
private TweenScale _buttonAnimationTween;
|
||||
|
||||
private DeckIntroductionTask.IntroductionData _data;
|
||||
|
||||
public Action<DeckIntroductionTask.IntroductionData> OnClick { get; set; }
|
||||
|
||||
public void Initialize(DeckIntroductionTask.IntroductionData data)
|
||||
{
|
||||
IFormatBehavior defaultBehaviour = FormatBehaviorManager.GetDefaultBehaviour(data.Deck.Format);
|
||||
_data = data;
|
||||
_playerName.text = data.PlayerName;
|
||||
_deckDetail.text = data.Detail;
|
||||
_formatIcon.spriteName = defaultBehaviour.SmallIconSpriteName;
|
||||
if (data.Deck.Format == Format.Rotation)
|
||||
{
|
||||
_formatIcon.spriteName = "icon_rotation_s";
|
||||
}
|
||||
_deckName.text = data.Deck.GetDeckName();
|
||||
_deckName.width = (defaultBehaviour.UseSubClass ? 242 : 284);
|
||||
_classInfoParts.gameObject.SetActive(defaultBehaviour.UseSubClass);
|
||||
if (defaultBehaviour.UseSubClass)
|
||||
{
|
||||
_classInfoParts.InitByCharaPrm(GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(data.Deck.GetDeckClassID()));
|
||||
_classInfoParts.SetSubClass((CardBasePrm.ClanType)data.Deck.GetDeckSubClassID());
|
||||
}
|
||||
int followerCount = 0;
|
||||
int spellCount = 0;
|
||||
int amuletCount = 0;
|
||||
GetCardCountEachType(data.Deck, out followerCount, out spellCount, out amuletCount);
|
||||
_followerCount.text = followerCount.ToString();
|
||||
_spellCount.text = spellCount.ToString();
|
||||
_amuletCount.text = amuletCount.ToString();
|
||||
_costCurve.Initialize(defaultBehaviour.CardMasterId);
|
||||
_costCurve.Refresh(data.Deck.GetCardIdList().ToArray());
|
||||
_button.onClick.Clear();
|
||||
_button.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
OnClickButton();
|
||||
}));
|
||||
string battleLogTexturePath = GetBattleLogTexturePath(data.TopCardId);
|
||||
_cardTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(battleLogTexturePath);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UIEventListener uIEventListener = UIEventListener.Get(_button.gameObject);
|
||||
uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, (UIEventListener.BoolDelegate)delegate
|
||||
{
|
||||
StartCoroutine(ButtonAnimation());
|
||||
});
|
||||
}
|
||||
|
||||
private IEnumerator ButtonAnimation()
|
||||
{
|
||||
BoxCollider btn = _button.GetComponent<BoxCollider>();
|
||||
Vector3 to = _buttonAnimationTween.to;
|
||||
Vector3 defaultSize = btn.size;
|
||||
Vector3 size = new Vector3(btn.size.x / to.x, btn.size.y / to.y, btn.size.z / to.z);
|
||||
if ((bool)_buttonAnimationTween)
|
||||
{
|
||||
_buttonAnimationTween.PlayForward();
|
||||
btn.size = size;
|
||||
while (Input.GetMouseButton(0))
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
_buttonAnimationTween.PlayReverse();
|
||||
btn.size = defaultSize;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetCardMaterialPath(int cardId)
|
||||
{
|
||||
CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default);
|
||||
CardParameter cardParameterFromId = instance.GetCardParameterFromId(cardId);
|
||||
CardParameter cardParameterFromId2 = instance.GetCardParameterFromId(cardParameterFromId.NormalCardId);
|
||||
ResourcesManager.AssetLoadPathType type = ResourcesManager.AssetLoadPathType.UnitCardMaterial;
|
||||
if (instance.GetCardParameterFromId(cardId).CharType != CardBasePrm.CharaType.NORMAL && !CardMaster.IsMutationCardCheck(instance.GetCardParameterFromId(cardId).BaseCardId))
|
||||
{
|
||||
type = ResourcesManager.AssetLoadPathType.SpellCardMaterial;
|
||||
}
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath(cardParameterFromId2.ResourceCardId.ToString(), type);
|
||||
}
|
||||
|
||||
private static string GetBattleLogTexturePath(int cardId)
|
||||
{
|
||||
CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default);
|
||||
ResourcesManager.AssetLoadPathType assetLoadPathType = ResourcesManager.AssetLoadPathType.UnitHeader;
|
||||
string path = instance.GetCardParameterFromId(cardId).ResourceCardId + "0";
|
||||
assetLoadPathType = ((instance.GetCardParameterFromId(cardId).CharType != CardBasePrm.CharaType.NORMAL && !CardMaster.IsMutationCardCheck(instance.GetCardParameterFromId(cardId).BaseCardId)) ? ResourcesManager.AssetLoadPathType.OtherHeader : ResourcesManager.AssetLoadPathType.UnitHeader);
|
||||
return Toolbox.ResourcesManager.GetAssetTypePath(path, assetLoadPathType, isfetch: true);
|
||||
}
|
||||
|
||||
private void GetCardCountEachType(DeckData deck, out int followerCount, out int spellCount, out int amuletCount)
|
||||
{
|
||||
CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default);
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
foreach (int cardId in deck.GetCardIdList())
|
||||
{
|
||||
switch (instance.GetCardParameterFromId(cardId).CharType)
|
||||
{
|
||||
case CardBasePrm.CharaType.NORMAL:
|
||||
num++;
|
||||
break;
|
||||
case CardBasePrm.CharaType.SPELL:
|
||||
num2++;
|
||||
break;
|
||||
case CardBasePrm.CharaType.FIELD:
|
||||
case CardBasePrm.CharaType.CHANT_FIELD:
|
||||
num3++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
followerCount = num;
|
||||
spellCount = num2;
|
||||
amuletCount = num3;
|
||||
}
|
||||
|
||||
private void OnClickButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
OnClick.Call(_data);
|
||||
}
|
||||
}
|
||||
1079
SVSim.BattleEngine/Engine/DeckListMenuUI.cs
Normal file
1079
SVSim.BattleEngine/Engine/DeckListMenuUI.cs
Normal file
File diff suppressed because it is too large
Load Diff
31
SVSim.BattleEngine/Engine/EffectSetUp.cs
Normal file
31
SVSim.BattleEngine/Engine/EffectSetUp.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class EffectSetUp : MonoBehaviour
|
||||
{
|
||||
public bool isBattle;
|
||||
|
||||
public bool isField;
|
||||
|
||||
public bool isFinished;
|
||||
|
||||
private List<string> _loadAssetList = new List<string>();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (GameMgr.GetIns() != null)
|
||||
{
|
||||
base.gameObject.SetActive(value: true);
|
||||
_loadAssetList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(base.gameObject, delegate
|
||||
{
|
||||
isFinished = true;
|
||||
}, isBattle, isField));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadAssetList);
|
||||
}
|
||||
}
|
||||
428
SVSim.BattleEngine/Engine/EnemyStatusPanelControl.cs
Normal file
428
SVSim.BattleEngine/Engine/EnemyStatusPanelControl.cs
Normal file
@@ -0,0 +1,428 @@
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class EnemyStatusPanelControl : MonoBehaviour, IStatusPanelControl
|
||||
{
|
||||
private BattleManagerBase _battleMgr;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject StatusPanel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject PPPanel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject StatusPanelAllwaysDisp;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite EpPanel;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite DeckIconSprite;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel DeckLabelAlwaysDisp;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite GraveIconSprite;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel GraveLabelAlwaysDisp;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel DeckLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel GraveLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel PPLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel PPLineLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel PPMaxLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel EpLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite[] EpList;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite EpIcon;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel HandCountLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel HandCountLabelAlwaysDisp;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite HandCountIconSpriteAlwaysDisp;
|
||||
|
||||
private const float ALWAYS_STATUS_PANEL_SHOW_ANIMATION_OFFSET = 350f;
|
||||
|
||||
private const float ALWAYS_STATUS_PANEL_SHOW_ANIMATION_SECOND = 0.5f;
|
||||
|
||||
private readonly Vector3 EP_PANEL_POSITION = new Vector3(235f, -90f, 0f);
|
||||
|
||||
private readonly Vector3 ANYA_EP_PANEL_POSITION = new Vector3(207f, -90f, 0f);
|
||||
|
||||
private const float EP_PANEL_OFFSET = 350f;
|
||||
|
||||
private const float PP_PANEL_OFFSET = 300f;
|
||||
|
||||
private const int ANYA_HIGH_RANK_SKIN_ID = 4413;
|
||||
|
||||
private ParticleSystem[] GaugeShiftEfcChild;
|
||||
|
||||
private bool isPlayer;
|
||||
|
||||
private IDictionary<string, Vector3> DefaultPosDict;
|
||||
|
||||
private Vector3 EpPanelPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GameMgr.GetIns().GetDataMgr().GetEnemySkinId() != 4413)
|
||||
{
|
||||
return EP_PANEL_POSITION;
|
||||
}
|
||||
return ANYA_EP_PANEL_POSITION;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 EpPanelOffScreenPosition => EpPanelPosition + Vector3.up * 350f;
|
||||
|
||||
public Vector3 BpPanelOffScreenPosition => DefaultPosDict["BPPanel"] + Vector3.up * 350f;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
string text = Toolbox.SavedataManager.GetString("LANG_SETTING", "Eng");
|
||||
if (text == Global.LANG_TYPE.Eng.ToString() || text == Global.LANG_TYPE.Ger.ToString())
|
||||
{
|
||||
PPPanel.transform.Find("PPIcon/PPSprite").gameObject.SetActive(value: false);
|
||||
Vector3 vector = new Vector3(0f, 11f, 0f);
|
||||
PPLabel.transform.localPosition += vector;
|
||||
PPLineLabel.transform.localPosition += vector;
|
||||
PPMaxLabel.transform.localPosition += vector;
|
||||
}
|
||||
PPPanel.transform.parent = BattleManagerBase.GetIns().Battle3DContainer.transform;
|
||||
DefaultPosDict = new Dictionary<string, Vector3>();
|
||||
DefaultPosDict["StatusPanel"] = StatusPanel.transform.localPosition;
|
||||
DefaultPosDict["PPPanel"] = new Vector3(PPPanel.transform.localPosition.x, 460f, PPPanel.transform.localPosition.z);
|
||||
DefaultPosDict["StatusPanelAllwaysDisp"] = StatusPanelAllwaysDisp.transform.localPosition;
|
||||
SetPp(0, 0);
|
||||
SetDeck(0);
|
||||
SetGrave(0);
|
||||
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f;
|
||||
EpPanel.transform.localPosition = EpPanelOffScreenPosition;
|
||||
PPPanel.SetActive(value: false);
|
||||
EpPanel.gameObject.SetActive(value: false);
|
||||
PPPanel.SetActive(value: false);
|
||||
EpPanel.gameObject.SetActive(value: false);
|
||||
StatusPanelAllwaysDisp.gameObject.SetActive(value: false);
|
||||
List<GameObject> list = new List<GameObject>();
|
||||
list.Add(base.gameObject);
|
||||
list.Add(PPPanel);
|
||||
list.Add(EpPanel.gameObject);
|
||||
UIManager.GetInstance().AttachAtlas(list);
|
||||
}
|
||||
|
||||
public void ChangePPPanelParent(Transform parent, Vector3 position)
|
||||
{
|
||||
PPPanel.transform.parent = parent;
|
||||
DefaultPosDict["PPPanel"] = position;
|
||||
if (PPPanel.GetComponent<iTween>() != null)
|
||||
{
|
||||
StartPPPanelAnimation();
|
||||
}
|
||||
else
|
||||
{
|
||||
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetUp(BattleManagerBase battleMgr)
|
||||
{
|
||||
_battleMgr = battleMgr;
|
||||
}
|
||||
|
||||
public void ShowStatus(bool isNewReplayMoveTurn)
|
||||
{
|
||||
if (BattlePlayerViewBase.AlwaysShowStatusPanel && !isNewReplayMoveTurn)
|
||||
{
|
||||
ShowStatusPanelAlways();
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusPanel.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowStatusPanelOnBattle()
|
||||
{
|
||||
StatusPanelAllwaysDisp.gameObject.SetActive(BattlePlayerViewBase.AlwaysShowStatusPanel);
|
||||
}
|
||||
|
||||
public void ShowStatusPanelAlways()
|
||||
{
|
||||
if (BattlePlayerViewBase.AlwaysShowStatusPanel)
|
||||
{
|
||||
StatusPanelAllwaysDisp.gameObject.SetActive(value: true);
|
||||
Vector3 localPosition = DefaultPosDict["StatusPanelAllwaysDisp"] + Vector3.up * 350f;
|
||||
StatusPanelAllwaysDisp.transform.localPosition = localPosition;
|
||||
iTween.MoveTo(StatusPanelAllwaysDisp, iTween.Hash("position", DefaultPosDict["StatusPanelAllwaysDisp"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
}
|
||||
}
|
||||
|
||||
public void HideStatusPanelAlways()
|
||||
{
|
||||
if (BattlePlayerViewBase.AlwaysShowStatusPanel)
|
||||
{
|
||||
StatusPanelAllwaysDisp.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowPpEp(bool isNotEPMax3, bool fixDirection = false, bool isNewReplay = false, bool isBanmenkun = false)
|
||||
{
|
||||
if (fixDirection)
|
||||
{
|
||||
isNotEPMax3 = false;
|
||||
}
|
||||
EpPanel.spriteName = GetEvoPanelSprite(isNotEPMax3);
|
||||
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
|
||||
if (isNotEPMax3)
|
||||
{
|
||||
EpIcon.transform.localPosition = new Vector3(-7.5f, -3.6f, 0f);
|
||||
EpList[0].spriteName = "battle_icon_evo_off_mini";
|
||||
EpList[1].spriteName = "battle_icon_evo_off_mini";
|
||||
EpList[2].spriteName = "battle_icon_evo_off_mini";
|
||||
EpList[0].transform.localPosition = new Vector3(5.1f, -59.2f, 0f);
|
||||
EpList[1].transform.localPosition = new Vector3(23.8f, -59.2f, 0f);
|
||||
EpList[2].gameObject.SetActive(value: false);
|
||||
if (isNewReplay)
|
||||
{
|
||||
EpPanel.transform.localScale = new Vector3(Mathf.Abs(EpPanel.transform.localScale.x), EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
|
||||
EpIcon.transform.localScale = new Vector3(Mathf.Abs(EpIcon.transform.localScale.x), EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
EpPanel.transform.localScale = new Vector3(0f - Mathf.Abs(EpPanel.transform.localScale.x), EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
|
||||
EpIcon.transform.localScale = new Vector3(0f - Mathf.Abs(EpIcon.transform.localScale.x), EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EpIcon.transform.localPosition = new Vector3(8f, -3.6f, 0f);
|
||||
EpList[0].spriteName = "battle_icon_evo_off_mini";
|
||||
EpList[1].spriteName = "battle_icon_evo_off_mini";
|
||||
EpList[2].spriteName = "battle_icon_evo_off_mini";
|
||||
EpList[0].transform.localPosition = new Vector3(17.1f, -59.2f, 0f);
|
||||
EpList[1].transform.localPosition = new Vector3(-1.6f, -59.2f, 0f);
|
||||
EpList[2].transform.localPosition = new Vector3(-20.2f, -59.2f, 0f);
|
||||
if (isNewReplay)
|
||||
{
|
||||
EpList[2].gameObject.SetActive(value: true);
|
||||
}
|
||||
float x = ((fixDirection || isNewReplay || isBanmenkun) ? (0f - Mathf.Abs(EpPanel.transform.localScale.x)) : (0f - EpPanel.transform.localScale.x));
|
||||
if (flag)
|
||||
{
|
||||
x = Mathf.Abs(EpPanel.transform.localScale.x);
|
||||
}
|
||||
EpPanel.transform.localScale = new Vector3(x, EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
|
||||
float x2 = ((fixDirection || isNewReplay || isBanmenkun) ? (0f - Mathf.Abs(EpIcon.transform.localScale.x)) : (0f - EpIcon.transform.localScale.x));
|
||||
if (flag)
|
||||
{
|
||||
x2 = Mathf.Abs(EpIcon.transform.localScale.x);
|
||||
}
|
||||
EpIcon.transform.localScale = new Vector3(x2, EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
|
||||
}
|
||||
if (!isNewReplay)
|
||||
{
|
||||
StartPPPanelAnimation();
|
||||
EpPanel.transform.localPosition = EpPanelOffScreenPosition;
|
||||
iTween.MoveTo(EpPanel.gameObject, iTween.Hash("position", EpPanelPosition, "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
}
|
||||
else
|
||||
{
|
||||
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"];
|
||||
EpPanel.transform.localPosition = EpPanelPosition;
|
||||
}
|
||||
EpPanel.gameObject.SetActive(value: true);
|
||||
}
|
||||
|
||||
private void StartPPPanelAnimation()
|
||||
{
|
||||
PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f;
|
||||
iTween.MoveTo(PPPanel, iTween.Hash("position", DefaultPosDict["PPPanel"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
PPPanel.SetActive(value: true);
|
||||
}
|
||||
|
||||
public void HideUI()
|
||||
{
|
||||
iTween.MoveTo(PPPanel, iTween.Hash("position", DefaultPosDict["PPPanel"] + Vector3.up * 300f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
iTween.MoveTo(EpPanel.gameObject, iTween.Hash("position", EpPanelOffScreenPosition, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
}
|
||||
|
||||
public void SetDeck(int num)
|
||||
{
|
||||
DeckLabel.text = num.ToString();
|
||||
DeckLabelAlwaysDisp.text = num.ToString();
|
||||
}
|
||||
|
||||
public void SetGrave(int num)
|
||||
{
|
||||
GraveLabel.text = num.ToString();
|
||||
GraveLabelAlwaysDisp.text = num.ToString();
|
||||
}
|
||||
|
||||
public void SetHandCount(int num)
|
||||
{
|
||||
HandCountLabelAlwaysDisp.text = num.ToString();
|
||||
UISprite handCountIconSpriteAlwaysDisp = HandCountIconSpriteAlwaysDisp;
|
||||
Color color = (HandCountLabelAlwaysDisp.color = ClassInfomationUIBase.GetHandCardCountColor(num));
|
||||
handCountIconSpriteAlwaysDisp.color = color;
|
||||
}
|
||||
|
||||
public void SetPp(int num, int max, bool isNewReplayMoveTurn = false)
|
||||
{
|
||||
PPLabel.text = num.ToString();
|
||||
PPMaxLabel.text = max.ToString();
|
||||
}
|
||||
|
||||
public void PlayIncreasePpAnimation(int oldPp, int newPp)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetEp(int evo, int cnt)
|
||||
{
|
||||
if (evo > 0)
|
||||
{
|
||||
EpIcon.spriteName = "battle_icon_evo_off";
|
||||
EpLabel.gameObject.SetActive(value: true);
|
||||
EpLabel.text = evo.ToString();
|
||||
return;
|
||||
}
|
||||
if (!_battleMgr.BattleEnemy.IsEpEvolveThisTurn)
|
||||
{
|
||||
EpIcon.spriteName = "battle_icon_evo_on";
|
||||
}
|
||||
else
|
||||
{
|
||||
EpIcon.spriteName = "battle_icon_evo_off";
|
||||
}
|
||||
EpLabel.gameObject.SetActive(value: false);
|
||||
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (EpList[i] != null && EpList[i].gameObject.activeSelf)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
EpList[i].spriteName = ((i < _battleMgr.BattleEnemy.EpTotal - cnt) ? "battle_icon_evo_off_mini" : "battle_icon_evo_on_mini");
|
||||
}
|
||||
else
|
||||
{
|
||||
EpList[i].spriteName = ((i < cnt) ? "battle_icon_evo_on_mini" : "battle_icon_evo_off_mini");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cnt <= 0)
|
||||
{
|
||||
EpIcon.spriteName = "battle_icon_evo_off";
|
||||
}
|
||||
}
|
||||
|
||||
public VfxBase PlayIncreaseMaxEpAnimation(int oldMaxEp, int newMaxEp)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
EpPanel.spriteName = GetEvoPanelSprite(isNotEpMax3: false);
|
||||
EpIcon.transform.localPosition = new Vector3(8f, -3.6f, 0f);
|
||||
EpList[0].transform.localPosition = new Vector3(17.1f, -59.2f, 0f);
|
||||
EpList[1].transform.localPosition = new Vector3(-1.6f, -59.2f, 0f);
|
||||
EpList[2].transform.localPosition = new Vector3(-20.2f, -59.2f, 0f);
|
||||
EpList[2].gameObject.SetActive(value: true);
|
||||
EpPanel.transform.localScale = new Vector3(0f - EpPanel.transform.localScale.x, EpPanel.transform.localScale.y, EpPanel.transform.localScale.z);
|
||||
EpIcon.transform.localScale = new Vector3(0f - EpIcon.transform.localScale.x, EpIcon.transform.localScale.y, EpIcon.transform.localScale.z);
|
||||
});
|
||||
}
|
||||
|
||||
public VfxBase PlayIncreaseUsableEpAnimation(int oldUsableEpAmount, int amountOfUsableEpGained, int maxEp)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
|
||||
for (int i = oldUsableEpAmount; i < oldUsableEpAmount + amountOfUsableEpGained; i++)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_UI_EP_5, EpList[flag ? (_battleMgr.BattleEnemy.EpTotal - i - 1) : i].transform.position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public VfxBase PlayDecreaseUsableEpAnimation(int oldUsableEpAmount, int usedEp)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CMN_UI_EP_6);
|
||||
int num = Mathf.Max(oldUsableEpAmount - usedEp, 0);
|
||||
EffectMgr effectMgr = GameMgr.GetIns().GetEffectMgr();
|
||||
bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413;
|
||||
for (int i = num; i < oldUsableEpAmount; i++)
|
||||
{
|
||||
effectMgr.Start(EffectMgr.EffectType.CMN_UI_EP_6, EpList[flag ? (_battleMgr.BattleEnemy.EpTotal - i - 1) : i].transform.position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void ChangeColor(Color color, float time)
|
||||
{
|
||||
TweenColor.Begin(StatusPanel, time, color);
|
||||
TweenColor.Begin(DeckLabel.gameObject, time, color);
|
||||
TweenColor.Begin(GraveLabel.gameObject, time, color);
|
||||
TweenColor.Begin(DeckIconSprite.gameObject, time, color);
|
||||
TweenColor.Begin(GraveIconSprite.gameObject, time, color);
|
||||
}
|
||||
|
||||
public Transform GetClassInfoAnchor()
|
||||
{
|
||||
return base.gameObject.transform.Find("AnchorTR");
|
||||
}
|
||||
|
||||
public GameObject GetPPPanel()
|
||||
{
|
||||
return PPPanel;
|
||||
}
|
||||
|
||||
public GameObject GetEPIcon()
|
||||
{
|
||||
return EpIcon.gameObject;
|
||||
}
|
||||
|
||||
private string GetEvoPanelSprite(bool isNotEpMax3)
|
||||
{
|
||||
string text = "battle_evo_";
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
int enemySkinId = dataMgr.GetEnemySkinId();
|
||||
if (dataMgr.IsHighRankSkinEnemy())
|
||||
{
|
||||
text = text + enemySkinId + "_";
|
||||
}
|
||||
else if (dataMgr.Is3DSkin(isPlayer: false))
|
||||
{
|
||||
text += "uma_";
|
||||
}
|
||||
else if (Global.IsSnCollabSkin(enemySkinId))
|
||||
{
|
||||
text += "sn_";
|
||||
}
|
||||
return text + "base_" + (isNotEpMax3 ? "02" : "01");
|
||||
}
|
||||
}
|
||||
16
SVSim.BattleEngine/Engine/EpSetModifier.cs
Normal file
16
SVSim.BattleEngine/Engine/EpSetModifier.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
public class EpSetModifier : ICardEpModifier
|
||||
{
|
||||
private readonly int m_ep;
|
||||
|
||||
public bool IsClearBeforeModifier => true;
|
||||
|
||||
public EpSetModifier(int ep)
|
||||
{
|
||||
m_ep = ep;
|
||||
}
|
||||
|
||||
public int CalcEp(int baseEp)
|
||||
{
|
||||
return m_ep;
|
||||
}
|
||||
}
|
||||
36
SVSim.BattleEngine/Engine/FieldCardCreator.cs
Normal file
36
SVSim.BattleEngine/Engine/FieldCardCreator.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class FieldCardCreator : CardCreatorBase
|
||||
{
|
||||
public FieldCardCreator(GameObject rootObject)
|
||||
: base(rootObject)
|
||||
{
|
||||
}
|
||||
|
||||
public static void SetupFieldCardMaterialToCardMesh(Transform rootCardTransform, CardParameter cardBasePrm, Material normalCardArtMaterial)
|
||||
{
|
||||
MeshRenderer component = rootCardTransform.transform.Find("NormalField").GetComponent<MeshRenderer>();
|
||||
Transform transform = rootCardTransform.Find("Normal");
|
||||
LOD[] lODs = transform.GetComponent<LODGroup>().GetLODs();
|
||||
UIManager.GetInstance().SetLayerRecursive(transform, 10);
|
||||
Material[] sharedMaterials = lODs[0].renderers[0].sharedMaterials;
|
||||
Material[] sharedMaterials2 = component.sharedMaterials;
|
||||
int rarity = cardBasePrm.Rarity;
|
||||
Material handFieldFrame = SBattleLoad.CardFrameMaterialHolder.GetHandFieldFrame(rarity);
|
||||
Material inPlayNormalUnitFrame = SBattleLoad.CardFrameMaterialHolder.GetInPlayNormalUnitFrame(rarity);
|
||||
handFieldFrame.shader = Shader.Find(handFieldFrame.shader.name);
|
||||
inPlayNormalUnitFrame.shader = Shader.Find(inPlayNormalUnitFrame.shader.name);
|
||||
sharedMaterials[0] = handFieldFrame;
|
||||
sharedMaterials2[0] = inPlayNormalUnitFrame;
|
||||
sharedMaterials[1] = (sharedMaterials2[1] = normalCardArtMaterial);
|
||||
sharedMaterials[2] = CardCreatorBase.GetSharedClassIconMaterial(cardBasePrm.Clan);
|
||||
for (int i = 0; i < lODs.Length; i++)
|
||||
{
|
||||
lODs[i].renderers[0].sharedMaterials = sharedMaterials;
|
||||
}
|
||||
component.sharedMaterials = sharedMaterials2;
|
||||
component.materials[1].mainTextureScale = cardBasePrm.NormalTilling;
|
||||
component.materials[1].mainTextureOffset = cardBasePrm.NormalOffset;
|
||||
}
|
||||
}
|
||||
26
SVSim.BattleEngine/Engine/GetDataTranslateTask.cs
Normal file
26
SVSim.BattleEngine/Engine/GetDataTranslateTask.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Cute;
|
||||
|
||||
public class GetDataTranslateTask : NetworkTask
|
||||
{
|
||||
public override string Url => NtDataTranslateManager.GetInstance().GetTranslateInfoUrl();
|
||||
|
||||
protected override int Parse()
|
||||
{
|
||||
int num = base.Parse();
|
||||
if (num != 1)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
string text = base.ResponseData["data"]["email_address"].ToString();
|
||||
NtDataTranslateManager.GetInstance().curBindEmail = text;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
NtDataTranslateManager.GetInstance().isTranslate = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
NtDataTranslateManager.GetInstance().isTranslate = true;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
24
SVSim.BattleEngine/Engine/IPaymentCallback.cs
Normal file
24
SVSim.BattleEngine/Engine/IPaymentCallback.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public interface IPaymentCallback
|
||||
{
|
||||
void evInitializeSucceeded();
|
||||
|
||||
void evInitializeFailed(string error);
|
||||
|
||||
void evPurchaseSucceeded(PaymentPurchase purchase);
|
||||
|
||||
void evPurchaseFailed(string error);
|
||||
|
||||
void evPurchaseCancelled(string error);
|
||||
|
||||
void evGetProductListSucceeded(List<PaymentSkuInfo> infos);
|
||||
|
||||
void evGetProductListFailed(string error);
|
||||
|
||||
void evConsumePurchaseSucceeded();
|
||||
|
||||
void evConsumePurchaseSucceedediOS();
|
||||
|
||||
void evConsumePurchaseFailed(string error);
|
||||
}
|
||||
5
SVSim.BattleEngine/Engine/LocalNotificationPriority.cs
Normal file
5
SVSim.BattleEngine/Engine/LocalNotificationPriority.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
public enum LocalNotificationPriority
|
||||
{
|
||||
High = 1,
|
||||
Normal
|
||||
}
|
||||
488
SVSim.BattleEngine/Engine/Mission.cs
Normal file
488
SVSim.BattleEngine/Engine/Mission.cs
Normal file
@@ -0,0 +1,488 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class Mission : UIBase
|
||||
{
|
||||
public enum MissionViewTab
|
||||
{
|
||||
NormalMission,
|
||||
Achievement,
|
||||
BattlePassMission
|
||||
}
|
||||
|
||||
public const int ONE_DAY_HOURS = 24;
|
||||
|
||||
public const double CAN_CHANGE_MISSION_CHECK_MARGIN_SECONDS = 10.0;
|
||||
|
||||
private static readonly Vector3 POS_SOLO_PLAY_MISSION_LABEL_CHANGE_ENABLE = new Vector3(990f, -31f, 0f);
|
||||
|
||||
private static readonly Vector3 POS_SOLO_PLAY_MISSION_LABEL_CHANGE_DISABLE = new Vector3(990f, -21f, 0f);
|
||||
|
||||
public static readonly int PERIOD_TEXT_SIZE_BIG = 21;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton MissionButton;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton AchievementButton;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton BattlePassMissionButton;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton ReceiveButton;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelSoloPlayMssion;
|
||||
|
||||
[SerializeField]
|
||||
private UIToggle _soloPlayMissionToggleUI;
|
||||
|
||||
[SerializeField]
|
||||
private UIEventListener _soloPlayMissionEventListener;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _soloPlayMssionChangeWaitTime;
|
||||
|
||||
public GameObject goAchievementBaseTop;
|
||||
|
||||
public GameObject goAchievementWindowBase;
|
||||
|
||||
private GameObject[] scrollItems;
|
||||
|
||||
private MissionViewTab _currentViewTab;
|
||||
|
||||
private static MissionViewTab _transitionViewTab = MissionViewTab.NormalMission;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel LabelMission;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel LabelAchievement;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel AchievementTopText;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelBgCenter;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _topObjMission;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelMissionChangeText;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _mailReceive;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel AchievementCanReceiveCount;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _battlePassMontlyMissionRoot;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _missionAndAchievementRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _battlePassMontlyMissionPeriodLabel;
|
||||
|
||||
[SerializeField]
|
||||
private SimpleScrollViewUI _battlePassMontlyMissionScrollView;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _btnTransitionBattlePass;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelNoBattlePassMission;
|
||||
|
||||
public ResourceHandler Handler { get; private set; }
|
||||
|
||||
public override void onFirstStart()
|
||||
{
|
||||
Handler = base.gameObject.AddMissingComponent<ResourceHandler>();
|
||||
base.IsShowFooterMenu = true;
|
||||
base.onFirstStart();
|
||||
SystemText systemText = Data.SystemText;
|
||||
UIManager.GetInstance().CreateTopBar(base.gameObject, systemText.Get("Mission_0001"), UIManager.ViewScene.MyPage);
|
||||
LabelMission.text = systemText.Get("Mission_0001");
|
||||
LabelAchievement.text = systemText.Get("Mission_0002");
|
||||
MissionButton.onClick.Clear();
|
||||
MissionButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
OnPushTabButton(MissionViewTab.NormalMission);
|
||||
}));
|
||||
AchievementButton.onClick.Clear();
|
||||
AchievementButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
OnPushTabButton(MissionViewTab.Achievement);
|
||||
}));
|
||||
BattlePassMissionButton.onClick.Clear();
|
||||
BattlePassMissionButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
OnPushTabButton(MissionViewTab.BattlePassMission);
|
||||
}));
|
||||
_btnTransitionBattlePass.onClick.Clear();
|
||||
_btnTransitionBattlePass.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BattlePass);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
}));
|
||||
UIEventListener uIEventListener = UIEventListener.Get(_soloPlayMissionEventListener.gameObject);
|
||||
uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
CreateChangeReceiveTypeConfirmDialog();
|
||||
});
|
||||
UIManager.GetInstance().SetLayerRecursive(base.transform, LayerMask.NameToLayer("MyPage"));
|
||||
}
|
||||
|
||||
private void OnPushTabButton(MissionViewTab viewTab)
|
||||
{
|
||||
if (_currentViewTab != viewTab)
|
||||
{
|
||||
UpdateMissionView(viewTab);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateChangeReceiveTypeConfirmDialog()
|
||||
{
|
||||
MissionInfoDetail.eMissionReceiveType receiveType;
|
||||
string text;
|
||||
if (Data.MissionInfo.data._missionReceiveType == MissionInfoDetail.eMissionReceiveType.normal)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON);
|
||||
receiveType = MissionInfoDetail.eMissionReceiveType.solo;
|
||||
text = Data.SystemText.Get("Mission_0083");
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_OFF);
|
||||
receiveType = MissionInfoDetail.eMissionReceiveType.normal;
|
||||
text = Data.SystemText.Get("Mission_0084");
|
||||
}
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Mission_0082"));
|
||||
dialogBase.SetText(text);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn);
|
||||
dialogBase.SetButtonText(Data.SystemText.Get("Mission_0085"));
|
||||
dialogBase.onPushButton1 = delegate
|
||||
{
|
||||
MissionChangeReceiveSettingTask missionChangeReceiveSettingTask = new MissionChangeReceiveSettingTask();
|
||||
missionChangeReceiveSettingTask.SetParameter(receiveType);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(missionChangeReceiveSettingTask, delegate
|
||||
{
|
||||
UpdateMissionView(MissionViewTab.NormalMission);
|
||||
}));
|
||||
};
|
||||
}
|
||||
|
||||
private void SetMissionTypeToggleBtn(MissionInfoDetail.eMissionReceiveType type)
|
||||
{
|
||||
_soloPlayMissionToggleUI.value = type == MissionInfoDetail.eMissionReceiveType.solo;
|
||||
bool flag = Data.MissionInfo.data.CanChangeReceiveType;
|
||||
TimeSpan timeSpan = default(TimeSpan);
|
||||
if (!flag)
|
||||
{
|
||||
timeSpan = TimeSpan.FromSeconds(Data.MissionInfo.data.WaitTimeCanChangeReceiveType - GameMgr.GetIns().GetMissionInfoTask().NowUnixTime());
|
||||
flag = timeSpan.TotalSeconds < -10.0;
|
||||
}
|
||||
_soloPlayMssionChangeWaitTime.gameObject.SetActive(!flag);
|
||||
UIManager.SetObjectToGrey(_soloPlayMissionEventListener.gameObject, !flag);
|
||||
_soloPlayMissionToggleUI.activeSprite.alpha = (_soloPlayMissionToggleUI.value ? 1f : 0f);
|
||||
_labelSoloPlayMssion.transform.localPosition = (flag ? POS_SOLO_PLAY_MISSION_LABEL_CHANGE_ENABLE : POS_SOLO_PLAY_MISSION_LABEL_CHANGE_DISABLE);
|
||||
if (!flag)
|
||||
{
|
||||
int num = timeSpan.Hours;
|
||||
int num2 = timeSpan.Minutes;
|
||||
if (num <= 0 && num2 <= 0)
|
||||
{
|
||||
num = 0;
|
||||
num2 = 1;
|
||||
}
|
||||
_soloPlayMssionChangeWaitTime.text = Data.SystemText.Get("Mission_0081", num.ToString("00"), num2.ToString("00"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangeViewSceneTransitionMissionViewTab(MissionViewTab viewTab)
|
||||
{
|
||||
_transitionViewTab = viewTab;
|
||||
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mission);
|
||||
}
|
||||
|
||||
protected override void onOpen()
|
||||
{
|
||||
base.onOpen();
|
||||
if (_currentViewTab != _transitionViewTab)
|
||||
{
|
||||
_currentViewTab = _transitionViewTab;
|
||||
ResetTransitionViewTab();
|
||||
}
|
||||
bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.BATTLE_PASS);
|
||||
UIManager.SetObjectToGrey(BattlePassMissionButton.gameObject, flag);
|
||||
if (flag && _currentViewTab == MissionViewTab.BattlePassMission)
|
||||
{
|
||||
_currentViewTab = MissionViewTab.NormalMission;
|
||||
}
|
||||
UpdateMissionView(_currentViewTab);
|
||||
UIManager.GetInstance().OnReadyViewScene(isFadein: true);
|
||||
int canReceiveAchievementRewards = GetCanReceiveAchievementRewards();
|
||||
AchievementCanReceiveCount.gameObject.SetActive(canReceiveAchievementRewards > 0);
|
||||
AchievementCanReceiveCount.text = canReceiveAchievementRewards.ToString();
|
||||
}
|
||||
|
||||
private void ResetTransitionViewTab()
|
||||
{
|
||||
_transitionViewTab = MissionViewTab.NormalMission;
|
||||
}
|
||||
|
||||
private void UpdateMissionView(MissionViewTab viewTab)
|
||||
{
|
||||
switch (viewTab)
|
||||
{
|
||||
case MissionViewTab.NormalMission:
|
||||
changeMission();
|
||||
break;
|
||||
case MissionViewTab.Achievement:
|
||||
changeAchievement();
|
||||
break;
|
||||
case MissionViewTab.BattlePassMission:
|
||||
ChangeBattlePassMission();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsUseCommonBackground()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void changeMission()
|
||||
{
|
||||
setScene(MissionViewTab.NormalMission);
|
||||
ReceiveButton.gameObject.SetActive(value: false);
|
||||
_soloPlayMissionToggleUI.gameObject.SetActive(value: true);
|
||||
SetMissionTypeToggleBtn(Data.MissionInfo.data._missionReceiveType);
|
||||
bool flag = Data.MissionInfo.data._isChangeMission;
|
||||
long num = GameMgr.GetIns().GetMissionInfoTask().NowUnixTime();
|
||||
TimeSpan timeSpan = TimeSpan.FromSeconds(Data.MissionInfo.data._canChangeMissionTime - num);
|
||||
if (!flag)
|
||||
{
|
||||
flag = timeSpan.TotalSeconds < -10.0;
|
||||
}
|
||||
List<UserMission> user_mission_list = Data.MissionInfo.data.user_mission_list;
|
||||
scrollItems = new GameObject[user_mission_list.Count];
|
||||
int num2 = 0;
|
||||
foreach (UserMission item in user_mission_list)
|
||||
{
|
||||
if (item.end_time <= 0 || item.GetMissionPeriodSec(num) > 0)
|
||||
{
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(goAchievementWindowBase);
|
||||
scrollItems[num2] = gameObject;
|
||||
scrollItems[num2].transform.parent = goAchievementBaseTop.transform;
|
||||
scrollItems[num2].transform.localPosition = Vector3.zero;
|
||||
scrollItems[num2].transform.localScale = Vector3.one;
|
||||
scrollItems[num2].SetActive(value: true);
|
||||
gameObject.GetComponent<AchievementWindowBase>().SetMission(item, Handler, flag, enableSeparator: false, displayChange: true, delegate
|
||||
{
|
||||
UpdateMissionView(MissionViewTab.NormalMission);
|
||||
});
|
||||
num2++;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
_labelMissionChangeText.text = Data.SystemText.Get("Mission_0036");
|
||||
}
|
||||
else
|
||||
{
|
||||
int num3 = timeSpan.Hours;
|
||||
int num4 = timeSpan.Minutes;
|
||||
if (timeSpan.TotalHours >= 24.0)
|
||||
{
|
||||
num3 = 24;
|
||||
num4 = 0;
|
||||
}
|
||||
else if (num3 <= 0 && num4 <= 0)
|
||||
{
|
||||
num3 = 0;
|
||||
num4 = 1;
|
||||
}
|
||||
_labelMissionChangeText.text = Data.SystemText.Get("Mission_0031", num3.ToString("00"), num4.ToString("00"));
|
||||
}
|
||||
_topObjMission.gameObject.SetActive(value: true);
|
||||
DisplayScrollItems();
|
||||
_labelBgCenter.gameObject.SetActive(value: false);
|
||||
AchievementTopText.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public void changeAchievement()
|
||||
{
|
||||
setScene(MissionViewTab.Achievement);
|
||||
scrollItems = new GameObject[Data.MissionInfo.data.user_achievement_list.Count];
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
foreach (UserAchievement item in Data.MissionInfo.data.user_achievement_list)
|
||||
{
|
||||
scrollItems[num] = UnityEngine.Object.Instantiate(goAchievementWindowBase);
|
||||
scrollItems[num].transform.parent = goAchievementBaseTop.transform;
|
||||
scrollItems[num].transform.localPosition = Vector3.zero;
|
||||
scrollItems[num].transform.localScale = Vector3.one;
|
||||
scrollItems[num].SetActive(value: true);
|
||||
AchievementWindowBase component = scrollItems[num].GetComponent<AchievementWindowBase>();
|
||||
component.SetAchievement(item, Handler, delegate
|
||||
{
|
||||
UpdateMissionView(MissionViewTab.Achievement);
|
||||
});
|
||||
if (item.achievement_status == 1)
|
||||
{
|
||||
num2++;
|
||||
}
|
||||
component.type = item.achievement_type;
|
||||
component.iType = num;
|
||||
component.level = item.level;
|
||||
num++;
|
||||
}
|
||||
AchievementCanReceiveCount.gameObject.SetActive(num2 > 0);
|
||||
AchievementCanReceiveCount.text = num2.ToString();
|
||||
AchievementTopText.text = Data.SystemText.Get("Mission_0021", num2.ToString());
|
||||
AchievementTopText.gameObject.SetActive(value: true);
|
||||
_topObjMission.SetActive(value: false);
|
||||
_soloPlayMissionToggleUI.gameObject.SetActive(value: false);
|
||||
ReceiveButton.gameObject.SetActive(value: true);
|
||||
UIManager.SetObjectToGrey(ReceiveButton.gameObject, num2 == 0);
|
||||
ReceiveButton.onClick.Clear();
|
||||
ReceiveButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
ReceiveAllAchievementRewards();
|
||||
}));
|
||||
goAchievementWindowBase.SetActive(value: false);
|
||||
DisplayScrollItems();
|
||||
_labelBgCenter.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
private void ChangeBattlePassMission()
|
||||
{
|
||||
setScene(MissionViewTab.BattlePassMission);
|
||||
BattlePassMonthlyMission monthlyMission = Data.MissionInfo.data.BattlePassMonthlyMissionData;
|
||||
bool flag = monthlyMission != null;
|
||||
_battlePassMontlyMissionScrollView.gameObject.SetActive(flag);
|
||||
_battlePassMontlyMissionPeriodLabel.gameObject.SetActive(flag);
|
||||
_btnTransitionBattlePass.gameObject.SetActive(flag);
|
||||
_labelNoBattlePassMission.gameObject.SetActive(!flag);
|
||||
if (flag)
|
||||
{
|
||||
_battlePassMontlyMissionScrollView.CreateScrollView(monthlyMission.MissionList.Count, delegate(int index, GameObject plate)
|
||||
{
|
||||
plate.GetComponent<AchievementWindowBase>().SetBttlePassMonthlyMission(monthlyMission.MissionList[index], Handler);
|
||||
});
|
||||
DateTime? dateTime = ConvertTime.GetDateTime(monthlyMission.EndDate);
|
||||
if (dateTime.HasValue)
|
||||
{
|
||||
string remainingTime = ConvertTime.GetRemainingTime(ConvertTime.GetTimeSpan(GameMgr.GetIns().GetMissionInfoTask().NowUnixTime(), dateTime.Value));
|
||||
_battlePassMontlyMissionPeriodLabel.text = remainingTime;
|
||||
_battlePassMontlyMissionPeriodLabel.fontSize = PERIOD_TEXT_SIZE_BIG;
|
||||
_battlePassMontlyMissionPeriodLabel.color = LabelDefine.TEXT_COLOR_ORANGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
_battlePassMontlyMissionPeriodLabel.text = Data.SystemText.Get("BattlePass_0007", ConvertTime.GetLocalPeriod(monthlyMission.StartDate, monthlyMission.EndDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setScene(MissionViewTab next_scene)
|
||||
{
|
||||
if (scrollItems != null)
|
||||
{
|
||||
for (int i = 0; i < scrollItems.Length; i++)
|
||||
{
|
||||
if ((bool)scrollItems[i])
|
||||
{
|
||||
UnityEngine.Object.Destroy(scrollItems[i]);
|
||||
}
|
||||
}
|
||||
scrollItems = null;
|
||||
}
|
||||
goAchievementBaseTop.GetComponent<UITable>().repositionNow = true;
|
||||
goAchievementBaseTop.GetComponent<UIScrollView>().ResetPosition();
|
||||
UpdateTabSprite(next_scene);
|
||||
_battlePassMontlyMissionRoot.SetActive(next_scene == MissionViewTab.BattlePassMission);
|
||||
_missionAndAchievementRoot.SetActive(next_scene != MissionViewTab.BattlePassMission);
|
||||
AchievementTopText.gameObject.SetActive(next_scene == MissionViewTab.Achievement);
|
||||
_topObjMission.SetActive(next_scene == MissionViewTab.NormalMission);
|
||||
_currentViewTab = next_scene;
|
||||
}
|
||||
|
||||
private void UpdateTabSprite(MissionViewTab scene)
|
||||
{
|
||||
switch (scene)
|
||||
{
|
||||
case MissionViewTab.NormalMission:
|
||||
MissionButton.normalSprite = MissionButton.pressedSprite;
|
||||
AchievementButton.normalSprite = AchievementButton.disabledSprite;
|
||||
BattlePassMissionButton.normalSprite = BattlePassMissionButton.disabledSprite;
|
||||
break;
|
||||
case MissionViewTab.Achievement:
|
||||
MissionButton.normalSprite = MissionButton.disabledSprite;
|
||||
AchievementButton.normalSprite = AchievementButton.pressedSprite;
|
||||
BattlePassMissionButton.normalSprite = BattlePassMissionButton.disabledSprite;
|
||||
break;
|
||||
case MissionViewTab.BattlePassMission:
|
||||
MissionButton.normalSprite = MissionButton.disabledSprite;
|
||||
AchievementButton.normalSprite = AchievementButton.disabledSprite;
|
||||
BattlePassMissionButton.normalSprite = BattlePassMissionButton.pressedSprite;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayScrollItems()
|
||||
{
|
||||
goAchievementBaseTop.GetComponent<UITable>().repositionNow = true;
|
||||
goAchievementBaseTop.GetComponent<UIScrollView>().ResetPosition();
|
||||
}
|
||||
|
||||
public void ReceiveAndDisplayRewards(GameObject obj, GameObject prefab, List<ReceivedReward> rewards)
|
||||
{
|
||||
obj.AddMissingComponent<ReceiveReward>().ShowReadDialog(rewards, prefab, obj, Handler);
|
||||
MyPageMenu.Instance.UpdateMissionCount();
|
||||
}
|
||||
|
||||
private void ReceiveAllAchievementRewards()
|
||||
{
|
||||
AchievementReceiveRewardTask achievementReceiveRewardTask = new AchievementReceiveRewardTask();
|
||||
achievementReceiveRewardTask.SetParameter(0, 0);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(achievementReceiveRewardTask, OnRequestAllAchievementReward, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode));
|
||||
}
|
||||
|
||||
private void OnRequestAllAchievementReward(NetworkTask.ResultCode error)
|
||||
{
|
||||
ReceiveAndDisplayRewards(base.gameObject, _mailReceive, Data.MissionInfo.data.total_reward_list);
|
||||
UpdateMissionView(MissionViewTab.Achievement);
|
||||
}
|
||||
|
||||
protected override void onClose()
|
||||
{
|
||||
base.onClose();
|
||||
Handler.UnloadAll();
|
||||
_currentViewTab = MissionViewTab.NormalMission;
|
||||
ResetTransitionViewTab();
|
||||
}
|
||||
|
||||
private int GetCanReceiveAchievementRewards()
|
||||
{
|
||||
int num = 0;
|
||||
foreach (UserAchievement item in Data.MissionInfo.data.user_achievement_list)
|
||||
{
|
||||
if (item.achievement_status == 1)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
17
SVSim.BattleEngine/Engine/NetworkAIBattleSetupCardEvent.cs
Normal file
17
SVSim.BattleEngine/Engine/NetworkAIBattleSetupCardEvent.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class NetworkAIBattleSetupCardEvent : NetworkBattleSetupCardEvent
|
||||
{
|
||||
public NetworkAIBattleSetupCardEvent(BattleManagerBase manager, RegisterActionManager registerCardList, NetworkBattleData data)
|
||||
: base(manager, registerCardList, data)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetupCardEvent(BattleManagerBase mgr, RegisterActionManager actionManager, BattleCardBase card, List<RegisterUnapproved> registerUnapprovedList)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SetupCardSkillEvent(BattleCardBase card)
|
||||
{
|
||||
}
|
||||
}
|
||||
31
SVSim.BattleEngine/Engine/NetworkNullLogger.cs
Normal file
31
SVSim.BattleEngine/Engine/NetworkNullLogger.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class NetworkNullLogger : INetworkLogger<NetworkLog>, IEnumerable<NetworkLog>, IEnumerable
|
||||
{
|
||||
public void LogInfo(string text)
|
||||
{
|
||||
}
|
||||
|
||||
public void LogError(string text)
|
||||
{
|
||||
}
|
||||
|
||||
public void LogWarning(string text)
|
||||
{
|
||||
}
|
||||
|
||||
public void ClearLog()
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerator<NetworkLog> GetEnumerator()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
59
SVSim.BattleEngine/Engine/NtDataTranslate.cs
Normal file
59
SVSim.BattleEngine/Engine/NtDataTranslate.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class NtDataTranslate : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private TitleUI _titleUI;
|
||||
|
||||
public GameObject BtnTranslate;
|
||||
|
||||
public NtDataTranslateInput InputObj;
|
||||
|
||||
public UILabel TxtTranslate;
|
||||
|
||||
public static NtDataTranslate Instance;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
initUI();
|
||||
requestData();
|
||||
}
|
||||
|
||||
private void initUI()
|
||||
{
|
||||
Instance = this;
|
||||
initEventListener();
|
||||
}
|
||||
|
||||
private void initEventListener()
|
||||
{
|
||||
UIEventListener.Get(BtnTranslate).onClick = onClickTranslate;
|
||||
}
|
||||
|
||||
private void requestData()
|
||||
{
|
||||
NtDataTranslateManager.GetInstance().GetTranslateInfo();
|
||||
}
|
||||
|
||||
private void onClickTranslate(GameObject btn)
|
||||
{
|
||||
if (!_titleUI.IsEnableClickButton())
|
||||
{
|
||||
return;
|
||||
}
|
||||
GetDataTranslateTask task = new GetDataTranslateTask();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
NtDataTranslateManager instance = NtDataTranslateManager.GetInstance();
|
||||
if (instance.isTranslate)
|
||||
{
|
||||
instance.ShowRebind();
|
||||
}
|
||||
else
|
||||
{
|
||||
instance.ShowMainNotice(instance.HongKongMacaoUserConfirm);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
96
SVSim.BattleEngine/Engine/NtDataTranslateInput.cs
Normal file
96
SVSim.BattleEngine/Engine/NtDataTranslateInput.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class NtDataTranslateInput : MonoBehaviour
|
||||
{
|
||||
public UIInput InputEmail1;
|
||||
|
||||
public UIInput InputEmail2;
|
||||
|
||||
public UILabel TxtEmailTitle1;
|
||||
|
||||
public UILabel TxtEmailTitle2;
|
||||
|
||||
public UILabel TxtEmailTip;
|
||||
|
||||
public string EmailAddress;
|
||||
|
||||
private NtDataTranslateInfo info;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
initUI();
|
||||
initEventListener();
|
||||
}
|
||||
|
||||
private void initUI()
|
||||
{
|
||||
info = NtDataTranslateManager.GetInstance().TranslateInfo;
|
||||
TxtEmailTitle1.text = info.emailAddress1;
|
||||
TxtEmailTitle2.text = info.emailAddress2;
|
||||
TxtEmailTip.text = string.Empty;
|
||||
}
|
||||
|
||||
private void initEventListener()
|
||||
{
|
||||
EventDelegate.Add(InputEmail1.onChange, onValueChange);
|
||||
EventDelegate.Add(InputEmail2.onChange, onValueChange);
|
||||
}
|
||||
|
||||
private void onValueChange()
|
||||
{
|
||||
if (checkInput().Equals(info.emailAddressTip1))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(InputEmail2.value))
|
||||
{
|
||||
TxtEmailTip.text = checkInput();
|
||||
}
|
||||
else
|
||||
{
|
||||
TxtEmailTip.text = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TxtEmailTip.text = checkInput();
|
||||
}
|
||||
}
|
||||
|
||||
private string checkInput()
|
||||
{
|
||||
string result = string.Empty;
|
||||
string value = InputEmail1.value;
|
||||
string value2 = InputEmail2.value;
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
result = info.emailAddressTip2;
|
||||
}
|
||||
else if (!Regex.IsMatch(value, "(?i)^([a-z0-9\\+_\\-]+)(\\.[a-z0-9\\+_\\-]+)*@([a-z0-9\\-]+\\.)+[a-z]{2,6}$"))
|
||||
{
|
||||
result = info.emailAddressTip2;
|
||||
}
|
||||
else if (!value2.Equals(value))
|
||||
{
|
||||
result = info.emailAddressTip1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void UpLoadEmail(Action callback)
|
||||
{
|
||||
string text = checkInput();
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
EmailAddress = InputEmail1.value;
|
||||
callback.Call();
|
||||
return;
|
||||
}
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(info.ERROR_TITLE);
|
||||
dialogBase.SetText(text);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn);
|
||||
dialogBase.SetPanelDepth(6000);
|
||||
}
|
||||
}
|
||||
27
SVSim.BattleEngine/Engine/NullBattlePlayerVfxCreator.cs
Normal file
27
SVSim.BattleEngine/Engine/NullBattlePlayerVfxCreator.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class NullBattlePlayerVfxCreator : IBattlePlayerVfxCreator
|
||||
{
|
||||
public VfxBase CreateUsePp(int pp, int maxPp, Vector3 labelPosition, bool newReplayMoveTurn)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public VfxBase CreateUseBp(int bp, int deltaBp, Func<Vector3> getPosition, bool isVariableCost, bool isSelf)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public VfxBase CreateUpdateEp(int evolCount, int evolveWaitTurnCount)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public VfxBase CreateCardDraw(IEnumerable<BattleCardBase> cards, bool isOpenDrawSkill = false)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
}
|
||||
71
SVSim.BattleEngine/Engine/NullClassInfomationUI.cs
Normal file
71
SVSim.BattleEngine/Engine/NullClassInfomationUI.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class NullClassInfomationUI : IClassInfomationUI
|
||||
{
|
||||
private static NullClassInfomationUI _instance;
|
||||
|
||||
public static NullClassInfomationUI GetInstance()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = new NullClassInfomationUI();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
protected NullClassInfomationUI()
|
||||
{
|
||||
}
|
||||
|
||||
public void ShowInfomation(bool playEffect)
|
||||
{
|
||||
}
|
||||
|
||||
public void NewReplayUpdateInfomation(NetworkBattleReceiver.ClassInfoUiInfo classInfo)
|
||||
{
|
||||
}
|
||||
|
||||
public void HideInfomation()
|
||||
{
|
||||
}
|
||||
|
||||
public void HideOtherInfomation()
|
||||
{
|
||||
}
|
||||
|
||||
public void HideAllInfomation()
|
||||
{
|
||||
}
|
||||
|
||||
public VfxBase LoadResources(Transform parent, bool isPlayer)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public void SetUpEvent(BattlePlayerBase player)
|
||||
{
|
||||
}
|
||||
|
||||
public void Recovery()
|
||||
{
|
||||
}
|
||||
|
||||
public GameObject GetInfomationUI()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetIsSelect(bool flg)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetInCardFocus(bool flg)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetTouchable(bool flag)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
public class NullNotMulliganEndToJudgeChecker : NotMulliganEndToJudgeChecker
|
||||
{
|
||||
protected override void IntervalCheck()
|
||||
{
|
||||
}
|
||||
|
||||
public override void StartChecker(string log = "")
|
||||
{
|
||||
}
|
||||
|
||||
public override void FinishChecker()
|
||||
{
|
||||
}
|
||||
|
||||
public override void StopChecker()
|
||||
{
|
||||
}
|
||||
}
|
||||
23
SVSim.BattleEngine/Engine/NullNotTurnEndToLoseChecker.cs
Normal file
23
SVSim.BattleEngine/Engine/NullNotTurnEndToLoseChecker.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
public class NullNotTurnEndToLoseChecker : NotTurnEndToLoseChecker
|
||||
{
|
||||
public NullNotTurnEndToLoseChecker(NetworkBattleManagerBase manager)
|
||||
: base(manager)
|
||||
{
|
||||
}
|
||||
|
||||
public override void StopChecker()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void IntervalCheck()
|
||||
{
|
||||
}
|
||||
|
||||
public override void StartChecker(string log = "")
|
||||
{
|
||||
}
|
||||
|
||||
public override void FinishChecker()
|
||||
{
|
||||
}
|
||||
}
|
||||
18
SVSim.BattleEngine/Engine/NullNotTurnStartToLoseChecker.cs
Normal file
18
SVSim.BattleEngine/Engine/NullNotTurnStartToLoseChecker.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
public class NullNotTurnStartToLoseChecker : NotTurnStartToLoseChecker
|
||||
{
|
||||
public override void StopChecker()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void IntervalCheck()
|
||||
{
|
||||
}
|
||||
|
||||
public override void FinishChecker()
|
||||
{
|
||||
}
|
||||
|
||||
public override void StartChecker(string log = "")
|
||||
{
|
||||
}
|
||||
}
|
||||
506
SVSim.BattleEngine/Engine/OmotePlugin.cs
Normal file
506
SVSim.BattleEngine/Engine/OmotePlugin.cs
Normal file
@@ -0,0 +1,506 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class OmotePlugin : MonoBehaviour
|
||||
{
|
||||
public delegate void OnNotifyEnabledReceivedEventHandler(bool enabled);
|
||||
|
||||
public delegate void OnUnregisterReceivedEventHandler(bool isSuccess);
|
||||
|
||||
[Serializable]
|
||||
private class OmotenashiFirebaseOptions
|
||||
{
|
||||
public string ApiKey;
|
||||
|
||||
public string ProjectId;
|
||||
|
||||
public string ApplicationId;
|
||||
|
||||
public string SenderId;
|
||||
}
|
||||
|
||||
public delegate void OmoteEventHandler<in TEventArgs>(object sender, TEventArgs e) where TEventArgs : EventArgs;
|
||||
|
||||
public class RequestResultEventArgs : EventArgs
|
||||
{
|
||||
internal class RawData
|
||||
{
|
||||
public int type;
|
||||
|
||||
public int result;
|
||||
|
||||
public string body;
|
||||
|
||||
public string endpoint;
|
||||
|
||||
public int statusCode;
|
||||
|
||||
public string reason;
|
||||
}
|
||||
|
||||
public int Type { get; private set; }
|
||||
|
||||
public int Result { get; private set; }
|
||||
|
||||
public string Body { get; private set; }
|
||||
|
||||
public string EndPoint { get; private set; }
|
||||
|
||||
public int StatusCode { get; private set; }
|
||||
|
||||
public string Reason { get; private set; }
|
||||
|
||||
internal RequestResultEventArgs(RawData data)
|
||||
{
|
||||
Type = data.type;
|
||||
Result = data.result;
|
||||
Body = data.body;
|
||||
EndPoint = data.endpoint;
|
||||
StatusCode = data.statusCode;
|
||||
Reason = data.reason;
|
||||
}
|
||||
}
|
||||
|
||||
public class LocalNotification
|
||||
{
|
||||
private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
public string Message { get; private set; }
|
||||
|
||||
public DateTime When { get; private set; }
|
||||
|
||||
public string LabelId { get; private set; }
|
||||
|
||||
public LocalNotificationPriority Priority { get; set; }
|
||||
|
||||
public int NotificationId { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string ExtraText { get; set; }
|
||||
|
||||
public string ImagePath { get; set; }
|
||||
|
||||
public LocalNotification(string message, DateTime when, string labelId)
|
||||
{
|
||||
if (message == null)
|
||||
{
|
||||
throw new ArgumentNullException("message");
|
||||
}
|
||||
if (labelId == null)
|
||||
{
|
||||
throw new ArgumentNullException("labelId");
|
||||
}
|
||||
Message = message;
|
||||
When = when;
|
||||
LabelId = labelId;
|
||||
Priority = LocalNotificationPriority.Normal;
|
||||
ExtraText = string.Empty;
|
||||
}
|
||||
|
||||
public void Schedule()
|
||||
{
|
||||
_ = (When.ToUniversalTime() - UnixEpoch).TotalSeconds;
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Cancel(LabelId);
|
||||
}
|
||||
|
||||
public static void Cancel(string labelId)
|
||||
{
|
||||
if (labelId == null)
|
||||
{
|
||||
OmoteLog.Error("labelId must not be null.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void CancelAll()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class RegistrationTokenEventArgs : EventArgs
|
||||
{
|
||||
public string RegistrationToken { get; set; }
|
||||
}
|
||||
|
||||
public class PushNotificationEventArgs : EventArgs
|
||||
{
|
||||
internal class RawData
|
||||
{
|
||||
public string id;
|
||||
|
||||
public string message;
|
||||
|
||||
public string extra;
|
||||
}
|
||||
|
||||
public string Id { get; private set; }
|
||||
|
||||
public string Message { get; private set; }
|
||||
|
||||
public string Extra { get; private set; }
|
||||
|
||||
internal PushNotificationEventArgs(RawData data)
|
||||
{
|
||||
Id = data.id;
|
||||
Message = data.message;
|
||||
Extra = data.extra;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Id={Id}, Message={Message}, Extra={Extra}";
|
||||
}
|
||||
}
|
||||
|
||||
public class LocalNotificationEventArgs : EventArgs
|
||||
{
|
||||
internal class RawData
|
||||
{
|
||||
public string scheduleId;
|
||||
|
||||
public string label;
|
||||
|
||||
public string scheduled;
|
||||
|
||||
public string message;
|
||||
|
||||
public string extra;
|
||||
}
|
||||
|
||||
public string ScheduleId { get; private set; }
|
||||
|
||||
public string LabelId { get; private set; }
|
||||
|
||||
public DateTime ScheduledAt { get; private set; }
|
||||
|
||||
public string MessageText { get; private set; }
|
||||
|
||||
public string ExtraText { get; private set; }
|
||||
|
||||
internal LocalNotificationEventArgs(RawData data)
|
||||
{
|
||||
ScheduleId = data.scheduleId;
|
||||
LabelId = data.label;
|
||||
ScheduledAt = DateTime.Parse(data.scheduled);
|
||||
MessageText = data.message;
|
||||
ExtraText = data.extra;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"MessageText={MessageText}, ScheduledAt={ScheduledAt}, LabelId={LabelId}, ScheduleId={ScheduleId}, ExtraText={ExtraText}";
|
||||
}
|
||||
}
|
||||
|
||||
public class NotificationChangedEventArgs : EventArgs
|
||||
{
|
||||
internal class RawData
|
||||
{
|
||||
public bool result;
|
||||
}
|
||||
|
||||
public bool Result { get; private set; }
|
||||
|
||||
internal NotificationChangedEventArgs(RawData data)
|
||||
{
|
||||
Result = data.result;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Result={Result}";
|
||||
}
|
||||
}
|
||||
|
||||
public delegate void OnRegistrationTokenReceivedEventHandler(object sender, RegistrationTokenEventArgs e);
|
||||
|
||||
public delegate void OnFailToRegisterForRemoteNotificationsEventHandler(object sender, string e);
|
||||
|
||||
[SerializeField]
|
||||
private OmotenashiFirebaseOptions omotenashiFirebaseOptions;
|
||||
|
||||
[SerializeField]
|
||||
private bool IsAutomatic = true;
|
||||
|
||||
public string country;
|
||||
|
||||
public event OnNotifyEnabledReceivedEventHandler OnNotificationReceived;
|
||||
|
||||
public event OnUnregisterReceivedEventHandler OnUnregisterReceived;
|
||||
|
||||
public event OmoteEventHandler<RequestResultEventArgs> OnRequestResult;
|
||||
|
||||
public event OnRegistrationTokenReceivedEventHandler OnRegistrationTokenReceived;
|
||||
|
||||
public event OmoteEventHandler<PushNotificationEventArgs> OnReceivedPushNotification;
|
||||
|
||||
public event OmoteEventHandler<LocalNotificationEventArgs> OnReceivedLocalNotification;
|
||||
|
||||
public event OmoteEventHandler<PushNotificationEventArgs> OnLaunchFromPushNotification;
|
||||
|
||||
public event OmoteEventHandler<LocalNotificationEventArgs> OnLaunchFromLocalNotification;
|
||||
|
||||
public event OmoteEventHandler<NotificationChangedEventArgs> OnNotificationEnableChanged;
|
||||
|
||||
public event OmoteEventHandler<NotificationChangedEventArgs> OnNotificationCountryChanged;
|
||||
|
||||
public event OnFailToRegisterForRemoteNotificationsEventHandler OnFailToRegisterForRemoteNotifications;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
}
|
||||
|
||||
private void AwakePush(OmotenashiFirebaseOptions options, AndroidJavaObject baseObject)
|
||||
{
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
StartPush();
|
||||
}
|
||||
|
||||
private void StartPush()
|
||||
{
|
||||
if (string.IsNullOrEmpty(country))
|
||||
{
|
||||
OmoteLog.Error("Country code is not set.");
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSandbox(bool isSandbox)
|
||||
{
|
||||
OmoteLog.Info("setDebugMode(isDebuggable: {0}) called.", isSandbox);
|
||||
}
|
||||
|
||||
public void SetDebugLogEnabled(bool isEnabled)
|
||||
{
|
||||
OmoteLog.SetEnable(isEnabled);
|
||||
OmoteLog.Info("setDebugLogEnabled(isEnabled: {0}) called.", isEnabled);
|
||||
}
|
||||
|
||||
public void SendConversion(string appViewerId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(appViewerId))
|
||||
{
|
||||
OmoteLog.Error("appViewerId is not set.");
|
||||
return;
|
||||
}
|
||||
OmoteLog.Info("SendConversion(appViewerId: {0}) called.", appViewerId);
|
||||
}
|
||||
|
||||
public void SendSession(string userId, string deviceId)
|
||||
{
|
||||
OmoteLog.Info("SendSession({0}, {1}) called.", userId, deviceId);
|
||||
}
|
||||
|
||||
public void SetRequestEnabled(bool isEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsRequestEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void CallbackUnregister(string isSuccess)
|
||||
{
|
||||
if (this.OnUnregisterReceived != null)
|
||||
{
|
||||
if (isSuccess.Equals("Success"))
|
||||
{
|
||||
OmoteLog.Info("Unregister: Success");
|
||||
this.OnUnregisterReceived(isSuccess: true);
|
||||
}
|
||||
else if (isSuccess.Equals("Fail"))
|
||||
{
|
||||
OmoteLog.Info("Unregister: Fail");
|
||||
this.OnUnregisterReceived(isSuccess: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
OmoteLog.Info("Unregister: unknown {0}", isSuccess);
|
||||
this.OnUnregisterReceived(isSuccess: false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OmoteLog.Info("Unregister: delegate is null");
|
||||
}
|
||||
}
|
||||
|
||||
public void GetNotificationEnabled()
|
||||
{
|
||||
if (this.OnNotificationReceived != null)
|
||||
{
|
||||
this.OnNotificationReceived(enabled: true);
|
||||
}
|
||||
}
|
||||
|
||||
private void InvokeFromJson<TArg, TRaw>(string json, Func<TRaw, TArg> argsCreator, OmoteEventHandler<TArg> action) where TArg : EventArgs
|
||||
{
|
||||
OmoteLog.Info("{0}", json);
|
||||
TRaw arg = JsonUtility.FromJson<TRaw>(json);
|
||||
TArg val = argsCreator(arg);
|
||||
OmoteLog.Info("{0}", val);
|
||||
action?.Invoke(this, val);
|
||||
}
|
||||
|
||||
public void CallStartPush()
|
||||
{
|
||||
StartPush();
|
||||
}
|
||||
|
||||
public void Unregister(bool isLocalOnly)
|
||||
{
|
||||
CallbackUnregister("Success");
|
||||
}
|
||||
|
||||
private void CallbackOnRequestResult(string json)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnRequestResult.");
|
||||
InvokeFromJson(json, (RequestResultEventArgs.RawData raw) => new RequestResultEventArgs(raw), this.OnRequestResult);
|
||||
}
|
||||
|
||||
private void OnApplicationPause(bool pause)
|
||||
{
|
||||
}
|
||||
|
||||
public bool CanScheduleExactAlarms()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RescheduleLocalNotification()
|
||||
{
|
||||
}
|
||||
|
||||
public void OpenExactAlarmSettings()
|
||||
{
|
||||
}
|
||||
|
||||
[Obsolete("Use LocalNotificationBuilder.")]
|
||||
public void ScheduleLocalNotification(string messageText, DateTime dateTime, string labelId, LocalNotificationPriority priority, int notificationId)
|
||||
{
|
||||
ScheduleLocalNotification(messageText, dateTime, labelId, priority, notificationId, string.Empty);
|
||||
}
|
||||
|
||||
[Obsolete("Use LocalNotificationBuilder.")]
|
||||
public void ScheduleLocalNotification(string messageText, DateTime date, string labelId, LocalNotificationPriority priority, int notificationId, string extraText)
|
||||
{
|
||||
LocalNotification localNotification = new LocalNotification(messageText, date, labelId);
|
||||
localNotification.Priority = priority;
|
||||
localNotification.NotificationId = notificationId;
|
||||
localNotification.ExtraText = extraText;
|
||||
localNotification.Schedule();
|
||||
}
|
||||
|
||||
[Obsolete("Use OmotePlugin.Localnotification.Cancel(string)")]
|
||||
public void CancelLocalNotification(string labelId)
|
||||
{
|
||||
LocalNotification.Cancel(labelId);
|
||||
}
|
||||
|
||||
[Obsolete("Use OmotePlugin.Localnotificatin.CancelAll()")]
|
||||
public void CancelAllLocalNotification()
|
||||
{
|
||||
LocalNotification.CancelAll();
|
||||
}
|
||||
|
||||
private void OnApnsTokenReceived(string token)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetNotificationsEnabled(bool enabled)
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsNotificationsEnabled()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdateCountry(string country)
|
||||
{
|
||||
if (string.IsNullOrEmpty(country))
|
||||
{
|
||||
OmoteLog.Error("country must not be null nor empty.");
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterForRemoteNotification()
|
||||
{
|
||||
}
|
||||
|
||||
public bool isNotificationAuthorized()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RequestNotificationPermission()
|
||||
{
|
||||
}
|
||||
|
||||
private void CallbackOnTokenReceived(string token)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
RegistrationTokenEventArgs e = new RegistrationTokenEventArgs
|
||||
{
|
||||
RegistrationToken = token
|
||||
};
|
||||
if (this.OnRegistrationTokenReceived != null)
|
||||
{
|
||||
this.OnRegistrationTokenReceived(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CallbackOnReceivedPushNotificationInForeground(string json)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnReceivedPushNotificationInForeground.");
|
||||
InvokeFromJson(json, (PushNotificationEventArgs.RawData raw) => new PushNotificationEventArgs(raw), this.OnReceivedPushNotification);
|
||||
}
|
||||
|
||||
private void CallbackOnReceivedLocalNotificationInForeground(string json)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnReceivedLocalNotificationInForeground.");
|
||||
InvokeFromJson(json, (LocalNotificationEventArgs.RawData raw) => new LocalNotificationEventArgs(raw), this.OnReceivedLocalNotification);
|
||||
}
|
||||
|
||||
private void CallbackOnLaunchFromPushNotification(string json)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnLaunchFromPushNotification.");
|
||||
InvokeFromJson(json, (PushNotificationEventArgs.RawData raw) => new PushNotificationEventArgs(raw), this.OnLaunchFromPushNotification);
|
||||
}
|
||||
|
||||
private void CallbackOnLaunchFromLocalNotification(string json)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnLaunchFromLocalNotification.");
|
||||
InvokeFromJson(json, (LocalNotificationEventArgs.RawData raw) => new LocalNotificationEventArgs(raw), this.OnLaunchFromLocalNotification);
|
||||
}
|
||||
|
||||
private void CallbackOnNotificationEnableChanged(string json)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnNotificationEnableChanged.");
|
||||
InvokeFromJson(json, (NotificationChangedEventArgs.RawData raw) => new NotificationChangedEventArgs(raw), this.OnNotificationEnableChanged);
|
||||
}
|
||||
|
||||
private void CallbackOnNotificationCountryChanged(string json)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnNotificationCountryChanged");
|
||||
InvokeFromJson(json, (NotificationChangedEventArgs.RawData raw) => new NotificationChangedEventArgs(raw), this.OnNotificationCountryChanged);
|
||||
}
|
||||
|
||||
private void CallbackOnFailToRegisterForRemoteNotifications(string errorString)
|
||||
{
|
||||
OmoteLog.Info("CallbackOnFailToRegisterForRemoteNotifications.");
|
||||
if (errorString != null && this.OnFailToRegisterForRemoteNotifications != null)
|
||||
{
|
||||
this.OnFailToRegisterForRemoteNotifications(this, errorString);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
SVSim.BattleEngine/Engine/Payment.cs
Normal file
43
SVSim.BattleEngine/Engine/Payment.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using Wizard;
|
||||
|
||||
public static class Payment
|
||||
{
|
||||
private static bool initialized;
|
||||
|
||||
public static void initialize(PaymentImpl callback, string productKey)
|
||||
{
|
||||
PaymentImpl.GetInstance().paymentUI.StartLoading();
|
||||
_ = initialized;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
public static void finalize()
|
||||
{
|
||||
if (initialized)
|
||||
{
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void purchaseProduct(string productId, PaymentBase.RefundWarningType refundWarningType)
|
||||
{
|
||||
RefundWarningDialog.Start(refundWarningType, delegate
|
||||
{
|
||||
PaymentImpl.GetInstance().paymentUI.StartLoading(useTimeCount: true);
|
||||
});
|
||||
}
|
||||
|
||||
public static void getProductList(string[] productIds)
|
||||
{
|
||||
PaymentImpl.GetInstance().paymentUI.StartLoading(useTimeCount: true, forProductListInit: true);
|
||||
}
|
||||
|
||||
public static void consumePurchase(string[] productIds, string orderId)
|
||||
{
|
||||
PaymentImpl.GetInstance().paymentUI.StartLoading(useTimeCount: true);
|
||||
}
|
||||
|
||||
public static void UseDebugLog(bool useDebugLog)
|
||||
{
|
||||
}
|
||||
}
|
||||
23
SVSim.BattleEngine/Engine/PaymentBase.cs
Normal file
23
SVSim.BattleEngine/Engine/PaymentBase.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PaymentBase : MonoBehaviour
|
||||
{
|
||||
public enum RefundWarningType
|
||||
{
|
||||
NONE,
|
||||
WARNING,
|
||||
PENALTY
|
||||
}
|
||||
|
||||
protected bool IsAlertAgree;
|
||||
|
||||
protected void CallPaymentStartFromAlert(string ProductId)
|
||||
{
|
||||
IsAlertAgree = true;
|
||||
purchaceStart(ProductId, isFromAlert: true);
|
||||
}
|
||||
|
||||
public virtual void purchaceStart(string ProductId, bool isFromAlert = false)
|
||||
{
|
||||
}
|
||||
}
|
||||
585
SVSim.BattleEngine/Engine/PaymentImpl.cs
Normal file
585
SVSim.BattleEngine/Engine/PaymentImpl.cs
Normal file
@@ -0,0 +1,585 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using Cute.Payment;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class PaymentImpl : PaymentBase, IPaymentCallback, IPaymentCommonCallback
|
||||
{
|
||||
public enum PaymentOriginalScreen
|
||||
{
|
||||
SHOP_PLUS,
|
||||
MYPAGE,
|
||||
NONE
|
||||
}
|
||||
|
||||
public List<string> ProductIdList;
|
||||
|
||||
public List<string> IdList;
|
||||
|
||||
public Dictionary<string, string> ProductPriceList;
|
||||
|
||||
public Dictionary<string, string> FormatProductPriceList;
|
||||
|
||||
public Dictionary<string, string> ProductNameList;
|
||||
|
||||
public Dictionary<string, string> ProductTextList;
|
||||
|
||||
public Dictionary<string, string> ProductPurchaseLimitList;
|
||||
|
||||
public Dictionary<string, string> ProductPurchaseNumberList;
|
||||
|
||||
public Dictionary<string, string> ProductCsvIdList;
|
||||
|
||||
public Dictionary<string, string> ProductImageNameList;
|
||||
|
||||
public Dictionary<string, bool> ProductIsSpecialShop;
|
||||
|
||||
public Dictionary<string, int> ProductCurrentPurchaseCount;
|
||||
|
||||
public Dictionary<string, int> ProductPurchaseLimitCount;
|
||||
|
||||
public Dictionary<string, string> ProductEndTime;
|
||||
|
||||
private string lastErrorMethod;
|
||||
|
||||
private string lastErrorMessage;
|
||||
|
||||
private long lastLogTimeTicks = DateTime.Now.Ticks;
|
||||
|
||||
private int sameLogCount;
|
||||
|
||||
public PaymentOriginalScreen PaymentFromScreen;
|
||||
|
||||
public List<PaymentSkuInfo> skuInfos;
|
||||
|
||||
public string selectedStoreProductId;
|
||||
|
||||
public List<PaymentPurchase> lastSucceededPurchases = new List<PaymentPurchase>();
|
||||
|
||||
public int resumePurchaseTransactionCount;
|
||||
|
||||
public bool inProcessingResumePurchaseTransaction;
|
||||
|
||||
public bool inProcessingPurchaseTransaction;
|
||||
|
||||
public bool isPaymentListErrorDialogOpen;
|
||||
|
||||
private bool _receivePaymentSuccess;
|
||||
|
||||
private bool _receivePaymentCancel;
|
||||
|
||||
private static PaymentImpl instance;
|
||||
|
||||
private bool isCountTime;
|
||||
|
||||
private bool isCountTimeForProductListInit;
|
||||
|
||||
private float timer;
|
||||
|
||||
public string StoreProductCountryCode { get; private set; }
|
||||
|
||||
public string StoreProductCurrencyCode { get; private set; }
|
||||
|
||||
public bool IsRefundedReceipt { get; private set; }
|
||||
|
||||
public PaymentUI paymentUI { get; private set; }
|
||||
|
||||
public event Action ProductListSucceeded;
|
||||
|
||||
public event Action ProductListFailed;
|
||||
|
||||
public event Action<string> FinishFailureEvent;
|
||||
|
||||
public event Action<NetworkTask.ResultCode> purchaseFinishSuccessEvent;
|
||||
|
||||
public event Action<NetworkTask.ResultCode> purchaseFinishHttpErrorEvent;
|
||||
|
||||
public event Action<int> purchaseFinishResultCodeErrorEvent;
|
||||
|
||||
public event Action purchaseRetryResultEvent;
|
||||
|
||||
public event Action ConsumePurchaseSucceeded;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (paymentUI == null)
|
||||
{
|
||||
paymentUI = new PaymentUI();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isCountTime)
|
||||
{
|
||||
checkTimeOut();
|
||||
}
|
||||
}
|
||||
|
||||
public static PaymentImpl GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
GameObject obj = new GameObject("PaymentImpl");
|
||||
UnityEngine.Object.DontDestroyOnLoad(obj);
|
||||
instance = obj.AddComponent<PaymentImpl>();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void OnItemListFailure(NetworkTask.ResultCode code)
|
||||
{
|
||||
Debug.LogError("OnItemListFailure" + code);
|
||||
Debug.LogError("プロダクトIDリストリクエストが失敗しました。やり直してください。");
|
||||
}
|
||||
|
||||
private void OnItemListResultCodeError(int code)
|
||||
{
|
||||
Debug.LogError("OnItemListResultCodeError" + code);
|
||||
this.ProductListFailed.Call();
|
||||
}
|
||||
|
||||
private void OnFinishSuccess(NetworkTask.ResultCode code)
|
||||
{
|
||||
string[] array = new string[lastSucceededPurchases.Count];
|
||||
for (int i = 0; i < lastSucceededPurchases.Count; i++)
|
||||
{
|
||||
array[i] = lastSucceededPurchases[i].getProductId();
|
||||
}
|
||||
string orderId = ((lastSucceededPurchases.Count > 0) ? lastSucceededPurchases[0].getOrderId() : "");
|
||||
Payment.consumePurchase(array, orderId);
|
||||
}
|
||||
|
||||
private void OnFinishFailure(NetworkTask.ResultCode code)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
Debug.LogError("OnFinishFailure:" + code);
|
||||
if (this.purchaseFinishHttpErrorEvent != null)
|
||||
{
|
||||
this.purchaseFinishHttpErrorEvent(code);
|
||||
}
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
|
||||
private void OnFinishResultCodeError(int resultCode)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
Debug.LogError("OnFinishResultCodeError" + resultCode);
|
||||
Debug.LogError("チェック不正です。");
|
||||
if (this.purchaseFinishResultCodeErrorEvent != null)
|
||||
{
|
||||
this.purchaseFinishResultCodeErrorEvent(resultCode);
|
||||
}
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
|
||||
public void OnPaymentCancelByRefundWarningDialog()
|
||||
{
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
|
||||
public void evInitializeSucceeded()
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
Payment.getProductList(ProductIdList.ToArray());
|
||||
}
|
||||
|
||||
public void OnInitializeSucceeded()
|
||||
{
|
||||
evInitializeSucceeded();
|
||||
}
|
||||
|
||||
public void evInitializeFailed(string error)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
sendPaymentErrorLog("evInitializeFailed", error);
|
||||
this.ProductListFailed.Call();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnInitializeFailed(int errorCode, string errorMessage)
|
||||
{
|
||||
evInitializeFailed(errorMessage);
|
||||
}
|
||||
|
||||
public void evPurchaseSucceeded(PaymentPurchase purchase)
|
||||
{
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
_receivePaymentSuccess = true;
|
||||
lastSucceededPurchases.Add(purchase);
|
||||
selectedStoreProductId = purchase.getProductId();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPurchaseFailed(string error)
|
||||
{
|
||||
evPurchaseFailed(error);
|
||||
}
|
||||
|
||||
public void OnPurchaseFailed(int errorCode, string errorMessage)
|
||||
{
|
||||
evPurchaseFailed(errorCode + ":" + errorMessage);
|
||||
}
|
||||
|
||||
public void evPurchaseFailed(string error)
|
||||
{
|
||||
if (BattleManagerBase.GetIns() != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
paymentUI.StopLoading();
|
||||
string message = paymentUI.GetText("Shop_0072");
|
||||
if (_receivePaymentCancel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_receivePaymentCancel = true;
|
||||
PaymentCancelTask paymentCancelTask = new PaymentCancelTask();
|
||||
paymentCancelTask.SetParameter(getSkuInfo(GetInstance().selectedStoreProductId), error);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(paymentCancelTask, delegate
|
||||
{
|
||||
if (!error.Contains("Received a pending purchase of SKU:") && !_receivePaymentSuccess)
|
||||
{
|
||||
if (this.FinishFailureEvent != null)
|
||||
{
|
||||
this.FinishFailureEvent(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
paymentUI.PurchaseFailed();
|
||||
}
|
||||
}
|
||||
}, delegate
|
||||
{
|
||||
}, delegate(int code)
|
||||
{
|
||||
Debug.LogError("OnPurchaseFailedCancelTaskResultCodeError" + code);
|
||||
}));
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
|
||||
public void OnPurchaseCancelled(string productId, string price, string currencyCode)
|
||||
{
|
||||
evPurchaseCancelled("");
|
||||
}
|
||||
|
||||
public void evPurchaseCancelled(string error)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
string message = paymentUI.GetText("Shop_0073");
|
||||
PaymentCancelTask paymentCancelTask = new PaymentCancelTask();
|
||||
paymentCancelTask.SetParameter(getSkuInfo(GetInstance().selectedStoreProductId), error);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(paymentCancelTask, delegate
|
||||
{
|
||||
if (this.FinishFailureEvent != null)
|
||||
{
|
||||
this.FinishFailureEvent(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
paymentUI.PurchaseCancelled();
|
||||
}
|
||||
}, delegate
|
||||
{
|
||||
}, delegate(int code)
|
||||
{
|
||||
Debug.LogError("OnCancelResultCodeError" + code);
|
||||
}));
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
|
||||
public void OnGetProductListSucceeded(List<PaymentSkuInfo> productInfo, bool waitUnfinishedTransaction)
|
||||
{
|
||||
evGetProductListSucceeded(productInfo);
|
||||
}
|
||||
|
||||
public void evGetProductListSucceeded(List<PaymentSkuInfo> infos)
|
||||
{
|
||||
skuInfos = infos;
|
||||
string text = "アイテムリストを取得しました" + Environment.NewLine;
|
||||
ProductPriceList.Clear();
|
||||
FormatProductPriceList.Clear();
|
||||
int count = infos.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
ProductPriceList.Add(infos[i].productId, infos[i].price);
|
||||
FormatProductPriceList.Add(infos[i].productId, infos[i].formattedPrice);
|
||||
StoreProductCountryCode = infos[i].currencyCode;
|
||||
StoreProductCurrencyCode = infos[i].currencyCode;
|
||||
if (!string.IsNullOrEmpty(StoreProductCountryCode))
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.CURRENT_REGION_CODE, StoreProductCountryCode);
|
||||
}
|
||||
text = text + " " + infos[i].title + " : " + infos[i].formattedPrice + Environment.NewLine;
|
||||
}
|
||||
if (!inProcessingResumePurchaseTransaction)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGetProductListFailed(int errorCode, string errorMessage)
|
||||
{
|
||||
evGetProductListFailed(errorCode + ":" + errorMessage);
|
||||
}
|
||||
|
||||
public void evGetProductListFailed(string error)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
sendPaymentErrorLog("evGetProductListFailed", error);
|
||||
this.ProductListFailed.Call();
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnConsumePurchaseSucceeded()
|
||||
{
|
||||
evConsumePurchaseSucceeded();
|
||||
}
|
||||
|
||||
public void evConsumePurchaseSucceeded()
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
lastSucceededPurchases.Clear();
|
||||
this.ConsumePurchaseSucceeded.Call();
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
|
||||
public void OnConsumePurchaseFailed(int errorCode, string errorMessage)
|
||||
{
|
||||
evConsumePurchaseFailed(errorCode + ":" + errorMessage);
|
||||
}
|
||||
|
||||
public void evConsumePurchaseFailed(string error)
|
||||
{
|
||||
paymentUI.StopLoading();
|
||||
sendPaymentErrorLog("evConsumePurchaseFailed", error);
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}
|
||||
|
||||
public void evConsumePurchaseSucceedediOS()
|
||||
{
|
||||
}
|
||||
|
||||
public void TryToShowBuyResultPopUp(int amount, int sum, bool isRefundedReceipt = false)
|
||||
{
|
||||
IsRefundedReceipt = isRefundedReceipt;
|
||||
if (this.purchaseFinishSuccessEvent != null)
|
||||
{
|
||||
this.purchaseFinishSuccessEvent(NetworkTask.ResultCode.Success);
|
||||
return;
|
||||
}
|
||||
string value = "";
|
||||
ProductNameList.TryGetValue(selectedStoreProductId, out value);
|
||||
paymentUI.PurchaseFinished(value, amount, sum, isRefundedReceipt);
|
||||
}
|
||||
|
||||
public void TryToShowBuyResultPopUpSecond(bool isRefundedReceipt = false)
|
||||
{
|
||||
IsRefundedReceipt = isRefundedReceipt;
|
||||
string value = "";
|
||||
ProductNameList.TryGetValue(selectedStoreProductId, out value);
|
||||
paymentUI.PurchaseFinished(value, 0, 0, isRefundedReceipt);
|
||||
if (this.purchaseRetryResultEvent != null)
|
||||
{
|
||||
this.purchaseRetryResultEvent();
|
||||
}
|
||||
}
|
||||
|
||||
public override void purchaceStart(string storeProductId, bool isFromAlert = false)
|
||||
{
|
||||
if (inProcessingPurchaseTransaction)
|
||||
{
|
||||
return;
|
||||
}
|
||||
inProcessingPurchaseTransaction = true;
|
||||
string message = "";
|
||||
if (false)
|
||||
{
|
||||
sendPaymentErrorLog("purchaceStart", message);
|
||||
if (this.FinishFailureEvent != null)
|
||||
{
|
||||
string text = paymentUI.GetText("Shop_0072");
|
||||
this.FinishFailureEvent(string.Format(text, resumePurchaseTransactionCount));
|
||||
}
|
||||
else
|
||||
{
|
||||
paymentUI.PurchaseFailed();
|
||||
}
|
||||
inProcessingPurchaseTransaction = false;
|
||||
return;
|
||||
}
|
||||
_receivePaymentSuccess = false;
|
||||
_receivePaymentCancel = false;
|
||||
bool isAlertOn = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PURCHASE_ALERT);
|
||||
if (!isFromAlert)
|
||||
{
|
||||
IsAlertAgree = false;
|
||||
}
|
||||
PaymentStartTask task = new PaymentStartTask();
|
||||
task.SetParameter(getSkuInfo(storeProductId), IsAlertAgree, isAlertOn);
|
||||
task.SkipAllCuteResultCodeCheckErrorPopup();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
Payment.purchaseProduct(storeProductId, task.NeedRefundWarningType);
|
||||
}, delegate
|
||||
{
|
||||
inProcessingPurchaseTransaction = false;
|
||||
}, delegate(int code)
|
||||
{
|
||||
inProcessingPurchaseTransaction = false;
|
||||
if (code == 329)
|
||||
{
|
||||
if (isAlertOn)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(DialogBase.Size.S);
|
||||
dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0329"));
|
||||
dialogBase.SetText(systemText.Get("Error_0329"));
|
||||
dialogBase.SetButtonText(systemText.Get("Shop_0082"));
|
||||
dialogBase.SetFadeButtonEnabled(flag: false);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetPanelDepth(6000);
|
||||
dialogBase.SetPanelSortingOrder(2);
|
||||
dialogBase.SetButtonDelegate(new EventDelegate(delegate
|
||||
{
|
||||
CallPaymentStartFromAlert(storeProductId);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
CallPaymentStartFromAlert(storeProductId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toolbox.NetworkManager.NetworkUI.OpenCloseOnlyErrorPopUp(code);
|
||||
}
|
||||
}));
|
||||
selectedStoreProductId = storeProductId;
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
{
|
||||
if (!inProcessingPurchaseTransaction)
|
||||
{
|
||||
this.ProductListSucceeded = null;
|
||||
this.ProductListFailed = null;
|
||||
this.FinishFailureEvent = null;
|
||||
this.purchaseFinishSuccessEvent = null;
|
||||
this.purchaseFinishHttpErrorEvent = null;
|
||||
this.purchaseFinishResultCodeErrorEvent = null;
|
||||
this.purchaseRetryResultEvent = null;
|
||||
this.ConsumePurchaseSucceeded = null;
|
||||
ProductIdList = new List<string>();
|
||||
IdList = new List<string>();
|
||||
ProductNameList = new Dictionary<string, string>();
|
||||
ProductPriceList = new Dictionary<string, string>();
|
||||
FormatProductPriceList = new Dictionary<string, string>();
|
||||
ProductTextList = new Dictionary<string, string>();
|
||||
ProductPurchaseLimitList = new Dictionary<string, string>();
|
||||
ProductPurchaseNumberList = new Dictionary<string, string>();
|
||||
ProductCsvIdList = new Dictionary<string, string>();
|
||||
ProductImageNameList = new Dictionary<string, string>();
|
||||
ProductIsSpecialShop = new Dictionary<string, bool>();
|
||||
ProductCurrentPurchaseCount = new Dictionary<string, int>();
|
||||
ProductPurchaseLimitCount = new Dictionary<string, int>();
|
||||
lastSucceededPurchases = new List<PaymentPurchase>();
|
||||
ProductEndTime = new Dictionary<string, string>();
|
||||
PaymentItemListTask task = new PaymentItemListTask();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
Payment.initialize(GetInstance(), "");
|
||||
}, OnItemListFailure, OnItemListResultCodeError));
|
||||
}
|
||||
}
|
||||
|
||||
public void finalize()
|
||||
{
|
||||
inProcessingPurchaseTransaction = false;
|
||||
inProcessingResumePurchaseTransaction = false;
|
||||
resumePurchaseTransactionCount = 0;
|
||||
this.ProductListSucceeded = null;
|
||||
this.ProductListFailed = null;
|
||||
this.FinishFailureEvent = null;
|
||||
this.purchaseFinishSuccessEvent = null;
|
||||
this.purchaseFinishHttpErrorEvent = null;
|
||||
this.purchaseFinishResultCodeErrorEvent = null;
|
||||
this.purchaseRetryResultEvent = null;
|
||||
this.ConsumePurchaseSucceeded = null;
|
||||
Payment.finalize();
|
||||
}
|
||||
|
||||
public void StartTimeCount(bool forProductListInit = false)
|
||||
{
|
||||
isCountTime = true;
|
||||
isCountTimeForProductListInit = forProductListInit;
|
||||
}
|
||||
|
||||
public void StopTimeCount()
|
||||
{
|
||||
isCountTime = false;
|
||||
timer = 0f;
|
||||
}
|
||||
|
||||
private void checkTimeOut()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
if (!(timer >= 30f))
|
||||
{
|
||||
return;
|
||||
}
|
||||
timer = 0f;
|
||||
paymentUI.StopLoading();
|
||||
if (isCountTimeForProductListInit)
|
||||
{
|
||||
if (PaymentFromScreen == PaymentOriginalScreen.SHOP_PLUS)
|
||||
{
|
||||
paymentUI.ProductListInitTimeOut();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
paymentUI.PurchaseTimeOut();
|
||||
}
|
||||
}
|
||||
|
||||
public PaymentSkuInfo getSkuInfo(PaymentPurchase purchase)
|
||||
{
|
||||
return skuInfos.Find((PaymentSkuInfo x) => x.productId == purchase.getProductId());
|
||||
}
|
||||
|
||||
public PaymentSkuInfo getSkuInfo(string productId)
|
||||
{
|
||||
return skuInfos.Find((PaymentSkuInfo x) => x.productId == productId);
|
||||
}
|
||||
|
||||
public bool isGoogleReward(string productId)
|
||||
{
|
||||
return productId.EndsWith(".rew");
|
||||
}
|
||||
|
||||
private void sendPaymentErrorLog(string method, string message)
|
||||
{
|
||||
long ticks = DateTime.Now.Ticks;
|
||||
if (method == lastErrorMethod && message == lastErrorMessage && ticks - lastLogTimeTicks < 600000000)
|
||||
{
|
||||
sameLogCount++;
|
||||
return;
|
||||
}
|
||||
LocalLog.AccumulateTraceLog(((sameLogCount > 0) ? $"same log : {sameLogCount}\n" : string.Empty) + "\n method:" + method + " message: " + message);
|
||||
lastLogTimeTicks = ticks;
|
||||
lastErrorMethod = method;
|
||||
lastErrorMessage = message;
|
||||
sameLogCount = 0;
|
||||
}
|
||||
}
|
||||
289
SVSim.BattleEngine/Engine/PaymentPC.cs
Normal file
289
SVSim.BattleEngine/Engine/PaymentPC.cs
Normal file
@@ -0,0 +1,289 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using Steamworks;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class PaymentPC : PaymentBase
|
||||
{
|
||||
public List<string> ProductIdList;
|
||||
|
||||
public List<string> IdList;
|
||||
|
||||
public Dictionary<string, string> ProductPriceList;
|
||||
|
||||
public Dictionary<string, string> FormatProductPriceList;
|
||||
|
||||
public Dictionary<string, string> ProductNameList;
|
||||
|
||||
public Dictionary<string, string> ProductTextList;
|
||||
|
||||
public Dictionary<string, string> ProductPurchaseLimitList;
|
||||
|
||||
public Dictionary<string, string> ProductPurchaseNumberList;
|
||||
|
||||
public Dictionary<string, string> ProductCsvIdList;
|
||||
|
||||
public Dictionary<string, string> ProductImageNameList;
|
||||
|
||||
public Dictionary<string, bool> ProductIsSpecialShop;
|
||||
|
||||
public Dictionary<string, int> ProductCurrentPurchaseCount;
|
||||
|
||||
public Dictionary<string, int> ProductPurchaseLimitCount;
|
||||
|
||||
public Dictionary<string, string> ProductEndTime;
|
||||
|
||||
public string selectedStoreProductId;
|
||||
|
||||
private static PaymentPC instance;
|
||||
|
||||
private bool isCountTime;
|
||||
|
||||
private float timer;
|
||||
|
||||
protected Callback<MicroTxnAuthorizationResponse_t> m_MicroTxnAuthorizationResponse;
|
||||
|
||||
public PaymentUI paymentUI { get; private set; }
|
||||
|
||||
public event Action ProductListSucceeded;
|
||||
|
||||
public event Action ProductListFailed;
|
||||
|
||||
public event Action<string> FinishFailureEvent;
|
||||
|
||||
public event Action<NetworkTask.ResultCode> purchaseFinishSuccessEvent;
|
||||
|
||||
public event Action<NetworkTask.ResultCode> purchaseFinishHttpErrorEvent;
|
||||
|
||||
public event Action<int> purchaseFinishResultCodeErrorEvent;
|
||||
|
||||
public event Action purchaseRetryResultEvent;
|
||||
|
||||
public event Action ConsumePurchaseSucceeded;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (paymentUI == null)
|
||||
{
|
||||
paymentUI = new PaymentUI();
|
||||
}
|
||||
m_MicroTxnAuthorizationResponse = Callback<MicroTxnAuthorizationResponse_t>.Create(OnMicroTxnAuthorizationResponse);
|
||||
}
|
||||
|
||||
private void OnMicroTxnAuthorizationResponse(MicroTxnAuthorizationResponse_t pCallback)
|
||||
{
|
||||
if (!Convert.ToBoolean(pCallback.m_bAuthorized))
|
||||
{
|
||||
return;
|
||||
}
|
||||
PaymentPCFinishTask paymentPCFinishTask = new PaymentPCFinishTask();
|
||||
paymentPCFinishTask.SetParameter(selectedStoreProductId, pCallback.m_unAppID.ToString(), pCallback.m_ulOrderID.ToString());
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(paymentPCFinishTask, delegate
|
||||
{
|
||||
string value = "";
|
||||
ProductNameList.TryGetValue(selectedStoreProductId, out value);
|
||||
if (!ProductIsSpecialShop[selectedStoreProductId])
|
||||
{
|
||||
paymentUI.PurchaseFinished(value);
|
||||
}
|
||||
if (this.ConsumePurchaseSucceeded != null)
|
||||
{
|
||||
this.ConsumePurchaseSucceeded();
|
||||
}
|
||||
}, paymentUI.PurchaseFailedPC));
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isCountTime)
|
||||
{
|
||||
checkTimeOut();
|
||||
}
|
||||
SteamAPI.RunCallbacks();
|
||||
}
|
||||
|
||||
public static PaymentPC GetInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
GameObject obj = new GameObject("PaymentPC");
|
||||
UnityEngine.Object.DontDestroyOnLoad(obj);
|
||||
instance = obj.AddComponent<PaymentPC>();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private void OnItemListFailure(NetworkTask.ResultCode code)
|
||||
{
|
||||
Debug.LogError("OnItemListFailure" + code);
|
||||
Debug.LogError("プロダクトIDリストリクエストが失敗しました。やり直してください。");
|
||||
}
|
||||
|
||||
private void OnItemListResultCodeError(int code)
|
||||
{
|
||||
Debug.LogError("OnItemListResultCodeError" + code);
|
||||
if (this.ProductListFailed != null)
|
||||
{
|
||||
this.ProductListFailed();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFinishResultCodeError(int resultCode)
|
||||
{
|
||||
Debug.LogError("OnFinishResultCodeError" + resultCode);
|
||||
Debug.LogError("チェック不正です。");
|
||||
if (this.purchaseFinishResultCodeErrorEvent != null)
|
||||
{
|
||||
this.purchaseFinishResultCodeErrorEvent(resultCode);
|
||||
}
|
||||
}
|
||||
|
||||
public override void purchaceStart(string ProductId, bool isFromAlert = false)
|
||||
{
|
||||
if (!isFromAlert)
|
||||
{
|
||||
IsAlertAgree = false;
|
||||
}
|
||||
bool isAlertOn = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PURCHASE_ALERT);
|
||||
PaymentPCStartTask task = new PaymentPCStartTask();
|
||||
task.SetParameter(ProductId, IsAlertAgree, isAlertOn);
|
||||
task.SkipAllCuteResultCodeCheckErrorPopup();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
PurchasePC(ProductId, task);
|
||||
}, delegate
|
||||
{
|
||||
}, delegate(int code)
|
||||
{
|
||||
if (code == 329)
|
||||
{
|
||||
if (isAlertOn)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(DialogBase.Size.S);
|
||||
dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0329"));
|
||||
dialogBase.SetText(systemText.Get("Error_0329"));
|
||||
dialogBase.SetButtonText(systemText.Get("Shop_0082"));
|
||||
dialogBase.SetFadeButtonEnabled(flag: false);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetPanelDepth(6000);
|
||||
dialogBase.SetPanelSortingOrder(2);
|
||||
dialogBase.SetButtonDelegate(new EventDelegate(delegate
|
||||
{
|
||||
CallPaymentStartFromAlert(ProductId);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
CallPaymentStartFromAlert(ProductId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Toolbox.NetworkManager.NetworkUI.OpenCloseOnlyErrorPopUp(code);
|
||||
}
|
||||
}));
|
||||
selectedStoreProductId = ProductId;
|
||||
}
|
||||
|
||||
private void PurchasePC(string ProductId, PaymentPCStartTask task)
|
||||
{
|
||||
RefundWarningDialog.Start(task.NeedRefundWarningType, delegate
|
||||
{
|
||||
SteamMicroTxnInitTask steamMicroTxnInitTask = new SteamMicroTxnInitTask();
|
||||
steamMicroTxnInitTask.SetParameter(ProductId);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(steamMicroTxnInitTask));
|
||||
});
|
||||
}
|
||||
|
||||
public void purchaceFinish(string ProductId)
|
||||
{
|
||||
PaymentPCFinishTask paymentPCFinishTask = new PaymentPCFinishTask();
|
||||
paymentPCFinishTask.SetParameter(ProductId);
|
||||
paymentPCFinishTask.SkipCuteTimeOutPopup();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(paymentPCFinishTask, delegate
|
||||
{
|
||||
string value = "";
|
||||
ProductNameList.TryGetValue(ProductId, out value);
|
||||
if (!ProductIsSpecialShop[ProductId])
|
||||
{
|
||||
paymentUI.PurchaseFinished(value);
|
||||
}
|
||||
if (this.ConsumePurchaseSucceeded != null)
|
||||
{
|
||||
this.ConsumePurchaseSucceeded();
|
||||
}
|
||||
}, paymentUI.PurchaseFailedPC));
|
||||
}
|
||||
|
||||
public void initialize()
|
||||
{
|
||||
this.ProductListSucceeded = null;
|
||||
this.ProductListFailed = null;
|
||||
this.FinishFailureEvent = null;
|
||||
this.purchaseFinishSuccessEvent = null;
|
||||
this.purchaseFinishHttpErrorEvent = null;
|
||||
this.purchaseFinishResultCodeErrorEvent = null;
|
||||
this.purchaseRetryResultEvent = null;
|
||||
this.ConsumePurchaseSucceeded = null;
|
||||
ProductIdList = new List<string>();
|
||||
IdList = new List<string>();
|
||||
ProductNameList = new Dictionary<string, string>();
|
||||
ProductPriceList = new Dictionary<string, string>();
|
||||
FormatProductPriceList = new Dictionary<string, string>();
|
||||
ProductTextList = new Dictionary<string, string>();
|
||||
ProductPurchaseLimitList = new Dictionary<string, string>();
|
||||
ProductPurchaseNumberList = new Dictionary<string, string>();
|
||||
ProductCsvIdList = new Dictionary<string, string>();
|
||||
ProductImageNameList = new Dictionary<string, string>();
|
||||
ProductIsSpecialShop = new Dictionary<string, bool>();
|
||||
ProductCurrentPurchaseCount = new Dictionary<string, int>();
|
||||
ProductPurchaseLimitCount = new Dictionary<string, int>();
|
||||
ProductEndTime = new Dictionary<string, string>();
|
||||
PaymentPCItemListTask task = new PaymentPCItemListTask();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
if (this.ProductListSucceeded != null)
|
||||
{
|
||||
this.ProductListSucceeded();
|
||||
}
|
||||
}, OnItemListFailure, OnItemListResultCodeError));
|
||||
}
|
||||
|
||||
public void finalize()
|
||||
{
|
||||
this.ProductListSucceeded = null;
|
||||
this.ProductListFailed = null;
|
||||
this.FinishFailureEvent = null;
|
||||
this.purchaseFinishSuccessEvent = null;
|
||||
this.purchaseFinishHttpErrorEvent = null;
|
||||
this.purchaseFinishResultCodeErrorEvent = null;
|
||||
this.purchaseRetryResultEvent = null;
|
||||
this.ConsumePurchaseSucceeded = null;
|
||||
Payment.finalize();
|
||||
}
|
||||
|
||||
public void StartTimeCount()
|
||||
{
|
||||
isCountTime = true;
|
||||
}
|
||||
|
||||
public void StopTimeCount()
|
||||
{
|
||||
isCountTime = false;
|
||||
}
|
||||
|
||||
private void checkTimeOut()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
if (timer >= 30f)
|
||||
{
|
||||
timer = 0f;
|
||||
paymentUI.StopLoading();
|
||||
paymentUI.PurchaseTimeOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
SVSim.BattleEngine/Engine/PaymentPurchase.cs
Normal file
12
SVSim.BattleEngine/Engine/PaymentPurchase.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
public class PaymentPurchase
|
||||
{
|
||||
public string getProductId()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public string getOrderId()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
38
SVSim.BattleEngine/Engine/PaymentSkuInfo.cs
Normal file
38
SVSim.BattleEngine/Engine/PaymentSkuInfo.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PaymentSkuInfo
|
||||
{
|
||||
public string title;
|
||||
|
||||
public string price;
|
||||
|
||||
public string description;
|
||||
|
||||
public string productId;
|
||||
|
||||
public string currencyCode;
|
||||
|
||||
public string currencySymbol;
|
||||
|
||||
public string formattedPrice;
|
||||
|
||||
public double priceAmountMicros;
|
||||
|
||||
public string countryCode;
|
||||
|
||||
public string downloadContentVersion;
|
||||
|
||||
public bool downloadable;
|
||||
|
||||
public List<long> downloadContentLengths = new List<long>();
|
||||
|
||||
public string type;
|
||||
|
||||
public PaymentSkuInfo(string strShopName, string strPrice, string strShopDescription, string strProductID)
|
||||
{
|
||||
title = strShopName;
|
||||
price = strPrice;
|
||||
description = strShopDescription;
|
||||
productId = strProductID;
|
||||
}
|
||||
}
|
||||
153
SVSim.BattleEngine/Engine/PaymentUI.cs
Normal file
153
SVSim.BattleEngine/Engine/PaymentUI.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
using System.Collections;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.ErrorDialog;
|
||||
|
||||
public class PaymentUI
|
||||
{
|
||||
public IEnumerator GooglePlayPointRewardFinished(string message)
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
while (Toolbox.NetworkManager.isConnect || Toolbox.NetworkManager.isTimeOut || Toolbox.NetworkManager.isError || UIManager.GetInstance().isOpenDialog())
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
createNewDialog(Wizard.Data.SystemText.Get("Common_0021"), message);
|
||||
}
|
||||
|
||||
public void PurchaseFinished(string name = "", int amount = 0, int sum = 0, bool isRefundedReceipt = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
name = Wizard.Data.SystemText.Get("Common_0201");
|
||||
}
|
||||
string message = Wizard.Data.SystemText.Get("Shop_0022", name);
|
||||
if (amount != 0)
|
||||
{
|
||||
}
|
||||
if (!isRefundedReceipt)
|
||||
{
|
||||
createNewDialog("", message);
|
||||
}
|
||||
}
|
||||
|
||||
public void PurchaseFailed(string name = "", int amount = 0, int sum = 0)
|
||||
{
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
string title = systemText.Get("Shop_0025");
|
||||
string message = systemText.Get("Shop_0084");
|
||||
createNewDialog(title, message);
|
||||
}
|
||||
|
||||
public void PurchaseCancelled(string name = "", int amount = 0, int sum = 0)
|
||||
{
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
string title = systemText.Get("Shop_0025");
|
||||
string message = systemText.Get("Shop_0085");
|
||||
createNewDialog(title, message);
|
||||
}
|
||||
|
||||
public void PurchaseTimeOut(string message = "", string title = "", DialogBase.Size size = DialogBase.Size.M)
|
||||
{
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
title = systemText.Get("Shop_0025");
|
||||
}
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
message = systemText.Get("Shop_0086");
|
||||
}
|
||||
createNewDialog(title, message, size);
|
||||
}
|
||||
}
|
||||
|
||||
public void ProductListInitTimeOut()
|
||||
{
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
string title = systemText.Get("Shop_0094");
|
||||
string message = systemText.Get("Shop_0093");
|
||||
createNewDialog(title, message, DialogBase.Size.M);
|
||||
}
|
||||
}
|
||||
|
||||
public void StartLoading(bool useTimeCount = false, bool forProductListInit = false)
|
||||
{
|
||||
if (useTimeCount)
|
||||
{
|
||||
PaymentImpl.GetInstance().StartTimeCount(forProductListInit);
|
||||
}
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
}
|
||||
|
||||
public void StopLoading()
|
||||
{
|
||||
PaymentImpl.GetInstance().StopTimeCount();
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
|
||||
private static void createNewDialog(string title, string message, DialogBase.Size size = DialogBase.Size.S)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
if (title != "")
|
||||
{
|
||||
dialogBase.SetTitleLabel(title);
|
||||
}
|
||||
dialogBase.SetText(message);
|
||||
dialogBase.SetSize(size);
|
||||
dialogBase.SetPanelDepth(3000);
|
||||
}
|
||||
|
||||
public string GetText(string text_id)
|
||||
{
|
||||
return Wizard.Data.SystemText.Get(text_id);
|
||||
}
|
||||
|
||||
public void PurchaseConfirm(string productId, string name = "", int amount = 0, int sum = 0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
name = Wizard.Data.SystemText.Get("Common_0201");
|
||||
}
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
string text = "";
|
||||
if (amount <= sum)
|
||||
{
|
||||
text = Wizard.Data.SystemText.Get("Shop_0110", name, sum.ToString());
|
||||
dialogBase.SetButtonDelegate(new EventDelegate(delegate
|
||||
{
|
||||
PaymentPC.GetInstance().purchaceFinish(productId);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
text = Wizard.Data.SystemText.Get("Shop_0111", name, sum.ToString());
|
||||
dialogBase.SetButtonDelegate(new EventDelegate(delegate
|
||||
{
|
||||
BrowserURL.Open("https://point.dmm.com/choice/pay");
|
||||
}));
|
||||
}
|
||||
dialogBase.SetText(text);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetTitleLabel(Wizard.Data.SystemText.Get("Shop_0003"));
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetPanelDepth(3000);
|
||||
}
|
||||
|
||||
public void PurchaseFailedPC(NetworkTask.ResultCode resultCode)
|
||||
{
|
||||
if (resultCode == NetworkTask.ResultCode.TimeOut)
|
||||
{
|
||||
DialogBase dialogBase = Dialog.Create("TIMEOUT_NORETRY");
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0012"));
|
||||
dialogBase.SetText(systemText.Get("Error_0006"));
|
||||
}
|
||||
}
|
||||
}
|
||||
282
SVSim.BattleEngine/Engine/PuzzleGenerator.cs
Normal file
282
SVSim.BattleEngine/Engine/PuzzleGenerator.cs
Normal file
@@ -0,0 +1,282 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class PuzzleGenerator
|
||||
{
|
||||
private const int EVOLVED_PUZZLE_ID = 109;
|
||||
|
||||
public VfxBase Generate(PuzzleQuestData puzzleQuestData)
|
||||
{
|
||||
PuzzleBattleManager obj = BattleManagerBase.GetIns() as PuzzleBattleManager;
|
||||
BattlePlayer battlePlayer = obj.BattlePlayer;
|
||||
BattleEnemy battleEnemy = obj.BattleEnemy;
|
||||
IEnumerable<BattleCardBase> playerFieldCards = new List<BattleCardBase>(battlePlayer.InPlayCards);
|
||||
IEnumerable<BattleCardBase> playerHandCards = new List<BattleCardBase>(battlePlayer.HandCardList);
|
||||
IEnumerable<BattleCardBase> playerDeckCards = new List<BattleCardBase>(battlePlayer.DeckCardList);
|
||||
IEnumerable<BattleCardBase> enemyFieldCards = new List<BattleCardBase>(battleEnemy.InPlayCards);
|
||||
IEnumerable<BattleCardBase> enemyHandCards = new List<BattleCardBase>(battleEnemy.HandCardList);
|
||||
IEnumerable<BattleCardBase> enemyDeckCards = new List<BattleCardBase>(battleEnemy.DeckCardList);
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
parallelVfxPlayer.Register(ClearInPlayAndHand(battlePlayer, playerFieldCards, playerHandCards));
|
||||
parallelVfxPlayer.Register(ClearInPlayAndHand(battleEnemy, enemyFieldCards, enemyHandCards));
|
||||
battlePlayer.ClearBattleCount();
|
||||
battleEnemy.ClearBattleCount();
|
||||
battlePlayer.EvolveWaitTurnCount = 0;
|
||||
battleEnemy.EvolveWaitTurnCount = 0;
|
||||
battlePlayer.DeckCardList.Clear();
|
||||
battleEnemy.DeckCardList.Clear();
|
||||
battlePlayer.DeckSkillCardList.Clear();
|
||||
battleEnemy.DeckSkillCardList.Clear();
|
||||
bool isSkillLost = battlePlayer.Class.IsSkillLost;
|
||||
bool isSkillLost2 = battleEnemy.Class.IsSkillLost;
|
||||
battlePlayer.Class.LoseSkill().Play();
|
||||
battleEnemy.Class.LoseSkill().Play();
|
||||
battlePlayer.Class.DamagedCounter.Clear();
|
||||
battlePlayer.Class.SkillApplyInformation.ForceDepriveForceWrath();
|
||||
battleEnemy.Class.DamagedCounter.Clear();
|
||||
battleEnemy.Class.SkillApplyInformation.ForceDepriveForceWrath();
|
||||
battlePlayer.Class.IsSkillLost = isSkillLost;
|
||||
battleEnemy.Class.IsSkillLost = isSkillLost2;
|
||||
if (BattleManagerBase.GetIns().DetailMgr.DetailPanelControl.EvoTargetPanelColliderGameObject != null)
|
||||
{
|
||||
BattleManagerBase.GetIns().DetailMgr.DetailPanelControl.EvoTargetPanelColliderGameObject.transform.parent = BattleManagerBase.GetIns().DetailMgr.DetailPanel.transform;
|
||||
}
|
||||
SetUpField(battlePlayer, battleEnemy, puzzleQuestData);
|
||||
battlePlayer.EvolvedCards.Clear();
|
||||
if (puzzleQuestData.Id != 109)
|
||||
{
|
||||
battleEnemy.EvolvedCards.Clear();
|
||||
}
|
||||
battlePlayer.TurnEvolveCardCountInfo.Clear();
|
||||
battleEnemy.TurnEvolveCardCountInfo.Clear();
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(parallelVfxPlayer, InstantVfx.Create(delegate
|
||||
{
|
||||
DestroyCardAndCorutine(playerDeckCards);
|
||||
DestroyCardAndCorutine(playerHandCards);
|
||||
DestroyCardAndCorutine(playerFieldCards);
|
||||
DestroyCardAndCorutine(enemyDeckCards);
|
||||
DestroyCardAndCorutine(enemyHandCards);
|
||||
DestroyCardAndCorutine(enemyFieldCards);
|
||||
}), RecoveryClassView(battlePlayer, battleEnemy), RecoveryInPlayAndHand(battlePlayer), RecoveryInPlayAndHand(battleEnemy), new DummyDeckChangeCardVfx(battlePlayer.IsPlayer, battlePlayer.DeckCardList.Count), new DummyDeckChangeCardVfx(battleEnemy.IsPlayer, battleEnemy.DeckCardList.Count), battlePlayer.StartBattleMainView(playEffect: false), battleEnemy.StartBattleMainView(playEffect: false));
|
||||
return ParallelVfxPlayer.Create(sequentialVfxPlayer);
|
||||
}
|
||||
|
||||
private VfxBase RecoveryClassView(BattlePlayerBase player, BattlePlayerBase enemy)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
if (player.Class.BattleCardView is PlayerClassBattleCardView playerClassBattleCardView)
|
||||
{
|
||||
iTween.Stop(playerClassBattleCardView.GameObject);
|
||||
playerClassBattleCardView.GameObject.transform.localPosition = Vector3.zero;
|
||||
playerClassBattleCardView.GameObject.SetActive(value: true);
|
||||
playerClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION));
|
||||
playerClassBattleCardView.GameObject.GetComponent<CardTemplate>().Collider.enabled = true;
|
||||
}
|
||||
if (enemy.Class.BattleCardView is EnemyClassBattleCardView enemyClassBattleCardView)
|
||||
{
|
||||
iTween.Stop(enemyClassBattleCardView.GameObject);
|
||||
enemyClassBattleCardView.GameObject.transform.localPosition = Vector3.zero;
|
||||
enemyClassBattleCardView.GameObject.SetActive(value: true);
|
||||
enemyClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION));
|
||||
enemyClassBattleCardView.GameObject.GetComponent<CardTemplate>().Collider.enabled = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SetUpField(BattlePlayer player, BattleEnemy enemy, PuzzleQuestData puzzleQuestData)
|
||||
{
|
||||
BattleLogManager.GetInstance().AddLogTurn(isSelfTurn: true);
|
||||
player.BattleView.ClearPlayQueue();
|
||||
if (!player.ClassAndInPlayCardList.Any((BattleCardBase c) => c.IsClass))
|
||||
{
|
||||
player.ClassAndInPlayCardList.Insert(0, player.Class);
|
||||
}
|
||||
if (!enemy.ClassAndInPlayCardList.Any((BattleCardBase c) => c.IsClass))
|
||||
{
|
||||
enemy.ClassAndInPlayCardList.Insert(0, enemy.Class);
|
||||
}
|
||||
player.ClassAndInPlayCardList.RemoveAll((BattleCardBase c) => !c.IsClass);
|
||||
enemy.ClassAndInPlayCardList.RemoveAll((BattleCardBase c) => !c.IsClass);
|
||||
player.TurnPlayCards.Clear();
|
||||
player.Class.SkillApplyInformation.LifeModifierList.Clear();
|
||||
player.Class.SkillApplyInformation.DamageList.Clear();
|
||||
enemy.Class.SkillApplyInformation.LifeModifierList.Clear();
|
||||
enemy.Class.SkillApplyInformation.DamageList.Clear();
|
||||
player.NowTurnEvol = true;
|
||||
player.Turn = 0;
|
||||
player.Class.SkillApplyInformation.LifeModifierList.Add(new DamageCardParameterModifier(20 - puzzleQuestData.BattleData.PlayerLife, -1, isSelfTurn: false));
|
||||
int playerPPCount = puzzleQuestData.BattleData.PlayerPPCount;
|
||||
player.SetCurrentEpCount(puzzleQuestData.BattleData.PlayerEPCount);
|
||||
int playerGraveCount = puzzleQuestData.BattleData.PlayerGraveCount;
|
||||
player.PpTotal = puzzleQuestData.BattleData.PlayerPPCount;
|
||||
if (player.IsShortageDeck)
|
||||
{
|
||||
PuzzleBattleManager puzzleBattleManager = BattleManagerBase.GetIns() as PuzzleBattleManager;
|
||||
player.ResetIsShortageDeck();
|
||||
iTween.Stop(puzzleBattleManager.ReaperCard);
|
||||
puzzleBattleManager.ReaperCard.transform.SetParent(puzzleBattleManager.CardHolder.transform);
|
||||
MotionUtils.SetLayerAll(puzzleBattleManager.ReaperCard, 10);
|
||||
puzzleBattleManager.ReaperCard.transform.localPosition = new Vector3(-4.1f, 16.4f, 4.1f);
|
||||
puzzleBattleManager.ReaperCard.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
|
||||
puzzleBattleManager.ReaperCard.transform.localScale = Global.CARD_BASE_STAY_SCALE;
|
||||
TweenColor.Begin(puzzleBattleManager.ReaperCard, 0f, Color.white);
|
||||
}
|
||||
enemy.NowTurnEvol = true;
|
||||
enemy.Turn = 0;
|
||||
int enemyLife = puzzleQuestData.BattleData.EnemyLife;
|
||||
if (enemyLife <= 20)
|
||||
{
|
||||
enemy.Class.SkillApplyInformation.LifeModifierList.Add(new DamageCardParameterModifier(20 - puzzleQuestData.BattleData.EnemyLife, -1, isSelfTurn: false));
|
||||
}
|
||||
else
|
||||
{
|
||||
((ClassBattleCardBase)enemy.Class).InitBaseMaxLife(enemyLife);
|
||||
}
|
||||
int enemyPPCount = puzzleQuestData.BattleData.EnemyPPCount;
|
||||
enemy.SetCurrentEpCount(puzzleQuestData.BattleData.EnemyEPCount);
|
||||
int enemyGraveCount = puzzleQuestData.BattleData.EnemyGraveCount;
|
||||
enemy.Pp = enemyPPCount;
|
||||
enemy.PpTotal = enemyPPCount;
|
||||
CardPrm[] playerInplay = puzzleQuestData.BattleData.PlayerInplay;
|
||||
foreach (CardPrm cardPrm in playerInplay)
|
||||
{
|
||||
player.Pp = playerPPCount;
|
||||
FieldGenSetCard(player, enemy, cardPrm);
|
||||
}
|
||||
playerInplay = puzzleQuestData.BattleData.EnemyInplay;
|
||||
foreach (CardPrm cardPrm2 in playerInplay)
|
||||
{
|
||||
enemy.Pp = enemyPPCount;
|
||||
FieldGenSetCard(enemy, player, cardPrm2);
|
||||
}
|
||||
int[] playerHand = puzzleQuestData.BattleData.PlayerHand;
|
||||
foreach (int cardId in playerHand)
|
||||
{
|
||||
player.HandCardList.Add(player.CreateNextIndexCard(cardId));
|
||||
}
|
||||
playerHand = puzzleQuestData.BattleData.EnemyHand;
|
||||
foreach (int cardId2 in playerHand)
|
||||
{
|
||||
enemy.HandCardList.Add(enemy.CreateNextIndexCard(cardId2));
|
||||
}
|
||||
playerHand = puzzleQuestData.BattleData.PlayerDeck;
|
||||
foreach (int cardId3 in playerHand)
|
||||
{
|
||||
AddToDeckNoIndexChange(player, player.CreateNextIndexCard(cardId3));
|
||||
}
|
||||
playerHand = puzzleQuestData.BattleData.EnemyDeck;
|
||||
foreach (int cardId4 in playerHand)
|
||||
{
|
||||
AddToDeckNoIndexChange(enemy, enemy.CreateNextIndexCard(cardId4));
|
||||
}
|
||||
player.Pp = playerPPCount;
|
||||
enemy.Pp = enemyPPCount;
|
||||
foreach (BattleCardBase handCard in player.HandCardList)
|
||||
{
|
||||
handCard.BattleCardView.ShowHandCardInfo().Play();
|
||||
}
|
||||
player.GainCemetery(1000);
|
||||
player.CemeteryList.Clear();
|
||||
for (int num2 = 0; num2 < playerGraveCount; num2++)
|
||||
{
|
||||
BattleCardBase targetCard = CardCreatorBase.CreateDummyInstance();
|
||||
player.DummyCardToCemetery(targetCard);
|
||||
}
|
||||
enemy.GainCemetery(1000);
|
||||
enemy.CemeteryList.Clear();
|
||||
for (int num3 = 0; num3 < enemyGraveCount; num3++)
|
||||
{
|
||||
BattleCardBase targetCard2 = CardCreatorBase.CreateDummyInstance();
|
||||
enemy.DummyCardToCemetery(targetCard2);
|
||||
}
|
||||
for (int num4 = 0; num4 < puzzleQuestData.BattleData.PlayerDeckCount - puzzleQuestData.BattleData.PlayerDeck.Count(); num4++)
|
||||
{
|
||||
player.AddToDeck(player.CreateNextIndexCard(100011040));
|
||||
}
|
||||
for (int num5 = 0; num5 < puzzleQuestData.BattleData.EnemyDeckCount - puzzleQuestData.BattleData.EnemyDeck.Count(); num5++)
|
||||
{
|
||||
enemy.AddToDeck(enemy.CreateNextIndexCard(100011040));
|
||||
}
|
||||
}
|
||||
|
||||
private VfxBase ClearInPlayAndHand(BattlePlayerBase player, IEnumerable<BattleCardBase> fieldCardList, IEnumerable<BattleCardBase> handCardList)
|
||||
{
|
||||
if (BattleManagerBase.GetIns() == null)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
foreach (BattleCardBase fieldCard in fieldCardList)
|
||||
{
|
||||
parallelVfxPlayer.Register(fieldCard.SkillApplyInformation.AllSkillEffectStop());
|
||||
player.BattleView.InPlayView.RemoveCardFromView(fieldCard.BattleCardView);
|
||||
player.ClassAndInPlayCardList.Remove(fieldCard);
|
||||
}
|
||||
foreach (BattleCardBase handCard in handCardList)
|
||||
{
|
||||
parallelVfxPlayer.Register(handCard.SkillApplyInformation.AllSkillEffectStop());
|
||||
player.BattleView.HandView.RemoveCardFromViewWithoutRearrange(handCard.BattleCardView);
|
||||
player.HandCardList.Remove(handCard);
|
||||
}
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
private void DestroyCardAndCorutine(IEnumerable<BattleCardBase> cardList)
|
||||
{
|
||||
foreach (BattleCardBase card in cardList)
|
||||
{
|
||||
if (card.BattleCardView._inPlayRearrangeCoroutine != null)
|
||||
{
|
||||
BattleCoroutine.GetInstance().StopCoroutine(card.BattleCardView._inPlayRearrangeCoroutine);
|
||||
}
|
||||
Object.Destroy(card.BattleCardView.GameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private VfxBase RecoveryInPlayAndHand(BattlePlayerBase player)
|
||||
{
|
||||
return ParallelVfxPlayer.Create(new RefreshHealthVfx(player), player.Class.SkillApplyInformation.CreateVfxSkillProtection(), player.BattleView.RecoveryInPlayCards(), player.BattleView.RecoveryInHandCards(), OpeningVfx.ShowBattleUIImmediatelyVfx(player, fixDirection: true), player.UsePp(0), InstantVfx.Create(player.BattleView.HideCommonPanel));
|
||||
}
|
||||
|
||||
private void AddToDeckNoIndexChange(BattlePlayerBase player, BattleCardBase card)
|
||||
{
|
||||
player.DeckCardList.Add(card);
|
||||
if (card.HasDeckSelfSkill)
|
||||
{
|
||||
player.AddDeckSkillCard(card);
|
||||
}
|
||||
}
|
||||
|
||||
private void FieldGenSetCard(BattlePlayerBase player, BattlePlayerBase enemy, CardPrm cardPrm)
|
||||
{
|
||||
bool isRecovery = BattleManagerBase.GetIns().IsRecovery;
|
||||
BattleManagerBase.GetIns().IsRecovery = true;
|
||||
SkillProcessor skillProcessor = new SkillProcessor();
|
||||
BattleCardBase battleCardBase = player.CreateNextIndexCard(cardPrm.Id);
|
||||
player.HandCardList.Add(battleCardBase);
|
||||
SkillConditionCheckerOption skillConditionCheckerOption = new SkillConditionCheckerOption();
|
||||
skillConditionCheckerOption.PlayedCard = battleCardBase;
|
||||
skillConditionCheckerOption.SummonedCard = battleCardBase;
|
||||
battleCardBase.PlayCard(skillProcessor, skillConditionCheckerOption, isInplayGeneration: true);
|
||||
battleCardBase.SelfBattlePlayer.StartSkillWhenChangeInplay(null, new List<BattleCardBase> { battleCardBase }, skillProcessor, isSummonCheck: false, null, skillConditionCheckerOption);
|
||||
skillProcessor.Process(new BattlePlayerPair(player, enemy));
|
||||
if (cardPrm.IsEvolve)
|
||||
{
|
||||
SkillProcessor skillProcessor2 = new SkillProcessor();
|
||||
battleCardBase.Evolution(isSkill: true, skillProcessor2, skillConditionCheckerOption);
|
||||
skillProcessor2.Process(new BattlePlayerPair(player, enemy));
|
||||
}
|
||||
if (cardPrm.ChantCount != -1)
|
||||
{
|
||||
battleCardBase.SkillApplyInformation.GiveChantCount(new ChantCountSetModifier(cardPrm.ChantCount));
|
||||
}
|
||||
battleCardBase.BattleCardView.InitializeBattleCardIcon(battleCardBase, battleCardBase.Skills).Play();
|
||||
BattleManagerBase.GetIns().IsRecovery = isRecovery;
|
||||
}
|
||||
}
|
||||
11
SVSim.BattleEngine/Engine/ReceiveIntervalTriggerStandard.cs
Normal file
11
SVSim.BattleEngine/Engine/ReceiveIntervalTriggerStandard.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
public class ReceiveIntervalTriggerStandard : ReceiveIntervalTrigger
|
||||
{
|
||||
public override void ReceiveDataCheck(NetworkBattleManagerBase networkBattleManager, NetworkBattleData networkBattleData, bool isPlayer, bool isExTurn)
|
||||
{
|
||||
base.ReceiveDataCheck(networkBattleManager, networkBattleData, isPlayer, isExTurn);
|
||||
if (ReceiveIntervalTrigger.IsEffectiveURI(networkBattleData.GetReceiveData().dataUri))
|
||||
{
|
||||
(networkBattleManager as NetworkStandardBattleMgr).battleStopChecker.StartChecker();
|
||||
}
|
||||
}
|
||||
}
|
||||
353
SVSim.BattleEngine/Engine/ReceiveReward.cs
Normal file
353
SVSim.BattleEngine/Engine/ReceiveReward.cs
Normal file
@@ -0,0 +1,353 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class ReceiveReward : MonoBehaviour
|
||||
{
|
||||
private GameObject currentItem;
|
||||
|
||||
private GameObject currentExpand;
|
||||
|
||||
private UIButton currentExpandButton;
|
||||
|
||||
private List<GameObject> _allItem = new List<GameObject>();
|
||||
|
||||
private const int RECEIVE_ITEM_CENTER_IF_LESS = 3;
|
||||
|
||||
private const float ITEM_MOVE_TIME = 0.2f;
|
||||
|
||||
private const float ITEM_MOVE_X = 800f;
|
||||
|
||||
private const int OBJ_BUTTON_TABLE = 1;
|
||||
|
||||
private const int LABEL_NOT_USABLE = 2;
|
||||
|
||||
public DialogBase ShowReadDialog(List<ReceivedReward> texts, GameObject itemPrefab, GameObject current, ResourceHandler resourceHandler, DialogBase dialog = null)
|
||||
{
|
||||
if (texts == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
currentItem = null;
|
||||
currentExpand = null;
|
||||
currentExpandButton = null;
|
||||
DialogBase dia;
|
||||
if (dialog == null)
|
||||
{
|
||||
dia = createDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
dia = dialog;
|
||||
}
|
||||
UITable table = createTable(dia, texts.Count);
|
||||
Action<SceneTransition.TransitionData> gotoScene = delegate(SceneTransition.TransitionData data)
|
||||
{
|
||||
dia.SetBackViewToNotCloseDialog();
|
||||
dia.gameObject.SetActive(value: false);
|
||||
SceneTransition.ChangeScene(data, delegate
|
||||
{
|
||||
if (current != null)
|
||||
{
|
||||
current.SetActive(value: false);
|
||||
}
|
||||
});
|
||||
};
|
||||
foreach (ReceivedReward t in texts)
|
||||
{
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(itemPrefab);
|
||||
gameObject.transform.parent = table.transform;
|
||||
gameObject.transform.localScale = Vector3.one;
|
||||
gameObject.transform.localPosition = Vector3.zero;
|
||||
NguiObjs component = gameObject.GetComponent<NguiObjs>();
|
||||
_allItem.Add(gameObject);
|
||||
UIButton expandButton = component.buttons[0];
|
||||
UIButton actionButton = component.buttons[1];
|
||||
UIButton actionButtonAlone = component.buttons[2];
|
||||
GameObject expandPart = component.objs[0];
|
||||
GameObject itemPart = component.objs[2];
|
||||
SystemText sysText = Data.SystemText;
|
||||
Action<string, SceneTransition.TransitionData, bool, Action> AddButtonAction = delegate(string textid, SceneTransition.TransitionData data, bool alone, Action action2)
|
||||
{
|
||||
UIManager.SetObjectToGrey(AddDialogItemButton(alone ? actionButtonAlone : actionButton, sysText.Get(textid), action2).gameObject, SceneTransition.IsMaintenance(data));
|
||||
};
|
||||
Action<string, SceneTransition.TransitionData, bool> action = delegate(string textid, SceneTransition.TransitionData data, bool alone)
|
||||
{
|
||||
AddButtonAction(textid, data, alone, delegate
|
||||
{
|
||||
gotoScene(data);
|
||||
});
|
||||
};
|
||||
GiftTransition giftTransition = Data.Master.GiftTransitionList.Find((GiftTransition data) => (t.reward_type == 4) ? (data._rewardType == t.reward_type && data._rewardDetailId == t.rewardUserGoodsId) : (data._rewardType == t.reward_type));
|
||||
bool flag = t.IsUsable;
|
||||
if (giftTransition != null)
|
||||
{
|
||||
bool arg = giftTransition._buttons.Count == 1;
|
||||
foreach (GiftTransition.TransitionButton button in giftTransition._buttons)
|
||||
{
|
||||
action(button._text, button._transitionData, arg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
bool flag2 = t.reward_type == 4;
|
||||
component.textures[0].gameObject.SetActive(value: true);
|
||||
if (flag2)
|
||||
{
|
||||
SetTicket(t.rewardUserGoodsId, t.reward_count, component.textures[0], component.labels[0], resourceHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.labels[0].text = getTitle((UserGoods.Type)t.reward_type, t.rewardUserGoodsId, t.reward_count);
|
||||
SetTexture((UserGoods.Type)t.reward_type, t.rewardUserGoodsId, component.textures[0], resourceHandler);
|
||||
}
|
||||
initExpand(expandPart, expandButton, itemPart, component);
|
||||
actionButton.gameObject.SetActive(value: false);
|
||||
actionButtonAlone.gameObject.SetActive(value: false);
|
||||
component.objs[1].SetActive(flag);
|
||||
component.objs[1].GetComponent<UITable>().Reposition();
|
||||
component.labels[2].gameObject.SetActive(!flag);
|
||||
if (!flag)
|
||||
{
|
||||
if (flag2 && t.rewardUserGoodsId == 2)
|
||||
{
|
||||
component.labels[2].text = Data.SystemText.Get("Mail_0060");
|
||||
}
|
||||
else
|
||||
{
|
||||
component.labels[2].text = Data.SystemText.Get("Mission_0045");
|
||||
}
|
||||
}
|
||||
}
|
||||
table.onReposition = delegate
|
||||
{
|
||||
dia.SetScrollViewActive(b: true);
|
||||
table.onReposition = null;
|
||||
};
|
||||
table.Reposition();
|
||||
dia.SetScrollViewActive(b: true);
|
||||
return dia;
|
||||
}
|
||||
|
||||
public void SetAllButtonDisable()
|
||||
{
|
||||
foreach (GameObject item in _allItem)
|
||||
{
|
||||
UIButton[] buttons = item.GetComponent<NguiObjs>().buttons;
|
||||
foreach (UIButton uIButton in buttons)
|
||||
{
|
||||
if (uIButton != null)
|
||||
{
|
||||
uIButton.isEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static DialogBase createDialog()
|
||||
{
|
||||
bool num = Data.Load.data._userTutorial.TutorialStep != 100;
|
||||
SystemText systemText = Data.SystemText;
|
||||
DialogBase dialogBase = (num ? MyPageMenu.CreateDialogForTutorial() : UIManager.GetInstance().CreateDialogClose());
|
||||
dialogBase.SetTitleLabel(systemText.Get("Mail_0021"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
dialogBase.SetScrollViewActive(b: true);
|
||||
if (num)
|
||||
{
|
||||
dialogBase.SetDialogNoClose();
|
||||
MyPageMenu.Instance.SetGuideToOkOnlyDialog(dialogBase);
|
||||
}
|
||||
return dialogBase;
|
||||
}
|
||||
|
||||
private static UITable createTable(DialogBase dia, int rewardNum)
|
||||
{
|
||||
GameObject gameObject = new GameObject("table");
|
||||
dia.ScrollView.contentPivot = ((rewardNum >= 3) ? UIWidget.Pivot.Top : UIWidget.Pivot.Center);
|
||||
dia.AttachToScrollView(gameObject.transform);
|
||||
UITable uITable = gameObject.AddComponent<UITable>();
|
||||
uITable.columns = 1;
|
||||
uITable.padding = new Vector2(0f, 5f);
|
||||
uITable.pivot = UIWidget.Pivot.Center;
|
||||
uITable.cellAlignment = UIWidget.Pivot.Center;
|
||||
return uITable;
|
||||
}
|
||||
|
||||
private void DoAction(Action action)
|
||||
{
|
||||
action();
|
||||
}
|
||||
|
||||
private void initExpand(GameObject expandPart, UIButton expandButton, GameObject itemPart, NguiObjs obs)
|
||||
{
|
||||
expandPart.SetActive(value: false);
|
||||
expandButton.gameObject.SetActive(value: true);
|
||||
expandButton.gameObject.AddComponent<UIDragScrollView>();
|
||||
currentItem = null;
|
||||
float itemOriginalX = itemPart.transform.localPosition.x;
|
||||
expandButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
if (currentItem != null)
|
||||
{
|
||||
currentItem.SetActive(value: true);
|
||||
RemoveITween(currentItem);
|
||||
iTween.MoveTo(currentItem, iTween.Hash("x", itemOriginalX, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad));
|
||||
currentExpandButton.gameObject.SetActive(value: true);
|
||||
currentExpand.SetActive(value: false);
|
||||
}
|
||||
Action action = delegate
|
||||
{
|
||||
itemPart.SetActive(value: false);
|
||||
};
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GIFT_ALL);
|
||||
RemoveITween(itemPart);
|
||||
iTween.MoveTo(itemPart, iTween.Hash("x", itemOriginalX + 800f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad, "oncomplete", "DoAction", "oncompletetarget", base.gameObject, "oncompleteparams", action));
|
||||
expandButton.gameObject.SetActive(value: false);
|
||||
expandPart.SetActive(value: true);
|
||||
obs.tweenAlpha.delay = 0.2f;
|
||||
obs.tweenAlpha.ResetToBeginning();
|
||||
obs.tweenAlpha.PlayForward();
|
||||
currentItem = itemPart;
|
||||
currentExpand = expandPart;
|
||||
currentExpandButton = expandButton;
|
||||
}));
|
||||
}
|
||||
|
||||
private void RemoveITween(GameObject obj)
|
||||
{
|
||||
iTween component = obj.GetComponent<iTween>();
|
||||
if (component != null)
|
||||
{
|
||||
UnityEngine.Object.Destroy(component);
|
||||
}
|
||||
}
|
||||
|
||||
private static UIButton AddDialogItemButton(UIButton orig, string buttonText, Action action)
|
||||
{
|
||||
UIButton uIButton = UnityEngine.Object.Instantiate(orig);
|
||||
uIButton.GetComponentInChildren<UILabel>().text = buttonText;
|
||||
uIButton.transform.parent = orig.transform.parent;
|
||||
uIButton.transform.localPosition = orig.transform.localPosition;
|
||||
uIButton.transform.localScale = orig.transform.localScale;
|
||||
uIButton.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
action();
|
||||
}));
|
||||
return uIButton;
|
||||
}
|
||||
|
||||
public static string getTitle(MailData mailData)
|
||||
{
|
||||
return getTitle((UserGoods.Type)mailData.reward_type, mailData.RewardUserGoodsId, mailData.reward_count);
|
||||
}
|
||||
|
||||
public static string getTitle(UserGoods.Type reward_type, long userGoodsId, long count)
|
||||
{
|
||||
string unit = getUnit(reward_type, userGoodsId);
|
||||
string userGoodsName = UserGoods.getUserGoodsName(reward_type, userGoodsId);
|
||||
return string.Format(unit, userGoodsName, count);
|
||||
}
|
||||
|
||||
private static string getUnit(UserGoods.Type reward_type, long userGoodsId)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
if (reward_type == UserGoods.Type.Item && ((int)userGoodsId == 1000 || (int)userGoodsId == 1001))
|
||||
{
|
||||
return systemText.Get("Mail_0040");
|
||||
}
|
||||
switch (reward_type)
|
||||
{
|
||||
case UserGoods.Type.Item:
|
||||
case UserGoods.Type.Card:
|
||||
case UserGoods.Type.SpotCard:
|
||||
case UserGoods.Type.SpotCardOnlyLatestCardPack:
|
||||
return systemText.Get("Mail_0041");
|
||||
case UserGoods.Type.Rupy:
|
||||
return systemText.Get("Mail_0042");
|
||||
case UserGoods.Type.SpotCardPoint:
|
||||
return systemText.Get("Mail_0063");
|
||||
default:
|
||||
return systemText.Get("Mail_0040");
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetTicket(long userGoodsId, long count, UITexture tex, UILabel label, ResourceHandler resourceHandler)
|
||||
{
|
||||
Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == userGoodsId);
|
||||
if (item != null)
|
||||
{
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item);
|
||||
resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
tex.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
});
|
||||
string unitFormat = item.unitFormat;
|
||||
label.text = string.Format(unitFormat, item.name, count);
|
||||
}
|
||||
else
|
||||
{
|
||||
tex.gameObject.SetActive(value: false);
|
||||
label.text = "";
|
||||
}
|
||||
}
|
||||
|
||||
public static string SetTicketTitle(int itemId, int count)
|
||||
{
|
||||
Item itemData = Item.GetItemData(UserGoods.Type.Item, itemId);
|
||||
return string.Format(itemData.unitFormat, itemData.name, count);
|
||||
}
|
||||
|
||||
public static void SetTexture(UserGoods.Type type, UITexture tex, ResourceHandler resourceHandler)
|
||||
{
|
||||
string texName = UserGoods.GetUserGoodsImageName(type, 0L);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item);
|
||||
resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
tex.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
});
|
||||
}
|
||||
|
||||
public static void SetTexture(UserGoods.Type type, long goodsId, UITexture texture, ResourceHandler resourceHandler)
|
||||
{
|
||||
string thumbnailName = GetThumbnailName(type, goodsId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(thumbnailName, ResourcesManager.AssetLoadPathType.Item);
|
||||
resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(thumbnailName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
texture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
});
|
||||
}
|
||||
|
||||
public static string GetThumbnailName(UserGoods.Type type, long id)
|
||||
{
|
||||
if (type == UserGoods.Type.Skin)
|
||||
{
|
||||
return GetSkinThumbnailName(id);
|
||||
}
|
||||
return UserGoods.GetUserGoodsImageName(type, id);
|
||||
}
|
||||
|
||||
public static string GetSkinThumbnailName(long id)
|
||||
{
|
||||
if (ExistsIndividualSkinThumbnail(id, out var imageName))
|
||||
{
|
||||
return imageName;
|
||||
}
|
||||
return UserGoods.GetUserGoodsImageName(UserGoods.Type.Skin, 0L);
|
||||
}
|
||||
|
||||
public static bool ExistsIndividualSkinThumbnail(long id, out string imageName)
|
||||
{
|
||||
UserGoods userGoods = new UserGoods(UserGoods.Type.Skin, id);
|
||||
imageName = userGoods.GetUserGoodsIndividualImageName();
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(imageName, ResourcesManager.AssetLoadPathType.Item);
|
||||
return Toolbox.ResourcesManager.ExistsAssetBundleManifest(assetTypePath);
|
||||
}
|
||||
}
|
||||
11
SVSim.BattleEngine/Engine/RecoveryNetworkInPlayAction.cs
Normal file
11
SVSim.BattleEngine/Engine/RecoveryNetworkInPlayAction.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
public class RecoveryNetworkInPlayAction : InPlayCardReflection
|
||||
{
|
||||
public RecoveryNetworkInPlayAction(BattleManagerBase battleMgr, OperateMgr operateMgr)
|
||||
: base(battleMgr, operateMgr)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void RegisterPairToAttackSelectControl(BattleCardBase attackCard, BattleCardBase targetCard)
|
||||
{
|
||||
}
|
||||
}
|
||||
24
SVSim.BattleEngine/Engine/RecoveryReplaceReceivedCard.cs
Normal file
24
SVSim.BattleEngine/Engine/RecoveryReplaceReceivedCard.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class RecoveryReplaceReceivedCard : ReplaceReceivedCard
|
||||
{
|
||||
public RecoveryReplaceReceivedCard(NetworkBattleManagerBase battleMgrBase, CardDataModel cardData)
|
||||
: base(battleMgrBase, cardData)
|
||||
{
|
||||
}
|
||||
|
||||
protected override BattleCardBase CreateActualCard(BattlePlayerBase battlePlayer, bool isCardInDeck, bool isOpenDrawSkill)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(CardId);
|
||||
BattleCardBase battleCardBase = _networkBattleMgr.CreateBattleCard(CardId, battlePlayer.IsPlayer, null, cardParameterFromId, battlePlayer, CardIdx);
|
||||
InheritedCardData(battleCardBase);
|
||||
ReplaceBuffInfoList(battleCardBase, _originalDummyCard);
|
||||
battleCardBase.ShallowCopyBuffInfoList(_originalDummyCard);
|
||||
Object.DestroyImmediate(_originalDummyCard.BattleCardView.GameObject);
|
||||
_originalDummyCard.SelfBattlePlayer.BattleView.HandView.RemoveCardFromViewWithoutRearrange(_originalDummyCard.BattleCardView);
|
||||
SettingTargetDeckSelfCardAddDeckSkillCardList(battleCardBase, isCardInDeck);
|
||||
RemoveOpenCardRemoveAfterActionSkills(battleCardBase);
|
||||
return battleCardBase;
|
||||
}
|
||||
}
|
||||
96
SVSim.BattleEngine/Engine/RedShellUnity/RedShell.cs
Normal file
96
SVSim.BattleEngine/Engine/RedShellUnity/RedShell.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using com.adjust.sdk;
|
||||
using RedShellSDK;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RedShellUnity;
|
||||
|
||||
public class RedShell : MonoBehaviour
|
||||
{
|
||||
private static RedShell instance;
|
||||
|
||||
private static bool quitting;
|
||||
|
||||
private static bool verboseLogs;
|
||||
|
||||
public static void SetApiKey(string apiKey)
|
||||
{
|
||||
if (!Adjust.IsEditor())
|
||||
{
|
||||
_ = verboseLogs;
|
||||
setupInstance();
|
||||
global::RedShellSDK.RedShellSDK.SetApiKey(apiKey);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetUserId(string userId)
|
||||
{
|
||||
if (!Adjust.IsEditor())
|
||||
{
|
||||
_ = verboseLogs;
|
||||
setupInstance();
|
||||
global::RedShellSDK.RedShellSDK.SetUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVerboseLogs(bool verboseLogs)
|
||||
{
|
||||
if (!Adjust.IsEditor())
|
||||
{
|
||||
RedShell.verboseLogs = verboseLogs;
|
||||
setupInstance();
|
||||
global::RedShellSDK.RedShellSDK.SetVerboseLogs(verboseLogs);
|
||||
}
|
||||
}
|
||||
|
||||
public static void MarkConversion()
|
||||
{
|
||||
if (!Adjust.IsEditor())
|
||||
{
|
||||
_ = verboseLogs;
|
||||
setupInstance();
|
||||
instance.StartCoroutine(global::RedShellSDK.RedShellSDK.MarkConversion());
|
||||
}
|
||||
}
|
||||
|
||||
public static void LogEvent(string type)
|
||||
{
|
||||
if (!Adjust.IsEditor())
|
||||
{
|
||||
_ = verboseLogs;
|
||||
setupInstance();
|
||||
instance.StartCoroutine(global::RedShellSDK.RedShellSDK.LogEvent(type));
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (!Adjust.IsEditor())
|
||||
{
|
||||
if (instance != null)
|
||||
{
|
||||
Object.Destroy(base.gameObject.GetComponent<RedShell>());
|
||||
return;
|
||||
}
|
||||
instance = this;
|
||||
Object.DontDestroyOnLoad(base.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (!(instance != this))
|
||||
{
|
||||
quitting = true;
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void setupInstance()
|
||||
{
|
||||
if (!Adjust.IsEditor() && !quitting && instance == null)
|
||||
{
|
||||
_ = verboseLogs;
|
||||
instance = new GameObject("Red Shell").AddComponent<RedShell>();
|
||||
}
|
||||
}
|
||||
}
|
||||
35
SVSim.BattleEngine/Engine/RegisterChangeUnionBurstCount.cs
Normal file
35
SVSim.BattleEngine/Engine/RegisterChangeUnionBurstCount.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class RegisterChangeUnionBurstCount : RegisterAlter
|
||||
{
|
||||
private int _gainValue;
|
||||
|
||||
private readonly string UnionBurstCountParameter = "unionburst";
|
||||
|
||||
public RegisterChangeUnionBurstCount(List<BattleCardBase> cardList, SkillBase skill, int gainCount)
|
||||
: base(cardList, skill)
|
||||
{
|
||||
base.IndexList = new List<int>();
|
||||
if (cardList != null && cardList.Count > 0)
|
||||
{
|
||||
cardList.ForEach(delegate(BattleCardBase x)
|
||||
{
|
||||
if (!base.IndexList.Any((int z) => z == x.Index))
|
||||
{
|
||||
base.IndexList.Add(x.Index);
|
||||
}
|
||||
});
|
||||
}
|
||||
_gainValue = gainCount;
|
||||
IsSelf = skill.SkillPrm.ownerCard.IsPlayer;
|
||||
}
|
||||
|
||||
public override Dictionary<string, object> MakeSendData()
|
||||
{
|
||||
Dictionary<string, object> dictionary = base.MakeSendData();
|
||||
dictionary.Add(ActionBaseParameter.type.ToString(), ActionBaseParameter.add.ToString());
|
||||
dictionary.Add(UnionBurstCountParameter, "a+" + _gainValue);
|
||||
return MakeAttachTarget(dictionary);
|
||||
}
|
||||
}
|
||||
186
SVSim.BattleEngine/Engine/RegisterCostChangeCard.cs
Normal file
186
SVSim.BattleEngine/Engine/RegisterCostChangeCard.cs
Normal file
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class RegisterCostChangeCard : RegisterAlter
|
||||
{
|
||||
public enum CostChangeType
|
||||
{
|
||||
addCost,
|
||||
setCost,
|
||||
halfCost,
|
||||
halfCostRoundDown
|
||||
}
|
||||
|
||||
public int CostVal;
|
||||
|
||||
private Dictionary<string, object> _data;
|
||||
|
||||
private RegisterActionManager _registerActionManager;
|
||||
|
||||
private BattleManagerBase _mgr;
|
||||
|
||||
private ICardCostModifier _costModifier;
|
||||
|
||||
private const string FOR_HAND_RESIDENT = "forHandResident";
|
||||
|
||||
public CostChangeType CostChangeTypeVal { get; private set; }
|
||||
|
||||
public int Index => base.IndexList[0];
|
||||
|
||||
public RegisterCostChangeCard(BattleManagerBase mgr, RegisterActionManager registerActionManager, ICardCostModifier costModifier, List<BattleCardBase> cards, SkillBase skill, SkillConditionCheckerOption option, RegisterTargetBase registerTarget = null, bool isNotCheckCard = false)
|
||||
: base(cards, skill)
|
||||
{
|
||||
RegisterCostChangeCard registerCostChangeCard = this;
|
||||
if (!isNotCheckCard && cards == null && skill == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.IndexList = new List<int>();
|
||||
if (cards == null)
|
||||
{
|
||||
base.IndexList.Add(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
cards.ForEach(delegate(BattleCardBase x)
|
||||
{
|
||||
if (!registerCostChangeCard.IndexList.Any((int z) => z == x.Index))
|
||||
{
|
||||
registerCostChangeCard.IndexList.Add(x.Index);
|
||||
}
|
||||
});
|
||||
if (cards.Count() == 0)
|
||||
{
|
||||
IsSelf = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsSelf = cards.First().IsPlayer;
|
||||
}
|
||||
}
|
||||
if (isNotCheckCard)
|
||||
{
|
||||
IsSelf = false;
|
||||
}
|
||||
_registerActionManager = registerActionManager;
|
||||
_mgr = mgr;
|
||||
_costModifier = costModifier;
|
||||
if (_costModifier != null)
|
||||
{
|
||||
SettingCostChangeType(_costModifier);
|
||||
}
|
||||
if (registerTarget != null)
|
||||
{
|
||||
registerTarget.SettingGroupIndexMsg(this);
|
||||
}
|
||||
if (_data == null)
|
||||
{
|
||||
_data = base.MakeSendData();
|
||||
_data.Add(ActionBaseParameter.type.ToString(), ActionBaseParameter.add.ToString());
|
||||
switch (CostChangeTypeVal)
|
||||
{
|
||||
case CostChangeType.addCost:
|
||||
_data.Add(ActionBaseParameter.cost.ToString(), "a" + CostVal);
|
||||
break;
|
||||
case CostChangeType.setCost:
|
||||
_data.Add(ActionBaseParameter.cost.ToString(), "s" + CostVal);
|
||||
break;
|
||||
case CostChangeType.halfCost:
|
||||
_data.Add(ActionBaseParameter.cost.ToString(), "d" + CostVal);
|
||||
break;
|
||||
case CostChangeType.halfCostRoundDown:
|
||||
_data.Add(ActionBaseParameter.cost.ToString(), "D" + CostVal);
|
||||
break;
|
||||
}
|
||||
if (registerActionManager.RegisterDataList.Any((RegisterActionBase r) => r is RegisterMetamorphoseData))
|
||||
{
|
||||
List<RegisterActionBase> registerMetamorphoses = registerActionManager.RegisterDataList.Where((RegisterActionBase r) => r is RegisterMetamorphoseData).ToList();
|
||||
int i;
|
||||
for (i = 0; i < registerMetamorphoses.Count(); i++)
|
||||
{
|
||||
if (base.IndexList.Any((int index) => index != -1 && index == (registerMetamorphoses[i] as RegisterMetamorphoseData).Index) && IsSelf == registerMetamorphoses[i].IsSelf)
|
||||
{
|
||||
_data.Add(ActionBaseParameter.isForce.ToString(), 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_data = MakeAttachTarget(_data);
|
||||
Dictionary<string, object> data = new Dictionary<string, object>(_data);
|
||||
Func<SkillBase, List<BattleCardBase>, SkillConditionCheckerOption, SkillProcessor, VfxBase> value = delegate(SkillBase _skill, List<BattleCardBase> _cards, SkillConditionCheckerOption _checkerOption, SkillProcessor _skillProcessor)
|
||||
{
|
||||
bool flag = _skill.SkillPrm.ownerCard.IsPlayer;
|
||||
if (_skill.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter)
|
||||
{
|
||||
flag = !flag;
|
||||
}
|
||||
RegisterFilter registerFilter = new RegisterFilter(registerCostChangeCard._registerActionManager, registerCostChangeCard._mgr, flag, _skill, _cards, isStop: true, option);
|
||||
registerCostChangeCard._registerActionManager.Add(registerFilter);
|
||||
RegisterCostChangeCard registerCostChangeCard2 = new RegisterCostChangeCard(registerCostChangeCard._mgr, registerCostChangeCard._registerActionManager, registerCostChangeCard._costModifier, null, null, option);
|
||||
List<string> groupMsgList = registerFilter.GetGroupMsgList();
|
||||
if (registerTarget != null && groupMsgList != null && groupMsgList.Count > 0)
|
||||
{
|
||||
data[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx]] = groupMsgList[0];
|
||||
}
|
||||
registerCostChangeCard2.SetSendData(data);
|
||||
registerCostChangeCard2.SetCostChangeType(ActionBaseParameter.del.ToString());
|
||||
registerCostChangeCard._registerActionManager.Add(registerCostChangeCard2);
|
||||
return NullVfx.GetInstance();
|
||||
};
|
||||
_skill.OnSkillStopEnd -= value;
|
||||
_skill.OnSkillStopEnd += value;
|
||||
_skill.OnSkillStopEnd -= ((NetworkBattleManagerBase)_mgr)._networkBattleSetupCardEventBase.Event_RegisterFilterSkillEnd;
|
||||
_skill.OnSkillStopEnd += ((NetworkBattleManagerBase)_mgr)._networkBattleSetupCardEventBase.Event_RegisterFilterSkillEnd;
|
||||
}
|
||||
if (skill is NetworkSkill_cost_change { IsForHandResident: not false })
|
||||
{
|
||||
_data.Add("forHandResident", 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCostChangeType(string type)
|
||||
{
|
||||
_data[ActionBaseParameter.type.ToString()] = type;
|
||||
}
|
||||
|
||||
public override Dictionary<string, object> MakeSendData()
|
||||
{
|
||||
return _data;
|
||||
}
|
||||
|
||||
private void SettingCostChangeType(ICardCostModifier costModifiers)
|
||||
{
|
||||
if (costModifiers is CostAddModifier)
|
||||
{
|
||||
CostAddModifier costAddModifier = costModifiers as CostAddModifier;
|
||||
if (costAddModifier.Cost != 0)
|
||||
{
|
||||
CostVal = costAddModifier.Cost;
|
||||
CostChangeTypeVal = CostChangeType.addCost;
|
||||
}
|
||||
}
|
||||
else if (costModifiers is CostSetModifier)
|
||||
{
|
||||
int cost = (costModifiers as CostSetModifier).Cost;
|
||||
CostVal = cost;
|
||||
CostChangeTypeVal = CostChangeType.setCost;
|
||||
}
|
||||
else if (costModifiers is CostHalfRoundUpModifier)
|
||||
{
|
||||
CostVal = 2;
|
||||
CostChangeTypeVal = CostChangeType.halfCost;
|
||||
}
|
||||
else if (costModifiers is CostHalfRoundDownModifier)
|
||||
{
|
||||
CostVal = 2;
|
||||
CostChangeTypeVal = CostChangeType.halfCostRoundDown;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetSendData(Dictionary<string, object> data)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
}
|
||||
37
SVSim.BattleEngine/Engine/RegisterExtraTurn.cs
Normal file
37
SVSim.BattleEngine/Engine/RegisterExtraTurn.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class RegisterExtraTurn : RegisterActionBase
|
||||
{
|
||||
private int _extraTurnNum;
|
||||
|
||||
public RegisterExtraTurn(int turnNum, bool isSelf)
|
||||
{
|
||||
_extraTurnNum = turnNum;
|
||||
IsSelf = isSelf;
|
||||
}
|
||||
|
||||
public override bool IsUseLotCard(RegisterLotCardBase lot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override Dictionary<string, object> MakeSendData()
|
||||
{
|
||||
return new Dictionary<string, object>
|
||||
{
|
||||
{
|
||||
RegisterTool.OrderListParameter.count.ToString(),
|
||||
_extraTurnNum
|
||||
},
|
||||
{
|
||||
NetworkBattleDefine.NetworkParameter.isSelf.ToString(),
|
||||
IsSelf ? 1 : 0
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public override string GetUriMsg()
|
||||
{
|
||||
return RegisterTool.OrderListParameter.exTurn.ToString();
|
||||
}
|
||||
}
|
||||
36
SVSim.BattleEngine/Engine/RegisterPlayCountChange.cs
Normal file
36
SVSim.BattleEngine/Engine/RegisterPlayCountChange.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class RegisterPlayCountChange : RegisterActionBase
|
||||
{
|
||||
public enum PlayCountParameter
|
||||
{
|
||||
count,
|
||||
isSelf
|
||||
}
|
||||
|
||||
public int PlayCount { get; private set; }
|
||||
|
||||
public RegisterPlayCountChange(bool isSelf, int playCount)
|
||||
{
|
||||
IsSelf = isSelf;
|
||||
PlayCount = playCount;
|
||||
base.IndexList = null;
|
||||
}
|
||||
|
||||
public override Dictionary<string, object> MakeSendData()
|
||||
{
|
||||
Dictionary<string, object> dictionary = base.MakeSendData();
|
||||
dictionary.Add(PlayCountParameter.count.ToString(), PlayCount);
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
public override string GetUriMsg()
|
||||
{
|
||||
return RegisterTool.OrderListParameter.playCount.ToString();
|
||||
}
|
||||
|
||||
public override bool IsUseLotCard(RegisterLotCardBase lot)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
70
SVSim.BattleEngine/Engine/RegisterSpellboost.cs
Normal file
70
SVSim.BattleEngine/Engine/RegisterSpellboost.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public class RegisterSpellboost : RegisterAlter
|
||||
{
|
||||
private int _addValue;
|
||||
|
||||
private int _deffSet;
|
||||
|
||||
private readonly string SpellboostParameter = "spellboost";
|
||||
|
||||
public List<int> SpellBoostIndexList { get; private set; }
|
||||
|
||||
public List<string> SpellBoostGroupIndexList { get; private set; }
|
||||
|
||||
public RegisterSpellboost(List<BattleCardBase> cardList, SkillBase skill, int addCount, int deffSet)
|
||||
: base(cardList, skill)
|
||||
{
|
||||
base.IndexList = new List<int>();
|
||||
if (cardList != null && cardList.Count > 0)
|
||||
{
|
||||
cardList.ForEach(delegate(BattleCardBase x)
|
||||
{
|
||||
if (!base.IndexList.Any((int z) => z == x.Index))
|
||||
{
|
||||
base.IndexList.Add(x.Index);
|
||||
}
|
||||
});
|
||||
}
|
||||
_addValue = addCount;
|
||||
_deffSet = deffSet;
|
||||
IsSelf = skill.SkillPrm.ownerCard.IsPlayer;
|
||||
SpellBoostGroupIndexList = new List<string>();
|
||||
SpellBoostIndexList = new List<int>();
|
||||
}
|
||||
|
||||
public override Dictionary<string, object> MakeSendData()
|
||||
{
|
||||
Dictionary<string, object> dictionary = new Dictionary<string, object>();
|
||||
if (SpellBoostGroupIndexList.Count > 0)
|
||||
{
|
||||
dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx], SpellBoostGroupIndexList[0]);
|
||||
}
|
||||
else if (base.IndexList.Count > 0)
|
||||
{
|
||||
List<object> list = new List<object>();
|
||||
foreach (int index in base.IndexList)
|
||||
{
|
||||
list.Add(index);
|
||||
}
|
||||
dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx], list);
|
||||
}
|
||||
dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.isSelf], IsSelf ? 1 : 0);
|
||||
dictionary.Add(ActionBaseParameter.type.ToString(), ActionBaseParameter.add.ToString());
|
||||
if (_deffSet == 0)
|
||||
{
|
||||
dictionary.Add(SpellboostParameter, "a" + _addValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionary.Add(SpellboostParameter, "s" + _deffSet);
|
||||
}
|
||||
return MakeAttachTarget(dictionary);
|
||||
}
|
||||
|
||||
public void SettingSpellBoostGrope(string message)
|
||||
{
|
||||
SpellBoostGroupIndexList.Add(message);
|
||||
}
|
||||
}
|
||||
90
SVSim.BattleEngine/Engine/ReplayInPlayAction.cs
Normal file
90
SVSim.BattleEngine/Engine/ReplayInPlayAction.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ReplayInPlayAction : WatchInPlayAction
|
||||
{
|
||||
public ReplayInPlayAction(BattleManagerBase battleMgr, OperateMgr operateMgr)
|
||||
: base(battleMgr, operateMgr)
|
||||
{
|
||||
}
|
||||
|
||||
public override void StartSelect(int actingCardIndex, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.StartSelect(actingCardIndex, isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartChoiceSelect(int actingCardIndex, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.StartChoiceSelect(actingCardIndex, isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CancelSelect(bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.CancelSelect(isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CancelChoiceSelect(bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.CancelChoiceSelect(isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer = true, bool isBurialRite = false, bool isChoiceBrave = false, bool isComplete = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CompleteSelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer, bool isBurialRite, bool isChoiceBrave)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SelectChoiceCard(int selectedChoiceCardId, bool isEvolve = false, bool isPlayer = true, bool isComplete = false)
|
||||
{
|
||||
if (isPlayer && isComplete)
|
||||
{
|
||||
base.SelectChoiceCard(selectedChoiceCardId, isEvolve, isPlayer, isComplete);
|
||||
}
|
||||
}
|
||||
|
||||
public override void WatchSelectChoiceCards(List<int> selectedChoiceCardIds, bool isEvolve = false, bool isPlayer = true, bool isComplete = false)
|
||||
{
|
||||
if (isPlayer && isComplete)
|
||||
{
|
||||
base.WatchSelectChoiceCards(selectedChoiceCardIds, isEvolve, isPlayer, isComplete);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CompleteChoiceCard(List<int> choiceIdList, bool isEvolveTargetSelect, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
CompleteChoiceDataIns = new CompleteChoiceData();
|
||||
OverrideChoicecard(isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OverrideChoicecard(bool isPlayer)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.OverrideChoicecard(isPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
114
SVSim.BattleEngine/Engine/ReplayPlayCardAction.cs
Normal file
114
SVSim.BattleEngine/Engine/ReplayPlayCardAction.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ReplayPlayCardAction : WatchPlayCardAction
|
||||
{
|
||||
public ReplayPlayCardAction(BattleManagerBase battleMgr, OperateMgr operateMgr, NetworkBattleData networkBattleData)
|
||||
: base(battleMgr, operateMgr, networkBattleData)
|
||||
{
|
||||
}
|
||||
|
||||
public override void StartSelect(int actingCardIndex, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.StartSelect(actingCardIndex, isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartChoiceSelect(int actingCardIndex, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.StartChoiceSelect(actingCardIndex, isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void StartSelectFusion(int actingCardIndex, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.StartSelectFusion(actingCardIndex, isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SelectFusionIngredientCard(int cardIndex, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.SelectFusionIngredientCard(cardIndex, isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CompleteSelectFusionIngredientCard(bool isPlayer)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.CompleteSelectFusionIngredientCard(isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CancelSelect(bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.CancelSelect(isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CancelChoiceSelect(bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.CancelChoiceSelect(isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer = true, bool isBurialRite = false, bool isChoiceBrave = false, bool isComplete = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite, isChoiceBrave: false, isComplete);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CompleteSelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer, bool isBurialRite, bool isChoiceBrave)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite, isChoiceBrave);
|
||||
}
|
||||
}
|
||||
|
||||
public override void SelectChoiceCard(int selectedChoiceCardId, bool isEvolve = false, bool isPlayer = true, bool isComplete = false)
|
||||
{
|
||||
if (isPlayer && isComplete)
|
||||
{
|
||||
base.SelectChoiceCard(selectedChoiceCardId, isEvolve, isPlayer, isComplete);
|
||||
}
|
||||
}
|
||||
|
||||
public override void WatchSelectChoiceCards(List<int> selectedChoiceCardIds, bool isEvolve = false, bool isPlayer = true, bool isComplete = false)
|
||||
{
|
||||
if (isPlayer && isComplete)
|
||||
{
|
||||
base.WatchSelectChoiceCards(selectedChoiceCardIds, isEvolve, isPlayer, isComplete);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CompleteChoiceCard(List<int> choiceIdList, bool isEvolveTargetSelect, bool isPlayer = true)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
CompleteChoiceDataIns = new CompleteChoiceData();
|
||||
OverrideChoicecard(isPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OverrideChoicecard(bool isPlayer)
|
||||
{
|
||||
if (isPlayer)
|
||||
{
|
||||
base.OverrideChoicecard(isPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
259
SVSim.BattleEngine/Engine/RoomInviteReceiveDialog.cs
Normal file
259
SVSim.BattleEngine/Engine/RoomInviteReceiveDialog.cs
Normal file
@@ -0,0 +1,259 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.ErrorDialog;
|
||||
using Wizard.RoomMatch;
|
||||
using Wizard.UIFriend;
|
||||
|
||||
public class RoomInviteReceiveDialog : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
protected UIWrapContent WrapContents;
|
||||
|
||||
[SerializeField]
|
||||
protected WrapContentsScrollBarSize WrapScrollbarSize;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject ScrollViewObject;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject ScrollBarObject;
|
||||
|
||||
[SerializeField]
|
||||
protected GameObject ScrollAreaObject;
|
||||
|
||||
protected List<Friend.PlayerData> _playerList;
|
||||
|
||||
protected Dictionary<int, List<string>> _loadQueueDict = new Dictionary<int, List<string>>();
|
||||
|
||||
protected List<string> _loadBookingList = new List<string>();
|
||||
|
||||
protected List<string> _loadedList = new List<string>();
|
||||
|
||||
protected LoadQueue _loadQueue = new LoadQueue();
|
||||
|
||||
protected int _choicePlayerIndex;
|
||||
|
||||
protected DialogBase _dialog;
|
||||
|
||||
protected bool _isJoinRoom;
|
||||
|
||||
private const int LOAD_MIN = 6;
|
||||
|
||||
public MyPageMenu MyPageClass { get; set; }
|
||||
|
||||
public void SetFriendList()
|
||||
{
|
||||
_playerList = new List<Friend.PlayerData>();
|
||||
Friend.PlayerData item = default(Friend.PlayerData);
|
||||
foreach (UserFriend friend in Wizard.Data.FriendInfo.data.friendList)
|
||||
{
|
||||
item.Copy(friend);
|
||||
_playerList.Add(item);
|
||||
}
|
||||
StartCoroutine(LoadCoroutine());
|
||||
}
|
||||
|
||||
private IEnumerator LoadCoroutine()
|
||||
{
|
||||
if (_playerList.Count == 0)
|
||||
{
|
||||
_dialog = UIManager.GetInstance().CreateDialogClose();
|
||||
_dialog.SetTitleLabel(Wizard.Data.SystemText.Get("RoomBattle_0068"));
|
||||
_dialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
_dialog.SetText(Wizard.Data.SystemText.Get("RoomBattle_0067"));
|
||||
ReturnTopFromError(_playerList.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_loadedList.Clear();
|
||||
_loadBookingList.Clear();
|
||||
_loadQueueDict.Clear();
|
||||
List<string> list = new List<string>();
|
||||
for (int i = 0; i < _playerList.Count; i++)
|
||||
{
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(_playerList[i].EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_S);
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(_playerList[i].Rank.ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S);
|
||||
string text = (string.IsNullOrEmpty(_playerList[i].Country) ? null : Toolbox.ResourcesManager.GetAssetTypePath(_playerList[i].Country, ResourcesManager.AssetLoadPathType.Country_S));
|
||||
List<string> list2 = new List<string>();
|
||||
if (!_loadedList.Contains(assetTypePath) && !list.Contains(assetTypePath))
|
||||
{
|
||||
list.Add(assetTypePath);
|
||||
list2.Add(assetTypePath);
|
||||
}
|
||||
foreach (string degreeResource in DegreeHelper.GetDegreeResourceList(_playerList[i].DegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false))
|
||||
{
|
||||
if (!_loadedList.Contains(degreeResource) && !list.Contains(degreeResource))
|
||||
{
|
||||
list.Add(degreeResource);
|
||||
list2.Add(degreeResource);
|
||||
}
|
||||
}
|
||||
if (!_loadedList.Contains(assetTypePath2) && !list.Contains(assetTypePath2))
|
||||
{
|
||||
list.Add(assetTypePath2);
|
||||
list2.Add(assetTypePath2);
|
||||
}
|
||||
if (text != null && !_loadedList.Contains(text) && !list.Contains(text))
|
||||
{
|
||||
list.Add(text);
|
||||
list2.Add(text);
|
||||
}
|
||||
if (6 > i)
|
||||
{
|
||||
_loadBookingList.AddRange(list2);
|
||||
continue;
|
||||
}
|
||||
_loadQueueDict.Add(i, list2);
|
||||
LoadQueue.Callback onEnd = delegate(string id)
|
||||
{
|
||||
_loadedList.AddRange(_loadQueueDict[int.Parse(id)]);
|
||||
};
|
||||
_loadQueue.AddToLast(i.ToString(), list2, null, onEnd);
|
||||
}
|
||||
bool loadEndFlg = false;
|
||||
StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadBookingList, delegate
|
||||
{
|
||||
loadEndFlg = true;
|
||||
}));
|
||||
while (!loadEndFlg)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
_loadedList.AddRange(_loadBookingList);
|
||||
_loadQueue.StartLoad();
|
||||
_dialog = UIManager.GetInstance().CreateDialogClose();
|
||||
_dialog.SetTitleLabel(Wizard.Data.SystemText.Get("RoomBattle_0069"));
|
||||
_dialog.SetObj(base.gameObject);
|
||||
_dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
||||
_dialog.SetSize(DialogBase.Size.M);
|
||||
_dialog.OnClose = delegate
|
||||
{
|
||||
UIManager.GetInstance().StartCoroutine(InviteDialogClose());
|
||||
};
|
||||
Init();
|
||||
}
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
|
||||
protected IEnumerator InviteDialogClose()
|
||||
{
|
||||
if (!_isJoinRoom)
|
||||
{
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
}
|
||||
_loadQueue.Clear();
|
||||
while (_loadQueue.IsClearing)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedList);
|
||||
if (!_isJoinRoom)
|
||||
{
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
WrapContents.onInitializeItem = _OnInitializeItem;
|
||||
WrapContents.maxIndex = 0;
|
||||
ScrollBarObject.GetComponent<UIScrollBarWrapContent>().m_WrapContents = WrapContents;
|
||||
WrapContents.minIndex = -(_playerList.Count - 1);
|
||||
WrapScrollbarSize.ContentUpdate();
|
||||
WrapContents.SortBasedOnScrollMovement();
|
||||
UIPanel component = ScrollViewObject.GetComponent<UIPanel>();
|
||||
int count = _playerList.Count;
|
||||
if (component.height > (float)(count * WrapContents.itemSize))
|
||||
{
|
||||
ScrollBarObject.SetActive(value: false);
|
||||
ScrollAreaObject.SetActive(value: false);
|
||||
ScrollViewObject.GetComponent<UIScrollView>().ResetPosition();
|
||||
}
|
||||
else
|
||||
{
|
||||
ScrollBarObject.SetActive(value: true);
|
||||
ScrollAreaObject.SetActive(value: true);
|
||||
}
|
||||
ScrollViewObject.GetComponent<UIScrollView>().ResetPosition();
|
||||
ScrollBarObject.GetComponent<UIScrollBar>().value = 0f;
|
||||
}
|
||||
|
||||
protected void _OnInitializeItem(GameObject go, int wrapIndex, int realIndex)
|
||||
{
|
||||
int num = realIndex * -1;
|
||||
go.name = num.ToString();
|
||||
Transform[] componentsInChildren = go.GetComponentsInChildren<Transform>(includeInactive: true);
|
||||
Transform[] array;
|
||||
if (num >= _playerList.Count || num < 0)
|
||||
{
|
||||
array = componentsInChildren;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array[i].gameObject.SetActive(value: false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
array = componentsInChildren;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
array[i].gameObject.SetActive(value: true);
|
||||
}
|
||||
go.transform.GetComponent<RoomInviteFriendColum>().SetPlayerData(_playerList[num], _loadedList);
|
||||
EventDelegate eventDelegate = new EventDelegate(this, "RoomJoin");
|
||||
eventDelegate.parameters[0].value = num;
|
||||
RoomInviteFriendColum component = go.GetComponent<RoomInviteFriendColum>();
|
||||
component.ButtonObject.onClick.Clear();
|
||||
component.ButtonObject.onClick.Add(eventDelegate);
|
||||
if (num + 1 == _playerList.Count)
|
||||
{
|
||||
component.UnderLineObject.SetActive(value: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.UnderLineObject.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
|
||||
protected void RoomJoin(int inPlayerIndex)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
InviteAcceptTask inviteAcceptTask = new InviteAcceptTask();
|
||||
inviteAcceptTask.SetParameter(_playerList[inPlayerIndex].ViewerId);
|
||||
inviteAcceptTask.SkipAllCuteResultCodeCheckErrorPopup();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(inviteAcceptTask, AcceptSuccess, null, ErrorDialog));
|
||||
}
|
||||
|
||||
private void AcceptSuccess(NetworkTask.ResultCode inResultCode)
|
||||
{
|
||||
if (!(_dialog == null))
|
||||
{
|
||||
_dialog.Close();
|
||||
_isJoinRoom = true;
|
||||
RoomConnectController.InitializeParameter param = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.VISITOR, new BattleParameter(NetworkDefine.ServerBattleType.OpenRoom, Format.Max, TwoPickFormat.None, Wizard.Data.InviteFriendBattle.BattleParameterInstance.Rule, isOpenDeckRoom: false), Wizard.Data.InviteFriendBattle.RoomId);
|
||||
UIManager.GetInstance().StartCoroutine(MyPageMenu.Instance.BattleMenu.JoinRoom(param, isInvite: true));
|
||||
}
|
||||
}
|
||||
|
||||
protected void ErrorDialog(int inErrorNo)
|
||||
{
|
||||
ReturnTopFromError(Wizard.Data.Load.data._receiveInviteCount);
|
||||
_dialog.Close();
|
||||
Dialog.Create(inErrorNo);
|
||||
}
|
||||
|
||||
protected void ReturnTopFromError(int inInviteCount)
|
||||
{
|
||||
if (inInviteCount <= 1)
|
||||
{
|
||||
InviteReset();
|
||||
}
|
||||
}
|
||||
|
||||
protected void InviteReset()
|
||||
{
|
||||
Object.Destroy(base.gameObject);
|
||||
}
|
||||
}
|
||||
11
SVSim.BattleEngine/Engine/SendIntervalTriggerStandard.cs
Normal file
11
SVSim.BattleEngine/Engine/SendIntervalTriggerStandard.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
public class SendIntervalTriggerStandard : SendIntervalTrigger
|
||||
{
|
||||
public override void SendDataCheck(NetworkBattleManagerBase networkBattleManager, NetworkBattleDefine.NetworkBattleURI sendUri)
|
||||
{
|
||||
base.SendDataCheck(networkBattleManager, sendUri);
|
||||
if (ReceiveIntervalTrigger.IsEffectiveURI(sendUri))
|
||||
{
|
||||
(networkBattleManager as NetworkStandardBattleMgr).battleStopChecker.StartChecker();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
SVSim.BattleEngine/Engine/SetDamageInfo.cs
Normal file
22
SVSim.BattleEngine/Engine/SetDamageInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class SetDamageInfo : DamageModifier
|
||||
{
|
||||
public int SetDamage { get; private set; }
|
||||
|
||||
public SetDamageInfo(int setDamage, string damageType, CardBasePrm.ClanType damageClan, bool isUseClass, int order)
|
||||
{
|
||||
SetDamage = setDamage;
|
||||
base.DamageType = new List<string>();
|
||||
base.DamageType.AddRange(damageType.Split(new string[1] { "_and_" }, StringSplitOptions.None));
|
||||
base.DamageClan = new List<CardBasePrm.ClanType> { damageClan };
|
||||
base.IsUseClass = isUseClass;
|
||||
base.OrderCount = order;
|
||||
}
|
||||
|
||||
public override int Calc(int damage)
|
||||
{
|
||||
return SetDamage;
|
||||
}
|
||||
}
|
||||
27
SVSim.BattleEngine/Engine/SetHealModifierInfo.cs
Normal file
27
SVSim.BattleEngine/Engine/SetHealModifierInfo.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
public class SetHealModifierInfo : HealModifier
|
||||
{
|
||||
private bool _isTargetSelfClass;
|
||||
|
||||
public int SetHealAmount { get; private set; }
|
||||
|
||||
public SetHealModifierInfo(int setHealAmount, int order, BattleCardBase owner, bool isTargetSelfClass)
|
||||
{
|
||||
SetHealAmount = setHealAmount;
|
||||
base.OrderCount = order;
|
||||
_owner = owner;
|
||||
_isTargetSelfClass = isTargetSelfClass;
|
||||
}
|
||||
|
||||
public override int Calc(int healAmount, BattleCardBase healOwner, BattleCardBase target)
|
||||
{
|
||||
if (_isTargetSelfClass)
|
||||
{
|
||||
if (target.IsClass && _owner == target)
|
||||
{
|
||||
return SetHealAmount;
|
||||
}
|
||||
return healAmount;
|
||||
}
|
||||
return SetHealAmount;
|
||||
}
|
||||
}
|
||||
468
SVSim.BattleEngine/Engine/SpecialCrystalDialog.cs
Normal file
468
SVSim.BattleEngine/Engine/SpecialCrystalDialog.cs
Normal file
@@ -0,0 +1,468 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.ErrorDialog;
|
||||
|
||||
public class SpecialCrystalDialog : MonoBehaviour
|
||||
{
|
||||
private const int TIME_LIMIT_ERROR_CODE = 4305;
|
||||
|
||||
private const float FLICK_MARGIN = 70f;
|
||||
|
||||
private List<string> _assetList = new List<string>();
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _tipsTexture;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _jpnOnlyRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UIDragScrollView _dragScrollView;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _fundSettlementButton;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _legalButton;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _priceLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _timeLimitLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _purchaseCountLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _buyFinishDialogPrefab;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _rootObject;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _arrowLeftButton;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _arrowRightButton;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _dragObject;
|
||||
|
||||
private string _defaultOpen = string.Empty;
|
||||
|
||||
private bool _isDragging;
|
||||
|
||||
private int _selectIndex;
|
||||
|
||||
private DialogBase _dialog;
|
||||
|
||||
private bool _finishGetProduct;
|
||||
|
||||
private static string _defaultOpenPageStatus = string.Empty;
|
||||
|
||||
private static GameObject _originalPrefab;
|
||||
|
||||
private static string _productName;
|
||||
|
||||
private static Action _saveOnCancel;
|
||||
|
||||
private static Action _saveOnFinish;
|
||||
|
||||
private static string saveScrollToProductId;
|
||||
|
||||
private static List<SpecialCrystalInfo> _specialCrystalInfo = null;
|
||||
|
||||
private static GameObject _finishDialogPrefab;
|
||||
|
||||
public static void Create(GameObject prefab, string scrollToProductId, Action onCancel, Action onFinish)
|
||||
{
|
||||
_originalPrefab = prefab;
|
||||
_saveOnCancel = onCancel;
|
||||
_saveOnFinish = onFinish;
|
||||
saveScrollToProductId = scrollToProductId;
|
||||
SystemText systemText = Wizard.Data.SystemText;
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(prefab);
|
||||
SpecialCrystalDialog specialDialog = gameObject.GetComponent<SpecialCrystalDialog>();
|
||||
specialDialog._defaultOpen = _defaultOpenPageStatus;
|
||||
_defaultOpenPageStatus = string.Empty;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetButtonText(systemText.Get("Dia_BuyCrystal_004_Button"), systemText.Get("MyPage_0054"));
|
||||
dialogBase.onPushButton1 = delegate
|
||||
{
|
||||
specialDialog.OnClickBuyButton();
|
||||
};
|
||||
dialogBase.onPushButton2 = delegate
|
||||
{
|
||||
BuyCrystal.InstantiateCrystalDialog(scrollToProductId, onlyInputBirthday: false, onCancel, onFinish);
|
||||
};
|
||||
dialogBase.onCloseWithoutSelect = delegate
|
||||
{
|
||||
PaymentPC.GetInstance().finalize();
|
||||
};
|
||||
dialogBase.ClickSe_Btn2 = Se.TYPE.SYS_BTN_DECIDE;
|
||||
dialogBase.SetDisp(inDisp: false);
|
||||
dialogBase.gameObject.SetActive(value: false);
|
||||
specialDialog._dialog = dialogBase;
|
||||
specialDialog._rootObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public static void SetDefaultOpenPage(string openPageStatus)
|
||||
{
|
||||
_defaultOpenPageStatus = openPageStatus;
|
||||
}
|
||||
|
||||
private string CorrectPriceText(string price)
|
||||
{
|
||||
return Wizard.Data.SystemText.Get("Shop_0083") + "$" + price;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
UIManager.GetInstance().StartCoroutine(Initialize());
|
||||
}
|
||||
|
||||
private IEnumerator Initialize()
|
||||
{
|
||||
_finishDialogPrefab = _buyFinishDialogPrefab;
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
bool oldBackKeyEnable = GameMgr.GetIns().GetInputMgr().isBackKeyEnable;
|
||||
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false;
|
||||
foreach (SpecialCrystalInfo item in Wizard.Data.Load.data._userCrystalCount.SpecialCrystalInfo)
|
||||
{
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(item.DialogBGImageFileName, ResourcesManager.AssetLoadPathType.SpecialCrystal);
|
||||
_assetList.Add(assetTypePath);
|
||||
}
|
||||
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroup(_assetList, null));
|
||||
_ = Wizard.Data.SystemText;
|
||||
PaymentPC paymentImpl = PaymentPC.GetInstance();
|
||||
paymentImpl.initialize();
|
||||
paymentImpl.ProductListSucceeded += OnSuccessGetProductList;
|
||||
paymentImpl.ProductListFailed += OnFailedGetProductList;
|
||||
while (!_finishGetProduct)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
_specialCrystalInfo = new List<SpecialCrystalInfo>();
|
||||
foreach (SpecialCrystalInfo item2 in Wizard.Data.Load.data._userCrystalCount.SpecialCrystalInfo)
|
||||
{
|
||||
if (paymentImpl.FormatProductPriceList.ContainsKey(item2.ProductId) && item2.RemainTime.Second > 0)
|
||||
{
|
||||
_specialCrystalInfo.Add(item2);
|
||||
}
|
||||
}
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
_dialog.gameObject.SetActive(value: true);
|
||||
_dialog.SetDisp(inDisp: true);
|
||||
_dialog.SetObj(base.gameObject);
|
||||
_rootObject.SetActive(value: true);
|
||||
GameMgr.GetIns().GetInputMgr().isBackKeyEnable = oldBackKeyEnable;
|
||||
if (!string.IsNullOrEmpty(_defaultOpen) && !_specialCrystalInfo.Exists((SpecialCrystalInfo info) => info.Status == _defaultOpen))
|
||||
{
|
||||
CloseDialogOnErrorFinish();
|
||||
Dialog.Create(4305);
|
||||
yield break;
|
||||
}
|
||||
if (_specialCrystalInfo.Count == 0)
|
||||
{
|
||||
CloseDialogOnErrorFinish();
|
||||
BuyCrystal.InstantiateCrystalDialog(null, onlyInputBirthday: false, _saveOnCancel, _saveOnFinish);
|
||||
yield break;
|
||||
}
|
||||
UpdateRemainTimeLabel();
|
||||
UIEventListener.Get(_arrowLeftButton.gameObject).onClick = delegate
|
||||
{
|
||||
OnClickButtonLeft();
|
||||
};
|
||||
UIEventListener.Get(_arrowRightButton.gameObject).onClick = delegate
|
||||
{
|
||||
OnClickButtonRight();
|
||||
};
|
||||
if (_specialCrystalInfo.Count <= 1)
|
||||
{
|
||||
_arrowLeftButton.gameObject.SetActive(value: false);
|
||||
_arrowRightButton.gameObject.SetActive(value: false);
|
||||
}
|
||||
_jpnOnlyRoot.gameObject.SetActive(value: false);
|
||||
_dragScrollView.enabled = false;
|
||||
InitializeDragEvent();
|
||||
int page = 0;
|
||||
for (int num = 0; num < _specialCrystalInfo.Count; num++)
|
||||
{
|
||||
if (_specialCrystalInfo[num].Status == _defaultOpen)
|
||||
{
|
||||
page = num;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ChangeSelectSpecialCrystal(page);
|
||||
}
|
||||
|
||||
private void CloseDialogOnErrorFinish()
|
||||
{
|
||||
base.gameObject.SetActive(value: false);
|
||||
_dialog.SetDisp(inDisp: false);
|
||||
_dialog.Close();
|
||||
_specialCrystalInfo = null;
|
||||
}
|
||||
|
||||
private void InitializeDragEvent()
|
||||
{
|
||||
if (_specialCrystalInfo.Count <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
UIEventListener.Get(_dragObject).onDragStart = delegate
|
||||
{
|
||||
_isDragging = true;
|
||||
};
|
||||
UIEventListener.Get(_dragObject).onDragEnd = delegate
|
||||
{
|
||||
_isDragging = false;
|
||||
};
|
||||
UIEventListener.Get(_dragObject).onDrag = delegate(GameObject obj, Vector2 delta)
|
||||
{
|
||||
if (delta.x >= 70f)
|
||||
{
|
||||
if (_isDragging)
|
||||
{
|
||||
OnClickButtonLeft();
|
||||
_isDragging = false;
|
||||
}
|
||||
}
|
||||
else if (delta.x <= -70f && _isDragging)
|
||||
{
|
||||
OnClickButtonRight();
|
||||
_isDragging = false;
|
||||
}
|
||||
};
|
||||
UIEventListener.Get(_dragObject).onScroll = delegate(GameObject obj, float delta)
|
||||
{
|
||||
if (delta > 0f)
|
||||
{
|
||||
if (_isDragging)
|
||||
{
|
||||
OnClickButtonLeft();
|
||||
_isDragging = false;
|
||||
}
|
||||
}
|
||||
else if (_isDragging)
|
||||
{
|
||||
OnClickButtonRight();
|
||||
_isDragging = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void UpdateRemainTimeLabel()
|
||||
{
|
||||
if (_specialCrystalInfo != null && _selectIndex <= _specialCrystalInfo.Count)
|
||||
{
|
||||
SpecialCrystalInfo specialCrystalInfo = _specialCrystalInfo[_selectIndex];
|
||||
_timeLimitLabel.text = specialCrystalInfo.RemainTime.GetShowText();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdateRemainTimeLabel();
|
||||
}
|
||||
|
||||
private void OnSuccessGetProductList()
|
||||
{
|
||||
_finishGetProduct = true;
|
||||
ClearPaymentHandler();
|
||||
}
|
||||
|
||||
private void OnFailedGetProductList()
|
||||
{
|
||||
_finishGetProduct = true;
|
||||
ClearPaymentHandler();
|
||||
BuyCrystal.PaymentListErrorDialog();
|
||||
_dialog.Close();
|
||||
}
|
||||
|
||||
private void ClearPaymentHandler()
|
||||
{
|
||||
PaymentPC instance = PaymentPC.GetInstance();
|
||||
instance.ProductListSucceeded -= OnSuccessGetProductList;
|
||||
instance.ProductListFailed -= OnFailedGetProductList;
|
||||
}
|
||||
|
||||
private void OnClickFundSettingButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.FUND_SETTLEMENT);
|
||||
}
|
||||
|
||||
private void OnClickLegalButton()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.LEGALTEXT);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_assetList);
|
||||
_assetList.Clear();
|
||||
}
|
||||
|
||||
private void OnClickBuyButton()
|
||||
{
|
||||
if (PlayerStaticData.IsLootBoxRegulation(PlayerStaticData.LootBoxType.SPECIAL_CRYSTAL))
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
LootBoxDialogUtility.CreateLootBoxRegulationDialog(PlayerStaticData.LootBoxType.SPECIAL_CRYSTAL);
|
||||
}
|
||||
else if (CreateItemList.IsBirthdayNotInput())
|
||||
{
|
||||
ShowBirthdayInputDialog();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowPayment(_selectIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowBirthdayInputDialog()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
Action onFinish = delegate
|
||||
{
|
||||
OnDecideBirthday(_selectIndex);
|
||||
};
|
||||
bool onlyInputBirthday = true;
|
||||
BuyCrystal.CreateBuyCrystal(isPlaySe: false, null, onlyInputBirthday, OnCancelBirthdayDialog, onFinish, isSpecialCrystal: true);
|
||||
}
|
||||
|
||||
private static void OnCancelBirthdayDialog()
|
||||
{
|
||||
Create(_originalPrefab, saveScrollToProductId, _saveOnCancel, _saveOnFinish);
|
||||
}
|
||||
|
||||
private static void OnDecideBirthday(int index)
|
||||
{
|
||||
ShowPayment(index);
|
||||
}
|
||||
|
||||
private static void ShowPayment(int index)
|
||||
{
|
||||
SpecialCrystalInfo info = _specialCrystalInfo[index];
|
||||
Action value = delegate
|
||||
{
|
||||
OnCunsumePurchageSuccess(info);
|
||||
};
|
||||
if (!PaymentPC.GetInstance().ProductPriceList.ContainsKey(info.ProductId))
|
||||
{
|
||||
Dialog.Create(4305);
|
||||
return;
|
||||
}
|
||||
PaymentPC.GetInstance().purchaceStart(info.ProductId);
|
||||
PaymentPC.GetInstance().ConsumePurchaseSucceeded += value;
|
||||
}
|
||||
|
||||
private static void OnCunsumePurchageSuccess(SpecialCrystalInfo info)
|
||||
{
|
||||
OnFinishPayment(info);
|
||||
}
|
||||
|
||||
private static void OnPurchageFinishSuccess(SpecialCrystalInfo info)
|
||||
{
|
||||
OnFinishPayment(info);
|
||||
}
|
||||
|
||||
private static void OnFinishPayment(SpecialCrystalInfo info)
|
||||
{
|
||||
UIManager.GetInstance().StartCoroutine(OnFinishPaymentCoroutine(info));
|
||||
}
|
||||
|
||||
private static IEnumerator OnFinishPaymentCoroutine(SpecialCrystalInfo info)
|
||||
{
|
||||
UIManager.GetInstance().OpenNotTouch();
|
||||
SpecialCrystalTaskInfo task = new SpecialCrystalTaskInfo();
|
||||
bool taskSuccess = false;
|
||||
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
taskSuccess = true;
|
||||
}));
|
||||
while (!taskSuccess)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
UIManager.GetInstance().offNotTouch();
|
||||
ShowBuyFinishDialog(info);
|
||||
}
|
||||
|
||||
private static void ShowBuyFinishDialog(SpecialCrystalInfo info)
|
||||
{
|
||||
Action value = delegate
|
||||
{
|
||||
OnPurchageFinishSuccess(info);
|
||||
};
|
||||
PaymentImpl.GetInstance().ConsumePurchaseSucceeded -= value;
|
||||
if (!PaymentImpl.GetInstance().IsRefundedReceipt)
|
||||
{
|
||||
SpecialCrystalBuyFinishDialog.Create(_finishDialogPrefab, info, _productName);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnClickButtonLeft()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
_selectIndex--;
|
||||
if (_selectIndex < 0)
|
||||
{
|
||||
_selectIndex = _specialCrystalInfo.Count - 1;
|
||||
}
|
||||
ChangeSelectSpecialCrystal(_selectIndex);
|
||||
}
|
||||
|
||||
private void OnClickButtonRight()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
_selectIndex++;
|
||||
if (_selectIndex >= _specialCrystalInfo.Count)
|
||||
{
|
||||
_selectIndex = 0;
|
||||
}
|
||||
ChangeSelectSpecialCrystal(_selectIndex);
|
||||
}
|
||||
|
||||
private void ChangeSelectSpecialCrystal(int page)
|
||||
{
|
||||
_selectIndex = page;
|
||||
PaymentPC instance = PaymentPC.GetInstance();
|
||||
SpecialCrystalInfo specialCrystalInfo = _specialCrystalInfo[_selectIndex];
|
||||
Dictionary<string, string> formatProductPriceList = instance.FormatProductPriceList;
|
||||
_dialog.SetTitleLabel(specialCrystalInfo.DialogTitle);
|
||||
if (formatProductPriceList != null)
|
||||
{
|
||||
bool flag = false;
|
||||
foreach (KeyValuePair<string, string> item in formatProductPriceList)
|
||||
{
|
||||
if (item.Key == specialCrystalInfo.ProductId)
|
||||
{
|
||||
_priceLabel.text = CorrectPriceText(item.Value);
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
_priceLabel.text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
_productName = instance.ProductNameList[specialCrystalInfo.ProductId];
|
||||
}
|
||||
_purchaseCountLabel.text = Wizard.Data.SystemText.Get("MyPage_0060", specialCrystalInfo.AvailablePurchaseCount.ToString());
|
||||
}
|
||||
_tipsTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(specialCrystalInfo.DialogBGImageFileName, ResourcesManager.AssetLoadPathType.SpecialCrystal, isfetch: true)) as Texture;
|
||||
}
|
||||
}
|
||||
33
SVSim.BattleEngine/Engine/SpecialSkillBattleCard.cs
Normal file
33
SVSim.BattleEngine/Engine/SpecialSkillBattleCard.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using Wizard;
|
||||
using Wizard.Battle.Card;
|
||||
|
||||
public class SpecialSkillBattleCard : BattleCardBase
|
||||
{
|
||||
public BossRushSpecialSkill Skill;
|
||||
|
||||
public override bool IsSpecialSkill => true;
|
||||
|
||||
public SpecialSkillBattleCard(BossRushSpecialSkill skill, BuildInfo buildInfo)
|
||||
: base(buildInfo)
|
||||
{
|
||||
Skill = skill;
|
||||
}
|
||||
|
||||
public override string SkillDescription(BattlePlayerBase.SideLogInfo sideLogInfo = null, bool isSkipOption = false, BuffInfo buff = null, string divergenceId = "", List<int> skillDescriptionValueList = null, List<int> sideLogDescriptionValueList = null)
|
||||
{
|
||||
return ConvertSkillDescription(Skill.SkillDescText, sideLogInfo, isSkipOption, buff, divergenceId, skillDescriptionValueList, (base.IsBuffDetail && base.ReplayBuffDetailSkillDescriptionValueList.Count > 0) ? base.ReplayBuffDetailSkillDescriptionValueList : base.ReplaySkillDescriptionValueList);
|
||||
}
|
||||
|
||||
public override string EvoSkillDescription(BattlePlayerBase.SideLogInfo sideLogInfo = null, bool isSkipOption = false, BuffInfo buff = null, string divergenceId = "", List<int> skillDescriptionValueList = null, List<int> sideLogDescriptionValueList = null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
public override BattleCardBase VirtualClone(BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer)
|
||||
{
|
||||
VirtualSpecialSkillBattleCard virtualSpecialSkillBattleCard = new VirtualSpecialSkillBattleCard(Skill, _buildInfo.VirtualClone(selfBattlePlayer, opponentBattlePlayer));
|
||||
CopyToVirtualCardBase(virtualSpecialSkillBattleCard);
|
||||
return virtualSpecialSkillBattleCard;
|
||||
}
|
||||
}
|
||||
9
SVSim.BattleEngine/Engine/SpecialSkillCardCreator.cs
Normal file
9
SVSim.BattleEngine/Engine/SpecialSkillCardCreator.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SpecialSkillCardCreator : CardCreatorBase
|
||||
{
|
||||
public SpecialSkillCardCreator(GameObject rootObject)
|
||||
: base(rootObject)
|
||||
{
|
||||
}
|
||||
}
|
||||
9
SVSim.BattleEngine/Engine/SpellCardCreator.cs
Normal file
9
SVSim.BattleEngine/Engine/SpellCardCreator.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SpellCardCreator : CardCreatorBase
|
||||
{
|
||||
public SpellCardCreator(GameObject rootObject)
|
||||
: base(rootObject)
|
||||
{
|
||||
}
|
||||
}
|
||||
26
SVSim.BattleEngine/Engine/SpellSkillCollection.cs
Normal file
26
SVSim.BattleEngine/Engine/SpellSkillCollection.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Wizard;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class SpellSkillCollection : SkillCollectionBase
|
||||
{
|
||||
public SpellSkillCollection(BattleCardBase ownerCard)
|
||||
: base(ownerCard)
|
||||
{
|
||||
}
|
||||
|
||||
public override VfxWith<SkillProcessor.ProcessInfo> CreateWhenPlayInfo(BattleCardBase playCard, SkillProcessor skillProcessor, BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option)
|
||||
{
|
||||
SkillProcessor.ProcessInfo value = CreateProcessInfo((SkillBase s) => s.OnWhenPlayStart, skillProcessor, playerInfoPair, option);
|
||||
return new VfxWith<SkillProcessor.ProcessInfo>(NullVfx.GetInstance(), value);
|
||||
}
|
||||
|
||||
public override bool CheckWhenPlayCondition(BattlePlayerReadOnlyInfoPair playerInfoPair, bool isPrePlay)
|
||||
{
|
||||
List<SkillBase> list = _skillList.Where((SkillBase s) => s.IsWhenPlaySkill).ToList();
|
||||
SkillBase item = list.First((SkillBase s) => s is Skill_spell_charge);
|
||||
list.Remove(item);
|
||||
return list.Any((SkillBase s) => s.CheckCondition(playerInfoPair, new SkillConditionCheckerOption(), isPrePlay));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
|
||||
namespace Sqlite3Plugin;
|
||||
|
||||
public class DatabaseCorruptionException : Exception
|
||||
{
|
||||
public DatabaseCorruptionException(int rc)
|
||||
: base($"Database is corrupted: code {rc}")
|
||||
{
|
||||
}
|
||||
}
|
||||
80
SVSim.BattleEngine/Engine/Sqlite3Plugin/ResultCode.cs
Normal file
80
SVSim.BattleEngine/Engine/Sqlite3Plugin/ResultCode.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
|
||||
namespace Sqlite3Plugin;
|
||||
|
||||
public class ResultCode
|
||||
{
|
||||
public const int SQLITE_OK = 0;
|
||||
|
||||
public const int SQLITE_ERROR = 1;
|
||||
|
||||
public const int SQLITE_INTERNAL = 2;
|
||||
|
||||
public const int SQLITE_PERM = 3;
|
||||
|
||||
public const int SQLITE_ABORT = 4;
|
||||
|
||||
public const int SQLITE_BUSY = 5;
|
||||
|
||||
public const int SQLITE_LOCKED = 6;
|
||||
|
||||
public const int SQLITE_NOMEM = 7;
|
||||
|
||||
public const int SQLITE_READONLY = 8;
|
||||
|
||||
public const int SQLITE_INTERRUPT = 9;
|
||||
|
||||
public const int SQLITE_IOERR = 10;
|
||||
|
||||
public const int SQLITE_CORRUPT = 11;
|
||||
|
||||
public const int SQLITE_NOTFOUND = 12;
|
||||
|
||||
public const int SQLITE_FULL = 13;
|
||||
|
||||
public const int SQLITE_CANTOPEN = 14;
|
||||
|
||||
public const int SQLITE_PROTOCOL = 15;
|
||||
|
||||
public const int SQLITE_EMPTY = 16;
|
||||
|
||||
public const int SQLITE_SCHEMA = 17;
|
||||
|
||||
public const int SQLITE_TOOBIG = 18;
|
||||
|
||||
public const int SQLITE_CONSTRAINT = 19;
|
||||
|
||||
public const int SQLITE_MISMATCH = 20;
|
||||
|
||||
public const int SQLITE_MISUSE = 21;
|
||||
|
||||
public const int SQLITE_NOLFS = 22;
|
||||
|
||||
public const int SQLITE_AUTH = 23;
|
||||
|
||||
public const int SQLITE_FORMAT = 24;
|
||||
|
||||
public const int SQLITE_RANGE = 25;
|
||||
|
||||
public const int SQLITE_NOTADB = 26;
|
||||
|
||||
public const int SQLITE_NOTICE = 27;
|
||||
|
||||
public const int SQLITE_WARNING = 28;
|
||||
|
||||
public const int SQLITE_ROW = 100;
|
||||
|
||||
public const int SQLITE_DONE = 101;
|
||||
|
||||
public static void CheckCorruption(int rc, string errMsg = null)
|
||||
{
|
||||
if (rc == 11 || rc == 26)
|
||||
{
|
||||
throw new DatabaseCorruptionException(rc);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(errMsg) && errMsg.IndexOf("unsupported file format", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
{
|
||||
throw new DatabaseCorruptionException(26);
|
||||
}
|
||||
}
|
||||
}
|
||||
72
SVSim.BattleEngine/Engine/Sqlite3Plugin/Sqlite3LibImport.cs
Normal file
72
SVSim.BattleEngine/Engine/Sqlite3Plugin/Sqlite3LibImport.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Sqlite3Plugin;
|
||||
|
||||
public static class Sqlite3LibImport
|
||||
{
|
||||
private const string LibraryName = "libsqlite3";
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_open(byte[] zFilename, out IntPtr ppDB);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_open_v2(byte[] zFilename, out IntPtr ppDB, int flags, byte[] zVfs);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_close(IntPtr db);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_exec(IntPtr db, byte[] zSql, IntPtr xCallback, IntPtr pArg, out IntPtr pzErrMsg);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_prepare_v2(IntPtr db, byte[] zSql, int nBytes, out IntPtr ppStmt, IntPtr pzTail);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_text(IntPtr pStmt, int i, byte[] zData, int nData, IntPtr xDel);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_int(IntPtr pStmt, int i, int iValue);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_double(IntPtr pStmt, int i, double rValue);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_bind_null(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_reset(IntPtr pStmt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_step(IntPtr pStmt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_finalize(IntPtr pStmt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_column_int(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern double sqlite3_column_double(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_column_bytes(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern IntPtr sqlite3_column_blob(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern IntPtr sqlite3_column_text(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_column_type(IntPtr pStmt, int i);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_vfs_register(IntPtr pStmt, int makeDflt);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern int sqlite3_vfs_unregister(IntPtr pVfs);
|
||||
|
||||
[DllImport("libsqlite3")]
|
||||
public static extern IntPtr sqlite3_vfs_find(byte[] zVfsName);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user