feat(battle-engine): full Unity/VFX/god-object shims + expanded copy closure (2570 files)
Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
4
SVSim.BattleEngine/Engine/AchievementInfo.cs
Normal file
4
SVSim.BattleEngine/Engine/AchievementInfo.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
public class AchievementInfo : HeaderData
|
||||
{
|
||||
public AchievementInfoDetail data;
|
||||
}
|
||||
6
SVSim.BattleEngine/Engine/AchievementInfoDetail.cs
Normal file
6
SVSim.BattleEngine/Engine/AchievementInfoDetail.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class AchievementInfoDetail
|
||||
{
|
||||
public List<UserAchievement> user_achievement_list;
|
||||
}
|
||||
777
SVSim.BattleEngine/Engine/AchievementWindowBase.cs
Normal file
777
SVSim.BattleEngine/Engine/AchievementWindowBase.cs
Normal file
@@ -0,0 +1,777 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Bingo;
|
||||
using Wizard.Lottery;
|
||||
using Wizard.Scripts.Network.Data.TableData;
|
||||
|
||||
public class AchievementWindowBase : MonoBehaviour
|
||||
{
|
||||
public enum AchievementType
|
||||
{
|
||||
None,
|
||||
Reward,
|
||||
Nonattainment,
|
||||
AlreadyReceived,
|
||||
PointRunning,
|
||||
PointClear,
|
||||
PointReceived
|
||||
}
|
||||
|
||||
public GameObject goButtonReward;
|
||||
|
||||
public UITexture achievementIconTexture;
|
||||
|
||||
public UILabel labelAchievementTitle;
|
||||
|
||||
public UILabel labelAchievementData;
|
||||
|
||||
public UILabel labelAchievementCount;
|
||||
|
||||
public UILabel _missionWaitLabel;
|
||||
|
||||
public UILabel _labelMissionPeriod;
|
||||
|
||||
public UILabel _labelMissionNotice;
|
||||
|
||||
public UISprite _titleLine;
|
||||
|
||||
public UILabel alreadyReceived;
|
||||
|
||||
[NonSerialized]
|
||||
public int type;
|
||||
|
||||
[NonSerialized]
|
||||
public int iType = -1;
|
||||
|
||||
[NonSerialized]
|
||||
public int level;
|
||||
|
||||
[NonSerialized]
|
||||
public string strAchievementData = "3種類のスリーブを使う。";
|
||||
|
||||
[SerializeField]
|
||||
private UILabel LabelDetailBtn;
|
||||
|
||||
[SerializeField]
|
||||
private UITable StarTable;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite StarOriginal;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject MailReceive;
|
||||
|
||||
[SerializeField]
|
||||
private UIGauge GaugeUI;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel GaugeLabel;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _Separator;
|
||||
|
||||
[SerializeField]
|
||||
private UIWidget _StarsWidget;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelTopRight;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _missionStartTime;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _missionTimeOver;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _applyFinish;
|
||||
|
||||
private const int ACHIEVEMENT_STARS_MAX = 5;
|
||||
|
||||
private ResourceHandler _resourceHandler;
|
||||
|
||||
private const string SPRITE_PREFIX_BUTTON_BLUE = "btn_common_02_s_";
|
||||
|
||||
private int _viewMailId;
|
||||
|
||||
private QuestRewardInfo _questRewardInfo;
|
||||
|
||||
private Action _onReceivceAchievementSuccess;
|
||||
|
||||
private CrossoverRewardInfo _crossoverRewardInfo;
|
||||
|
||||
private const int BINGO_MISSION_SPRITE_WIDTH = 752;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
LabelDetailBtn.text = Data.SystemText.Get("Common_0022");
|
||||
}
|
||||
|
||||
public void SetType(AchievementType typeBase)
|
||||
{
|
||||
labelAchievementCount.gameObject.SetActive(typeBase != AchievementType.AlreadyReceived);
|
||||
alreadyReceived.gameObject.SetActive(typeBase == AchievementType.AlreadyReceived || typeBase == AchievementType.PointReceived);
|
||||
goButtonReward.SetActive(typeBase != AchievementType.AlreadyReceived && typeBase != AchievementType.PointReceived);
|
||||
UIManager.SetObjectToGrey(goButtonReward, typeBase == AchievementType.Nonattainment || typeBase == AchievementType.PointRunning);
|
||||
}
|
||||
|
||||
public void SetActiveGaugeUI(bool isActive)
|
||||
{
|
||||
GaugeUI.gameObject.SetActive(isActive);
|
||||
}
|
||||
|
||||
public void OnRewardClick()
|
||||
{
|
||||
AchievementReceiveRewardTask achievementReceiveRewardTask = new AchievementReceiveRewardTask();
|
||||
achievementReceiveRewardTask.SetParameter(type, level);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(achievementReceiveRewardTask, OnRequestRewardAchievement, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode));
|
||||
}
|
||||
|
||||
public void OnDetail()
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Mission_0007"));
|
||||
dialogBase.SetText(strAchievementData);
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
||||
}
|
||||
|
||||
private void OnRequestRewardAchievement(NetworkTask.ResultCode error)
|
||||
{
|
||||
OnRequestReward(error, Data.MissionInfo.data.total_reward_list);
|
||||
_onReceivceAchievementSuccess.Call();
|
||||
}
|
||||
|
||||
private void OnRequestReward(NetworkTask.ResultCode error, List<ReceivedReward> rewards)
|
||||
{
|
||||
base.transform.parent.gameObject.AddMissingComponent<ReceiveReward>().ShowReadDialog(rewards, MailReceive, base.gameObject, _resourceHandler);
|
||||
MyPageMenu.Instance.UpdateMissionCount();
|
||||
}
|
||||
|
||||
private void SetAchievementCommon(UserAchievement achi)
|
||||
{
|
||||
bool num = achi.reward_type == 4;
|
||||
strAchievementData = achi.achievement_name;
|
||||
SystemText systemText = Data.SystemText;
|
||||
labelAchievementTitle.text = systemText.Get("Mission_0023") + strAchievementData;
|
||||
labelAchievementTitle.rightAnchor.target = _StarsWidget.transform;
|
||||
labelAchievementTitle.rightAnchor.relative = 0f;
|
||||
if (num)
|
||||
{
|
||||
ReceiveReward.SetTicket(achi.RewardUserGoodsId, achi.reward_number, achievementIconTexture, labelAchievementData, _resourceHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReceiveReward.SetTexture((UserGoods.Type)achi.reward_type, achievementIconTexture, _resourceHandler);
|
||||
labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)achi.reward_type, achi.RewardUserGoodsId, achi.reward_number);
|
||||
}
|
||||
GaugeUI.gameObject.SetActive(value: true);
|
||||
int num2 = ((achi.total_count > achi.require_number) ? achi.require_number : achi.total_count);
|
||||
int require_number = achi.require_number;
|
||||
labelAchievementCount.gameObject.SetActive(value: false);
|
||||
GaugeLabel.text = num2 + "/" + require_number;
|
||||
if (num2 != 0 && require_number != 0)
|
||||
{
|
||||
float value = (float)num2 / (float)require_number;
|
||||
GaugeUI.Value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
GaugeUI.Value = 0f;
|
||||
}
|
||||
goButtonReward.GetComponent<UIButton>().GetComponentInChildren<UILabel>().text = systemText.Get("Mail_0023");
|
||||
}
|
||||
|
||||
private void SetRunning(UserAchievement achi)
|
||||
{
|
||||
SetType(AchievementType.Nonattainment);
|
||||
SetAchievementCommon(achi);
|
||||
SetAchievementStars(achi, cleared: false);
|
||||
}
|
||||
|
||||
private void SetAchievementStars(UserAchievement achi, bool cleared)
|
||||
{
|
||||
int num = achi._maxLevel;
|
||||
int num2 = achi.level;
|
||||
if (achi._maxLevel > 5)
|
||||
{
|
||||
num = 5;
|
||||
num2 = ((achi.level == achi._maxLevel) ? 5 : ((achi.level <= 0 || achi.level % 5 != 0) ? (achi.level % 5) : 5));
|
||||
}
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
UISprite uISprite = UnityEngine.Object.Instantiate(StarOriginal, StarOriginal.transform.localPosition, StarOriginal.transform.localRotation);
|
||||
uISprite.transform.parent = StarTable.transform;
|
||||
uISprite.transform.localPosition = Vector3.zero;
|
||||
uISprite.transform.localScale = Vector3.one;
|
||||
if ((num2 == i + 1 && cleared) || num2 > i + 1)
|
||||
{
|
||||
uISprite.spriteName = "achievement_star_02";
|
||||
}
|
||||
else
|
||||
{
|
||||
uISprite.spriteName = "achievement_star_01";
|
||||
}
|
||||
uISprite.gameObject.SetActive(value: true);
|
||||
}
|
||||
StarTable.repositionNow = true;
|
||||
}
|
||||
|
||||
private void SetCanReceive(UserAchievement achi)
|
||||
{
|
||||
SetType(AchievementType.Reward);
|
||||
SetAchievementCommon(achi);
|
||||
SetAchievementStars(achi, cleared: false);
|
||||
UIButton component = goButtonReward.GetComponent<UIButton>();
|
||||
component.onClick.Clear();
|
||||
component.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
OnRewardClick();
|
||||
}));
|
||||
}
|
||||
|
||||
private void SetAlreadyReceived(UserAchievement achi)
|
||||
{
|
||||
SetType(AchievementType.AlreadyReceived);
|
||||
SetAchievementCommon(achi);
|
||||
SetAchievementStars(achi, cleared: true);
|
||||
}
|
||||
|
||||
public void SetAchievement(UserAchievement achi, ResourceHandler resourceHandler, Action onReceivceAchievementSuccess)
|
||||
{
|
||||
_resourceHandler = resourceHandler;
|
||||
_onReceivceAchievementSuccess = onReceivceAchievementSuccess;
|
||||
switch (achi.achievement_status)
|
||||
{
|
||||
case 0:
|
||||
SetRunning(achi);
|
||||
break;
|
||||
case 1:
|
||||
SetCanReceive(achi);
|
||||
break;
|
||||
case 2:
|
||||
SetAlreadyReceived(achi);
|
||||
break;
|
||||
default:
|
||||
UnityEngine.Debug.LogError("unkown achievement status");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCrossoverReward(CrossoverRewardInfo reward, AchievementType type, ResourceHandler resourceHandler, Action onReceiveReward)
|
||||
{
|
||||
_crossoverRewardInfo = reward;
|
||||
_resourceHandler = resourceHandler;
|
||||
SetType(type);
|
||||
string texName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.RewardType, reward.RewardDetailId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item);
|
||||
_resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
if (reward.RewardDetailId == _crossoverRewardInfo.RewardDetailId)
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
}
|
||||
});
|
||||
RankInfo rankInfo = Data.Load.data.GetRankInfo(Format.Crossover, reward.Rank);
|
||||
labelAchievementTitle.text = Data.SystemText.Get("Profile_0042", Data.SystemText.Get(rankInfo.rank_name));
|
||||
labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.RewardType, reward.RewardDetailId, reward.RewardCount);
|
||||
GaugeUI.gameObject.SetActive(value: false);
|
||||
UIButton component = goButtonReward.GetComponent<UIButton>();
|
||||
component.GetComponentInChildren<UILabel>().text = Data.SystemText.Get("Mail_0023");
|
||||
goButtonReward.gameObject.SetActive(type != AchievementType.PointReceived);
|
||||
UIManager.SetObjectToGrey(goButtonReward, type != AchievementType.PointClear);
|
||||
component.onClick.Clear();
|
||||
component.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
ReceiveCrossoverReward(reward.RewardId, onReceiveReward);
|
||||
}));
|
||||
CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor);
|
||||
}
|
||||
|
||||
private void ReceiveCrossoverReward(int rewardId, Action onReceiveReward)
|
||||
{
|
||||
CrossoverReceiveRankRewardTask task = new CrossoverReceiveRankRewardTask();
|
||||
task.SetParameter(rewardId);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
onReceiveReward.Call();
|
||||
DialogCreator.CreateRewardReceiveDialog(task.ReceivedRewardList);
|
||||
}));
|
||||
}
|
||||
|
||||
public void SetQuestPoint(QuestRewardInfo reward, AchievementType type, ResourceHandler resourceHandler, Action onRequestRewardPointCallBack)
|
||||
{
|
||||
_questRewardInfo = reward;
|
||||
strAchievementData = reward.Point.ToString();
|
||||
labelAchievementTitle.text = Data.SystemText.Get("Quest_0019", strAchievementData);
|
||||
_resourceHandler = resourceHandler;
|
||||
SetType(type);
|
||||
string texName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.RewardType, reward.RewardDetailId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item);
|
||||
_resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
if (reward.RewardDetailId == _questRewardInfo.RewardDetailId)
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
}
|
||||
});
|
||||
labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.RewardType, reward.RewardDetailId, reward.RewardCount);
|
||||
GaugeUI.gameObject.SetActive(value: false);
|
||||
UIButton component = goButtonReward.GetComponent<UIButton>();
|
||||
component.GetComponentInChildren<UILabel>().text = Data.SystemText.Get("Mail_0023");
|
||||
goButtonReward.gameObject.SetActive(type != AchievementType.PointReceived);
|
||||
UIManager.SetObjectToGrey(goButtonReward, type != AchievementType.PointClear);
|
||||
component.onClick.Clear();
|
||||
component.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
OnQuestPointReceive(reward.Id, onRequestRewardPointCallBack);
|
||||
}));
|
||||
GetComponent<UISprite>().spriteName = string.Empty;
|
||||
CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor);
|
||||
}
|
||||
|
||||
public void SetMission(UserMission mission, ResourceHandler resourceHandler, bool canChangeMissions, bool enableSeparator, bool displayChange, Action onChangeMissionSuccess = null)
|
||||
{
|
||||
_resourceHandler = resourceHandler;
|
||||
_Separator.gameObject.SetActive(enableSeparator);
|
||||
if (mission.mission_status == 0 && SetMissionWait(mission))
|
||||
{
|
||||
return;
|
||||
}
|
||||
SystemText systemText = Data.SystemText;
|
||||
if (mission.reward_type == 4)
|
||||
{
|
||||
ReceiveReward.SetTicket(mission.RewardUserGoodsId, mission.reward_number, achievementIconTexture, labelAchievementData, _resourceHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReceiveReward.SetTexture((UserGoods.Type)mission.reward_type, mission.RewardUserGoodsId, achievementIconTexture, _resourceHandler);
|
||||
labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)mission.reward_type, mission.RewardUserGoodsId, mission.reward_number);
|
||||
}
|
||||
labelAchievementTitle.text = mission.mission_name;
|
||||
int require_number = mission.require_number;
|
||||
bool flag = require_number > 0;
|
||||
GaugeUI.gameObject.SetActive(flag);
|
||||
if (flag)
|
||||
{
|
||||
int num = ((mission.total_count > mission.require_number) ? mission.require_number : mission.total_count);
|
||||
GaugeLabel.text = num + "/" + require_number;
|
||||
if (num != 0)
|
||||
{
|
||||
float value = (float)num / (float)require_number;
|
||||
GaugeUI.Value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
GaugeUI.Value = 0f;
|
||||
}
|
||||
}
|
||||
UIButton component = goButtonReward.GetComponent<UIButton>();
|
||||
component.normalSprite = "btn_common_02_s_off";
|
||||
component.pressedSprite = "btn_common_02_s_on";
|
||||
component.GetComponentInChildren<UILabel>().text = systemText.Get("Mission_0029");
|
||||
component.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
ChangeMission(mission.id, mission.mission_name, onChangeMissionSuccess);
|
||||
}));
|
||||
goButtonReward.SetActive(displayChange && !mission.default_flag);
|
||||
UIManager.SetObjectToGrey(goButtonReward, !canChangeMissions);
|
||||
labelAchievementCount.gameObject.SetActive(value: false);
|
||||
SetMissionPeriodLabel(mission);
|
||||
CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor);
|
||||
}
|
||||
|
||||
public void SetBttlePassMonthlyMission(BattlePassMonthlyMission.MissionDetail mission, ResourceHandler resourceHandler)
|
||||
{
|
||||
_Separator.gameObject.SetActive(value: false);
|
||||
_labelMissionPeriod.gameObject.SetActive(value: false);
|
||||
labelAchievementCount.gameObject.SetActive(value: false);
|
||||
goButtonReward.gameObject.SetActive(value: false);
|
||||
_resourceHandler = resourceHandler;
|
||||
labelAchievementTitle.text = mission.Name;
|
||||
alreadyReceived.gameObject.SetActive(mission.IsCleared);
|
||||
BattlePassMonthlyMission.MissionDetail.RewardInfo reward = mission.Reward;
|
||||
if (reward == null)
|
||||
{
|
||||
_resourceHandler.Add(Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_battle_pass_point", ResourcesManager.AssetLoadPathType.BattlePass), delegate
|
||||
{
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_battle_pass_point", ResourcesManager.AssetLoadPathType.BattlePass, isfetch: true);
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath);
|
||||
});
|
||||
labelAchievementData.text = string.Empty;
|
||||
}
|
||||
else if (reward.UserGoods.GoodsType == UserGoods.Type.Item)
|
||||
{
|
||||
ReceiveReward.SetTicket(reward.UserGoods.Id, reward.Number, achievementIconTexture, labelAchievementData, _resourceHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReceiveReward.SetTexture(reward.UserGoods.GoodsType, achievementIconTexture, _resourceHandler);
|
||||
labelAchievementData.text = ReceiveReward.getTitle(reward.UserGoods.GoodsType, reward.UserGoods.Id, reward.Number);
|
||||
}
|
||||
SetViewBattlePassPointText(mission.BattlePassPoint);
|
||||
int requireNumber = mission.RequireNumber;
|
||||
bool flag = requireNumber > 0;
|
||||
GaugeUI.gameObject.SetActive(flag);
|
||||
if (flag)
|
||||
{
|
||||
int num = ((mission.DoneNumber > mission.RequireNumber) ? mission.RequireNumber : mission.DoneNumber);
|
||||
GaugeLabel.text = num + "/" + requireNumber;
|
||||
if (num != 0)
|
||||
{
|
||||
float value = (float)num / (float)requireNumber;
|
||||
GaugeUI.Value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
GaugeUI.Value = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SetViewBattlePassPointText(int point)
|
||||
{
|
||||
string text = " ";
|
||||
if (labelAchievementData.text == string.Empty)
|
||||
{
|
||||
labelAchievementData.text = Data.SystemText.Get("BattlePass_0010", point.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
UILabel uILabel = labelAchievementData;
|
||||
uILabel.text = uILabel.text + text + Data.SystemText.Get("BattlePass_0010", point.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private bool SetMissionWait(UserMission mission)
|
||||
{
|
||||
MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask();
|
||||
long num = (long)Time.realtimeSinceStartup - missionInfoTask.RequestTime;
|
||||
long num2 = missionInfoTask.ServerTime + num;
|
||||
TimeSpan timeSpan = TimeSpan.FromSeconds(mission.start_time - num2).Add(new TimeSpan(0, 1, 0));
|
||||
int num3 = timeSpan.Hours;
|
||||
int num4 = timeSpan.Minutes;
|
||||
if (timeSpan.TotalHours >= 24.0)
|
||||
{
|
||||
num3 = 24;
|
||||
num4 = 0;
|
||||
}
|
||||
else if (num3 <= 0 && num4 <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (mission.IsGemMission())
|
||||
{
|
||||
_missionWaitLabel.text = Data.SystemText.Get("Mission_0073", num3.ToString("00"), num4.ToString("00"));
|
||||
_labelMissionNotice.gameObject.SetActive(value: true);
|
||||
_labelMissionNotice.text = Data.SystemText.Get("Mission_0074");
|
||||
}
|
||||
else
|
||||
{
|
||||
_missionWaitLabel.text = Data.SystemText.Get("Mission_0041", num3.ToString("00"), num4.ToString("00"));
|
||||
}
|
||||
labelAchievementTitle.gameObject.SetActive(value: false);
|
||||
labelAchievementCount.gameObject.SetActive(value: false);
|
||||
labelAchievementData.gameObject.SetActive(value: false);
|
||||
labelAchievementData.gameObject.SetActive(value: false);
|
||||
goButtonReward.gameObject.SetActive(value: false);
|
||||
GaugeUI.gameObject.SetActive(value: false);
|
||||
_titleLine.gameObject.SetActive(value: false);
|
||||
_missionWaitLabel.gameObject.SetActive(value: true);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetMissionPeriodLabel(UserMission mission)
|
||||
{
|
||||
if (mission.end_time <= 0 || mission.IsGemMission())
|
||||
{
|
||||
_labelMissionPeriod.gameObject.SetActive(value: false);
|
||||
return;
|
||||
}
|
||||
long nowUnixTime = GameMgr.GetIns().GetMissionInfoTask().NowUnixTime();
|
||||
string remainingTime = ConvertTime.GetRemainingTime(TimeSpan.FromSeconds(mission.GetMissionPeriodSec(nowUnixTime)));
|
||||
goButtonReward.gameObject.SetActive(value: false);
|
||||
_labelMissionPeriod.gameObject.SetActive(value: true);
|
||||
_labelMissionPeriod.text = remainingTime;
|
||||
}
|
||||
|
||||
private void ChangeMission(int id, string content, Action onChangeMissionSuccess)
|
||||
{
|
||||
SystemText systemText = Data.SystemText;
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetTitleLabel(systemText.Get("Mission_0033"));
|
||||
dialogBase.SetText(systemText.Get("Mission_0030", content));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn);
|
||||
dialogBase.onPushButton1 = delegate
|
||||
{
|
||||
MissionRetireTask missionRetireTask = new MissionRetireTask();
|
||||
missionRetireTask.SetParameter(id);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(missionRetireTask, delegate
|
||||
{
|
||||
onChangeMissionSuccess.Call();
|
||||
}, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode));
|
||||
};
|
||||
}
|
||||
|
||||
private void OnQuestPointReceive(int rewardId, Action onRequestRewardPointCallBack)
|
||||
{
|
||||
QuestRewardReceiveTask task = new QuestRewardReceiveTask();
|
||||
task.SetParameter(rewardId);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
||||
{
|
||||
onRequestRewardPointCallBack.Call();
|
||||
DialogCreator.CreateRewardReceiveDialog(task.ReceiveRewardList);
|
||||
}, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode));
|
||||
}
|
||||
|
||||
public void SetHistoryItem(ItemAcquireHistory item, bool enableSeparator, ResourceHandler resourceHandler)
|
||||
{
|
||||
_resourceHandler = resourceHandler;
|
||||
SystemText systemText = Data.SystemText;
|
||||
if (item.RewardType == 4)
|
||||
{
|
||||
ReceiveReward.SetTicket(item.RewardUserGoodsId, item.RewardCount, achievementIconTexture, labelAchievementTitle, _resourceHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReceiveReward.SetTexture((UserGoods.Type)item.RewardType, achievementIconTexture, _resourceHandler);
|
||||
labelAchievementTitle.text = ReceiveReward.getTitle((UserGoods.Type)item.RewardType, item.RewardUserGoodsId, item.RewardCount);
|
||||
}
|
||||
labelAchievementData.text = item.Message;
|
||||
labelAchievementCount.text = systemText.Get("Mail_0043", ConvertTime.ToLocal(item.AcquireTime));
|
||||
GaugeUI.gameObject.SetActive(value: false);
|
||||
goButtonReward.SetActive(value: false);
|
||||
_Separator.gameObject.SetActive(enableSeparator);
|
||||
}
|
||||
|
||||
public void SetMail(MailData mail, Action<int, int> OnReadMail, ResourceHandler handler)
|
||||
{
|
||||
_resourceHandler = handler;
|
||||
_viewMailId = mail.mail_id;
|
||||
SetCommonMail(mail);
|
||||
TimeLeftUpdate timeLeftUpdate = base.gameObject.AddMissingComponent<TimeLeftUpdate>();
|
||||
timeLeftUpdate.mailData = mail;
|
||||
_labelTopRight.gameObject.SetActive(value: true);
|
||||
timeLeftUpdate.timeLeft = _labelTopRight;
|
||||
timeLeftUpdate.UpdateTime();
|
||||
SystemText systemText = Data.SystemText;
|
||||
labelAchievementCount.text = systemText.Get("Mail_0043", mail.create_time);
|
||||
goButtonReward.SetActive(value: true);
|
||||
goButtonReward.transform.Find("RewardLabel").GetComponent<UILabel>().text = systemText.Get("Mail_0023");
|
||||
UIButton component = goButtonReward.GetComponent<UIButton>();
|
||||
component.normalSprite = "btn_common_02_s_off";
|
||||
component.hoverSprite = "btn_common_02_s_off";
|
||||
component.pressedSprite = "btn_common_02_s_on";
|
||||
UIEventListener.Get(goButtonReward).onClick = delegate
|
||||
{
|
||||
OnReadMail(mail.mail_id, mail.mail_id);
|
||||
};
|
||||
}
|
||||
|
||||
public void SetHistoryMail(MailData mail, ResourceHandler handler)
|
||||
{
|
||||
_resourceHandler = handler;
|
||||
_viewMailId = mail.mail_id;
|
||||
SetCommonMail(mail);
|
||||
TimeLeftUpdate component = base.gameObject.GetComponent<TimeLeftUpdate>();
|
||||
if ((bool)component)
|
||||
{
|
||||
component.mailData = null;
|
||||
}
|
||||
_labelTopRight.gameObject.SetActive(value: false);
|
||||
labelAchievementCount.text = Data.SystemText.Get("Mail_0044", mail.create_time);
|
||||
goButtonReward.SetActive(value: false);
|
||||
}
|
||||
|
||||
private void SetCommonMail(MailData mailData)
|
||||
{
|
||||
GaugeUI.gameObject.SetActive(value: false);
|
||||
labelAchievementData.text = mailData.message;
|
||||
labelAchievementTitle.text = ReceiveReward.getTitle(mailData);
|
||||
string textureName = ReceiveReward.GetThumbnailName((UserGoods.Type)mailData.reward_type, mailData.RewardUserGoodsId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item);
|
||||
_resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
if (mailData.mail_id == _viewMailId)
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void CopyAnchor(UIRect.AnchorPoint original, UIRect.AnchorPoint destination)
|
||||
{
|
||||
destination.target = original.target;
|
||||
destination.relative = original.relative;
|
||||
destination.absolute = original.absolute;
|
||||
}
|
||||
|
||||
public void SetGetButtonToGreyOut()
|
||||
{
|
||||
UIManager.SetObjectToGrey(goButtonReward, b: true);
|
||||
}
|
||||
|
||||
public void SetLottery(LotteryMissionData lotteryData, bool needCeparator)
|
||||
{
|
||||
string userGoodsImageName = UserGoods.GetUserGoodsImageName(lotteryData.UserGoodsType, lotteryData.ItemId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
base.gameObject.GetComponent<UISprite>().width = 800;
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath);
|
||||
_Separator.gameObject.SetActive(needCeparator);
|
||||
labelAchievementTitle.text = lotteryData.MissionTitle;
|
||||
if (lotteryData.UserGoodsType == UserGoods.Type.Item)
|
||||
{
|
||||
labelAchievementData.text = ReceiveReward.SetTicketTitle(lotteryData.ItemId, lotteryData.ItemCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
labelAchievementData.text = ReceiveReward.getTitle(lotteryData.UserGoodsType, lotteryData.ItemId, lotteryData.ItemCount);
|
||||
}
|
||||
goButtonReward.SetActive(value: false);
|
||||
if (lotteryData.StartTime.Second > 0)
|
||||
{
|
||||
_missionStartTime.text = Data.SystemText.Get("Mission_0077", lotteryData.StartTime.LocalTime);
|
||||
_missionStartTime.gameObject.SetActive(value: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_labelMissionPeriod.text = lotteryData.EndTime.GetShowText("Mission_0062", "Mission_0060", "Mission_0061");
|
||||
_labelMissionPeriod.gameObject.SetActive(value: true);
|
||||
}
|
||||
CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor);
|
||||
_applyFinish.gameObject.SetActive(lotteryData.IsCleared);
|
||||
_labelMissionPeriod.gameObject.SetActive(!lotteryData.IsCleared && !lotteryData.IsTimeOver);
|
||||
_missionTimeOver.gameObject.SetActive(lotteryData.IsTimeOver);
|
||||
GaugeLabel.text = lotteryData.MissionCurrent + "/" + lotteryData.MissionMax;
|
||||
GaugeUI.Value = lotteryData.MissionRatio;
|
||||
bool active = true;
|
||||
if (lotteryData.IsCleared || lotteryData.MissionMax == 0)
|
||||
{
|
||||
active = false;
|
||||
}
|
||||
GaugeUI.gameObject.SetActive(active);
|
||||
}
|
||||
|
||||
public void SetBingoMission(BingoInfoTask.BingoMissionData missionData, bool needCeparator, ResourceHandler handler)
|
||||
{
|
||||
_resourceHandler = handler;
|
||||
base.gameObject.GetComponent<UISprite>().width = 752;
|
||||
base.gameObject.GetComponent<UISprite>().enabled = false;
|
||||
alreadyReceived.gameObject.SetActive(missionData.IsCleared);
|
||||
labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)missionData.Reward.reward_type, missionData.Reward.rewardUserGoodsId, missionData.Reward.reward_count);
|
||||
string textureName = UserGoods.GetUserGoodsImageName((UserGoods.Type)missionData.Reward.reward_type, missionData.Reward.rewardUserGoodsId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item);
|
||||
_resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
});
|
||||
CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor);
|
||||
_titleLine.SetAnchor((GameObject)null);
|
||||
_titleLine.spriteName = "quest_line_05";
|
||||
_titleLine.SetDimensions(610, 2);
|
||||
_Separator.spriteName = "quest_line_02";
|
||||
_Separator.gameObject.SetActive(needCeparator);
|
||||
goButtonReward.SetActive(value: false);
|
||||
GaugeLabel.text = missionData.MissionCurrent + "/" + missionData.MissionMax;
|
||||
GaugeUI.Value = missionData.MissionRatio;
|
||||
labelAchievementTitle.text = missionData.MissionTitle;
|
||||
}
|
||||
|
||||
public void SetBingoRewardDetails(ReceivedReward reward, bool needCeparator, ResourceHandler handler)
|
||||
{
|
||||
_resourceHandler = handler;
|
||||
base.gameObject.GetComponent<UISprite>().width = 752;
|
||||
base.gameObject.GetComponent<UISprite>().enabled = false;
|
||||
goButtonReward.SetActive(value: false);
|
||||
_titleLine.SetAnchor((GameObject)null);
|
||||
_titleLine.spriteName = "quest_line_05";
|
||||
_titleLine.SetDimensions(610, 2);
|
||||
_Separator.spriteName = "quest_line_02";
|
||||
_Separator.gameObject.SetActive(needCeparator);
|
||||
labelAchievementTitle.text = string.Format(Data.SystemText.Get("Bingo_0004", reward.lineNum.ToString()));
|
||||
labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId, reward.reward_count);
|
||||
GaugeUI.gameObject.SetActive(value: false);
|
||||
string textureName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item);
|
||||
_resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
});
|
||||
}
|
||||
|
||||
public void SetBingoSideBarRewards(string lineNum, ReceivedReward reward, bool isCleared, bool needCeparator, ResourceHandler handler)
|
||||
{
|
||||
_resourceHandler = handler;
|
||||
_Separator.gameObject.SetActive(needCeparator);
|
||||
goButtonReward.SetActive(value: false);
|
||||
labelAchievementTitle.text = string.Format(Data.SystemText.Get("Bingo_0004", lineNum));
|
||||
labelAchievementData.text = ReceiveReward.getTitle((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId, reward.reward_count);
|
||||
alreadyReceived.gameObject.SetActive(isCleared);
|
||||
string textureName = UserGoods.GetUserGoodsImageName((UserGoods.Type)reward.reward_type, reward.rewardUserGoodsId);
|
||||
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item);
|
||||
_resourceHandler.Add(assetTypePath, delegate
|
||||
{
|
||||
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true);
|
||||
achievementIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(assetTypePath2);
|
||||
});
|
||||
}
|
||||
|
||||
public void SetPracticePuzzleMission(PracticePuzzleMissionData mission, ResourceHandler resourceHandler, bool canChangeMissions, bool enableSeparator, bool displayChange, Action onChangeMissionSuccess = null)
|
||||
{
|
||||
_resourceHandler = resourceHandler;
|
||||
_Separator.gameObject.SetActive(enableSeparator);
|
||||
goButtonReward.SetActive(value: false);
|
||||
_ = Data.SystemText;
|
||||
if (mission.UserGoodsType == UserGoods.Type.Item)
|
||||
{
|
||||
ReceiveReward.SetTicket(mission.ItemId, mission.ItemCount, achievementIconTexture, labelAchievementData, _resourceHandler);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReceiveReward.SetTexture(mission.UserGoodsType, mission.ItemId, achievementIconTexture, _resourceHandler);
|
||||
labelAchievementData.text = ReceiveReward.getTitle(mission.UserGoodsType, mission.ItemId, mission.ItemCount);
|
||||
}
|
||||
labelAchievementTitle.text = mission.Name;
|
||||
int totalMissionCount = mission.TotalMissionCount;
|
||||
bool flag = totalMissionCount > 0;
|
||||
GaugeUI.gameObject.SetActive(flag);
|
||||
if (flag)
|
||||
{
|
||||
int num = ((mission.TotalMissionCount > mission.CurrentClearCount) ? mission.CurrentClearCount : mission.TotalMissionCount);
|
||||
GaugeLabel.text = num + "/" + totalMissionCount;
|
||||
if (num != 0)
|
||||
{
|
||||
float value = (float)num / (float)totalMissionCount;
|
||||
GaugeUI.Value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
GaugeUI.Value = 0f;
|
||||
}
|
||||
}
|
||||
alreadyReceived.gameObject.SetActive(mission.IsCleared);
|
||||
labelAchievementCount.gameObject.SetActive(value: false);
|
||||
CopyAnchor(_labelTopRight.rightAnchor, labelAchievementTitle.rightAnchor);
|
||||
}
|
||||
|
||||
public void SetRedEtherMission(RedEtherCampaignRewardData rewardData, ResourceHandler resourceHandler)
|
||||
{
|
||||
_resourceHandler = resourceHandler;
|
||||
goButtonReward.SetActive(value: false);
|
||||
ReceiveReward.SetTexture(rewardData.UserGoodsType, 0L, achievementIconTexture, _resourceHandler);
|
||||
labelAchievementData.text = ReceiveReward.getTitle(rewardData.UserGoodsType, 0L, rewardData.ItemCount);
|
||||
labelAchievementTitle.text = rewardData.MissionText;
|
||||
alreadyReceived.gameObject.SetActive(rewardData.IsCleared);
|
||||
GaugeUI.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
356
SVSim.BattleEngine/Engine/ActiveAnimation.cs
Normal file
356
SVSim.BattleEngine/Engine/ActiveAnimation.cs
Normal file
@@ -0,0 +1,356 @@
|
||||
using System.Collections.Generic;
|
||||
using AnimationOrTween;
|
||||
using UnityEngine;
|
||||
|
||||
[AddComponentMenu("NGUI/Internal/Active Animation")]
|
||||
public class ActiveAnimation : MonoBehaviour
|
||||
{
|
||||
public static ActiveAnimation current;
|
||||
|
||||
public List<EventDelegate> onFinished = new List<EventDelegate>();
|
||||
|
||||
[HideInInspector]
|
||||
public GameObject eventReceiver;
|
||||
|
||||
[HideInInspector]
|
||||
public string callWhenFinished;
|
||||
|
||||
private Animation mAnim;
|
||||
|
||||
private Direction mLastDirection;
|
||||
|
||||
private Direction mDisableDirection;
|
||||
|
||||
private bool mNotify;
|
||||
|
||||
private Animator mAnimator;
|
||||
|
||||
private string mClip = "";
|
||||
|
||||
private float playbackTime => Mathf.Clamp01(mAnimator.GetCurrentAnimatorStateInfo(0).normalizedTime);
|
||||
|
||||
public bool isPlaying
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mAnim == null)
|
||||
{
|
||||
if (mAnimator != null)
|
||||
{
|
||||
if (mLastDirection == Direction.Reverse)
|
||||
{
|
||||
if (playbackTime == 0f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (playbackTime == 1f)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
foreach (AnimationState item in mAnim)
|
||||
{
|
||||
if (!mAnim.IsPlaying(item.name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (mLastDirection == Direction.Forward)
|
||||
{
|
||||
if (item.time < item.length)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (mLastDirection == Direction.Reverse)
|
||||
{
|
||||
if (item.time > 0f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Finish()
|
||||
{
|
||||
if (mAnim != null)
|
||||
{
|
||||
foreach (AnimationState item in mAnim)
|
||||
{
|
||||
if (mLastDirection == Direction.Forward)
|
||||
{
|
||||
item.time = item.length;
|
||||
}
|
||||
else if (mLastDirection == Direction.Reverse)
|
||||
{
|
||||
item.time = 0f;
|
||||
}
|
||||
}
|
||||
mAnim.Sample();
|
||||
}
|
||||
else if (mAnimator != null)
|
||||
{
|
||||
mAnimator.Play(mClip, 0, (mLastDirection == Direction.Forward) ? 1f : 0f);
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
if (mAnim != null)
|
||||
{
|
||||
foreach (AnimationState item in mAnim)
|
||||
{
|
||||
if (mLastDirection == Direction.Reverse)
|
||||
{
|
||||
item.time = item.length;
|
||||
}
|
||||
else if (mLastDirection == Direction.Forward)
|
||||
{
|
||||
item.time = 0f;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mAnimator != null)
|
||||
{
|
||||
mAnimator.Play(mClip, 0, (mLastDirection == Direction.Reverse) ? 1f : 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (eventReceiver != null && EventDelegate.IsValid(onFinished))
|
||||
{
|
||||
eventReceiver = null;
|
||||
callWhenFinished = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float deltaTime = RealTime.deltaTime;
|
||||
if (deltaTime == 0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (mAnimator != null)
|
||||
{
|
||||
mAnimator.Update((mLastDirection == Direction.Reverse) ? (0f - deltaTime) : deltaTime);
|
||||
if (isPlaying)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mAnimator.enabled = false;
|
||||
base.enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(mAnim != null))
|
||||
{
|
||||
base.enabled = false;
|
||||
return;
|
||||
}
|
||||
bool flag = false;
|
||||
foreach (AnimationState item in mAnim)
|
||||
{
|
||||
if (!mAnim.IsPlaying(item.name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
float num = item.speed * deltaTime;
|
||||
item.time += num;
|
||||
if (num < 0f)
|
||||
{
|
||||
if (item.time > 0f)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.time = 0f;
|
||||
}
|
||||
}
|
||||
else if (item.time < item.length)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.time = item.length;
|
||||
}
|
||||
}
|
||||
mAnim.Sample();
|
||||
if (flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.enabled = false;
|
||||
}
|
||||
if (!mNotify)
|
||||
{
|
||||
return;
|
||||
}
|
||||
mNotify = false;
|
||||
if (current == null)
|
||||
{
|
||||
current = this;
|
||||
EventDelegate.Execute(onFinished);
|
||||
if (eventReceiver != null && !string.IsNullOrEmpty(callWhenFinished))
|
||||
{
|
||||
eventReceiver.SendMessage(callWhenFinished, SendMessageOptions.DontRequireReceiver);
|
||||
}
|
||||
current = null;
|
||||
}
|
||||
if (mDisableDirection != Direction.Toggle && mLastDirection == mDisableDirection)
|
||||
{
|
||||
NGUITools.SetActive(base.gameObject, state: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void Play(string clipName, Direction playDirection)
|
||||
{
|
||||
if (playDirection == Direction.Toggle)
|
||||
{
|
||||
playDirection = ((mLastDirection != Direction.Forward) ? Direction.Forward : Direction.Reverse);
|
||||
}
|
||||
if (mAnim != null)
|
||||
{
|
||||
base.enabled = true;
|
||||
mAnim.enabled = false;
|
||||
if (string.IsNullOrEmpty(clipName))
|
||||
{
|
||||
if (!mAnim.isPlaying)
|
||||
{
|
||||
mAnim.Play();
|
||||
}
|
||||
}
|
||||
else if (!mAnim.IsPlaying(clipName))
|
||||
{
|
||||
mAnim.Play(clipName);
|
||||
}
|
||||
foreach (AnimationState item in mAnim)
|
||||
{
|
||||
if (string.IsNullOrEmpty(clipName) || item.name == clipName)
|
||||
{
|
||||
float num = Mathf.Abs(item.speed);
|
||||
item.speed = num * (float)playDirection;
|
||||
if (playDirection == Direction.Reverse && item.time == 0f)
|
||||
{
|
||||
item.time = item.length;
|
||||
}
|
||||
else if (playDirection == Direction.Forward && item.time == item.length)
|
||||
{
|
||||
item.time = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
mLastDirection = playDirection;
|
||||
mNotify = true;
|
||||
mAnim.Sample();
|
||||
}
|
||||
else if (mAnimator != null)
|
||||
{
|
||||
if (base.enabled && isPlaying && mClip == clipName)
|
||||
{
|
||||
mLastDirection = playDirection;
|
||||
return;
|
||||
}
|
||||
base.enabled = true;
|
||||
mNotify = true;
|
||||
mLastDirection = playDirection;
|
||||
mClip = clipName;
|
||||
mAnimator.Play(mClip, 0, (playDirection == Direction.Forward) ? 0f : 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
|
||||
{
|
||||
if (!NGUITools.GetActive(anim.gameObject))
|
||||
{
|
||||
if (enableBeforePlay != EnableCondition.EnableThenPlay)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
NGUITools.SetActive(anim.gameObject, state: true);
|
||||
UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren<UIPanel>();
|
||||
int i = 0;
|
||||
for (int num = componentsInChildren.Length; i < num; i++)
|
||||
{
|
||||
componentsInChildren[i].Refresh();
|
||||
}
|
||||
}
|
||||
ActiveAnimation activeAnimation = anim.GetComponent<ActiveAnimation>();
|
||||
if (activeAnimation == null)
|
||||
{
|
||||
activeAnimation = anim.gameObject.AddComponent<ActiveAnimation>();
|
||||
}
|
||||
activeAnimation.mAnim = anim;
|
||||
activeAnimation.mDisableDirection = (Direction)disableCondition;
|
||||
activeAnimation.onFinished.Clear();
|
||||
activeAnimation.Play(clipName, playDirection);
|
||||
if (activeAnimation.mAnim != null)
|
||||
{
|
||||
activeAnimation.mAnim.Sample();
|
||||
}
|
||||
else if (activeAnimation.mAnimator != null)
|
||||
{
|
||||
activeAnimation.mAnimator.Update(0f);
|
||||
}
|
||||
return activeAnimation;
|
||||
}
|
||||
|
||||
public static ActiveAnimation Play(Animation anim, string clipName, Direction playDirection)
|
||||
{
|
||||
return Play(anim, clipName, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable);
|
||||
}
|
||||
|
||||
public static ActiveAnimation Play(Animation anim, Direction playDirection)
|
||||
{
|
||||
return Play(anim, null, playDirection, EnableCondition.DoNothing, DisableCondition.DoNotDisable);
|
||||
}
|
||||
|
||||
public static ActiveAnimation Play(Animator anim, string clipName, Direction playDirection, EnableCondition enableBeforePlay, DisableCondition disableCondition)
|
||||
{
|
||||
if (enableBeforePlay != EnableCondition.IgnoreDisabledState && !NGUITools.GetActive(anim.gameObject))
|
||||
{
|
||||
if (enableBeforePlay != EnableCondition.EnableThenPlay)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
NGUITools.SetActive(anim.gameObject, state: true);
|
||||
UIPanel[] componentsInChildren = anim.gameObject.GetComponentsInChildren<UIPanel>();
|
||||
int i = 0;
|
||||
for (int num = componentsInChildren.Length; i < num; i++)
|
||||
{
|
||||
componentsInChildren[i].Refresh();
|
||||
}
|
||||
}
|
||||
ActiveAnimation activeAnimation = anim.GetComponent<ActiveAnimation>();
|
||||
if (activeAnimation == null)
|
||||
{
|
||||
activeAnimation = anim.gameObject.AddComponent<ActiveAnimation>();
|
||||
}
|
||||
activeAnimation.mAnimator = anim;
|
||||
activeAnimation.mDisableDirection = (Direction)disableCondition;
|
||||
activeAnimation.onFinished.Clear();
|
||||
activeAnimation.Play(clipName, playDirection);
|
||||
if (activeAnimation.mAnim != null)
|
||||
{
|
||||
activeAnimation.mAnim.Sample();
|
||||
}
|
||||
else if (activeAnimation.mAnimator != null)
|
||||
{
|
||||
activeAnimation.mAnimator.Update(0f);
|
||||
}
|
||||
return activeAnimation;
|
||||
}
|
||||
}
|
||||
22
SVSim.BattleEngine/Engine/AddDamageInfo.cs
Normal file
22
SVSim.BattleEngine/Engine/AddDamageInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class AddDamageInfo : DamageModifier
|
||||
{
|
||||
public int AddDamage { get; protected set; }
|
||||
|
||||
public AddDamageInfo(int addDamage, string damageType, CardBasePrm.ClanType damageClan, bool isUseClass, int order)
|
||||
{
|
||||
AddDamage = addDamage;
|
||||
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 damage + AddDamage;
|
||||
}
|
||||
}
|
||||
77
SVSim.BattleEngine/Engine/AlleyField.cs
Normal file
77
SVSim.BattleEngine/Engine/AlleyField.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AlleyField : BackGroundBase
|
||||
{
|
||||
public override int FieldId => 22;
|
||||
|
||||
public override int FieldEffectId => 22;
|
||||
|
||||
public AlleyField(string bgmId = "NONE")
|
||||
: base(bgmId)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void BattleFieldBuild()
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate
|
||||
{
|
||||
base.Field = GameObject.Find(_str3DFieldPath);
|
||||
base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform;
|
||||
GimicAudioList = base.Field.GetComponent<AudioList>().GimicAudioList;
|
||||
_fieldModel = base.Field.transform.Find("md_bf_aley_root").gameObject;
|
||||
_fieldParticles = _fieldModel.transform.Find("Particles22").gameObject;
|
||||
List<string> list = new List<string>(_fieldObjDictionary.Keys);
|
||||
List<GameObject> list2 = new List<GameObject>();
|
||||
for (int i = 0; i < _fieldObjDictionary.Count; i++)
|
||||
{
|
||||
list2.Add(_fieldObjDictionary[list[i]]);
|
||||
}
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate
|
||||
{
|
||||
base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent<SetShaderGlobalColorBG>();
|
||||
base.IsLoadDone = true;
|
||||
}, isBattle: true, isField: true);
|
||||
}));
|
||||
}
|
||||
|
||||
public override void StartFieldSetEffect(Vector3 pos)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_22, pos);
|
||||
}
|
||||
|
||||
public override void StartFieldTapEffect(int areaId, Vector3 pos)
|
||||
{
|
||||
base.StartFieldTapEffect(areaId, pos);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_22_1, pos);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldOpening()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
_battleCamera.Camera.transform.localPosition = new Vector3(2750f, -510f, -10f);
|
||||
_battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-10f, -53f, 84f));
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(300f, -30f, -150f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-11f, -100f, 92f), "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
yield return new WaitForSeconds(2f);
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldGimic(GameObject obj)
|
||||
{
|
||||
string tag = obj.tag;
|
||||
if (tag != null && tag == "FieldGimic1")
|
||||
{
|
||||
_ = _gimicCntDictionary[obj.tag];
|
||||
}
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldShake()
|
||||
{
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
}
|
||||
8
SVSim.BattleEngine/Engine/AnimationOrTween/Direction.cs
Normal file
8
SVSim.BattleEngine/Engine/AnimationOrTween/Direction.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace AnimationOrTween;
|
||||
|
||||
public enum Direction
|
||||
{
|
||||
Reverse = -1,
|
||||
Toggle,
|
||||
Forward
|
||||
}
|
||||
530
SVSim.BattleEngine/Engine/AreaSelInfo.cs
Normal file
530
SVSim.BattleEngine/Engine/AreaSelInfo.cs
Normal file
@@ -0,0 +1,530 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class AreaSelInfo : MonoBehaviour
|
||||
{
|
||||
private enum eTableCategory
|
||||
{
|
||||
CARD,
|
||||
SLEEVE,
|
||||
OTHER,
|
||||
MAX
|
||||
}
|
||||
|
||||
private const float LEFTSTAGEINFO_X_IN = 0f;
|
||||
|
||||
private const float LEFTSTAGEINFO_X_OUT = -1120f;
|
||||
|
||||
private const int CLEARPRESENT_MAX = 3;
|
||||
|
||||
private static readonly Vector3 CLEARPRESENT_CARD_COLLISIONSIZE = new Vector3(175f, 230f, 1f);
|
||||
|
||||
private const int CLEARPRESENT_CARD_DEPTHOFFSET = 50;
|
||||
|
||||
private const int CLEARPRESENT_RESOURCELIST_CAPACITY = 2;
|
||||
|
||||
private static readonly string[] CLEARPRESENT_NAME = new string[10] { "", "Common_0205", "", "Common_0201", "", "", "", "", "", "Common_0115" };
|
||||
|
||||
private static readonly string[] CLEARPRESENT_THUMBNAIL_SPRITENAME = new string[10] { "", "thumbnail_liquid", "", "thumbnail_crystal", "", "", "thumbnail_card", "thumbnail_emblem", "thumbnail_title", "thumbnail_rupy" };
|
||||
|
||||
private readonly Vector3 REWARD_TABLE_DEFAULT_POSITION = new Vector3(45f, -85.3f, 0f);
|
||||
|
||||
private readonly Vector3 REWARD_TABLE_CARD_POSITION = new Vector3(28.5f, -85.3f, 0f);
|
||||
|
||||
private const float TABLE_CONTAINS_CARD_REWARD_OFFSET_X = -16f;
|
||||
|
||||
private const int REWARD_BG_BASIC_WIDTH = 250;
|
||||
|
||||
private const int REWARD_BG_OFFSET_WIDTH_PER_GOODS = 90;
|
||||
|
||||
private readonly Dictionary<UserGoods.Type, float> REWARD_BG_OFFSET_MAGNIFICATION = new Dictionary<UserGoods.Type, float>
|
||||
{
|
||||
{
|
||||
UserGoods.Type.Degree,
|
||||
2f
|
||||
},
|
||||
{
|
||||
UserGoods.Type.Card,
|
||||
1.2f
|
||||
},
|
||||
{
|
||||
UserGoods.Type.Sleeve,
|
||||
1.2f
|
||||
},
|
||||
{
|
||||
UserGoods.Type.Skin,
|
||||
1.2f
|
||||
},
|
||||
{
|
||||
UserGoods.Type.RedEther,
|
||||
1f
|
||||
},
|
||||
{
|
||||
UserGoods.Type.Rupy,
|
||||
1f
|
||||
},
|
||||
{
|
||||
UserGoods.Type.Item,
|
||||
1f
|
||||
},
|
||||
{
|
||||
UserGoods.Type.Emblem,
|
||||
1f
|
||||
}
|
||||
};
|
||||
|
||||
private const float LABEL_ONLY_DEGREE_OFFSET_Y = -10f;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _clearRewardPrefab;
|
||||
|
||||
private List<AreaSelectClearReward> _clearRewardList = new List<AreaSelectClearReward>();
|
||||
|
||||
[SerializeField]
|
||||
private UITable _tableRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UITable[] _tableRewardsCategory = new UITable[3];
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _cardObjEvacuationRoot;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _spriteRewardBackground;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelAcquired;
|
||||
|
||||
private List<UIBase_CardManager.CardObjData> _cardObjList = new List<UIBase_CardManager.CardObjData>();
|
||||
|
||||
[SerializeField]
|
||||
private GameObject CardDetailRoot;
|
||||
|
||||
[SerializeField]
|
||||
private CardDetailUI CardDetailPrefab;
|
||||
|
||||
private CardDetailUI _cardDetail;
|
||||
|
||||
private List<string> _loadFileList = new List<string>();
|
||||
|
||||
private bool _isLoadEnd = true;
|
||||
|
||||
public void SetClearPresent(StoryChapterData chapterData)
|
||||
{
|
||||
if (chapterData == null || chapterData.Rewards == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (chapterData.Rewards.Length != 0)
|
||||
{
|
||||
base.gameObject.SetActive(value: true);
|
||||
bool isCleared = chapterData.IsCleared;
|
||||
for (int i = 0; i < _clearRewardList.Count; i++)
|
||||
{
|
||||
_clearRewardList[i].gameObject.SetActive(value: false);
|
||||
}
|
||||
List<long> list = new List<long>();
|
||||
for (int j = 0; j < chapterData.Rewards.Length; j++)
|
||||
{
|
||||
StoryChapterData.StoryReward storyReward = chapterData.Rewards[j];
|
||||
if (storyReward == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (j >= _clearRewardList.Count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (storyReward.RewardType == 5)
|
||||
{
|
||||
if (list.Contains(storyReward.RewardUserGoodsId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(storyReward.RewardUserGoodsId);
|
||||
}
|
||||
_clearRewardList[j].gameObject.SetActive(value: true);
|
||||
_clearRewardList[j].ShowReward((UserGoods.Type)storyReward.RewardType, storyReward.RewardUserGoodsId, storyReward.RewardNumber, isCleared);
|
||||
}
|
||||
RepositionRewards();
|
||||
SetRewardBackgroundWidth();
|
||||
SetAcquiredLabel(isCleared);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void RepositionRewards()
|
||||
{
|
||||
for (int i = 0; i < _tableRewardsCategory.Length; i++)
|
||||
{
|
||||
_tableRewardsCategory[i].gameObject.SetActive(value: false);
|
||||
}
|
||||
for (int j = 0; j < _clearRewardList.Count; j++)
|
||||
{
|
||||
if (_clearRewardList[j].gameObject.activeSelf)
|
||||
{
|
||||
int num = _clearRewardList[j].RewardGoodsType switch
|
||||
{
|
||||
UserGoods.Type.Card => 0,
|
||||
UserGoods.Type.Sleeve => 1,
|
||||
_ => 2,
|
||||
};
|
||||
Transform obj = _clearRewardList[j].gameObject.transform;
|
||||
obj.SetParent(_tableRewardsCategory[num].transform);
|
||||
obj.SetAsLastSibling();
|
||||
_tableRewardsCategory[num].gameObject.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < _tableRewardsCategory.Length; k++)
|
||||
{
|
||||
if (_tableRewardsCategory[k].gameObject.activeInHierarchy)
|
||||
{
|
||||
_tableRewardsCategory[k].Reposition();
|
||||
}
|
||||
}
|
||||
_tableRoot.Reposition();
|
||||
if (_tableRewardsCategory[0].gameObject.activeInHierarchy)
|
||||
{
|
||||
_tableRoot.transform.localPosition = REWARD_TABLE_CARD_POSITION;
|
||||
for (int l = 0; l < _tableRewardsCategory.Length; l++)
|
||||
{
|
||||
if (l != 0)
|
||||
{
|
||||
Vector3 localPosition = _tableRewardsCategory[l].transform.localPosition;
|
||||
localPosition.x += -16f;
|
||||
_tableRewardsCategory[l].transform.localPosition = localPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tableRoot.transform.localPosition = REWARD_TABLE_DEFAULT_POSITION;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetRewardBackgroundWidth()
|
||||
{
|
||||
float num = 0f;
|
||||
for (int i = 0; i < _clearRewardList.Count; i++)
|
||||
{
|
||||
if (_clearRewardList[i].gameObject.activeInHierarchy)
|
||||
{
|
||||
UserGoods.Type rewardGoodsType = _clearRewardList[i].RewardGoodsType;
|
||||
num += REWARD_BG_OFFSET_MAGNIFICATION[rewardGoodsType];
|
||||
}
|
||||
}
|
||||
int width = 250 + (int)(90f * num);
|
||||
_spriteRewardBackground.width = width;
|
||||
}
|
||||
|
||||
private void SetAcquiredLabel(bool isAcquired)
|
||||
{
|
||||
_labelAcquired.gameObject.SetActive(isAcquired);
|
||||
if (!isAcquired)
|
||||
{
|
||||
return;
|
||||
}
|
||||
float a = float.MaxValue;
|
||||
float num = float.MinValue;
|
||||
bool flag = true;
|
||||
for (int i = 0; i < _clearRewardList.Count; i++)
|
||||
{
|
||||
if (_clearRewardList[i].gameObject.activeInHierarchy)
|
||||
{
|
||||
Transform rewardTransform = _clearRewardList[i].GetRewardTransform();
|
||||
a = Mathf.Min(a, rewardTransform.position.x);
|
||||
num = Mathf.Max(num, rewardTransform.position.x);
|
||||
if (_clearRewardList[i].RewardGoodsType != UserGoods.Type.Degree)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vector3 position = _labelAcquired.transform.position;
|
||||
position.x = Mathf.Lerp(a, num, 0.5f);
|
||||
_labelAcquired.transform.position = position;
|
||||
Vector3 localPosition = _labelAcquired.transform.localPosition;
|
||||
localPosition.y = _tableRoot.transform.localPosition.y + (flag ? (-10f) : 0f);
|
||||
_labelAcquired.transform.localPosition = localPosition;
|
||||
}
|
||||
|
||||
public void LoadClearPresent(IReadOnlyList<StoryChapterData> stageDataList)
|
||||
{
|
||||
if (!_isLoadEnd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_isLoadEnd = false;
|
||||
ReleaseClearPresent();
|
||||
if (CardDetailPrefab != null)
|
||||
{
|
||||
_cardDetail = Object.Instantiate(CardDetailPrefab);
|
||||
_cardDetail.transform.parent = CardDetailRoot.transform;
|
||||
_cardDetail.transform.localPosition = Vector3.zero;
|
||||
_cardDetail.transform.localScale = Vector3.one;
|
||||
_cardDetail.OnClose = OnCardDetailClose;
|
||||
_cardDetail.gameObject.SetActive(value: false);
|
||||
_cardDetail.Initialize(_cardDetail.gameObject.layer, CardMaster.CardMasterId.Default);
|
||||
_cardDetail.IsShowFlavorTextButton = true;
|
||||
_cardDetail.IsShowVoiceButton = true;
|
||||
_cardDetail.IsShowEvolutionButton = true;
|
||||
}
|
||||
_clearRewardList.Clear();
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
AreaSelectClearReward component = NGUITools.AddChild(_tableRoot.gameObject, _clearRewardPrefab).GetComponent<AreaSelectClearReward>();
|
||||
_clearRewardList.Add(component);
|
||||
}
|
||||
List<int> list = new List<int>(2);
|
||||
List<string> loadPath = new List<string>();
|
||||
StoryChapterData.StoryReward storyReward = null;
|
||||
for (int j = 0; j < stageDataList.Count; j++)
|
||||
{
|
||||
for (int k = 0; k < stageDataList[j].Rewards.Length; k++)
|
||||
{
|
||||
string text = string.Empty;
|
||||
storyReward = stageDataList[j].Rewards[k];
|
||||
if (storyReward == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (storyReward.RewardType == 5)
|
||||
{
|
||||
if (!list.Contains((int)storyReward.RewardUserGoodsId))
|
||||
{
|
||||
list.Add((int)storyReward.RewardUserGoodsId);
|
||||
}
|
||||
}
|
||||
else if (storyReward.RewardType == 4)
|
||||
{
|
||||
string userGoodsImageName = UserGoods.GetUserGoodsImageName(UserGoods.Type.Item, storyReward.RewardUserGoodsId);
|
||||
text = Toolbox.ResourcesManager.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item);
|
||||
}
|
||||
else if (storyReward.RewardType == 6)
|
||||
{
|
||||
long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(storyReward.RewardUserGoodsId);
|
||||
text = Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture);
|
||||
Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId);
|
||||
if (sleeve.IsPremiumSleeve)
|
||||
{
|
||||
UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve);
|
||||
}
|
||||
}
|
||||
else if (storyReward.RewardType == 8)
|
||||
{
|
||||
foreach (string degreeResource in DegreeHelper.GetDegreeResourceList(storyReward.RewardUserGoodsId, DegreeHelper.DegreeType.SMALL, isFetch: false))
|
||||
{
|
||||
if (!loadPath.Contains(degreeResource))
|
||||
{
|
||||
loadPath.Add(degreeResource);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (storyReward.RewardType == 7)
|
||||
{
|
||||
text = Toolbox.ResourcesManager.GetAssetTypePath(storyReward.RewardUserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M);
|
||||
}
|
||||
else if (storyReward.RewardType == 10)
|
||||
{
|
||||
text = Toolbox.ResourcesManager.GetAssetTypePath(storyReward.RewardUserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail);
|
||||
}
|
||||
if (text != string.Empty && !loadPath.Contains(text))
|
||||
{
|
||||
loadPath.Add(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (list.Count == 0 && loadPath.Count == 0)
|
||||
{
|
||||
_isLoadEnd = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartCoroutine(LoadClearPresentInner(list, loadPath));
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator LoadClearPresentInner(List<int> cardidlist, List<string> rewardPathList)
|
||||
{
|
||||
UIManager uiMgr = UIManager.GetInstance();
|
||||
UIBase_CardManager uiCardMgr = uiMgr.getUIBase_CardManager();
|
||||
bool isLoadRewardEnd = false;
|
||||
_loadFileList.Clear();
|
||||
bool isLoadCard = cardidlist.Count > 0;
|
||||
if (isLoadCard)
|
||||
{
|
||||
int layer = LayerMask.NameToLayer("FrontUI");
|
||||
uiMgr.CardLoadSelect(base.gameObject, cardidlist, layer, is2D: true);
|
||||
}
|
||||
StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(rewardPathList, delegate
|
||||
{
|
||||
_loadFileList.AddRange(rewardPathList);
|
||||
isLoadRewardEnd = true;
|
||||
}));
|
||||
while ((isLoadCard && (!uiCardMgr.getCreateEndFlag() || !uiCardMgr.isAssetAllReady)) || !isLoadRewardEnd)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
_cardObjList = uiMgr.getCardList2DObjs();
|
||||
if (_cardObjList != null)
|
||||
{
|
||||
for (int num = 0; num < _cardObjList.Count; num++)
|
||||
{
|
||||
GameObject cardObj = _cardObjList[num].CardObj;
|
||||
if (!(cardObj == null))
|
||||
{
|
||||
cardObj.SetActive(value: false);
|
||||
UITexture[] componentsInChildren = cardObj.GetComponentsInChildren<UITexture>(includeInactive: true);
|
||||
for (int num2 = 0; num2 < componentsInChildren.Length; num2++)
|
||||
{
|
||||
componentsInChildren[num2].depth += 50;
|
||||
}
|
||||
UILabel[] componentsInChildren2 = cardObj.GetComponentsInChildren<UILabel>(includeInactive: true);
|
||||
for (int num3 = 0; num3 < componentsInChildren2.Length; num3++)
|
||||
{
|
||||
componentsInChildren2[num3].depth += 50;
|
||||
}
|
||||
UISprite[] componentsInChildren3 = cardObj.GetComponentsInChildren<UISprite>(includeInactive: true);
|
||||
for (int num4 = 0; num4 < componentsInChildren3.Length; num4++)
|
||||
{
|
||||
componentsInChildren3[num4].depth += 50;
|
||||
}
|
||||
cardObj.GetComponent<CardListTemplate>().HideNum();
|
||||
cardObj.AddComponent<BoxCollider>().size = CLEARPRESENT_CARD_COLLISIONSIZE;
|
||||
cardObj.AddComponent<UIEventListener>().onClick = _cardDetail.OnPushCardDetailOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int num5 = 0; num5 < 3; num5++)
|
||||
{
|
||||
_clearRewardList[num5].Init(_cardObjList, _cardObjEvacuationRoot);
|
||||
}
|
||||
_isLoadEnd = true;
|
||||
}
|
||||
|
||||
public void ReleaseClearPresent()
|
||||
{
|
||||
if (_cardDetail != null)
|
||||
{
|
||||
Object.Destroy(_cardDetail.gameObject);
|
||||
_cardDetail = null;
|
||||
}
|
||||
if (_cardObjList != null)
|
||||
{
|
||||
for (int i = 0; i < _cardObjList.Count; i++)
|
||||
{
|
||||
Object.Destroy(_cardObjList[i].CardObj.gameObject);
|
||||
}
|
||||
_cardObjList.Clear();
|
||||
}
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList);
|
||||
_loadFileList.Clear();
|
||||
}
|
||||
|
||||
private void OnCardDetailClose()
|
||||
{
|
||||
}
|
||||
|
||||
public bool GetLoadEnd()
|
||||
{
|
||||
return _isLoadEnd;
|
||||
}
|
||||
|
||||
public void ResetInfoPosition()
|
||||
{
|
||||
base.gameObject.transform.localPosition = new Vector3(0f, base.gameObject.transform.localPosition.y, base.gameObject.transform.localPosition.z);
|
||||
}
|
||||
|
||||
public void MoveToScreen(bool isIn, bool isImmediate)
|
||||
{
|
||||
MoveToScreenObj(base.gameObject, isIn ? 0f : (-1120f), isImmediate ? 0f : 0.5f);
|
||||
}
|
||||
|
||||
public void MoveToScreenObj(GameObject target, float localPosX, float time)
|
||||
{
|
||||
if (Mathf.Approximately(time, 0f))
|
||||
{
|
||||
Vector3 localPosition = target.transform.localPosition;
|
||||
localPosition.x = localPosX;
|
||||
target.transform.localPosition = localPosition;
|
||||
return;
|
||||
}
|
||||
iTween.MoveTo(target, iTween.Hash("islocal", true, "x", localPosX, "time", time));
|
||||
}
|
||||
|
||||
public static string GetPresentItemName(int itemID, long userGoodsId)
|
||||
{
|
||||
switch ((UserGoods.Type)itemID)
|
||||
{
|
||||
case UserGoods.Type.RedEther:
|
||||
case UserGoods.Type.Rupy:
|
||||
return Data.SystemText.Get(CLEARPRESENT_NAME[itemID]);
|
||||
case UserGoods.Type.Item:
|
||||
{
|
||||
Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == userGoodsId);
|
||||
if (item == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return item.name;
|
||||
}
|
||||
case UserGoods.Type.Sleeve:
|
||||
{
|
||||
Sleeve sleeve = Data.Master.SleeveMgr.Get(userGoodsId);
|
||||
if (sleeve == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return sleeve.sleeve_name;
|
||||
}
|
||||
case UserGoods.Type.Emblem:
|
||||
{
|
||||
Emblem emblem = Data.Master.EmblemMgr.Get(userGoodsId);
|
||||
if (emblem == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return emblem._name;
|
||||
}
|
||||
case UserGoods.Type.Degree:
|
||||
{
|
||||
Degree degree = Data.Master.DegreeMgr.Get((int)userGoodsId);
|
||||
if (degree == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return degree._name;
|
||||
}
|
||||
case UserGoods.Type.Skin:
|
||||
{
|
||||
ClassCharacterMasterData charaPrmByCharaId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId((int)userGoodsId);
|
||||
if (charaPrmByCharaId == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return charaPrmByCharaId.chara_name;
|
||||
}
|
||||
case UserGoods.Type.SpotCardPoint:
|
||||
return Data.SystemText.Get("Common_0161");
|
||||
case UserGoods.Type.MyPageBG:
|
||||
return Data.Master.MyPageCustomBGMaster[userGoodsId.ToString()].Name;
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetPresentItemSpriteName(int itemID)
|
||||
{
|
||||
if (itemID < 0 || itemID >= CLEARPRESENT_THUMBNAIL_SPRITENAME.Length)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return CLEARPRESENT_THUMBNAIL_SPRITENAME[itemID];
|
||||
}
|
||||
}
|
||||
346
SVSim.BattleEngine/Engine/ArenaColosseum.cs
Normal file
346
SVSim.BattleEngine/Engine/ArenaColosseum.cs
Normal file
@@ -0,0 +1,346 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick;
|
||||
using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick;
|
||||
|
||||
public class ArenaColosseum : ArenaEntryDataBase
|
||||
{
|
||||
public enum eRound
|
||||
{
|
||||
FinalNotAdvance = -1,
|
||||
Round1 = 1,
|
||||
Round2B = 2,
|
||||
Round2A = 3,
|
||||
FinalB = 4,
|
||||
FinalA = 5,
|
||||
FinalMin = 4,
|
||||
RoundMax = 5,
|
||||
Undecided = 6,
|
||||
Lose = 7
|
||||
}
|
||||
|
||||
public enum eStageNo
|
||||
{
|
||||
Stage1 = 1,
|
||||
Stage2,
|
||||
FinalStage,
|
||||
Max
|
||||
}
|
||||
|
||||
public enum eEntryStatus
|
||||
{
|
||||
TwoPickClassSelect = 1,
|
||||
TwoPickCardSelect,
|
||||
SetUpComplete
|
||||
}
|
||||
|
||||
public enum eRule
|
||||
{
|
||||
NONE = 0,
|
||||
RotationBo1 = 1,
|
||||
UnlimitedBo1 = 2,
|
||||
TwoPick = 3,
|
||||
TwoPickChaos = 4,
|
||||
Crossover = 5,
|
||||
MyRotation = 6,
|
||||
HOF = 31,
|
||||
WindFall = 33,
|
||||
Avatar = 39
|
||||
}
|
||||
|
||||
public enum eDeckIndex
|
||||
{
|
||||
Main = 0,
|
||||
First = 0,
|
||||
Second = 1,
|
||||
Third = 2
|
||||
}
|
||||
|
||||
public struct Detail
|
||||
{
|
||||
public string RoundTimeText { get; set; }
|
||||
|
||||
public string RoundTimeStartText { get; set; }
|
||||
|
||||
public string RoundTimeEndText { get; set; }
|
||||
|
||||
public string GroupName { get; set; }
|
||||
|
||||
public int MaxBattleNum { get; set; }
|
||||
|
||||
public int BreakThroughNum { get; set; }
|
||||
|
||||
public int MaxEntryNum { get; set; }
|
||||
}
|
||||
|
||||
public class TwoPick
|
||||
{
|
||||
public CandidateClass CandidateClass { get; set; }
|
||||
|
||||
public CandidateCardInfo CandidateCard { get; set; }
|
||||
|
||||
public Deck DeckData { get; set; }
|
||||
|
||||
public CandidateChaos CandidateChaos { get; set; }
|
||||
}
|
||||
|
||||
public enum eResultEffect
|
||||
{
|
||||
None,
|
||||
GroupA,
|
||||
Final,
|
||||
Clear
|
||||
}
|
||||
|
||||
private bool _isRankMatching;
|
||||
|
||||
public bool CanUseNonPossessionCard;
|
||||
|
||||
public int DeckEntryId { get; set; }
|
||||
|
||||
public bool IsColosseumPeriod { get; set; }
|
||||
|
||||
public bool IsRoundPeriod { get; set; }
|
||||
|
||||
public eEntryStatus EntryStatus { get; set; }
|
||||
|
||||
public Format DeckFormat { get; set; }
|
||||
|
||||
public eRule Rule { get; set; }
|
||||
|
||||
public bool IsNormalTwoPick { get; set; }
|
||||
|
||||
public int ChaosNum { get; set; }
|
||||
|
||||
public bool IsTwoPickRule
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Rule != eRule.TwoPick)
|
||||
{
|
||||
return Rule == eRule.TwoPickChaos;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool NeedsFirstTips { get; set; }
|
||||
|
||||
public int ColosseumId { get; set; }
|
||||
|
||||
public int ChaoseTipsId { get; set; }
|
||||
|
||||
public bool IsSpecialDeckSelectRule
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Rule != eRule.HOF)
|
||||
{
|
||||
return Rule == eRule.WindFall;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDeckMaxNumberChange => Rule == eRule.WindFall;
|
||||
|
||||
public int DeckMaxNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Rule == eRule.WindFall)
|
||||
{
|
||||
return 35;
|
||||
}
|
||||
return 40;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRankMatching
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isRankMatching;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_isRankMatching != value)
|
||||
{
|
||||
_isRankMatching = value;
|
||||
if (RealTimeNetworkAgent.FinishTaskBase != null)
|
||||
{
|
||||
RealTimeNetworkAgent.FinishTaskBase = new ColosseumBattleFinishTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<DeckData> DeckList { get; set; }
|
||||
|
||||
public eRound Round { get; set; }
|
||||
|
||||
public int ServerRoundId { get; set; }
|
||||
|
||||
public eStageNo StageNo { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public List<ReceivedReward> RewardList { get; set; }
|
||||
|
||||
public eResultEffect ResultEffect { get; set; }
|
||||
|
||||
public string ColorCodeId { get; set; }
|
||||
|
||||
public string CardPool { get; set; }
|
||||
|
||||
public int RetryRemainingNum { get; set; }
|
||||
|
||||
public int BattleMax { get; set; }
|
||||
|
||||
public int ClearWinNum { get; set; }
|
||||
|
||||
public bool IsDeckEntry { get; set; }
|
||||
|
||||
public bool IsFreeEntry
|
||||
{
|
||||
get
|
||||
{
|
||||
return Data.MyPageNotifications.data.IsColosseumFreeEntry;
|
||||
}
|
||||
set
|
||||
{
|
||||
Data.MyPageNotifications.data.IsColosseumFreeEntry = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRetry { get; set; }
|
||||
|
||||
public bool IsLastDay { get; set; }
|
||||
|
||||
public bool IsClear { get; set; }
|
||||
|
||||
public bool IsRetire { get; set; }
|
||||
|
||||
public bool IsFinish { get; set; }
|
||||
|
||||
public bool IsDeckDeleted { get; set; }
|
||||
|
||||
public bool IsFinalRoundTry { get; set; }
|
||||
|
||||
public eRound NextRound { get; set; }
|
||||
|
||||
public double RemainingUnixTime { get; set; }
|
||||
|
||||
public float RemainingSinceTime { get; set; }
|
||||
|
||||
public double RemainingServerUnixTime { get; set; }
|
||||
|
||||
public string NextRoundStartTimeText { get; set; }
|
||||
|
||||
public string NowRoundTimeText { get; set; }
|
||||
|
||||
public string ColosseumTimeText { get; set; }
|
||||
|
||||
public string AnnounceNo { get; set; }
|
||||
|
||||
public Detail[] DetailData { get; set; }
|
||||
|
||||
public eStageNo FocusStageNo { get; set; }
|
||||
|
||||
public int WinBattleNum { get; set; }
|
||||
|
||||
public List<bool> BattleResultList { get; set; }
|
||||
|
||||
public List<int> BoxGradeList { get; set; }
|
||||
|
||||
public int FinalRoundEliminateCount { get; set; }
|
||||
|
||||
public TwoPick TwoPickData { get; set; }
|
||||
|
||||
public ArenaColosseum()
|
||||
{
|
||||
base.LootBoxType = PlayerStaticData.LootBoxType.COLOSSEUM;
|
||||
DeckList = new List<DeckData>();
|
||||
RewardList = new List<ReceivedReward>();
|
||||
BattleResultList = new List<bool>();
|
||||
BoxGradeList = new List<int>();
|
||||
DetailData = new Detail[5];
|
||||
Rule = eRule.TwoPick;
|
||||
TwoPickData = new TwoPick();
|
||||
TwoPickData.CandidateClass = new CandidateClass();
|
||||
TwoPickData.CandidateCard = new CandidateCardInfo();
|
||||
TwoPickData.CandidateChaos = new CandidateChaos();
|
||||
}
|
||||
|
||||
public int GetRoundNumber(eRound inRound)
|
||||
{
|
||||
switch (inRound)
|
||||
{
|
||||
case eRound.Round1:
|
||||
return 1;
|
||||
case eRound.Round2B:
|
||||
case eRound.Round2A:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetGroupText(eRound inRound)
|
||||
{
|
||||
switch (inRound)
|
||||
{
|
||||
case eRound.Round2A:
|
||||
case eRound.FinalA:
|
||||
return Data.SystemText.Get("Colosseum_0020");
|
||||
case eRound.Round2B:
|
||||
case eRound.FinalB:
|
||||
return Data.SystemText.Get("Colosseum_0021");
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public eStageNo GetStageNoFromRoundId(eRound inRoundId)
|
||||
{
|
||||
switch (inRoundId)
|
||||
{
|
||||
case eRound.Round1:
|
||||
return eStageNo.Stage1;
|
||||
case eRound.Round2B:
|
||||
case eRound.Round2A:
|
||||
return eStageNo.Stage2;
|
||||
case eRound.FinalB:
|
||||
case eRound.FinalA:
|
||||
return eStageNo.FinalStage;
|
||||
default:
|
||||
return eStageNo.Stage1;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsFinalRound()
|
||||
{
|
||||
if (Round == eRound.FinalA || Round == eRound.FinalB)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public DialogBase CreateDetailDialog(GameObject defaultDetailPrefab)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
GameObject gameObject = Object.Instantiate(defaultDetailPrefab);
|
||||
dialogBase.SetObj(gameObject);
|
||||
gameObject.GetComponent<ColosseumDetail>().Init(dialogBase);
|
||||
return dialogBase;
|
||||
}
|
||||
|
||||
public void ApiRuleParseAndSet(int apiRule)
|
||||
{
|
||||
ArenaColosseum colosseumData = Data.ArenaData.ColosseumData;
|
||||
colosseumData.Rule = (eRule)apiRule;
|
||||
colosseumData.DeckFormat = ArenaData.ApiDeckFormatParse(colosseumData.Rule);
|
||||
}
|
||||
}
|
||||
206
SVSim.BattleEngine/Engine/ArenaCompetition.cs
Normal file
206
SVSim.BattleEngine/Engine/ArenaCompetition.cs
Normal file
@@ -0,0 +1,206 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Scripts.Network.Data.TaskData.Arena;
|
||||
|
||||
public class ArenaCompetition : ArenaEntryDataBase
|
||||
{
|
||||
public enum EntryStatusType
|
||||
{
|
||||
NotEntry,
|
||||
NotChallenge,
|
||||
NotRegistDeck,
|
||||
InBattle
|
||||
}
|
||||
|
||||
public enum FreebieStatusType
|
||||
{
|
||||
InFreeBattle,
|
||||
CanPermanentEntry,
|
||||
PermanentEntryDone
|
||||
}
|
||||
|
||||
public enum EntryCostType
|
||||
{
|
||||
EntryWithFree,
|
||||
EntryWithCost
|
||||
}
|
||||
|
||||
private bool _isRankMatching;
|
||||
|
||||
public bool IsCompetitionPeriod { get; private set; }
|
||||
|
||||
public bool IsEntry { get; set; }
|
||||
|
||||
public bool IsInFreeBattleRegistDeck { get; set; }
|
||||
|
||||
public bool NeedsFirstTips { get; private set; }
|
||||
|
||||
public int CompetitionId { get; private set; }
|
||||
|
||||
public FreebieStatusType FreebieStatus { get; set; }
|
||||
|
||||
public Format DeckFormat { get; private set; }
|
||||
|
||||
public ArenaColosseum.eRule Rule { get; private set; }
|
||||
|
||||
public bool IsSpecialMode { get; private set; }
|
||||
|
||||
public string NowRoundTimeText { get; private set; }
|
||||
|
||||
public string EntryEndTimeText { get; private set; }
|
||||
|
||||
public string EndTimeText { get; private set; }
|
||||
|
||||
public double EntryRemainingUnixTime { get; set; }
|
||||
|
||||
public double RemainingUnixTime { get; set; }
|
||||
|
||||
public float RemainingSinceTime { get; set; }
|
||||
|
||||
public double RemainingServerUnixTime { get; set; }
|
||||
|
||||
public string EntryTimeText { get; private set; }
|
||||
|
||||
public List<DeckData> DeckList { get; set; }
|
||||
|
||||
public List<Wizard.Scripts.Network.Data.TaskData.Arena.Reward> EntryRewardList { get; set; }
|
||||
|
||||
public bool IsRewardReceived { get; private set; }
|
||||
|
||||
public string AnnounceId { get; private set; }
|
||||
|
||||
public string CompetitionName { get; private set; }
|
||||
|
||||
public int MaxEntryCount { get; private set; }
|
||||
|
||||
public int MaxChallengeCount { get; private set; }
|
||||
|
||||
public int MaxWinCount { get; private set; }
|
||||
|
||||
public int BestWinCount { get; private set; }
|
||||
|
||||
public int MaxLoseCount { get; private set; }
|
||||
|
||||
public int RestChallangeCount { get; private set; }
|
||||
|
||||
public int RestEntryCount { get; private set; }
|
||||
|
||||
public int CurrentWinCount { get; private set; }
|
||||
|
||||
public int FreebieChallengeCount { get; private set; }
|
||||
|
||||
public bool IsChampion { get; private set; }
|
||||
|
||||
public bool IsEntryTimeEnd { get; private set; }
|
||||
|
||||
public int MaxBattleCount { get; private set; }
|
||||
|
||||
public int IsCompletedTwoPickDeck { get; private set; }
|
||||
|
||||
public int MaxFreebieChallengeCount { get; private set; }
|
||||
|
||||
public EntryStatusType EntryStatus { get; private set; }
|
||||
|
||||
public EntryCostType CostType { get; private set; }
|
||||
|
||||
public bool IsRankMatching
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isRankMatching;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_isRankMatching != value)
|
||||
{
|
||||
_isRankMatching = value;
|
||||
if (RealTimeNetworkAgent.FinishTaskBase != null)
|
||||
{
|
||||
RealTimeNetworkAgent.FinishTaskBase = new CompetitionBattleFinishTask();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArenaCompetition()
|
||||
{
|
||||
}
|
||||
|
||||
public ArenaCompetition(JsonData responseData)
|
||||
{
|
||||
JsonData jsonData = responseData["data"]["competition_info"];
|
||||
IsCompetitionPeriod = jsonData["is_competition_period"].ToBoolean();
|
||||
if (IsCompetitionPeriod)
|
||||
{
|
||||
Rule = (ArenaColosseum.eRule)jsonData["deck_format"].ToInt();
|
||||
DeckFormat = ArenaData.ApiDeckFormatParse(Rule);
|
||||
IsEntry = jsonData["is_entry"].ToBoolean();
|
||||
IsInFreeBattleRegistDeck = jsonData["is_in_battle"].ToBoolean();
|
||||
IsSpecialMode = jsonData["is_special_mode"].ToInt() == 1;
|
||||
string text = ConvertTime.ToLocal(DateTime.Parse(jsonData["entry_start_time"].ToString()));
|
||||
EntryRemainingUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["entry_end_time"].ToString()));
|
||||
string text2 = ConvertTime.ToLocal(DateTime.Parse(jsonData["entry_end_time"].ToString()));
|
||||
EntryTimeText = Data.SystemText.Get("Colosseum_0033", text, text2);
|
||||
EntryEndTimeText = text2;
|
||||
string text3 = ConvertTime.ToLocal(DateTime.Parse(jsonData["start_time"].ToString()));
|
||||
RemainingUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["end_time"].ToString()));
|
||||
string text4 = ConvertTime.ToLocal(DateTime.Parse(jsonData["end_time"].ToString()));
|
||||
NowRoundTimeText = Data.SystemText.Get("Colosseum_0033", text3, text4);
|
||||
EndTimeText = text4;
|
||||
RemainingSinceTime = Time.realtimeSinceStartup;
|
||||
RemainingServerUnixTime = responseData["data_headers"]["servertime"].ToDouble();
|
||||
NeedsFirstTips = jsonData.GetValueOrDefault("is_display_tips", 0) == 1;
|
||||
CompetitionId = jsonData.GetValueOrDefault("competition_id", 0);
|
||||
FreebieStatus = (FreebieStatusType)jsonData["freebie_status"].ToInt();
|
||||
DeckList = new List<DeckData>();
|
||||
EntryRewardList = new List<Wizard.Scripts.Network.Data.TaskData.Arena.Reward>();
|
||||
JsonData jsonData2 = jsonData["featured_entry_reward_list"];
|
||||
for (int i = 0; i < jsonData2.Count; i++)
|
||||
{
|
||||
Wizard.Scripts.Network.Data.TaskData.Arena.Reward item = new Wizard.Scripts.Network.Data.TaskData.Arena.Reward(jsonData2[i]);
|
||||
EntryRewardList.Add(item);
|
||||
}
|
||||
IsRewardReceived = jsonData["is_received_featured_entry_reward"].ToBoolean();
|
||||
if (jsonData["announce_id"] != null)
|
||||
{
|
||||
AnnounceId = jsonData["announce_id"].ToString();
|
||||
}
|
||||
MaxEntryCount = jsonData.GetValueOrDefault("max_entry_count", 0);
|
||||
MaxChallengeCount = jsonData.GetValueOrDefault("max_challenge_count", 0);
|
||||
MaxWinCount = jsonData.GetValueOrDefault("max_win_count", 0);
|
||||
MaxLoseCount = jsonData.GetValueOrDefault("max_lose_count", 0);
|
||||
MaxBattleCount = jsonData.GetValueOrDefault("max_battle_count", 0);
|
||||
MaxFreebieChallengeCount = jsonData["max_freebie_challenge_count"].ToInt();
|
||||
crystalCost = jsonData.GetValueOrDefault("crystal_cost", 0);
|
||||
rupyCost = jsonData.GetValueOrDefault("rupy_cost", 0);
|
||||
BestWinCount = jsonData["max_win_count_in_entry"].ToInt();
|
||||
RestChallangeCount = jsonData["rest_challenge_num"].ToInt();
|
||||
RestEntryCount = jsonData["rest_entry_num"].ToInt();
|
||||
CurrentWinCount = jsonData["current_win_count"].ToInt();
|
||||
FreebieChallengeCount = jsonData["freebie_challenge_count"].ToInt();
|
||||
EntryStatus = (EntryStatusType)jsonData["entry_status"].ToInt();
|
||||
CostType = (EntryCostType)jsonData["entry_type"].ToInt();
|
||||
IsChampion = jsonData.GetValueOrDefault("is_champion", 0) == 1;
|
||||
CompetitionName = jsonData.GetValueOrDefault("competition_name", string.Empty).Replace("\\n", "\n");
|
||||
double num = RemainingServerUnixTime + (double)Time.realtimeSinceStartup - (double)RemainingSinceTime;
|
||||
IsEntryTimeEnd = EntryRemainingUnixTime - num < 0.0;
|
||||
bool flag = CompetitionId <= PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID);
|
||||
Data.MyPageNotifications.data.IsCompetitionBadge = !IsRewardReceived && EntryStatus == EntryStatusType.NotEntry && !IsEntryTimeEnd && !flag;
|
||||
base.ExpirtyInfo = new ShopExpirtyInfo(jsonData["sales_period_info"]);
|
||||
if (DeckFormat == Format.TwoPick)
|
||||
{
|
||||
IsCompletedTwoPickDeck = jsonData["is_completed_two_pick_deck"].ToInt();
|
||||
}
|
||||
}
|
||||
base.LootBoxType = PlayerStaticData.LootBoxType.COMPETITION;
|
||||
}
|
||||
|
||||
public void SetRestChallangeCountByEntry(JsonData responseData)
|
||||
{
|
||||
RestChallangeCount = responseData["rest_challenge_count"].ToInt();
|
||||
IsEntry = true;
|
||||
}
|
||||
}
|
||||
80
SVSim.BattleEngine/Engine/ArenaData.cs
Normal file
80
SVSim.BattleEngine/Engine/ArenaData.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using LitJson;
|
||||
using Wizard;
|
||||
|
||||
public class ArenaData : HeaderData
|
||||
{
|
||||
public enum eARENA_PAY
|
||||
{
|
||||
None = 0,
|
||||
Crystal = 1,
|
||||
Ticket = 3,
|
||||
Rupy = 4,
|
||||
Free = 5
|
||||
}
|
||||
|
||||
public ArenaTwoPickData TwoPickData { get; set; }
|
||||
|
||||
public SealedData SealedData { get; private set; }
|
||||
|
||||
public SealedMyPageResponseData SealedMyPageResponseData { get; private set; }
|
||||
|
||||
public ArenaColosseum ColosseumData { get; set; }
|
||||
|
||||
public ArenaCompetition CompetitionData { get; set; }
|
||||
|
||||
public ArenaData()
|
||||
{
|
||||
SealedData = new SealedData();
|
||||
ColosseumData = new ArenaColosseum();
|
||||
CompetitionData = new ArenaCompetition();
|
||||
}
|
||||
|
||||
public ArenaData(JsonData data)
|
||||
: this()
|
||||
{
|
||||
if (data != null)
|
||||
{
|
||||
JsonData data2 = data[0];
|
||||
TwoPickData = new ArenaTwoPickData(data2);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearSealedData()
|
||||
{
|
||||
SealedData = new SealedData();
|
||||
}
|
||||
|
||||
public void SetSealedMyPageResponseData(JsonData rootData)
|
||||
{
|
||||
if (rootData.Keys.Contains("sealed_info"))
|
||||
{
|
||||
SealedMyPageResponseData = new SealedMyPageResponseData(rootData["sealed_info"]);
|
||||
}
|
||||
}
|
||||
|
||||
public static Format ApiDeckFormatParse(ArenaColosseum.eRule rule)
|
||||
{
|
||||
Format format = Format.Rotation;
|
||||
switch (rule)
|
||||
{
|
||||
case ArenaColosseum.eRule.RotationBo1:
|
||||
return Format.Rotation;
|
||||
case ArenaColosseum.eRule.UnlimitedBo1:
|
||||
return Format.Unlimited;
|
||||
case ArenaColosseum.eRule.TwoPick:
|
||||
case ArenaColosseum.eRule.TwoPickChaos:
|
||||
return Format.TwoPick;
|
||||
case ArenaColosseum.eRule.HOF:
|
||||
case ArenaColosseum.eRule.WindFall:
|
||||
return Format.Max;
|
||||
case ArenaColosseum.eRule.Crossover:
|
||||
return Format.Crossover;
|
||||
case ArenaColosseum.eRule.MyRotation:
|
||||
return Format.MyRotation;
|
||||
case ArenaColosseum.eRule.Avatar:
|
||||
return Format.Avatar;
|
||||
default:
|
||||
return Format.Max;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
SVSim.BattleEngine/Engine/ArenaEntryDataBase.cs
Normal file
16
SVSim.BattleEngine/Engine/ArenaEntryDataBase.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Wizard;
|
||||
|
||||
public abstract class ArenaEntryDataBase
|
||||
{
|
||||
public bool isJoin;
|
||||
|
||||
public int crystalCost;
|
||||
|
||||
public int rupyCost;
|
||||
|
||||
public int ticketCost;
|
||||
|
||||
public ShopExpirtyInfo ExpirtyInfo { get; set; }
|
||||
|
||||
public PlayerStaticData.LootBoxType LootBoxType { get; set; }
|
||||
}
|
||||
80
SVSim.BattleEngine/Engine/ArenaField.cs
Normal file
80
SVSim.BattleEngine/Engine/ArenaField.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ArenaField : BackGroundBase
|
||||
{
|
||||
public override int FieldId => 9;
|
||||
|
||||
public ArenaField(string bgmId = "NONE")
|
||||
: base(bgmId)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void BattleFieldBuild()
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate
|
||||
{
|
||||
base.Field = GameObject.Find(_str3DFieldPath);
|
||||
base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform;
|
||||
GimicAudioList = base.Field.GetComponent<AudioList>().GimicAudioList;
|
||||
_fieldModel = base.Field.transform.Find("md_bf_arna_root").gameObject;
|
||||
_fieldParticles = _fieldModel.transform.Find("Particles09").gameObject;
|
||||
_fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles);
|
||||
_fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent<ParticleSystem>());
|
||||
List<string> list = new List<string>(_fieldObjDictionary.Keys);
|
||||
List<GameObject> list2 = new List<GameObject>();
|
||||
for (int i = 0; i < _fieldObjDictionary.Count; i++)
|
||||
{
|
||||
list2.Add(_fieldObjDictionary[list[i]]);
|
||||
}
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate
|
||||
{
|
||||
base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent<SetShaderGlobalColorBG>();
|
||||
base.IsLoadDone = true;
|
||||
}, isBattle: true, isField: true);
|
||||
}));
|
||||
}
|
||||
|
||||
public override void StartFieldSetEffect(Vector3 pos)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_9, pos);
|
||||
}
|
||||
|
||||
public override void StartFieldTapEffect(int areaId, Vector3 pos)
|
||||
{
|
||||
base.StartFieldTapEffect(areaId, pos);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_9_1, pos);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldOpening()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
_fieldParticleSystemDictionary["opening"].Play();
|
||||
_battleCamera.Camera.transform.localPosition = new Vector3(2700f, -880f, 300f);
|
||||
_battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-19f, -90f, 90f));
|
||||
Vector3[] bezierCubic = MotionUtils.GetBezierCubic(new Vector3(2700f, -880f, 300f), new Vector3(1700f, -550f, -220f), new Vector3(700f, -200f, 20f), new Vector3(-240f, -190f, -70f), 10);
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierCubic, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-37f, -117f, 107f), "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
yield return new WaitForSeconds(2f);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT);
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldGimic(GameObject obj)
|
||||
{
|
||||
string tag = obj.tag;
|
||||
if (tag != null && tag == "FieldGimic1")
|
||||
{
|
||||
_ = _gimicCntDictionary[obj.tag];
|
||||
}
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldShake()
|
||||
{
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
}
|
||||
101
SVSim.BattleEngine/Engine/ArenaNextSceneSelector.cs
Normal file
101
SVSim.BattleEngine/Engine/ArenaNextSceneSelector.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class ArenaNextSceneSelector : INextSceneSelector
|
||||
{
|
||||
private BattleResultUIController m_battleResultNewControl;
|
||||
|
||||
private bool _movingToMyPage;
|
||||
|
||||
public ArenaNextSceneSelector(BattleResultUIController battleResultControl)
|
||||
{
|
||||
m_battleResultNewControl = battleResultControl;
|
||||
_movingToMyPage = false;
|
||||
}
|
||||
|
||||
public void Setup(bool isWin, GameObject gameObject)
|
||||
{
|
||||
if (m_battleResultNewControl.ResultMsgReportBtnFlag)
|
||||
{
|
||||
m_battleResultNewControl.ReportBtnObj.labels[0].text = Data.SystemText.Get("Con_Management_001_Button");
|
||||
m_battleResultNewControl.ReportBtnObj.gameObject.SetActive(value: true);
|
||||
m_battleResultNewControl.ReportBtnObj.buttons[0].onClick.Clear();
|
||||
m_battleResultNewControl.ReportBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
ConsistencyReportButtonAction.CreateReportConfirmWindow();
|
||||
}));
|
||||
}
|
||||
m_battleResultNewControl.MissionBtnObj.labels[0].text = Data.SystemText.Get("Battle_0200");
|
||||
m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Clear();
|
||||
m_battleResultNewControl.MissionBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
MissionInfoTask missionInfoTask = GameMgr.GetIns().GetMissionInfoTask();
|
||||
missionInfoTask.SetParameter();
|
||||
m_battleResultNewControl.StartCoroutine(Toolbox.NetworkManager.Connect(missionInfoTask, delegate
|
||||
{
|
||||
m_battleResultNewControl.CreateMissionList();
|
||||
}, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode));
|
||||
}));
|
||||
m_battleResultNewControl.HomeBtnObj.labels[0].text = Data.SystemText.Get("Battle_0202");
|
||||
m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Clear();
|
||||
m_battleResultNewControl.HomeBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
MoveToMyPage();
|
||||
}));
|
||||
if (GameMgr.GetIns().GetDataMgr().IsColosseumBattleType())
|
||||
{
|
||||
m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0489");
|
||||
}
|
||||
else if (GameMgr.GetIns().GetDataMgr().IsCompetitionBattleType())
|
||||
{
|
||||
m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Competition_0021");
|
||||
}
|
||||
else if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.Sealed)
|
||||
{
|
||||
m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Sealed_BattleResult_0001");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_battleResultNewControl.RetryBtnObj.labels[0].text = Data.SystemText.Get("Battle_0203");
|
||||
}
|
||||
m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Clear();
|
||||
m_battleResultNewControl.RetryBtnObj.buttons[0].onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.TwoPick)
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.TwoPick);
|
||||
}
|
||||
else if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.Sealed)
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Sealed);
|
||||
}
|
||||
else if (GameMgr.GetIns().GetDataMgr().IsCompetitionBattleType())
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.CompetitionLobby);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.Colosseum);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
iTween.MoveTo(m_battleResultNewControl.ButtonGrid.gameObject, iTween.Hash("position", m_battleResultNewControl.DefaultPosDict["ButtonGrid"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
}
|
||||
|
||||
private void MoveToMyPage()
|
||||
{
|
||||
if (!_movingToMyPage)
|
||||
{
|
||||
_movingToMyPage = true;
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS);
|
||||
GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.MyPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
204
SVSim.BattleEngine/Engine/ArenaResultAnimationAgent.cs
Normal file
204
SVSim.BattleEngine/Engine/ArenaResultAnimationAgent.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class ArenaResultAnimationAgent : ResultAnimationAgent
|
||||
{
|
||||
public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin)
|
||||
{
|
||||
m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false);
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
battleResultControl.TitleWin.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleLose.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleDraw.gameObject.SetActive(value: true);
|
||||
battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f;
|
||||
battleResultControl.TitleDraw.alpha = 0f;
|
||||
battleResultControl.Bg.color = new Color32(0, 48, 16, 0);
|
||||
battleResultControl.ResultTitle.spriteName = "result_top_lose";
|
||||
}
|
||||
else if (isWin)
|
||||
{
|
||||
battleResultControl.TitleWin.gameObject.SetActive(value: true);
|
||||
battleResultControl.TitleLose.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleDraw.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f;
|
||||
battleResultControl.TitleWin.alpha = 0f;
|
||||
battleResultControl.Bg.color = new Color32(32, 24, 0, 0);
|
||||
battleResultControl.ResultTitle.spriteName = "result_top_win";
|
||||
}
|
||||
else
|
||||
{
|
||||
battleResultControl.TitleWin.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleLose.gameObject.SetActive(value: true);
|
||||
battleResultControl.TitleDraw.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f;
|
||||
battleResultControl.TitleLose.alpha = 0f;
|
||||
battleResultControl.Bg.color = new Color32(0, 24, 48, 0);
|
||||
battleResultControl.ResultTitle.spriteName = "result_top_lose";
|
||||
}
|
||||
battleResultControl.MainPanel.alpha = 1f;
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE);
|
||||
}
|
||||
else if (isWin)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE);
|
||||
}
|
||||
TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f);
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f);
|
||||
TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero);
|
||||
battleResultControl.TitleDraw.transform.localScale = Vector3.one;
|
||||
iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear));
|
||||
}
|
||||
else if (isWin)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero);
|
||||
battleResultControl.TitleWin.transform.localScale = Vector3.one;
|
||||
iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear));
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero);
|
||||
battleResultControl.TitleLose.transform.localScale = Vector3.one;
|
||||
iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear));
|
||||
}
|
||||
HideEmotionMessage();
|
||||
if (battleResultControl.ResultMsgWindowFlag)
|
||||
{
|
||||
StartCoroutine(battleResultControl.ShowSpecialResultInfo());
|
||||
}
|
||||
yield return new WaitForSeconds(2f);
|
||||
RankWinnerReward winnerReward = GameMgr.GetIns()._rankWinnerReward;
|
||||
if (winnerReward == null)
|
||||
{
|
||||
int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE);
|
||||
string value2 = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_STRING);
|
||||
if (value != 0 && value2 != "")
|
||||
{
|
||||
winnerReward = UIManager.GetInstance().createRankWinnerReward();
|
||||
GameMgr.GetIns()._rankWinnerReward = winnerReward;
|
||||
winnerReward.SetInfomation(value, value2);
|
||||
winnerReward.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
if (winnerReward != null && isWin)
|
||||
{
|
||||
float seconds = 3f;
|
||||
StartCoroutine(winnerReward.ResultWinnerReward());
|
||||
yield return new WaitForSeconds(seconds);
|
||||
StartCoroutine(winnerReward.HideRewardObject());
|
||||
}
|
||||
if (!battleResultControl.IsDraw && ShowRewardDialog(battleResultControl))
|
||||
{
|
||||
while (battleResultControl.IsRewardWait)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
if (Data.ArenaBattleFinish.data != null)
|
||||
{
|
||||
TreasureBoxCpResultInfo treasureBoxCpResultInfo = Data.ArenaBattleFinish.data.TreasureBoxCpResultInfo;
|
||||
if (treasureBoxCpResultInfo.IsPlayGradeUpAnimation())
|
||||
{
|
||||
yield return TreasureBoxCpOpenBoxAnimation(battleResultControl, treasureBoxCpResultInfo.AfterGrade);
|
||||
}
|
||||
if (treasureBoxCpResultInfo.IsBoxOpened())
|
||||
{
|
||||
yield return CreateTreasureBoxCpRewardDialog(treasureBoxCpResultInfo);
|
||||
}
|
||||
}
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject);
|
||||
}
|
||||
else if (isWin)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f);
|
||||
iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject);
|
||||
}
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
if (isWin)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP);
|
||||
}
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER);
|
||||
iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
yield return new WaitForSeconds(1f);
|
||||
if (isWin)
|
||||
{
|
||||
PlayWinVoice();
|
||||
}
|
||||
if (battleResultControl.AddClassExp > 0)
|
||||
{
|
||||
battleResultControl.SettingAddClassExpTextAnimation();
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP);
|
||||
yield return new WaitForSeconds(0.05f);
|
||||
}
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
bool _isFinishBattlePass = false;
|
||||
battleResultControl.SetBattlePassGauge(delegate
|
||||
{
|
||||
_isFinishBattlePass = true;
|
||||
});
|
||||
while (!_isFinishBattlePass)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
if (Data.RedEtherCampaignResultData != null)
|
||||
{
|
||||
bool isFinishRedEther = false;
|
||||
RedEtherCampaignPanel.Create(battleResultControl.gameObject, Data.RedEtherCampaignResultData, battleResultControl, delegate
|
||||
{
|
||||
isFinishRedEther = true;
|
||||
});
|
||||
while (!isFinishRedEther)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield return ShowRewardDialog(Data.RedEtherCampaignResultData.RewardList);
|
||||
}
|
||||
battleResultControl.GreySpriteBGVisible = false;
|
||||
nextSceneSelector.Show();
|
||||
battleResultControl.PrepareAchievementLog();
|
||||
battleResultControl.FinishResult();
|
||||
}
|
||||
}
|
||||
22
SVSim.BattleEngine/Engine/ArenaResultAnimationHandler.cs
Normal file
22
SVSim.BattleEngine/Engine/ArenaResultAnimationHandler.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ArenaResultAnimationHandler : IResultAnimationHandler
|
||||
{
|
||||
private readonly GameObject m_resultAnimationAgentObj;
|
||||
|
||||
private readonly ArenaResultAnimationAgent m_resultAnimationAgentIns;
|
||||
|
||||
public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns;
|
||||
|
||||
public ArenaResultAnimationHandler(BattleCamera battleCamera)
|
||||
{
|
||||
m_resultAnimationAgentObj = new GameObject();
|
||||
m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent<ArenaResultAnimationAgent>();
|
||||
m_resultAnimationAgentIns.GetComponent<ArenaResultAnimationAgent>().SetBattleCamera(battleCamera);
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
Object.Destroy(m_resultAnimationAgentObj);
|
||||
}
|
||||
}
|
||||
63
SVSim.BattleEngine/Engine/ArenaResultReporter.cs
Normal file
63
SVSim.BattleEngine/Engine/ArenaResultReporter.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
using Wizard;
|
||||
using Wizard.Lottery;
|
||||
|
||||
public class ArenaResultReporter : IBattleResultReporter
|
||||
{
|
||||
public bool IsEnd => Data.ArenaBattleFinish.data != null;
|
||||
|
||||
public int ClassExp => GetClassExp();
|
||||
|
||||
public List<UserAchievement> UserAchievement => GetUserAchievementList();
|
||||
|
||||
public List<UserMission> UserMission => GetUserMissionList();
|
||||
|
||||
public List<ReceivedReward> MissionRewards => Data.ArenaBattleFinish.data._missionRewards;
|
||||
|
||||
public List<ReceivedReward> VictoryRewards => Data.ArenaBattleFinish.data._victoryRewards;
|
||||
|
||||
public LotteryApplyData LotteryData => LotteryApplyData.EmptyData();
|
||||
|
||||
public bool IsDataExist
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Data.ArenaBattleFinish.data != null)
|
||||
{
|
||||
return Data.ArenaBattleFinish.data.IsProcessed;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public MyPageHomeDialogData HomeDialogData => null;
|
||||
|
||||
public void Report(bool isWin)
|
||||
{
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
public JsonData GetFinishResponseData()
|
||||
{
|
||||
return Data.ArenaBattleFinish.data._responseData;
|
||||
}
|
||||
|
||||
public List<UserAchievement> GetUserAchievementList()
|
||||
{
|
||||
return Data.ArenaBattleFinish.data.achieved_achievement_list;
|
||||
}
|
||||
|
||||
public List<UserMission> GetUserMissionList()
|
||||
{
|
||||
return Data.ArenaBattleFinish.data.achieved_mission_list;
|
||||
}
|
||||
|
||||
public int GetClassExp()
|
||||
{
|
||||
return Data.ArenaBattleFinish.data.get_class_chara_experience;
|
||||
}
|
||||
}
|
||||
24
SVSim.BattleEngine/Engine/ArenaTwoPickData.cs
Normal file
24
SVSim.BattleEngine/Engine/ArenaTwoPickData.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using LitJson;
|
||||
using Wizard;
|
||||
|
||||
public class ArenaTwoPickData : ArenaEntryDataBase
|
||||
{
|
||||
public ChallengeData ChallengeData { get; private set; }
|
||||
|
||||
public ArenaTwoPickData(JsonData data)
|
||||
{
|
||||
isJoin = data["is_join"].ToBoolean();
|
||||
crystalCost = data["cost"].ToInt();
|
||||
rupyCost = data["rupy_cost"].ToInt();
|
||||
ticketCost = data["ticket_cost"].ToInt();
|
||||
base.LootBoxType = PlayerStaticData.LootBoxType.TWOPICK;
|
||||
if (data.Keys.Contains("sales_period_info"))
|
||||
{
|
||||
base.ExpirtyInfo = new ShopExpirtyInfo(data["sales_period_info"]);
|
||||
}
|
||||
if (data.Keys.Contains("format_info"))
|
||||
{
|
||||
ChallengeData = new ChallengeData(data["format_info"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
76
SVSim.BattleEngine/Engine/AspectCamera.cs
Normal file
76
SVSim.BattleEngine/Engine/AspectCamera.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class AspectCamera : MonoBehaviour
|
||||
{
|
||||
public Vector2 aspect = new Vector2(4f, 3f);
|
||||
|
||||
public Color32 backgroundColor = Color.black;
|
||||
|
||||
private float aspectRate;
|
||||
|
||||
private Camera _camera;
|
||||
|
||||
private static Camera _backgroundCamera;
|
||||
|
||||
private int sizeVal = 1;
|
||||
|
||||
public const float LOWER_LIMIT_ASPECT_RATIO = 0.5625f;
|
||||
|
||||
public const float UPPER_LIMIT_ASPECT_RATIO = 0.4618f;
|
||||
|
||||
public const float LOWER_LIMIT_ASPECT_RATIO_RECIPROCAL = 1.7777778f;
|
||||
|
||||
private const float SAFE_AREA_RATE = 0.892f;
|
||||
|
||||
private const float SAFE_AREA_NONE_RATE = 1f;
|
||||
|
||||
public static float SafeAreaRate;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
aspectRate = aspect.x / aspect.y;
|
||||
_camera = GetComponent<Camera>();
|
||||
SafeAreaRate = 1f;
|
||||
float num = (float)Screen.height / (float)Screen.width;
|
||||
if (num < 0.5625f)
|
||||
{
|
||||
num = Mathf.Max(num, 0.4618f);
|
||||
float t = (0.5625f - num) / 0.10069999f;
|
||||
SafeAreaRate = Mathf.Lerp(1f, 0.892f, t);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateScreenRate()
|
||||
{
|
||||
float num = aspect.y / aspect.x;
|
||||
float num2 = (float)Screen.height / (float)Screen.width;
|
||||
if (num2 < 0.5625f)
|
||||
{
|
||||
num2 = 0.5625f;
|
||||
}
|
||||
if (num > num2)
|
||||
{
|
||||
float num3 = num2 / num;
|
||||
_camera.rect = new Rect(0f, 0f, 1f, 1f);
|
||||
_camera.orthographicSize = (float)sizeVal * num3;
|
||||
}
|
||||
else
|
||||
{
|
||||
float num4 = num / num2;
|
||||
_camera.rect = new Rect(0f, 0f, 1f, 1f);
|
||||
_camera.orthographicSize = (float)sizeVal / num4;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsChangeAspect()
|
||||
{
|
||||
return _camera.aspect == aspectRate;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdateScreenRate();
|
||||
_camera.ResetAspect();
|
||||
}
|
||||
}
|
||||
528
SVSim.BattleEngine/Engine/AttackSelectControl.cs
Normal file
528
SVSim.BattleEngine/Engine/AttackSelectControl.cs
Normal file
@@ -0,0 +1,528 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Battle.Touch;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class AttackSelectControl
|
||||
{
|
||||
public class AttackPair
|
||||
{
|
||||
public class AttackPairCard
|
||||
{
|
||||
public IBattleCardView _battleCardView;
|
||||
|
||||
public bool _isReady;
|
||||
|
||||
public bool _hasStartedMoving;
|
||||
|
||||
public AttackPairCard(IBattleCardView battleCardBase)
|
||||
{
|
||||
_battleCardView = battleCardBase;
|
||||
}
|
||||
|
||||
public AttackPairCard(AttackPairCard attackPairCard)
|
||||
{
|
||||
_battleCardView = attackPairCard._battleCardView;
|
||||
_isReady = attackPairCard._isReady;
|
||||
_hasStartedMoving = attackPairCard._hasStartedMoving;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_battleCardView = null;
|
||||
_isReady = false;
|
||||
_hasStartedMoving = false;
|
||||
}
|
||||
}
|
||||
|
||||
public AttackPairCard _attackInitiator;
|
||||
|
||||
public AttackPairCard _attackTarget;
|
||||
|
||||
public bool IsAttackPairReady
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_attackInitiator._isReady)
|
||||
{
|
||||
return _attackTarget._isReady;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public AttackPair(IBattleCardView attackInitiator, IBattleCardView attackTarget)
|
||||
{
|
||||
_attackInitiator = new AttackPairCard(attackInitiator);
|
||||
_attackTarget = new AttackPairCard(attackTarget);
|
||||
}
|
||||
|
||||
public AttackPair(AttackPair attackPair)
|
||||
{
|
||||
_attackInitiator = new AttackPairCard(attackPair._attackInitiator);
|
||||
_attackTarget = new AttackPairCard(attackPair._attackTarget);
|
||||
}
|
||||
|
||||
public bool Compare(IBattleCardView attackInitiatorView, IBattleCardView attackTargetView)
|
||||
{
|
||||
if (_attackInitiator._battleCardView == attackInitiatorView)
|
||||
{
|
||||
return _attackTarget._battleCardView == attackTargetView;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
_attackInitiator.Clear();
|
||||
_attackTarget.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public class WaitUntilAttackPairIsReadyVfx : VfxBase
|
||||
{
|
||||
private AttackPair _attackPair;
|
||||
|
||||
public WaitUntilAttackPairIsReadyVfx(AttackPair attackPair)
|
||||
{
|
||||
_attackPair = attackPair;
|
||||
}
|
||||
|
||||
public override void Play()
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(Wait());
|
||||
}
|
||||
|
||||
private IEnumerator Wait()
|
||||
{
|
||||
while (!_attackPair.IsAttackPairReady)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
IsEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
private BattleCardBase currentAttackInitiatorBattleCard;
|
||||
|
||||
private bool areAttackPairsBeingUpdated;
|
||||
|
||||
private readonly AttackPair currentAttackPair = new AttackPair(null, null);
|
||||
|
||||
private readonly List<AttackPair> successfulAttackPairs = new List<AttackPair>();
|
||||
|
||||
public const float Z_FLOAT_AMOUNT = -100f;
|
||||
|
||||
private const float EPSILON = 0.1f;
|
||||
|
||||
private const float SMOOTHING_AMOUNT = 0.01f;
|
||||
|
||||
private const float DECAY_MULTIPLIER = 10f;
|
||||
|
||||
private const float IDLING_POSITION = 0.025390625f;
|
||||
|
||||
private IBattleCardView currentAttackInitiator
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentAttackPair._attackInitiator._battleCardView;
|
||||
}
|
||||
set
|
||||
{
|
||||
currentAttackPair._attackInitiator._battleCardView = value;
|
||||
}
|
||||
}
|
||||
|
||||
private IBattleCardView currentAttackTarget
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentAttackPair._attackTarget._battleCardView;
|
||||
}
|
||||
set
|
||||
{
|
||||
currentAttackPair._attackTarget._battleCardView = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
float t = MotionUtils.CalculateFrameRateIndependantDampingConstant(0.01f, 10f);
|
||||
if (currentAttackInitiator != null && !currentAttackInitiator._attackTargetSelectInfo.IsCardInvolvedInAttack)
|
||||
{
|
||||
MoveCardUpwards(currentAttackPair._attackInitiator, t);
|
||||
}
|
||||
if (currentAttackTarget != null && !currentAttackTarget._attackTargetSelectInfo.IsCardInvolvedInAttack)
|
||||
{
|
||||
MoveCardUpwards(currentAttackPair._attackTarget, t);
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterAttackInitiator(BattleCardBase attackInitiatorCard, BattlePlayerBase opponentBattlePlayer)
|
||||
{
|
||||
currentAttackInitiatorBattleCard = attackInitiatorCard;
|
||||
currentAttackInitiator = attackInitiatorCard.BattleCardView;
|
||||
ToggleAttackableCardFrameEffects(isEnabled: true, opponentBattlePlayer);
|
||||
attackInitiatorCard.BattleCardView._attackTargetSelectInfo._isBeingSelectedInAttack = true;
|
||||
if (!attackInitiatorCard.BattleCardView._attackTargetSelectInfo.IsCardInvolvedInAttack)
|
||||
{
|
||||
ResetCardOrientationAndStopMovement(attackInitiatorCard.BattleCardView);
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterAttackTarget(IBattleCardView attackTargetCard)
|
||||
{
|
||||
if (currentAttackTarget == attackTargetCard)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (attackTargetCard != null)
|
||||
{
|
||||
attackTargetCard._attackTargetSelectInfo._isBeingSelectedInAttack = true;
|
||||
if (!attackTargetCard._attackTargetSelectInfo.IsCardInvolvedInAttack)
|
||||
{
|
||||
ResetCardOrientationAndStopMovement(attackTargetCard);
|
||||
}
|
||||
}
|
||||
currentAttackPair._attackTarget._isReady = !IsCardTranslatable(attackTargetCard);
|
||||
currentAttackPair._attackTarget._hasStartedMoving = !IsCardTranslatable(attackTargetCard);
|
||||
ResetCardPosition(currentAttackTarget);
|
||||
if (currentAttackTarget != null)
|
||||
{
|
||||
currentAttackTarget._attackTargetSelectInfo._isBeingSelectedInAttack = false;
|
||||
}
|
||||
currentAttackTarget = attackTargetCard;
|
||||
}
|
||||
|
||||
public virtual void RegisterAttackPair(AttackPair attackPair)
|
||||
{
|
||||
IBattleCardView battleCardView = attackPair._attackInitiator._battleCardView;
|
||||
IBattleCardView battleCardView2 = attackPair._attackTarget._battleCardView;
|
||||
if (attackPair == null || battleCardView == null || battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn == null)
|
||||
{
|
||||
ResetCardPosition(currentAttackInitiator);
|
||||
ResetCardPosition(currentAttackTarget);
|
||||
return;
|
||||
}
|
||||
successfulAttackPairs.Add(attackPair);
|
||||
battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Enqueue(attackPair);
|
||||
battleCardView2._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Enqueue(attackPair);
|
||||
if (!areAttackPairsBeingUpdated)
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(UpdateAttackPairs());
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelAttackSelect(bool wasAttackSuccessful, BattlePlayerBase opponentBattlePlayer)
|
||||
{
|
||||
if (wasAttackSuccessful)
|
||||
{
|
||||
AttackPair attackPair = new AttackPair(currentAttackPair);
|
||||
RegisterAttackPair(attackPair);
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetCardPosition(currentAttackInitiator);
|
||||
ResetCardPosition(currentAttackTarget);
|
||||
}
|
||||
if (currentAttackInitiatorBattleCard != null)
|
||||
{
|
||||
ToggleAttackableCardFrameEffects(isEnabled: false, opponentBattlePlayer);
|
||||
}
|
||||
if (currentAttackInitiator != null)
|
||||
{
|
||||
currentAttackInitiator._attackTargetSelectInfo._isBeingSelectedInAttack = false;
|
||||
}
|
||||
if (currentAttackTarget != null)
|
||||
{
|
||||
currentAttackTarget._attackTargetSelectInfo._isBeingSelectedInAttack = false;
|
||||
}
|
||||
currentAttackInitiatorBattleCard = null;
|
||||
currentAttackPair.Clear();
|
||||
}
|
||||
|
||||
public void ResetCardOrientationAndStopMovement(IBattleCardView targetCard)
|
||||
{
|
||||
if (!targetCard._attackTargetSelectInfo.IsUneffectedByAttackTargetting)
|
||||
{
|
||||
iTween.Stop(targetCard.CardWrapObject);
|
||||
targetCard.CardWrapObject.transform.rotation = Quaternion.identity;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual VfxBase ResetCardAfterAttackOnReplay()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
for (int i = 0; i < successfulAttackPairs.Count(); i++)
|
||||
{
|
||||
IBattleCardView battleCardView = successfulAttackPairs[i]._attackInitiator._battleCardView;
|
||||
if (battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Count > 0)
|
||||
{
|
||||
battleCardView._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Dequeue();
|
||||
}
|
||||
ResetCardPosition(battleCardView);
|
||||
IBattleCardView battleCardView2 = successfulAttackPairs[i]._attackTarget._battleCardView;
|
||||
if (battleCardView2._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Count > 0)
|
||||
{
|
||||
battleCardView2._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Dequeue();
|
||||
}
|
||||
ResetCardPosition(battleCardView2);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public virtual VfxBase ResetCardAfterAttack(IBattleCardView cardToReset)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
if (cardToReset._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Count > 0)
|
||||
{
|
||||
cardToReset._attackTargetSelectInfo._attackPairsCardIsInvolvedIn.Dequeue();
|
||||
}
|
||||
if (cardToReset._attackTargetSelectInfo.IsCardInvolvedInAttack)
|
||||
{
|
||||
cardToReset._attackTargetSelectInfo.CurrentAttackPairCardIsInvolvedIn._attackTarget._isReady = true;
|
||||
}
|
||||
ResetCardPosition(cardToReset);
|
||||
});
|
||||
}
|
||||
|
||||
private void ResetCardPosition(IBattleCardView targetCard)
|
||||
{
|
||||
if (!BattleManagerBase.GetIns().IsRecovery && IsCardTranslatable(targetCard) && !targetCard._attackTargetSelectInfo.IsCardInvolvedInAttack && !targetCard._attackTargetSelectInfo.IsUneffectedByAttackTargetting)
|
||||
{
|
||||
ImmediateVfxMgr.GetInstance().Register(SequentialVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
iTween.Stop(targetCard.CardWrapObject);
|
||||
}), new DelaySetupVfx(() => (targetCard._attackTargetSelectInfo._isBeingSelectedInAttack || targetCard._attackTargetSelectInfo.IsCardInvolvedInAttack) ? ((VfxBase)NullVfx.GetInstance()) : ((VfxBase)new FallToGroundVfx(targetCard.CardWrapObject)))));
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void StartCardIdling(IBattleCardView battleCardView)
|
||||
{
|
||||
iTween.Stop(battleCardView.CardWrapObject);
|
||||
iTween.MoveAdd(battleCardView.CardWrapObject, iTween.Hash("z", 0.025390625f, "time", Random.Range(0.5f, 0.6f), "looptype", iTween.LoopType.pingPong, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
}
|
||||
|
||||
public virtual VfxBase RemoveAttackPairVfx(IBattleCardView attackInitiator, IBattleCardView attackTarget)
|
||||
{
|
||||
AttackPair attackPairToRemove = null;
|
||||
for (int i = 0; i < successfulAttackPairs.Count; i++)
|
||||
{
|
||||
if (successfulAttackPairs[i].Compare(attackInitiator, attackTarget))
|
||||
{
|
||||
attackPairToRemove = successfulAttackPairs[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (attackPairToRemove != null)
|
||||
{
|
||||
VfxBase vfxBase = CreateWaitUntilAttackPairIsReadyVfx(attackPairToRemove);
|
||||
VfxBase vfxBase2 = InstantVfx.Create(delegate
|
||||
{
|
||||
successfulAttackPairs.Remove(attackPairToRemove);
|
||||
});
|
||||
return SequentialVfxPlayer.Create(vfxBase, vfxBase2);
|
||||
}
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
private void ToggleAttackableCardFrameEffects(bool isEnabled, BattlePlayerBase opponentBattlePlayer)
|
||||
{
|
||||
List<BattleCardBase> classAndInPlayCardList = opponentBattlePlayer.ClassAndInPlayCardList;
|
||||
for (int i = 0; i < classAndInPlayCardList.Count; i++)
|
||||
{
|
||||
if (CanCardAttackTarget(currentAttackInitiatorBattleCard, classAndInPlayCardList[i], opponentBattlePlayer.InPlayCards) && classAndInPlayCardList[i].AreCanBeAttackedConditionsFulfilled)
|
||||
{
|
||||
classAndInPlayCardList[i].BattleCardView._inPlayFrameEffect.ToggleTargetSelectEffect(isEnabled);
|
||||
}
|
||||
}
|
||||
currentAttackInitiator._inPlayFrameEffect.ToggleTargetSelectEffect(isEnabled, isAttackTargetSelectInitiator: true);
|
||||
}
|
||||
|
||||
private VfxBase CreateWaitUntilAttackPairIsReadyVfx(AttackPair attackPair)
|
||||
{
|
||||
return new WaitUntilAttackPairIsReadyVfx(attackPair);
|
||||
}
|
||||
|
||||
private IEnumerator UpdateAttackPairs()
|
||||
{
|
||||
areAttackPairsBeingUpdated = true;
|
||||
while (successfulAttackPairs.Count > 0)
|
||||
{
|
||||
float t = MotionUtils.CalculateFrameRateIndependantDampingConstant(0.01f, 10f);
|
||||
for (int i = 0; i < successfulAttackPairs.Count; i++)
|
||||
{
|
||||
AttackPair attackPair = successfulAttackPairs[i];
|
||||
if (!attackPair.IsAttackPairReady)
|
||||
{
|
||||
AttackPair.AttackPairCard attackInitiator = attackPair._attackInitiator;
|
||||
AttackPair.AttackPairCard attackTarget = attackPair._attackTarget;
|
||||
if (attackInitiator._battleCardView._attackTargetSelectInfo.CurrentAttackPairCardIsInvolvedIn == attackPair)
|
||||
{
|
||||
MoveCardUpwards(attackInitiator, t);
|
||||
}
|
||||
if (attackTarget._battleCardView._attackTargetSelectInfo.CurrentAttackPairCardIsInvolvedIn == attackPair)
|
||||
{
|
||||
MoveCardUpwards(attackTarget, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
yield return null;
|
||||
}
|
||||
areAttackPairsBeingUpdated = false;
|
||||
}
|
||||
|
||||
private void MoveCardUpwards(AttackPair.AttackPairCard attackPairCard, float t)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery)
|
||||
{
|
||||
attackPairCard._isReady = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (attackPairCard == null || attackPairCard._battleCardView == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
IBattleCardView battleCardView = attackPairCard._battleCardView;
|
||||
if (IsCardTranslatable(battleCardView) && !battleCardView._attackTargetSelectInfo.IsUneffectedByAttackTargetting && !attackPairCard._isReady)
|
||||
{
|
||||
if (!attackPairCard._hasStartedMoving)
|
||||
{
|
||||
attackPairCard._hasStartedMoving = true;
|
||||
ResetCardOrientationAndStopMovement(battleCardView);
|
||||
}
|
||||
Transform transform = battleCardView.CardWrapObject.transform;
|
||||
if (!IsCardFullyTranslated(battleCardView))
|
||||
{
|
||||
Vector3 b = CalculateFinalFloatingPosition(battleCardView);
|
||||
transform.localPosition = Vector3.Lerp(transform.transform.localPosition, b, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
transform.localPosition = CalculateFinalFloatingPosition(battleCardView);
|
||||
attackPairCard._isReady = true;
|
||||
StartCardIdling(battleCardView);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Vector3 CalculateFinalFloatingPosition(IBattleCardView battleCardView)
|
||||
{
|
||||
Vector3 localPosition = battleCardView.CardWrapObject.transform.transform.localPosition;
|
||||
localPosition.z = -100f;
|
||||
return localPosition;
|
||||
}
|
||||
|
||||
public bool IsCardTranslatable(IBattleCardView cardToTranslate)
|
||||
{
|
||||
if (cardToTranslate != null)
|
||||
{
|
||||
return !cardToTranslate.CardInfo.IsClass;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsCardFullyTranslated(IBattleCardView cardBeingTranslated)
|
||||
{
|
||||
return Mathf.Abs(cardBeingTranslated.CardWrapObject.transform.localPosition.z - -100f) < 0.1f;
|
||||
}
|
||||
|
||||
public static bool CanCardAttackTarget(BattleCardBase Attacker, BattleCardBase Target, IEnumerable<BattleCardBase> TargetInPlayCards)
|
||||
{
|
||||
bool flag = false;
|
||||
bool isClass = Target.IsClass;
|
||||
if (TargetInPlayCards.Any((BattleCardBase c) => c.SkillApplyInformation.IsGuard && !c.CantBeFocusedAttack(Attacker)))
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
if (Attacker.SkillApplyInformation.IsIgnoreGuard)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
if (Attacker.AttackableCount <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ((!Attacker.SkillApplyInformation.IsQuick || !Attacker.SkillApplyInformation.IsRush) && !Attacker.Attackable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (isClass)
|
||||
{
|
||||
if (!Attacker.SkillApplyInformation.IsQuick)
|
||||
{
|
||||
if (Attacker.IsFirstTurn)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Attacker.Attackable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (Attacker.IsCantAttackClass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Attacker.SkillApplyInformation.IsForceAttackUnit && Attacker.OpponentBattlePlayer.InPlayCards.Any((BattleCardBase c) => !c.CantBeFocusedAttack(Attacker) && c.IsUnit && !AttackTargetSelectTouchProcessor.CheckAttackToUnitNotHasGuardError(Attacker, c)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!Target.IsInplay)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Target.IsField || Target.CantBeFocusedAttack(Attacker))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (flag && (isClass || !Target.SkillApplyInformation.IsGuard))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (isClass && Attacker.IsCantAttackClass)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Target.IsUnit && Attacker.SkillApplyInformation.IsSkillCantAtkUnit)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (Target.IsUnit && Attacker.SkillApplyInformation.IsSkillCantAtkUnitBaseCardId && Attacker.SkillApplyInformation.CantAtkUnitBaseCardIdList.Contains(Target.BaseParameter.BaseCardId))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!isClass && Attacker.SkillApplyInformation.IsSkillCantAtkUnitNotHasGuard && !Target.SkillApplyInformation.IsGuard)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsAttackPossible(BattleCardBase attacker, BattleCardBase target, IEnumerable<BattleCardBase> opponentInPlayCards)
|
||||
{
|
||||
if (attacker.Attackable)
|
||||
{
|
||||
return CanCardAttackTarget(attacker, target, opponentInPlayCards);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsAttackPossible(AIVirtualCard attacker, AIVirtualCard target, BattlePlayerBase opponent)
|
||||
{
|
||||
if (attacker.BaseCard.Attackable)
|
||||
{
|
||||
return CanCardAttackTarget(attacker.BaseCard, target.BaseCard, opponent.InPlayCards);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
487
SVSim.BattleEngine/Engine/BattleCardIconAnimations.cs
Normal file
487
SVSim.BattleEngine/Engine/BattleCardIconAnimations.cs
Normal file
@@ -0,0 +1,487 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class BattleCardIconAnimations : MonoBehaviour
|
||||
{
|
||||
public class SkillIcon
|
||||
{
|
||||
public string _key;
|
||||
|
||||
public string _iconSpriteName;
|
||||
|
||||
public int LabelNumber;
|
||||
|
||||
public SkillIcon(string key, string iconSpriteName, int labelNumber)
|
||||
{
|
||||
_key = key;
|
||||
_iconSpriteName = iconSpriteName;
|
||||
LabelNumber = labelNumber;
|
||||
}
|
||||
}
|
||||
|
||||
private List<SkillIcon> skillIconList = new List<SkillIcon>();
|
||||
|
||||
private List<SkillIcon> skillIconListWithoutDuplicates = new List<SkillIcon>();
|
||||
|
||||
private CardTemplate cardTemplate;
|
||||
|
||||
private BattleCardBase _card;
|
||||
|
||||
private SkillCollectionBase collection;
|
||||
|
||||
private bool skillIconAlphaFlg;
|
||||
|
||||
private int skillCount;
|
||||
|
||||
private int _inductionLabelNumber = -1;
|
||||
|
||||
private const float ALPHA_BLEND_RATE = 0.6f;
|
||||
|
||||
private const string INDUCTION_ICON_SPRITE_NAME = "battle_notice_status_04";
|
||||
|
||||
private const string WHITE_RITUAL_STACK_SPRITE_NAME = "battle_notice_status_11";
|
||||
|
||||
public VfxBase Initialize(BattleCardBase card, SkillCollectionBase collection, bool isStackWhiteRitual = false)
|
||||
{
|
||||
_card = card;
|
||||
this.collection = collection;
|
||||
ISkillApplyInformation skillApplyInformation = card.SkillApplyInformation;
|
||||
bool isEarthRiteField = (IsEarthRiteField() ? true : false);
|
||||
bool hasInductionSkill = HasInductionSkill();
|
||||
bool hasInductionNumberSkill = HasInductionNumberSkill();
|
||||
bool hasKiller = (skillApplyInformation.IsKiller ? true : false);
|
||||
bool hasDrain = (skillApplyInformation.IsDrain ? true : false);
|
||||
bool hasWhenDestroySkill = (HasWhenDestroySkill() ? true : false);
|
||||
bool hasGetonSkill = HasGetonSkill();
|
||||
bool isGetOnAfter = _card.GetOnCards.Any();
|
||||
bool hasWhiteRirualStackSkill = HasStackWhiteRitualSkill();
|
||||
int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount;
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
InitializeIcon(isEarthRiteField && !hasWhiteRirualStackSkill, isEarthRiteField && hasWhiteRirualStackSkill, whiteRitualCount, hasInductionSkill, hasInductionNumberSkill, hasKiller, hasDrain, hasWhenDestroySkill, hasGetonSkill, isGetOnAfter, isReplay: false, isStackWhiteRitual);
|
||||
});
|
||||
}
|
||||
|
||||
public VfxBase InitializeOnlyStack(BattleCardBase card, SkillCollectionBase collection)
|
||||
{
|
||||
_card = card;
|
||||
this.collection = collection;
|
||||
bool isEarthRiteField = IsEarthRiteField();
|
||||
bool hasWhiteRirualStackSkill = HasStackWhiteRitualSkill();
|
||||
int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount;
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
InitializeIcon(isEarthRiteField && !hasWhiteRirualStackSkill, isEarthRiteField && hasWhiteRirualStackSkill, whiteRitualCount, hasInductionSkill: false, hasInductionNumberSkill: false, hasKiller: false, hasDrain: false, hasWhenDestroySkill: false, hasGetonSkill: false);
|
||||
});
|
||||
}
|
||||
|
||||
private void InitializeIcon(bool hasWhiteRirualSkill, bool hasWhiteRirualStackSkill, int whiteRitualCount, bool hasInductionSkill, bool hasInductionNumberSkill, bool hasKiller, bool hasDrain, bool hasWhenDestroySkill, bool hasGetonSkill, bool isGetOnAfter = false, bool isReplay = false, bool isStackWhiteRitual = false)
|
||||
{
|
||||
if (!(_card.BattleCardView.GameObject == null))
|
||||
{
|
||||
ClearAllSkillIcons();
|
||||
cardTemplate = _card.BattleCardView.GameObject.GetComponent<CardTemplate>();
|
||||
cardTemplate.SkillIconTemp.gameObject.transform.localPosition = new Vector3(0f, -30f, -0.1f);
|
||||
cardTemplate.SkillIconTemp.gameObject.transform.localScale = new Vector3(0.2f, 0.2f, 1f);
|
||||
cardTemplate.SkillIconTemp.atlas = UIManager.GetInstance().GetAtlasList().FirstOrDefault((UIAtlas s) => s.name == "Battle");
|
||||
AddToIconList("white_ritual", "battle_notice_status_08", hasWhiteRirualSkill);
|
||||
AddToIconList("stack_white_ritual", "battle_notice_status_11", hasWhiteRirualStackSkill, whiteRitualCount);
|
||||
AddToIconList("induction", "battle_notice_status_04", hasInductionSkill);
|
||||
AddToIconList("induction_number", "battle_notice_status_04", hasInductionNumberSkill, GetInductionLabelNumber());
|
||||
AddToIconList("killer", "battle_notice_status_01", hasKiller);
|
||||
AddToIconList("drain", "battle_notice_status_07", hasDrain);
|
||||
AddToIconList("destroy", "battle_notice_status_06", hasWhenDestroySkill);
|
||||
if (isReplay)
|
||||
{
|
||||
AddToIconList("geton", "battle_notice_status_09", hasGetonSkill);
|
||||
AddToIconList("geton_after", "battle_notice_status_10", isGetOnAfter);
|
||||
}
|
||||
else if (isGetOnAfter)
|
||||
{
|
||||
AddToIconList("geton_after", "battle_notice_status_10", hasGetonSkill);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddToIconList("geton", "battle_notice_status_09", hasGetonSkill);
|
||||
}
|
||||
PopulateSkillIconListWithoutDuplicates();
|
||||
string spriteName = (skillIconListWithoutDuplicates.Any() ? skillIconListWithoutDuplicates[0]._iconSpriteName : string.Empty);
|
||||
cardTemplate.SkillIconTemp.spriteName = spriteName;
|
||||
ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates.Any() ? skillIconListWithoutDuplicates[0].LabelNumber : (-1));
|
||||
UpdateSkillIconLabelColor();
|
||||
skillCount = 0;
|
||||
cardTemplate.SkillIconTemp.gameObject.SetActive(value: true);
|
||||
if (isStackWhiteRitual)
|
||||
{
|
||||
cardTemplate.SkillIconTemp.alpha = 1.5f;
|
||||
skillIconAlphaFlg = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public VfxBase UpdateLabelNumber()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
SkillIcon skillIcon = skillIconListWithoutDuplicates.FirstOrDefault((SkillIcon i) => i._key == "induction_number");
|
||||
if (skillIcon != null)
|
||||
{
|
||||
skillIcon.LabelNumber = GetInductionLabelNumber();
|
||||
if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_04")
|
||||
{
|
||||
ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIcon.LabelNumber);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public VfxBase UpdateWhiteRitualCountLabel()
|
||||
{
|
||||
if (!HasStackWhiteRitualSkill() || !IsEarthRiteField())
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount;
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
SkillIcon skillIcon = skillIconListWithoutDuplicates.FirstOrDefault((SkillIcon i) => i._key == "stack_white_ritual");
|
||||
if (skillIcon != null)
|
||||
{
|
||||
skillIcon.LabelNumber = whiteRitualCount;
|
||||
if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_11")
|
||||
{
|
||||
ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIcon.LabelNumber);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void AddToIconList(string key, string spriteName, bool addCondition, int labelNumber = -1)
|
||||
{
|
||||
if (addCondition)
|
||||
{
|
||||
AddSkillIcon(key, spriteName, labelNumber);
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateSkillIconListWithoutDuplicates()
|
||||
{
|
||||
AddToIconListWithoutDuplicates("white_ritual");
|
||||
AddToIconListWithoutDuplicates("stack_white_ritual");
|
||||
AddToIconListWithoutDuplicates("induction");
|
||||
AddToIconListWithoutDuplicates("induction_number");
|
||||
AddToIconListWithoutDuplicates("destroy");
|
||||
AddToIconListWithoutDuplicates("killer");
|
||||
AddToIconListWithoutDuplicates("drain");
|
||||
AddToIconListWithoutDuplicates("geton");
|
||||
}
|
||||
|
||||
private void AddToIconListWithoutDuplicates(string key)
|
||||
{
|
||||
if (skillIconList.Any((SkillIcon c) => c._key == key) && !skillIconListWithoutDuplicates.Any((SkillIcon c) => c._key == key))
|
||||
{
|
||||
SkillIcon skillIcon = skillIconList.SingleOrDefault((SkillIcon c) => c._key == key && c._iconSpriteName != null);
|
||||
skillIconListWithoutDuplicates.Add(new SkillIcon(key, skillIcon._iconSpriteName, skillIcon.LabelNumber));
|
||||
}
|
||||
}
|
||||
|
||||
public VfxBase ShowIcon()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
cardTemplate.SkillIconTemp.gameObject.SetActive(value: true);
|
||||
});
|
||||
}
|
||||
|
||||
public VfxBase HideIcon()
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
cardTemplate.SkillIconTemp.gameObject.SetActive(value: false);
|
||||
});
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (cardTemplate != null)
|
||||
{
|
||||
if (cardTemplate.SkillIconTemp.gameObject.activeSelf)
|
||||
{
|
||||
SkillIconAlphaBlend();
|
||||
}
|
||||
else
|
||||
{
|
||||
cardTemplate.SkillIconTemp.alpha = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddSkillIcon(string key, string fileName, int labelNumber = -1)
|
||||
{
|
||||
string iconSpriteName = ((!skillIconList.Any((SkillIcon v) => v._key == key)) ? fileName : null);
|
||||
skillIconList.Add(new SkillIcon(key, iconSpriteName, labelNumber));
|
||||
skillIconListWithoutDuplicates = skillIconList.Where((SkillIcon v) => v._iconSpriteName != null).ToList();
|
||||
}
|
||||
|
||||
public void DeleteSkillIcon(string key)
|
||||
{
|
||||
if (skillIconList.Any((SkillIcon v) => v._key == key))
|
||||
{
|
||||
skillIconList.Remove(skillIconList.Where((SkillIcon v) => v._key == key).Last());
|
||||
}
|
||||
skillIconListWithoutDuplicates = skillIconList.Where((SkillIcon v) => v._iconSpriteName != null).ToList();
|
||||
if (skillIconListWithoutDuplicates.Count == 0)
|
||||
{
|
||||
cardTemplate.SkillIconTemp.spriteName = string.Empty;
|
||||
cardTemplate.SkillIconLabelTemp.text = string.Empty;
|
||||
}
|
||||
ChangeTexture();
|
||||
}
|
||||
|
||||
public void DeleteUnneededSkillIcons()
|
||||
{
|
||||
RemoveSkillIconFromList("white_ritual", () => !IsEarthRiteField());
|
||||
RemoveSkillIconFromList("induction", () => !HasInductionSkill());
|
||||
RemoveSkillIconFromList("induction_number", () => !HasInductionNumberSkill());
|
||||
RemoveSkillIconFromList("destroy", () => !HasWhenDestroySkill());
|
||||
}
|
||||
|
||||
private void RemoveSkillIconFromList(string key, Func<bool> deleteCondition)
|
||||
{
|
||||
if (deleteCondition())
|
||||
{
|
||||
DeleteSkillIcon(key);
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeTexture()
|
||||
{
|
||||
if (skillIconListWithoutDuplicates.Count() - 1 > skillCount)
|
||||
{
|
||||
skillCount++;
|
||||
cardTemplate.SkillIconTemp.spriteName = skillIconListWithoutDuplicates[skillCount]._iconSpriteName;
|
||||
ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates[skillCount].LabelNumber);
|
||||
}
|
||||
else if (skillIconListWithoutDuplicates.Count() != 0)
|
||||
{
|
||||
skillCount = 0;
|
||||
cardTemplate.SkillIconTemp.spriteName = skillIconListWithoutDuplicates[skillCount]._iconSpriteName;
|
||||
ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates[skillCount].LabelNumber);
|
||||
}
|
||||
UpdateSkillIconLabelColor();
|
||||
}
|
||||
|
||||
private void UpdateSkillIconLabelColor()
|
||||
{
|
||||
if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_11")
|
||||
{
|
||||
cardTemplate.SkillIconLabelTemp.color = Color.white;
|
||||
cardTemplate.SkillIconLabelTemp.effectColor = Color.black;
|
||||
}
|
||||
else if (cardTemplate.SkillIconTemp.spriteName == "battle_notice_status_04")
|
||||
{
|
||||
cardTemplate.SkillIconLabelTemp.color = Color.black;
|
||||
cardTemplate.SkillIconLabelTemp.effectColor = Color.white;
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangeSkillIconLabel(UILabel label, int labelNumber)
|
||||
{
|
||||
if (labelNumber == -1)
|
||||
{
|
||||
label.text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
label.text = labelNumber.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearAllSkillIcons()
|
||||
{
|
||||
skillIconList.Clear();
|
||||
skillIconListWithoutDuplicates.Clear();
|
||||
}
|
||||
|
||||
private void SkillIconAlphaBlend()
|
||||
{
|
||||
bool flag = cardTemplate.SkillIconLabelTemp.text.IsNotNullOrEmpty();
|
||||
if (skillIconListWithoutDuplicates.Count > 1)
|
||||
{
|
||||
if (skillIconAlphaFlg)
|
||||
{
|
||||
cardTemplate.SkillIconTemp.alpha += (flag ? (0.6f * Time.deltaTime * 2f) : (0.6f * Time.deltaTime));
|
||||
}
|
||||
else
|
||||
{
|
||||
cardTemplate.SkillIconTemp.alpha -= (flag ? (0.6f * Time.deltaTime * 2f) : (0.6f * Time.deltaTime));
|
||||
}
|
||||
}
|
||||
else if (cardTemplate.SkillIconTemp.spriteName == string.Empty)
|
||||
{
|
||||
cardTemplate.SkillIconTemp.alpha = 1f;
|
||||
if (skillIconListWithoutDuplicates.Count > 0)
|
||||
{
|
||||
if (cardTemplate.SkillIconTemp.spriteName != skillIconListWithoutDuplicates[0]._iconSpriteName)
|
||||
{
|
||||
cardTemplate.SkillIconTemp.spriteName = skillIconListWithoutDuplicates[0]._iconSpriteName;
|
||||
}
|
||||
ChangeSkillIconLabel(cardTemplate.SkillIconLabelTemp, skillIconListWithoutDuplicates[0].LabelNumber);
|
||||
UpdateSkillIconLabelColor();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cardTemplate.SkillIconTemp.alpha = 1f;
|
||||
}
|
||||
if (skillIconAlphaFlg && cardTemplate.SkillIconTemp.alpha >= (flag ? 2f : 1f))
|
||||
{
|
||||
skillIconAlphaFlg = false;
|
||||
}
|
||||
else if (!skillIconAlphaFlg && cardTemplate.SkillIconTemp.alpha <= 0f)
|
||||
{
|
||||
ChangeTexture();
|
||||
skillIconAlphaFlg = true;
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasWhenDestroySkill()
|
||||
{
|
||||
return collection._skillTimingInfo.IsWhenDestroy;
|
||||
}
|
||||
|
||||
public bool HasInductionSkill()
|
||||
{
|
||||
for (int i = 0; i < collection.Count(); i++)
|
||||
{
|
||||
SkillBase skillBase = collection.ElementAt(i);
|
||||
if (skillBase.IsInductionSkill && skillBase.SkillPrm.buildInfo._icon == "induction")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool HasStackWhiteRitualSkill()
|
||||
{
|
||||
return collection.Any((SkillBase x) => x is Skill_stack_white_ritual);
|
||||
}
|
||||
|
||||
public bool HasGetonSkill()
|
||||
{
|
||||
return collection.Any((SkillBase x) => x is Skill_geton);
|
||||
}
|
||||
|
||||
public bool HasInductionNumberSkill()
|
||||
{
|
||||
for (int i = 0; i < collection.Count(); i++)
|
||||
{
|
||||
SkillBase skillBase = collection.ElementAt(i);
|
||||
if (skillBase.IsInductionSkill && skillBase.SkillPrm.buildInfo._icon != "induction" && skillBase.SkillPrm.buildInfo._icon.Contains("induction"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int GetInductionLabelNumber()
|
||||
{
|
||||
if (_inductionLabelNumber != -1)
|
||||
{
|
||||
return _inductionLabelNumber;
|
||||
}
|
||||
SkillBase skillBase = collection.FirstOrDefault((SkillBase s) => s.IsInductionSkill && s.SkillPrm.buildInfo._icon != "induction" && s.SkillPrm.buildInfo._icon.Contains("induction"));
|
||||
if (skillBase == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
SkillOptionValue skillOptionValue = new SkillOptionValue(skillBase.SkillPrm.buildInfo._icon);
|
||||
skillOptionValue.SetupFilterVariable(BattleManagerBase.GetIns().GetBattlePlayerInfoPair(_card.IsPlayer), _card, isPrePlay: false, null);
|
||||
return skillOptionValue.GetInt(SkillFilterCreator.ContentKeyword.induction);
|
||||
}
|
||||
|
||||
private bool IsEarthRiteField()
|
||||
{
|
||||
if (_card.IsField || _card.IsChantField)
|
||||
{
|
||||
return _card.IsTribe(CardBasePrm.TribeType.WHITE_RITUAL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public VfxBase UpdateSkillIconInReplay(List<NetworkBattleReceiver.InplaySkillEffect> inplaySkillEffectList, int inductionNumber, bool isInitialize, bool isStackWhiteRitual = false)
|
||||
{
|
||||
if (!isInitialize && _card.HasStackWhiteRitualAndOtherIconSkill() && skillIconListWithoutDuplicates.Count < 2)
|
||||
{
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
_inductionLabelNumber = inductionNumber;
|
||||
bool hasWhiteRitualSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.WhiteRitual);
|
||||
bool hasWhiteRirualStackSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.StackWhiteRitual);
|
||||
bool hasInductionSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Induction);
|
||||
bool hasInductionNumberSkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.InductionNumber);
|
||||
bool hasKiller = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Killer);
|
||||
bool hasDrain = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Drain);
|
||||
bool hasWhenDestroySkill = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Destroy);
|
||||
bool hasGeton = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.Geton);
|
||||
bool hasGetonAfter = inplaySkillEffectList.Contains(NetworkBattleReceiver.InplaySkillEffect.GetonAfter);
|
||||
int whiteRitualCount = _card.SkillApplyInformation.WhiteRitualCount;
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
if (skillIconList.Count == 0 || isInitialize)
|
||||
{
|
||||
InitializeIcon(hasWhiteRitualSkill, hasWhiteRirualStackSkill, whiteRitualCount, hasInductionSkill, hasInductionNumberSkill, hasKiller, hasDrain, hasWhenDestroySkill, hasGeton, hasGetonAfter, isReplay: true, isStackWhiteRitual);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateSkillIcon("white_ritual", "battle_notice_status_08", hasWhiteRitualSkill);
|
||||
UpdateSkillIcon("stack_white_ritual", "battle_notice_status_11", hasWhiteRirualStackSkill, whiteRitualCount);
|
||||
UpdateSkillIcon("induction", "battle_notice_status_04", hasInductionSkill);
|
||||
UpdateSkillIcon("induction_number", "battle_notice_status_04", hasInductionNumberSkill, GetInductionLabelNumber());
|
||||
UpdateSkillIcon("killer", "battle_notice_status_01", hasKiller);
|
||||
UpdateSkillIcon("drain", "battle_notice_status_07", hasDrain);
|
||||
UpdateSkillIcon("destroy", "battle_notice_status_06", hasWhenDestroySkill);
|
||||
UpdateSkillIcon("geton", "battle_notice_status_09", hasGeton);
|
||||
UpdateSkillIcon("geton_after", "battle_notice_status_10", hasGetonAfter);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateSkillIcon(string key, string spriteName, bool hasIcon, int labelNumber = -1)
|
||||
{
|
||||
if (hasIcon && !skillIconList.Any((SkillIcon v) => v._key == key))
|
||||
{
|
||||
AddToIconList(key, spriteName, hasIcon, labelNumber);
|
||||
}
|
||||
else if (!hasIcon && skillIconList.Any((SkillIcon v) => v._key == key))
|
||||
{
|
||||
DeleteSkillIcon(key);
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteSkillIcons()
|
||||
{
|
||||
if (!(cardTemplate == null))
|
||||
{
|
||||
DeleteSkillIcon("white_ritual");
|
||||
DeleteSkillIcon("stack_white_ritual");
|
||||
DeleteSkillIcon("induction");
|
||||
DeleteSkillIcon("induction_number");
|
||||
DeleteSkillIcon("destroy");
|
||||
DeleteSkillIcon("killer");
|
||||
DeleteSkillIcon("drain");
|
||||
DeleteSkillIcon("geton");
|
||||
}
|
||||
}
|
||||
|
||||
public int GetIconListCount()
|
||||
{
|
||||
return skillIconListWithoutDuplicates.Count;
|
||||
}
|
||||
}
|
||||
52
SVSim.BattleEngine/Engine/BattleCoroutine.cs
Normal file
52
SVSim.BattleEngine/Engine/BattleCoroutine.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class BattleCoroutine
|
||||
{
|
||||
private static BattleCoroutine m_instance;
|
||||
|
||||
private static MonoBehaviour _coroutineObject;
|
||||
|
||||
public static BattleCoroutine GetInstance()
|
||||
{
|
||||
if (m_instance == null)
|
||||
{
|
||||
m_instance = new BattleCoroutine();
|
||||
}
|
||||
if (_coroutineObject == null)
|
||||
{
|
||||
GameObject gameObject = Object.Instantiate(Resources.Load("Prefab/Game/_BattleCoroutine")) as GameObject;
|
||||
if (null != gameObject)
|
||||
{
|
||||
_coroutineObject = gameObject.GetComponent<MonoBehaviour>();
|
||||
}
|
||||
}
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
public Coroutine StartCoroutine(IEnumerator enumerator)
|
||||
{
|
||||
return _coroutineObject.StartCoroutine(enumerator);
|
||||
}
|
||||
|
||||
public void StopAllCoroutines()
|
||||
{
|
||||
_coroutineObject.StopAllCoroutines();
|
||||
}
|
||||
|
||||
public void StopCoroutine(IEnumerator enumerator)
|
||||
{
|
||||
if (enumerator != null)
|
||||
{
|
||||
_coroutineObject.StopCoroutine(enumerator);
|
||||
}
|
||||
}
|
||||
|
||||
public void StopCoroutine(Coroutine enumerator)
|
||||
{
|
||||
if (enumerator != null)
|
||||
{
|
||||
_coroutineObject.StopCoroutine(enumerator);
|
||||
}
|
||||
}
|
||||
}
|
||||
49
SVSim.BattleEngine/Engine/BattleFinishSendBase.cs
Normal file
49
SVSim.BattleEngine/Engine/BattleFinishSendBase.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using Cute;
|
||||
using Wizard;
|
||||
|
||||
public class BattleFinishSendBase
|
||||
{
|
||||
private FinishTaskBase _finishTaskBase;
|
||||
|
||||
private Action<NetworkTask.ResultCode> _onSuccess;
|
||||
|
||||
private NetworkManager _networkManager;
|
||||
|
||||
private BattleManagerBase _battleMgr;
|
||||
|
||||
public BattleFinishSendBase(BattleManagerBase mgr)
|
||||
{
|
||||
_networkManager = Toolbox.NetworkManager;
|
||||
_battleMgr = mgr;
|
||||
}
|
||||
|
||||
public void SendMatchingFinish(FinishTaskBase finishTaskBase, Action<NetworkTask.ResultCode> callbackOnSuccess)
|
||||
{
|
||||
_finishTaskBase = finishTaskBase;
|
||||
SettingFinishBattleParameter(finishTaskBase);
|
||||
_onSuccess = callbackOnSuccess;
|
||||
StartMatchingFinish();
|
||||
}
|
||||
|
||||
private void StartMatchingFinish()
|
||||
{
|
||||
LocalLog.AccumulateLastTraceLog("StartMatchingFinish");
|
||||
BattleCoroutine.GetInstance().StartCoroutine(_networkManager.Connect(_finishTaskBase, _onSuccess, CallbackOnFailure, null, encrypt: true, useJson: false, showLoadingIcon: false));
|
||||
}
|
||||
|
||||
public void CallbackOnFailure(NetworkTask.ResultCode result)
|
||||
{
|
||||
LocalLog.AccumulateTraceLog("CallbackOnFailure" + result);
|
||||
}
|
||||
|
||||
private void SettingFinishBattleParameter(FinishTaskBase data)
|
||||
{
|
||||
int cumulativeEvolutionCount = _battleMgr.BattlePlayer._cumulativeEvolutionCount;
|
||||
int cumulativeEvolutionCount2 = _battleMgr.BattleEnemy._cumulativeEvolutionCount;
|
||||
int battle_result = ((!_battleMgr.BattlePlayer.Class.IsDead) ? 1 : 0);
|
||||
int is_retire = (_battleMgr.IsPlayerRetire ? 1 : 0);
|
||||
DataMgr dataMgr = GameMgr.GetIns().GetDataMgr();
|
||||
data.SettingFinishBattleParameter(dataMgr.GetPlayerClassId(), _battleMgr.BattlePlayer.Turn, cumulativeEvolutionCount, cumulativeEvolutionCount2, battle_result, is_retire);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using Cute;
|
||||
using Wizard;
|
||||
|
||||
public class BattleFinishToOpponentDisConnectChecker : NetworkBattleIntervalCheckerBase
|
||||
{
|
||||
private NetworkBattleManagerBase networkBattleManager;
|
||||
|
||||
private DialogBase BattleFinishWaitDialog;
|
||||
|
||||
private SystemText _systemText;
|
||||
|
||||
private int _dispScene;
|
||||
|
||||
private const int WINDOW_DISP_WAIT = 0;
|
||||
|
||||
private const int WINDOW_UPDATE = 1;
|
||||
|
||||
private const int FINISH_SEND_WAIT = 2;
|
||||
|
||||
private const int FINISH_OPPONENT_DISCONNECT_INTERVAL = 8;
|
||||
|
||||
private const int FINISH_OPPONENT_DISP_COUNTER_INTERVAL = 98;
|
||||
|
||||
private const int FINISH_BATTLE_SEND_INTERVAL = 128;
|
||||
|
||||
private bool _isDisconnect;
|
||||
|
||||
public bool IsStart { get; private set; }
|
||||
|
||||
public event Action OnDisConnectWin;
|
||||
|
||||
public BattleFinishToOpponentDisConnectChecker(NetworkBattleManagerBase manager)
|
||||
{
|
||||
networkBattleManager = manager;
|
||||
_systemText = Data.SystemText;
|
||||
}
|
||||
|
||||
public override void StartChecker(string log = "")
|
||||
{
|
||||
if (BattleFinishWaitDialog == null)
|
||||
{
|
||||
LocalLog.AccumulateTraceLog("#6911825CreateBattleFinishWaitDialog" + log);
|
||||
}
|
||||
base.StartChecker();
|
||||
IsStart = true;
|
||||
CreateBattleFinishWaitDialog();
|
||||
BattleFinishWaitDialog.SetActive(inActive: false);
|
||||
UIManager.GetInstance().closeInSceneNotNetwork();
|
||||
}
|
||||
|
||||
public override void StopChecker()
|
||||
{
|
||||
base.StopChecker();
|
||||
if (BattleFinishWaitDialog != null)
|
||||
{
|
||||
BattleFinishWaitDialog.Close();
|
||||
LocalLog.AccumulateTraceLog("#691182DialogCloseStopChecker");
|
||||
}
|
||||
UIManager.GetInstance().closeInSceneNotNetwork();
|
||||
}
|
||||
|
||||
protected override void IntervalCheck()
|
||||
{
|
||||
base.IntervalCheck();
|
||||
switch (_dispScene)
|
||||
{
|
||||
case 0:
|
||||
if (!networkBattleManager.VfxMgr.IsEnd)
|
||||
{
|
||||
InitTimer();
|
||||
}
|
||||
else if (NetworkUtility.GetTimeSpanSecond(base.startTick) >= 8)
|
||||
{
|
||||
if (networkBattleManager.disconnectToLoseChecker.IsDisconnect())
|
||||
{
|
||||
ShowDisconnectAlert();
|
||||
}
|
||||
_dispScene++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (networkBattleManager.disconnectToLoseChecker.IsDisconnect())
|
||||
{
|
||||
ShowDisconnectAlert();
|
||||
break;
|
||||
}
|
||||
ShowBattleFinishWaitDialog();
|
||||
if (NetworkUtility.GetTimeSpanSecond(base.startTick) <= 98)
|
||||
{
|
||||
int num = 98 - NetworkUtility.GetTimeSpanSecond(base.startTick);
|
||||
BattleFinishWaitDialog.SetText(_systemText.Get("Battle_0425", num.ToString() ?? ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
BattleFinishWaitDialog.SetText(_systemText.Get("Battle_0426"));
|
||||
_dispScene++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (NetworkUtility.GetTimeSpanSecond(base.startTick) >= 128)
|
||||
{
|
||||
BattleFinishWaitDialog.Close();
|
||||
LocalLog.AccumulateTraceLog("#691182DialogClose");
|
||||
this.OnDisConnectWin.Call();
|
||||
StopChecker();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowDisconnectAlert()
|
||||
{
|
||||
BattleFinishWaitDialog.SetActive(inActive: false);
|
||||
if (!_isDisconnect)
|
||||
{
|
||||
_isDisconnect = true;
|
||||
UIManager.GetInstance().closeInSceneNotNetwork();
|
||||
BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.ShowAlert(PanelMgr.BattleAlertType.DisconnectInfomation, isClass: false);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowBattleFinishWaitDialog()
|
||||
{
|
||||
if (!BattleFinishWaitDialog.gameObject.activeSelf)
|
||||
{
|
||||
LocalLog.AccumulateTraceLog("#691182ShowBattleFinishWaitDialog");
|
||||
}
|
||||
BattleFinishWaitDialog.SetActive(inActive: true);
|
||||
if (_isDisconnect)
|
||||
{
|
||||
_isDisconnect = false;
|
||||
UIManager.GetInstance().createInSceneNotNetwork();
|
||||
BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.OffNotHideAndNotCreate();
|
||||
BattleManagerBase.GetIns().BattlePlayer.PlayerBattleView.HideAlertDialogue();
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateBattleFinishWaitDialog()
|
||||
{
|
||||
UIManager.GetInstance().closeInSceneNotNetwork();
|
||||
UIManager.GetInstance().createInSceneNotNetwork();
|
||||
BattleFinishWaitDialog = UIManager.GetInstance().CreateDialogClose();
|
||||
BattleFinishWaitDialog.SetTitleLabel(Data.SystemText.Get("Battle_0423"));
|
||||
BattleFinishWaitDialog.SetButtonLayout(DialogBase.ButtonLayout.NONE);
|
||||
BattleFinishWaitDialog.SetFadeButtonEnabled(flag: false);
|
||||
BattleFinishWaitDialog.SetPanelDepth(5000);
|
||||
}
|
||||
}
|
||||
423
SVSim.BattleEngine/Engine/BattleKeywordInfoListMgr.cs
Normal file
423
SVSim.BattleEngine/Engine/BattleKeywordInfoListMgr.cs
Normal file
@@ -0,0 +1,423 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Battle.View;
|
||||
|
||||
public class BattleKeywordInfoListMgr : MonoBehaviour
|
||||
{
|
||||
private const string KEYWORD = "KEYWORD";
|
||||
|
||||
private static readonly string[] KEYWORD_PATTERNS = new string[2] { "\\[u\\]\\[(ffcd45|524522)\\](?<KEYWORD>.*?)\\[-\\]\\[/u\\]", "\\[b\\](?<KEYWORD>.*?)\\[/b\\]" };
|
||||
|
||||
private static readonly string KEYWORD_TITLE_REMOVE_PATTERN = "<<\\{me.hand_self.count\\}\\+\\d\\?\\?>>";
|
||||
|
||||
private const int LABEL_KEYWORD = 0;
|
||||
|
||||
private const int LABEL_DESC = 1;
|
||||
|
||||
private const int LINE_SPRITE = 0;
|
||||
|
||||
private const int PADDING_OBJECT = 1;
|
||||
|
||||
private const int LINE_SPRITE_OFFSET = -12;
|
||||
|
||||
private const int CLASS_EFFECT_TABLE_PADDING_Y = 30;
|
||||
|
||||
private const int CLASS_EFFECT_FONT_SIZE = 21;
|
||||
|
||||
[SerializeField]
|
||||
public UIScrollView ScrollView;
|
||||
|
||||
[SerializeField]
|
||||
private NguiObjs SkillInfo;
|
||||
|
||||
[SerializeField]
|
||||
public UITable _table;
|
||||
|
||||
[SerializeField]
|
||||
private UIPanel _panel;
|
||||
|
||||
private IList<NguiObjs> SkillInfoList = new List<NguiObjs>();
|
||||
|
||||
private Action ResetTableFinishAction;
|
||||
|
||||
public static IList<string> GetKeywords(CardParameter cardParameter)
|
||||
{
|
||||
return GetKeywords(cardParameter.SkillDescription + cardParameter.EvoSkillDescription);
|
||||
}
|
||||
|
||||
public static IList<string> GetKeywords(string skillDescription)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
for (int i = 0; i < KEYWORD_PATTERNS.Length; i++)
|
||||
{
|
||||
foreach (Match item in Regex.Matches(skillDescription, KEYWORD_PATTERNS[i]))
|
||||
{
|
||||
string value = item.Groups["KEYWORD"].Value;
|
||||
if (!list.Contains(value))
|
||||
{
|
||||
list.Add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void SetKeywordInfos(IList<string> currentWords, CardMaster.CardMasterId cardMasterId)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
for (int i = 0; i < currentWords.Count; i++)
|
||||
{
|
||||
string keywordTitle = string.Empty;
|
||||
string skillinfo = string.Empty;
|
||||
string text = currentWords[i];
|
||||
string valueOrDefault = Data.Master.BattleKeywordReplaceDic.GetValueOrDefault(text, text);
|
||||
if (GetKeywordData(valueOrDefault, cardMasterId, out keywordTitle, out skillinfo) && !list.Contains(keywordTitle))
|
||||
{
|
||||
AddKeywordInfo(keywordTitle, skillinfo, LabelDefine.TEXT_COLOR_KEYWORD, cardMasterId);
|
||||
list.Add(keywordTitle);
|
||||
}
|
||||
}
|
||||
StartCoroutine(RepositionTable());
|
||||
}
|
||||
|
||||
public void SetBuffInfos(List<int> baseCardID, List<string> buff)
|
||||
{
|
||||
string empty = string.Empty;
|
||||
for (int i = 0; i < baseCardID.Count; i++)
|
||||
{
|
||||
empty = ((CardMaster.GetInstanceForBattle().GetCardParameterFromId(baseCardID[i]).CardName != null && !(CardMaster.GetInstanceForBattle().GetCardParameterFromId(baseCardID[i]).CardName == string.Empty)) ? CardMaster.GetInstanceForBattle().GetCardParameterFromId(baseCardID[i]).CardName : Data.SystemText.Get("BattleLog_0097"));
|
||||
AddKeywordInfo(empty, buff[i], LabelDefine.TEXT_COLOR_NORMAL, CardMaster.BatttleCardMasterId);
|
||||
}
|
||||
StartCoroutine(RepositionTable());
|
||||
}
|
||||
|
||||
public IEnumerator RepositionTable()
|
||||
{
|
||||
yield return null;
|
||||
_table.Reposition();
|
||||
ScrollView.verticalScrollBar.value = 0f;
|
||||
ScrollView.ResetPosition();
|
||||
if (ResetTableFinishAction != null)
|
||||
{
|
||||
ResetTableFinishAction();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddKeywordInfo(string keyword, string desc, Color32 keywordColor, CardMaster.CardMasterId cardMasterId, bool isClassEffect = false, Action onClickCardName = null, bool isKeyWordDisp = true)
|
||||
{
|
||||
NguiObjs nguiObjs = UnityEngine.Object.Instantiate(SkillInfo);
|
||||
keyword = Regex.Replace(keyword, KEYWORD_TITLE_REMOVE_PATTERN, "");
|
||||
if (isClassEffect)
|
||||
{
|
||||
nguiObjs.labels[0].fontSize = 21;
|
||||
nguiObjs.labels[1].fontSize = 21;
|
||||
}
|
||||
nguiObjs.transform.parent = _table.transform;
|
||||
nguiObjs.labels[0].text = keyword;
|
||||
nguiObjs.labels[0].color = keywordColor;
|
||||
nguiObjs.labels[1].SetWrapText(desc);
|
||||
nguiObjs.transform.localScale = new Vector3(1f, 1f, 1f);
|
||||
nguiObjs.gameObject.name = SkillInfoList.Count.ToString();
|
||||
nguiObjs.gameObject.SetActive(value: true);
|
||||
if (isClassEffect)
|
||||
{
|
||||
GameObject gameObject = new GameObject("paddingObject");
|
||||
gameObject.transform.SetParent(nguiObjs.labels[0].gameObject.transform);
|
||||
gameObject.transform.localPosition = Vector3.zero;
|
||||
gameObject.transform.localScale = Vector3.one;
|
||||
UISprite uISprite = gameObject.AddComponent<UISprite>();
|
||||
uISprite.alpha = 0f;
|
||||
uISprite.height = 30;
|
||||
gameObject.transform.localPosition = new Vector3(nguiObjs.labels[0].width / 2, gameObject.transform.localPosition.y);
|
||||
nguiObjs.objs.Add(gameObject);
|
||||
if (SkillInfoList.Count == 0)
|
||||
{
|
||||
gameObject.SetActive(value: false);
|
||||
}
|
||||
BoxCollider boxCollider = nguiObjs.labels[1].gameObject.AddComponent<BoxCollider>();
|
||||
boxCollider.size = new Vector3(nguiObjs.labels[1].width, nguiObjs.labels[1].height);
|
||||
boxCollider.center = new Vector3(nguiObjs.labels[1].width / 2, -nguiObjs.labels[1].height / 2);
|
||||
List<string> keyWordList = BattlePlayerView.GetKeyWordList(nguiObjs.labels[1].text);
|
||||
UIEventListener uIEventListener = UIEventListener.Get(nguiObjs.labels[1].gameObject);
|
||||
uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
if (keyWordList.Count == 0)
|
||||
{
|
||||
onClickCardName();
|
||||
}
|
||||
else
|
||||
{
|
||||
BattlePlayerView.CreateClassEffectPanel(keyWordList, cardMasterId);
|
||||
}
|
||||
});
|
||||
BattlePlayerView.SetKeyWordColor(nguiObjs.labels[1].gameObject, nguiObjs.labels[1]);
|
||||
BoxCollider boxCollider2 = nguiObjs.labels[0].gameObject.AddComponent<BoxCollider>();
|
||||
boxCollider2.size = new Vector3(nguiObjs.labels[0].width, nguiObjs.labels[0].height);
|
||||
boxCollider2.center = new Vector3(nguiObjs.labels[0].width / 2, -nguiObjs.labels[0].height / 2);
|
||||
BattlePlayerView.SetLabelColorEvent(nguiObjs.labels[0]);
|
||||
UIEventListener uIEventListener2 = UIEventListener.Get(nguiObjs.labels[0].gameObject);
|
||||
uIEventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
onClickCardName();
|
||||
});
|
||||
if (!isKeyWordDisp)
|
||||
{
|
||||
nguiObjs.labels[0].gameObject.SetActive(value: false);
|
||||
nguiObjs.labels[1].transform.localPosition = new Vector3(nguiObjs.labels[1].transform.localPosition.x, nguiObjs.labels[0].transform.localPosition.y);
|
||||
SkillInfoList[SkillInfoList.Count - 1].objs[0].SetActive(value: false);
|
||||
}
|
||||
boxCollider.gameObject.AddComponent<UIDragScrollView>().scrollView = ScrollView;
|
||||
boxCollider2.gameObject.AddComponent<UIDragScrollView>().scrollView = ScrollView;
|
||||
UILabel uILabel = nguiObjs.labels[1];
|
||||
uILabel.topAnchor.target = null;
|
||||
uILabel.bottomAnchor.target = null;
|
||||
uILabel.leftAnchor.target = null;
|
||||
uILabel.rightAnchor.target = null;
|
||||
UISprite component = nguiObjs.objs[0].GetComponent<UISprite>();
|
||||
component.topAnchor.target = null;
|
||||
component.bottomAnchor.target = null;
|
||||
component.leftAnchor.target = null;
|
||||
component.rightAnchor.target = null;
|
||||
component.transform.localPosition = new Vector3(component.transform.localPosition.x, uILabel.transform.localPosition.y - (float)uILabel.height + -12f);
|
||||
}
|
||||
SkillInfoList.Add(nguiObjs);
|
||||
}
|
||||
|
||||
public void RemoveKeyWord(int index)
|
||||
{
|
||||
bool activeSelf = SkillInfoList[index].labels[0].gameObject.activeSelf;
|
||||
UnityEngine.Object.Destroy(SkillInfoList[index].gameObject);
|
||||
if (SkillInfoList.Count > index + 1)
|
||||
{
|
||||
if (!SkillInfoList[index + 1].labels[0].gameObject.activeSelf)
|
||||
{
|
||||
Vector3 localPosition = SkillInfoList[index + 1].labels[1].transform.localPosition;
|
||||
if (activeSelf)
|
||||
{
|
||||
SkillInfoList[index + 1].labels[0].gameObject.SetActive(value: true);
|
||||
}
|
||||
SkillInfoList[index + 1].labels[1].transform.localPosition = new Vector3(localPosition.x, SkillInfoList[index + 1].labels[0].transform.localPosition.y - (float)SkillInfoList[index + 1].labels[0].height);
|
||||
SkillInfoList[index + 1].objs[0].transform.localPosition = new Vector3(SkillInfoList[index + 1].objs[0].transform.localPosition.x, -72 - SkillInfoList[index + 1].labels[1].height + -12);
|
||||
}
|
||||
}
|
||||
else if (index - 1 > 0)
|
||||
{
|
||||
bool flag = false;
|
||||
bool flag2 = false;
|
||||
if (SkillInfoList[index - 1].labels[0].gameObject.activeSelf)
|
||||
{
|
||||
flag = true;
|
||||
if (index + 1 < SkillInfoList.Count && !SkillInfoList[index + 1].labels[0].gameObject.activeSelf)
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
if (flag && !flag2)
|
||||
{
|
||||
SkillInfoList[index - 1].objs[0].SetActive(value: true);
|
||||
}
|
||||
}
|
||||
SkillInfoList.RemoveAt(index);
|
||||
if (SkillInfoList.Count != 0)
|
||||
{
|
||||
SkillInfoList[0].objs[1].SetActive(value: false);
|
||||
}
|
||||
if (base.gameObject.activeInHierarchy)
|
||||
{
|
||||
StartCoroutine(RepositionTable());
|
||||
}
|
||||
}
|
||||
|
||||
public void AddKeywordInfo(BattleCardBase card, string keyword, string desc, Color32 keywordColor)
|
||||
{
|
||||
NguiObjs nguiObjs = UnityEngine.Object.Instantiate(SkillInfo);
|
||||
nguiObjs.transform.parent = _table.transform;
|
||||
nguiObjs.labels[0].text = keyword;
|
||||
nguiObjs.labels[0].color = keywordColor;
|
||||
nguiObjs.labels[1].SetWrapText(desc);
|
||||
nguiObjs.transform.localScale = new Vector3(1f, 1f, 1f);
|
||||
nguiObjs.gameObject.name = SkillInfoList.Count.ToString();
|
||||
nguiObjs.gameObject.SetActive(value: true);
|
||||
UIRect[] componentsInChildren = nguiObjs.gameObject.GetComponentsInChildren<UIRect>();
|
||||
for (int i = 0; i < componentsInChildren.Length; i++)
|
||||
{
|
||||
componentsInChildren[i].ResetAndUpdateAnchors();
|
||||
}
|
||||
SkillInfoList.Add(nguiObjs);
|
||||
}
|
||||
|
||||
public void SetScrollView(DialogBase dia)
|
||||
{
|
||||
UIPanel component = ScrollView.GetComponent<UIPanel>();
|
||||
GameObject gameObject = dia.WindowSprite.gameObject;
|
||||
GameObject gameObject2 = dia.titleLine.gameObject;
|
||||
component.topAnchor.target = gameObject2.transform;
|
||||
component.topAnchor.relative = 0f;
|
||||
component.topAnchor.absolute = -10;
|
||||
component.bottomAnchor.target = gameObject.transform;
|
||||
component.bottomAnchor.relative = 0f;
|
||||
component.bottomAnchor.absolute = 25;
|
||||
component.leftAnchor.target = gameObject.transform;
|
||||
component.leftAnchor.relative = 0f;
|
||||
component.leftAnchor.absolute = 25;
|
||||
component.rightAnchor.target = gameObject.transform;
|
||||
component.rightAnchor.relative = 1f;
|
||||
component.rightAnchor.absolute = -25;
|
||||
gameObject.GetComponent<UIDragScrollView>().scrollView = ScrollView;
|
||||
component.UpdateAnchors();
|
||||
}
|
||||
|
||||
private bool GetKeywordData(string skill, CardMaster.CardMasterId cardMasterId, out string keywordTitle, out string skillinfo)
|
||||
{
|
||||
keywordTitle = string.Empty;
|
||||
skillinfo = string.Empty;
|
||||
if (Data.Master.BattleKeyWordDic.ContainsKey(skill))
|
||||
{
|
||||
string skillToLower = skill.ToLower();
|
||||
KeyValuePair<string, string> keyValuePair = Data.Master.BattleKeyWordDic.First((KeyValuePair<string, string> data) => data.Key.ToLower() == skillToLower);
|
||||
keywordTitle = keyValuePair.Key;
|
||||
skillinfo = keyValuePair.Value;
|
||||
List<int> cardIdsInDesc = GetCardIdsInDesc(skillinfo);
|
||||
if (cardIdsInDesc.Count > 0)
|
||||
{
|
||||
skillinfo = string.Empty;
|
||||
for (int num = 0; num < cardIdsInDesc.Count; num++)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstance(cardMasterId).GetCardParameterFromId(cardIdsInDesc[num]);
|
||||
if (num > 0)
|
||||
{
|
||||
skillinfo += "\n";
|
||||
skillinfo += Data.SystemText.Get("Card_0198_BattleKeyWord_01", cardParameterFromId.CardName);
|
||||
skillinfo += "\n";
|
||||
}
|
||||
skillinfo += GetCardDescText(cardParameterFromId);
|
||||
}
|
||||
}
|
||||
skillinfo = skillinfo.Trim();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static string GetCardDescText(CardParameter param)
|
||||
{
|
||||
string empty = string.Empty;
|
||||
string clanNameByKey = GameMgr.GetIns().GetDataMgr().GetClanNameByKey((int)param.Clan);
|
||||
string cardTypeName = CardBasePrm.GetCardTypeName(param.CharType);
|
||||
empty = ((!(param.TribeName == "ALL")) ? (Data.SystemText.Get("Card_0200_BattleKeyWord_03", param.Cost.ToString(), clanNameByKey, param.TribeName, cardTypeName) + "\n") : (Data.SystemText.Get("Card_0199_BattleKeyWord_02", param.Cost.ToString(), clanNameByKey, cardTypeName) + "\n"));
|
||||
if (param.CharType == CardBasePrm.CharaType.NORMAL || param.CharType == CardBasePrm.CharaType.EVOLUTION)
|
||||
{
|
||||
if (!param.IsEvolveChoiceCard)
|
||||
{
|
||||
empty = empty + Data.SystemText.Get("Card_0201_BattleKeyWord_04", param.Atk.ToString(), param.Life.ToString()) + "\n";
|
||||
if (param.ConvertedSkillDescription != string.Empty)
|
||||
{
|
||||
empty = empty + ConvertKeywordsInText(param.ConvertedSkillDescription) + "\n";
|
||||
}
|
||||
}
|
||||
empty = empty + Data.SystemText.Get("Card_0202_BattleKeyWord_05") + "\n";
|
||||
empty = empty + Data.SystemText.Get("Card_0201_BattleKeyWord_04", param.EvoAtk.ToString(), param.EvoLife.ToString()) + "\n";
|
||||
if (param.ConvertedEvoSkillDescription != string.Empty)
|
||||
{
|
||||
empty = empty + ConvertKeywordsInText(param.ConvertedEvoSkillDescription) + "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
empty = empty + ConvertKeywordsInText(param.ConvertedSkillDescription) + "\n";
|
||||
}
|
||||
return empty;
|
||||
}
|
||||
|
||||
private static string ConvertKeywordsInText(string skilldisc)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
List<string> list2 = new List<string>();
|
||||
for (int i = 0; i < KEYWORD_PATTERNS.Length; i++)
|
||||
{
|
||||
foreach (Match item2 in Regex.Matches(skilldisc, KEYWORD_PATTERNS[i]))
|
||||
{
|
||||
string item = Regex.Escape(item2.Value);
|
||||
if (list.Contains(item))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string value = item2.Groups["KEYWORD"].Value;
|
||||
if (Data.Master.BattleKeyWordDic.ContainsKey(value))
|
||||
{
|
||||
List<int> cardIdsInDesc = GetCardIdsInDesc(Data.Master.BattleKeyWordDic[value]);
|
||||
list.Add(item);
|
||||
if (cardIdsInDesc.Count > 0)
|
||||
{
|
||||
list2.Add(Data.SystemText.Get("Card_0203_BattleKeyWord_06", value));
|
||||
}
|
||||
else
|
||||
{
|
||||
list2.Add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < list.Count; j++)
|
||||
{
|
||||
skilldisc = Regex.Replace(skilldisc, list[j], list2[j]);
|
||||
}
|
||||
return Global.ConvertToWithoutBBCode(skilldisc);
|
||||
}
|
||||
|
||||
public static List<int> GetCardIdsInDesc(string desc)
|
||||
{
|
||||
string text = "KEYWORD";
|
||||
string pattern = "\\[card\\](?<" + text + ">.*?)\\[/card\\]";
|
||||
List<int> list = new List<int>();
|
||||
foreach (Match item2 in Regex.Matches(desc, pattern))
|
||||
{
|
||||
int item = int.Parse(item2.Groups[text].Value);
|
||||
if (!list.Contains(item))
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<string> GetKeyWordNameList()
|
||||
{
|
||||
List<string> list = new List<string>(SkillInfoList.Count);
|
||||
for (int i = 0; i < SkillInfoList.Count; i++)
|
||||
{
|
||||
list.Add(SkillInfoList[i].labels[0].text);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public IList<NguiObjs> GetSkillInfoList()
|
||||
{
|
||||
return SkillInfoList;
|
||||
}
|
||||
|
||||
public float GetScrollViewSizeY()
|
||||
{
|
||||
return ScrollView.GetComponent<UIPanel>().GetViewSize().y;
|
||||
}
|
||||
|
||||
public void SetResetTableFinishAction(Action inAction)
|
||||
{
|
||||
ResetTableFinishAction = inAction;
|
||||
}
|
||||
|
||||
public void SetKeyWordFocus(float inScrollBarValue)
|
||||
{
|
||||
ScrollView.verticalScrollBar.value = inScrollBarValue;
|
||||
}
|
||||
|
||||
public void SetPanelDepth(int depth)
|
||||
{
|
||||
_panel.depth = depth;
|
||||
}
|
||||
}
|
||||
69
SVSim.BattleEngine/Engine/BattlePlayerVfxCreatorBase.cs
Normal file
69
SVSim.BattleEngine/Engine/BattlePlayerVfxCreatorBase.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class BattlePlayerVfxCreatorBase : IBattlePlayerVfxCreator
|
||||
{
|
||||
private readonly IBattlePlayerView m_battleView;
|
||||
|
||||
public BattlePlayerVfxCreatorBase(IBattlePlayerView battleView)
|
||||
{
|
||||
m_battleView = battleView;
|
||||
}
|
||||
|
||||
public VfxBase CreateUsePp(int pp, int maxPp, Vector3 labelPosition, bool newReplayMoveTurn)
|
||||
{
|
||||
if (newReplayMoveTurn)
|
||||
{
|
||||
return ParallelVfxPlayer.Create(InstantVfx.Create(delegate
|
||||
{
|
||||
m_battleView.StatusParentPanel.GetComponent<IStatusPanelControl>().SetPp(pp, maxPp, newReplayMoveTurn);
|
||||
}));
|
||||
}
|
||||
return ParallelVfxPlayer.Create(new LoadAndPlayEffectVfx("cmn_ui_cost_1", null, labelPosition, 0f), InstantVfx.Create(delegate
|
||||
{
|
||||
m_battleView.StatusParentPanel.GetComponent<IStatusPanelControl>().SetPp(pp, maxPp, newReplayMoveTurn);
|
||||
}));
|
||||
}
|
||||
|
||||
public VfxBase CreateUseBp(int bp, int deltaBp, Func<Vector3> getPosition, bool isVariableCost, bool isSelf)
|
||||
{
|
||||
if (BattleManagerBase.GetIns().IsRecovery || isVariableCost)
|
||||
{
|
||||
return ParallelVfxPlayer.Create(m_battleView.SetBp(bp));
|
||||
}
|
||||
string fileName = ((deltaBp < 0) ? "cmn_ui_hbp_2" : "cmn_ui_hbp_1");
|
||||
if (deltaBp < 0 && isSelf)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_HBP_UP);
|
||||
}
|
||||
return ParallelVfxPlayer.Create(new LoadAndPlayEffectVfx(fileName, null, getPosition, 0f, BattleManagerBase.GetIns().Battle3DContainer.layer), m_battleView.SetBp(bp));
|
||||
}
|
||||
|
||||
public VfxBase CreateUpdateEp(int evolCount, int evolveWaitTurnCount)
|
||||
{
|
||||
return new UpdateEpVfx(m_battleView, evolCount, evolveWaitTurnCount);
|
||||
}
|
||||
|
||||
public VfxBase CreateCardDraw(IEnumerable<BattleCardBase> cards, bool isOpenDrawSkill)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
foreach (BattleCardBase card in cards)
|
||||
{
|
||||
if (card.BaseCost != card.Cost)
|
||||
{
|
||||
List<int> costList = card.BattleCardView.GetUseCostList(card.Cost);
|
||||
bool isInHand = card.IsInHand;
|
||||
sequentialVfxPlayer.Register(InstantVfx.Create(delegate
|
||||
{
|
||||
card.BattleCardView.UpdateCost(costList, isGenerateInHand: true, playEffect: true, isInHand);
|
||||
}));
|
||||
}
|
||||
}
|
||||
sequentialVfxPlayer.Register(new PlayerDrawCardVfx(cards, isOpenDrawSkill));
|
||||
sequentialVfxPlayer.Register(new PlayerEndDrawVfx(cards));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
}
|
||||
36
SVSim.BattleEngine/Engine/BattleSettingBaseData.cs
Normal file
36
SVSim.BattleEngine/Engine/BattleSettingBaseData.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using LitJson;
|
||||
|
||||
public class BattleSettingBaseData
|
||||
{
|
||||
public int PlayerCharaId { get; }
|
||||
|
||||
public int EnemyCharaId { get; }
|
||||
|
||||
public int EnemyClassId { get; }
|
||||
|
||||
public int EnemyAiId { get; }
|
||||
|
||||
public int FieldId { get; }
|
||||
|
||||
public string BgmId { get; }
|
||||
|
||||
public BattleSettingBaseData(JsonData jsonData)
|
||||
{
|
||||
PlayerCharaId = jsonData["chara_id"].ToInt();
|
||||
EnemyCharaId = jsonData["enemy_chara_id"].ToInt();
|
||||
EnemyClassId = jsonData["enemy_class"].ToInt();
|
||||
EnemyAiId = jsonData["enemy_ai_id"].ToInt();
|
||||
FieldId = jsonData["battle3dfield_id"].ToInt();
|
||||
BgmId = GetBgmId(jsonData);
|
||||
}
|
||||
|
||||
private static string GetBgmId(JsonData jsonData)
|
||||
{
|
||||
string text = jsonData["bgm_id"].ToString();
|
||||
if (!(text == "0"))
|
||||
{
|
||||
return text;
|
||||
}
|
||||
return "NONE";
|
||||
}
|
||||
}
|
||||
157
SVSim.BattleEngine/Engine/BattleSettingData.cs
Normal file
157
SVSim.BattleEngine/Engine/BattleSettingData.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using LitJson;
|
||||
|
||||
public class BattleSettingData
|
||||
{
|
||||
public int DeckClassId { get; }
|
||||
|
||||
public int DeckSkinId { get; }
|
||||
|
||||
public int PlayerCharaId { get; }
|
||||
|
||||
public string PlayerEmotionId { get; }
|
||||
|
||||
public int EnemyCharaId { get; }
|
||||
|
||||
public string EnemyEmotionId { get; }
|
||||
|
||||
public int EnemyClassId { get; }
|
||||
|
||||
public int EnemyAiId { get; }
|
||||
|
||||
public int FieldId { get; }
|
||||
|
||||
public string BgmId { get; }
|
||||
|
||||
public BattleSettingData(JsonData jsonData, BattleSettingBaseData baseData)
|
||||
{
|
||||
DeckClassId = jsonData["deck_class_id"].ToInt();
|
||||
DeckSkinId = GetDeckSkinId(jsonData, DeckClassId);
|
||||
PlayerCharaId = GetPlayerCharaId(jsonData, baseData.PlayerCharaId, DeckClassId);
|
||||
PlayerEmotionId = GetPlayerEmotionId(jsonData, PlayerCharaId);
|
||||
EnemyCharaId = baseData.EnemyCharaId;
|
||||
EnemyEmotionId = GetEnemyEmotionId(jsonData, EnemyCharaId);
|
||||
EnemyClassId = baseData.EnemyClassId;
|
||||
EnemyAiId = baseData.EnemyAiId;
|
||||
FieldId = GetFieldId(jsonData, baseData.FieldId);
|
||||
BgmId = GetBgmId(jsonData, baseData.BgmId);
|
||||
}
|
||||
|
||||
private static int GetDeckSkinId(JsonData jsonData, int deckClassId)
|
||||
{
|
||||
int num = jsonData["deck_skin_id_override"].ToInt();
|
||||
if (num == 0)
|
||||
{
|
||||
return GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(deckClassId, isCurrentChara: false)
|
||||
.skin_id;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static int GetPlayerCharaId(JsonData jsonData, int baseCharaId, int classId)
|
||||
{
|
||||
int? overridePlayerCharaId = GetOverridePlayerCharaId(jsonData);
|
||||
if (overridePlayerCharaId.HasValue)
|
||||
{
|
||||
return overridePlayerCharaId.Value;
|
||||
}
|
||||
if (baseCharaId == 0)
|
||||
{
|
||||
return GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(classId, isCurrentChara: false)
|
||||
.chara_id;
|
||||
}
|
||||
return baseCharaId;
|
||||
}
|
||||
|
||||
private static int? GetOverridePlayerCharaId(JsonData jsonData)
|
||||
{
|
||||
int num = jsonData["skin_id_override"].ToInt();
|
||||
if (num == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static string GetPlayerEmotionId(JsonData jsonData, int charaId)
|
||||
{
|
||||
int? overridePlayerEmotionId = GetOverridePlayerEmotionId(jsonData);
|
||||
return GetEmotionId(charaId, overridePlayerEmotionId);
|
||||
}
|
||||
|
||||
private static int? GetOverridePlayerEmotionId(JsonData jsonData)
|
||||
{
|
||||
int num = jsonData["player_emotion_override"].ToInt();
|
||||
if (num == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static string GetEnemyEmotionId(JsonData jsonData, int charaId)
|
||||
{
|
||||
int? overrideEnemyEmotionId = GetOverrideEnemyEmotionId(jsonData);
|
||||
return GetEmotionId(charaId, overrideEnemyEmotionId);
|
||||
}
|
||||
|
||||
private static int? GetOverrideEnemyEmotionId(JsonData jsonData)
|
||||
{
|
||||
int num = jsonData["enemy_emotion_override"].ToInt();
|
||||
if (num == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static string GetEmotionId(int charaId, int? variationId)
|
||||
{
|
||||
int skin_id = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(charaId)
|
||||
.skin_id;
|
||||
if (!variationId.HasValue)
|
||||
{
|
||||
return $"{skin_id}";
|
||||
}
|
||||
return $"{skin_id}_{variationId.Value}";
|
||||
}
|
||||
|
||||
private static int GetFieldId(JsonData jsonData, int baseFieldId)
|
||||
{
|
||||
int? overrideFieldId = GetOverrideFieldId(jsonData);
|
||||
if (!overrideFieldId.HasValue)
|
||||
{
|
||||
return baseFieldId;
|
||||
}
|
||||
return overrideFieldId.Value;
|
||||
}
|
||||
|
||||
private static int? GetOverrideFieldId(JsonData jsonData)
|
||||
{
|
||||
int num = jsonData["battle3dfield_id_override"].ToInt();
|
||||
if (num == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private static string GetBgmId(JsonData jsonData, string baseBgmId)
|
||||
{
|
||||
string overrideBgmId = GetOverrideBgmId(jsonData);
|
||||
if (overrideBgmId == null)
|
||||
{
|
||||
return baseBgmId;
|
||||
}
|
||||
return overrideBgmId;
|
||||
}
|
||||
|
||||
private static string GetOverrideBgmId(JsonData jsonData)
|
||||
{
|
||||
string text = jsonData["bgm_id_override"].ToString();
|
||||
if (!(text != "0"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
36
SVSim.BattleEngine/Engine/BattleStageChoiceObject.cs
Normal file
36
SVSim.BattleEngine/Engine/BattleStageChoiceObject.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class BattleStageChoiceObject : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private UIButton _button;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _texture;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _offObject;
|
||||
|
||||
public Action _onButton;
|
||||
|
||||
public void Init()
|
||||
{
|
||||
UIEventListener.Get(_button.gameObject).onClick = null;
|
||||
UIEventListener uIEventListener = UIEventListener.Get(_button.gameObject);
|
||||
uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
_onButton();
|
||||
});
|
||||
}
|
||||
|
||||
public void SettingOffSelect(bool isOff)
|
||||
{
|
||||
_offObject.gameObject.SetActive(isOff);
|
||||
}
|
||||
|
||||
public void SettingTexture(Texture texture)
|
||||
{
|
||||
_texture.mainTexture = texture;
|
||||
}
|
||||
}
|
||||
468
SVSim.BattleEngine/Engine/BattleStageChoiceWindow.cs
Normal file
468
SVSim.BattleEngine/Engine/BattleStageChoiceWindow.cs
Normal file
@@ -0,0 +1,468 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class BattleStageChoiceWindow : MonoBehaviour
|
||||
{
|
||||
public class PageData
|
||||
{
|
||||
public readonly GameObject Obj;
|
||||
|
||||
public BattleStageChoiceObject[] StageList;
|
||||
|
||||
public PageData(BattleStageChoiceObject[] stageList, GameObject obj)
|
||||
{
|
||||
StageList = stageList;
|
||||
Obj = obj;
|
||||
}
|
||||
}
|
||||
|
||||
public class StageData
|
||||
{
|
||||
public GameObject StageDataObject;
|
||||
|
||||
public string TextureName;
|
||||
|
||||
public StageData(GameObject obj, string textureName)
|
||||
{
|
||||
StageDataObject = obj;
|
||||
TextureName = textureName;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _initializeEnd;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _leftButton;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _rightButton;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _allOffButton;
|
||||
|
||||
[SerializeField]
|
||||
private BoxCollider _flickCollider;
|
||||
|
||||
[SerializeField]
|
||||
private UIGrid _radioIconsGrid;
|
||||
|
||||
[SerializeField]
|
||||
private UIGrid _deckTableOriginal;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _deckTableRoot;
|
||||
|
||||
private List<UIGrid> _stagePageList = new List<UIGrid>();
|
||||
|
||||
[SerializeField]
|
||||
private BattleStageChoiceObject _battleTageSelectOriginal;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _radioIconOriginal;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _allOnLabel;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _allOffLabel;
|
||||
|
||||
private int _currentPage;
|
||||
|
||||
private bool _isChangePage;
|
||||
|
||||
private float _timeChangePage;
|
||||
|
||||
private List<UISprite> _radioIconClones;
|
||||
|
||||
private List<PageData> _pageList = new List<PageData>();
|
||||
|
||||
private int _maxSelectStageNum;
|
||||
|
||||
private bool _isScroll = true;
|
||||
|
||||
private int _loadDoneStageTextureNum;
|
||||
|
||||
private const int MAXNUM_STAGE_PER_TABLE = 9;
|
||||
|
||||
private List<string> _loadedResourceList = new List<string>();
|
||||
|
||||
public bool[] SettingOffStageIndexs { get; private set; }
|
||||
|
||||
public Action<bool> OnAllOff { get; set; }
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_isChangePage)
|
||||
{
|
||||
_timeChangePage += Time.deltaTime;
|
||||
if (_timeChangePage >= 0.2f)
|
||||
{
|
||||
_isChangePage = false;
|
||||
_timeChangePage = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator LoadResource(Action onLoadEnd)
|
||||
{
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
||||
for (int i = 0; i < Data.Load.data.OpenBattleFieldIdList.Count; i++)
|
||||
{
|
||||
string path = "BattleStage_" + int.Parse(Data.Load.data.OpenBattleFieldIdList[i]).ToString("00");
|
||||
_loadedResourceList.Add(resourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.BattlePass));
|
||||
}
|
||||
yield return StartCoroutine(resourcesManager.LoadAssetGroupAsync(_loadedResourceList, null));
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
onLoadEnd.Call();
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
if (_initializeEnd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_initializeEnd = true;
|
||||
PlayerPrefsWrapper.TurnOnFirsStageIfStageIdListAllOff();
|
||||
_maxSelectStageNum = Data.Load.data.OpenBattleFieldIdList.Count;
|
||||
if (_maxSelectStageNum <= 9)
|
||||
{
|
||||
_isScroll = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isScroll = true;
|
||||
}
|
||||
if (_isScroll)
|
||||
{
|
||||
UIEventListener uIEventListener = UIEventListener.Get(_flickCollider.gameObject);
|
||||
uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, new UIEventListener.VectorDelegate(OnDragPanel));
|
||||
UIEventListener uIEventListener2 = UIEventListener.Get(_rightButton.gameObject);
|
||||
uIEventListener2.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener2.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
NextPage();
|
||||
});
|
||||
UIEventListener uIEventListener3 = UIEventListener.Get(_leftButton.gameObject);
|
||||
uIEventListener3.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener3.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
PrevPage();
|
||||
});
|
||||
}
|
||||
UIEventListener uIEventListener4 = UIEventListener.Get(_allOffButton.gameObject);
|
||||
uIEventListener4.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener4.onClick, (UIEventListener.VoidDelegate)delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
if (IsAllOff())
|
||||
{
|
||||
for (int i = 0; i < SettingOffStageIndexs.Length; i++)
|
||||
{
|
||||
SettingOffStageIndexs[i] = false;
|
||||
}
|
||||
_allOnLabel.gameObject.SetActive(value: false);
|
||||
_allOffLabel.gameObject.SetActive(value: true);
|
||||
OnAllOff(obj: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < SettingOffStageIndexs.Length; j++)
|
||||
{
|
||||
SettingOffStageIndexs[j] = true;
|
||||
}
|
||||
_allOnLabel.gameObject.SetActive(value: true);
|
||||
_allOffLabel.gameObject.SetActive(value: false);
|
||||
OnAllOff(obj: true);
|
||||
}
|
||||
UpdateStageOffView();
|
||||
});
|
||||
_radioIconClones = new List<UISprite>();
|
||||
SettingOffStageIndexs = new bool[_maxSelectStageNum];
|
||||
int num = _maxSelectStageNum;
|
||||
_loadDoneStageTextureNum = 0;
|
||||
int num2 = 1 + num / 9;
|
||||
for (int num3 = 0; num3 < num2; num3++)
|
||||
{
|
||||
int num4 = num;
|
||||
if (num4 >= 9)
|
||||
{
|
||||
num4 = 9;
|
||||
}
|
||||
AddStageTable(num3, num4);
|
||||
num -= 9;
|
||||
if (num <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!_isScroll)
|
||||
{
|
||||
_leftButton.gameObject.SetActive(value: false);
|
||||
_rightButton.gameObject.SetActive(value: false);
|
||||
}
|
||||
for (int num5 = 0; num5 < _stagePageList.Count; num5++)
|
||||
{
|
||||
_stagePageList[num5].Reposition();
|
||||
}
|
||||
foreach (PageData page in _pageList)
|
||||
{
|
||||
page.Obj.SetActive(value: false);
|
||||
}
|
||||
_pageList[_currentPage].Obj.SetActive(value: true);
|
||||
SettingOffStageIndexs = ConvertSaveDataToStageIndexList();
|
||||
UpdateStageOffView();
|
||||
UpdateAllOnOffLabel();
|
||||
UpdateRadioButtonView();
|
||||
}
|
||||
|
||||
private bool[] ConvertSaveDataToStageIndexList()
|
||||
{
|
||||
string[] array = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.OFF_STAGE_ID).Split(',');
|
||||
bool[] array2 = new bool[_maxSelectStageNum];
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
for (int j = 0; j < _maxSelectStageNum; j++)
|
||||
{
|
||||
if (array[i] == Data.Load.data.OpenBattleFieldIdList[j].ToString())
|
||||
{
|
||||
array2[j] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array2;
|
||||
}
|
||||
|
||||
public void SaveSetting()
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.OFF_STAGE_ID, PlayerPrefsWrapper.ConvertStageIdListToSaveData(SettingOffStageIndexs));
|
||||
}
|
||||
|
||||
private void UpdateStageOffView()
|
||||
{
|
||||
int num = 0;
|
||||
foreach (PageData page in _pageList)
|
||||
{
|
||||
BattleStageChoiceObject[] stageList = page.StageList;
|
||||
foreach (BattleStageChoiceObject battleStageChoiceObject in stageList)
|
||||
{
|
||||
if (SettingOffStageIndexs[num])
|
||||
{
|
||||
battleStageChoiceObject.SettingOffSelect(isOff: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
battleStageChoiceObject.SettingOffSelect(isOff: false);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAllOnOffLabel()
|
||||
{
|
||||
if (IsAllOff())
|
||||
{
|
||||
_allOnLabel.gameObject.SetActive(value: true);
|
||||
_allOffLabel.gameObject.SetActive(value: false);
|
||||
OnAllOff(obj: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_allOnLabel.gameObject.SetActive(value: false);
|
||||
_allOffLabel.gameObject.SetActive(value: true);
|
||||
OnAllOff(obj: false);
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsAllOff()
|
||||
{
|
||||
bool result = true;
|
||||
for (int i = 0; i < _maxSelectStageNum; i++)
|
||||
{
|
||||
if (!SettingOffStageIndexs[i])
|
||||
{
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void AddStageTable(int tableIndex, int createNum)
|
||||
{
|
||||
BattleStageChoiceObject[] array = new BattleStageChoiceObject[createNum];
|
||||
UIGrid uIGrid = UnityEngine.Object.Instantiate(_deckTableOriginal);
|
||||
uIGrid.transform.parent = _deckTableRoot.transform;
|
||||
uIGrid.transform.localScale = Vector3.one;
|
||||
uIGrid.transform.localPosition = Vector3.zero;
|
||||
int num = 0;
|
||||
uIGrid.sorting = UIGrid.Sorting.Custom;
|
||||
_stagePageList.Add(uIGrid);
|
||||
for (int i = 0; i < createNum; i++)
|
||||
{
|
||||
string textureId = Data.Load.data.OpenBattleFieldIdList[_loadDoneStageTextureNum];
|
||||
BattleStageChoiceObject battleStageChoiceObject = CreateStageFrame(tableIndex * 9 + i, textureId);
|
||||
_loadDoneStageTextureNum++;
|
||||
uIGrid.AddChild(battleStageChoiceObject.transform);
|
||||
battleStageChoiceObject.transform.localScale = Vector3.one;
|
||||
battleStageChoiceObject.gameObject.name = (num + i).ToString();
|
||||
array[i] = battleStageChoiceObject;
|
||||
}
|
||||
if (_isScroll)
|
||||
{
|
||||
UISprite uISprite = UnityEngine.Object.Instantiate(_radioIconOriginal);
|
||||
_radioIconClones.Add(uISprite);
|
||||
_radioIconsGrid.AddChild(uISprite.transform);
|
||||
uISprite.transform.localScale = Vector3.one;
|
||||
}
|
||||
PageData item = new PageData(array, uIGrid.gameObject);
|
||||
_pageList.Add(item);
|
||||
}
|
||||
|
||||
private BattleStageChoiceObject CreateStageFrame(int index, string textureId)
|
||||
{
|
||||
BattleStageChoiceObject battleStageChoiceObject = UnityEngine.Object.Instantiate(_battleTageSelectOriginal);
|
||||
battleStageChoiceObject.Init();
|
||||
UIEventListener uIEventListener = UIEventListener.Get(battleStageChoiceObject.gameObject);
|
||||
uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, (UIEventListener.BoolDelegate)delegate(GameObject g, bool b)
|
||||
{
|
||||
StartCoroutine(PushedAnimation(g));
|
||||
});
|
||||
battleStageChoiceObject._onButton = (Action)Delegate.Combine(battleStageChoiceObject._onButton, (Action)delegate
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
|
||||
SettingOffStageIndexs[index] = !SettingOffStageIndexs[index];
|
||||
UpdateStageOffView();
|
||||
UpdateAllOnOffLabel();
|
||||
});
|
||||
ResourcesManager resourcesManager = Toolbox.ResourcesManager;
|
||||
string path = "BattleStage_" + int.Parse(textureId).ToString("00");
|
||||
Texture texture = resourcesManager.LoadObject<Texture>(resourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.BattleStage, isfetch: true));
|
||||
battleStageChoiceObject.SettingTexture(texture);
|
||||
UIEventListener uIEventListener2 = UIEventListener.Get(battleStageChoiceObject.gameObject);
|
||||
uIEventListener2.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener2.onDrag, new UIEventListener.VectorDelegate(OnDragPanel));
|
||||
return battleStageChoiceObject;
|
||||
}
|
||||
|
||||
private void OnDragPanel(GameObject obj, Vector2 dir)
|
||||
{
|
||||
if (_isScroll)
|
||||
{
|
||||
if (dir.x >= 70f)
|
||||
{
|
||||
PrevPage();
|
||||
}
|
||||
else if (dir.x <= -70f)
|
||||
{
|
||||
NextPage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void NextPage()
|
||||
{
|
||||
if (ChangePage(_currentPage + 1))
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrevPage()
|
||||
{
|
||||
if (ChangePage(_currentPage - 1))
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN);
|
||||
}
|
||||
}
|
||||
|
||||
private bool ChangePage(int newPage, bool isImmediate = false)
|
||||
{
|
||||
int currentPage = _currentPage;
|
||||
if (_isChangePage)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int count = _radioIconClones.Count;
|
||||
bool flag = false;
|
||||
if (newPage < 0)
|
||||
{
|
||||
newPage = count - 1;
|
||||
flag = true;
|
||||
}
|
||||
if (newPage >= count)
|
||||
{
|
||||
newPage = 0;
|
||||
flag = true;
|
||||
}
|
||||
if (currentPage == newPage)
|
||||
{
|
||||
isImmediate = true;
|
||||
}
|
||||
_currentPage = newPage;
|
||||
foreach (PageData page in _pageList)
|
||||
{
|
||||
page.Obj.SetActive(value: false);
|
||||
}
|
||||
_pageList[_currentPage].Obj.SetActive(value: true);
|
||||
_pageList[currentPage].Obj.SetActive(value: true);
|
||||
float num = ((_currentPage < currentPage) ? 1400f : (-1400f));
|
||||
if (flag)
|
||||
{
|
||||
num = 0f - num;
|
||||
}
|
||||
Vector3 pos = new Vector3(num, 0f, 0f);
|
||||
Vector3 localPosition = new Vector3(0f - num, 0f, 0f);
|
||||
Vector3 zero = Vector3.zero;
|
||||
_pageList[_currentPage].Obj.transform.localPosition = localPosition;
|
||||
TweenPosition.Begin(_pageList[currentPage].Obj, isImmediate ? 0f : 0.2f, pos);
|
||||
TweenPosition.Begin(_pageList[_currentPage].Obj, isImmediate ? 0f : 0.2f, zero);
|
||||
if (!isImmediate)
|
||||
{
|
||||
_isChangePage = true;
|
||||
}
|
||||
UpdateRadioButtonView();
|
||||
bool flag2;
|
||||
bool active = (flag2 = _pageList.Count >= 2) || flag2;
|
||||
_radioIconsGrid.gameObject.SetActive(active);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void UpdateRadioButtonView()
|
||||
{
|
||||
for (int i = 0; i < _radioIconClones.Count; i++)
|
||||
{
|
||||
if (i == _currentPage)
|
||||
{
|
||||
_radioIconClones[i].spriteName = _radioIconClones[i].spriteName.Replace("_off", "_on");
|
||||
}
|
||||
else
|
||||
{
|
||||
_radioIconClones[i].spriteName = _radioIconClones[i].spriteName.Replace("_on", "_off");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator PushedAnimation(GameObject obj)
|
||||
{
|
||||
TweenScale scl = obj.GetComponent<TweenScale>();
|
||||
if ((bool)scl)
|
||||
{
|
||||
scl.PlayForward();
|
||||
while (Input.GetMouseButton(0))
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
scl.PlayReverse();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList);
|
||||
_loadedResourceList = null;
|
||||
}
|
||||
}
|
||||
24
SVSim.BattleEngine/Engine/BattleStopChecker.cs
Normal file
24
SVSim.BattleEngine/Engine/BattleStopChecker.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using Cute;
|
||||
|
||||
public class BattleStopChecker : NetworkBattleIntervalCheckerBase
|
||||
{
|
||||
private const int JUDGE_RESULT_RETRY_TIMER = 95;
|
||||
|
||||
public event Action OnBattleStop;
|
||||
|
||||
public override void StopChecker()
|
||||
{
|
||||
base.StopChecker();
|
||||
}
|
||||
|
||||
protected override void IntervalCheck()
|
||||
{
|
||||
base.IntervalCheck();
|
||||
if (NetworkUtility.GetTimeSpanSecond(base.startTick) >= 95)
|
||||
{
|
||||
this.OnBattleStop.Call();
|
||||
StartChecker();
|
||||
}
|
||||
}
|
||||
}
|
||||
67
SVSim.BattleEngine/Engine/BattleUtility.cs
Normal file
67
SVSim.BattleEngine/Engine/BattleUtility.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public static class BattleUtility
|
||||
{
|
||||
public class RepeatSkillsAndTiming
|
||||
{
|
||||
public List<SkillBase> _skills;
|
||||
|
||||
public List<string> _timings;
|
||||
|
||||
public RepeatSkillsAndTiming(List<SkillBase> skills, List<string> timings)
|
||||
{
|
||||
_timings = timings;
|
||||
_skills = skills;
|
||||
}
|
||||
}
|
||||
|
||||
public static RepeatSkillsAndTiming GetRepeatSkillsWithTiming(List<SkillBase> skills)
|
||||
{
|
||||
if (skills == null || skills.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
BattleCardBase ownerCard = skills.First().SkillPrm.ownerCard;
|
||||
return GetRepeatSkillsWithTiming(ownerCard.SelfBattlePlayer, ownerCard, skills);
|
||||
}
|
||||
|
||||
public static List<SkillBase> GetRepeatSkillsForPrediction(BattlePlayerBase sourcePlayer, BattleCardBase virtualCard)
|
||||
{
|
||||
if (virtualCard.Skills == null || virtualCard.Skills.Count() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return GetRepeatSkillsWithTiming(sourcePlayer, virtualCard, virtualCard.Skills.ToList())?._skills;
|
||||
}
|
||||
|
||||
public static List<SkillBase> GetRepeatableWhenPlaySkill(BattleCardBase ownerCard, List<SkillBase> activeSkills, bool isInvokeCheck)
|
||||
{
|
||||
if (ownerCard.Skills.Any((SkillBase s) => s.IsUserSelectType && !(s is Skill_fusion)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (isInvokeCheck && !ownerCard.HasSkillWhenPlay(isOnlyNoSelect: true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (activeSkills.Count == 1 && activeSkills.Any((SkillBase s) => s is Skill_pp_fixeduse))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return activeSkills.Where((SkillBase c) => c.OnWhenPlayStart != 0).ToList();
|
||||
}
|
||||
|
||||
private static RepeatSkillsAndTiming GetRepeatSkillsWithTiming(BattlePlayerBase player, BattleCardBase ownerCard, List<SkillBase> activeSkills)
|
||||
{
|
||||
List<SkillBase> list = new List<SkillBase>();
|
||||
List<string> list2 = new List<string>();
|
||||
IEnumerable<SkillBase> enumerable = activeSkills.Where((SkillBase s) => s.IsWhenDestroySkill);
|
||||
if (player.Class.SkillApplyInformation.RepeatSkillTimingList.Any((RepeatSkillInfo s) => s.Timing == "when_destroy" && Skill_repeat_skill.CheckCardType(s.Target, ownerCard)) && enumerable.Count() > 0)
|
||||
{
|
||||
list.AddRange(enumerable);
|
||||
list2.Add("when_destroy");
|
||||
}
|
||||
return new RepeatSkillsAndTiming(list, list2);
|
||||
}
|
||||
}
|
||||
229
SVSim.BattleEngine/Engine/BetterList.cs
Normal file
229
SVSim.BattleEngine/Engine/BetterList.cs
Normal file
@@ -0,0 +1,229 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
|
||||
public class BetterList<T>
|
||||
{
|
||||
public delegate int CompareFunc(T left, T right);
|
||||
|
||||
public T[] buffer;
|
||||
|
||||
public int size;
|
||||
|
||||
[DebuggerHidden]
|
||||
public T this[int i]
|
||||
{
|
||||
get
|
||||
{
|
||||
return buffer[i];
|
||||
}
|
||||
set
|
||||
{
|
||||
buffer[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[DebuggerHidden]
|
||||
[DebuggerStepThrough]
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
if (buffer != null)
|
||||
{
|
||||
int i = 0;
|
||||
while (i < size)
|
||||
{
|
||||
yield return buffer[i];
|
||||
int num = i + 1;
|
||||
i = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AllocateMore()
|
||||
{
|
||||
T[] array = ((buffer != null) ? new T[Mathf.Max(buffer.Length << 1, 32)] : new T[32]);
|
||||
if (buffer != null && size > 0)
|
||||
{
|
||||
buffer.CopyTo(array, 0);
|
||||
}
|
||||
buffer = array;
|
||||
}
|
||||
|
||||
private void Trim()
|
||||
{
|
||||
if (size > 0)
|
||||
{
|
||||
if (size < buffer.Length)
|
||||
{
|
||||
T[] array = new T[size];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
array[i] = buffer[i];
|
||||
}
|
||||
buffer = array;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
size = 0;
|
||||
}
|
||||
|
||||
public void Release()
|
||||
{
|
||||
size = 0;
|
||||
buffer = null;
|
||||
}
|
||||
|
||||
public void Add(T item)
|
||||
{
|
||||
if (buffer == null || size == buffer.Length)
|
||||
{
|
||||
AllocateMore();
|
||||
}
|
||||
buffer[size++] = item;
|
||||
}
|
||||
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
if (buffer == null || size == buffer.Length)
|
||||
{
|
||||
AllocateMore();
|
||||
}
|
||||
if (index > -1 && index < size)
|
||||
{
|
||||
for (int num = size; num > index; num--)
|
||||
{
|
||||
buffer[num] = buffer[num - 1];
|
||||
}
|
||||
buffer[index] = item;
|
||||
size++;
|
||||
}
|
||||
else
|
||||
{
|
||||
Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(T item)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ref readonly T reference = ref buffer[i];
|
||||
object obj = item;
|
||||
if (reference.Equals(obj))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int IndexOf(T item)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
ref readonly T reference = ref buffer[i];
|
||||
object obj = item;
|
||||
if (reference.Equals(obj))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public bool Remove(T item)
|
||||
{
|
||||
if (buffer != null)
|
||||
{
|
||||
EqualityComparer<T> equalityComparer = EqualityComparer<T>.Default;
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (equalityComparer.Equals(buffer[i], item))
|
||||
{
|
||||
size--;
|
||||
buffer[i] = default(T);
|
||||
for (int j = i; j < size; j++)
|
||||
{
|
||||
buffer[j] = buffer[j + 1];
|
||||
}
|
||||
buffer[size] = default(T);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RemoveAt(int index)
|
||||
{
|
||||
if (buffer != null && index > -1 && index < size)
|
||||
{
|
||||
size--;
|
||||
buffer[index] = default(T);
|
||||
for (int i = index; i < size; i++)
|
||||
{
|
||||
buffer[i] = buffer[i + 1];
|
||||
}
|
||||
buffer[size] = default(T);
|
||||
}
|
||||
}
|
||||
|
||||
public T Pop()
|
||||
{
|
||||
if (buffer != null && size != 0)
|
||||
{
|
||||
T result = buffer[--size];
|
||||
buffer[size] = default(T);
|
||||
return result;
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
public T[] ToArray()
|
||||
{
|
||||
Trim();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
[DebuggerHidden]
|
||||
[DebuggerStepThrough]
|
||||
public void Sort(CompareFunc comparer)
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = size - 1;
|
||||
bool flag = true;
|
||||
while (flag)
|
||||
{
|
||||
flag = false;
|
||||
for (int i = num; i < num2; i++)
|
||||
{
|
||||
if (comparer(buffer[i], buffer[i + 1]) > 0)
|
||||
{
|
||||
T val = buffer[i];
|
||||
buffer[i] = buffer[i + 1];
|
||||
buffer[i + 1] = val;
|
||||
flag = true;
|
||||
}
|
||||
else if (!flag)
|
||||
{
|
||||
num = ((i != 0) ? (i - 1) : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
SVSim.BattleEngine/Engine/BothBattlePlayerFilter.cs
Normal file
11
SVSim.BattleEngine/Engine/BothBattlePlayerFilter.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Wizard;
|
||||
|
||||
public class BothBattlePlayerFilter : ISkillBattlePlayerFilter
|
||||
{
|
||||
public IEnumerable<IBattlePlayerReadOnlyInfo> Filtering(BattlePlayerReadOnlyInfoPair playerInfoPair)
|
||||
{
|
||||
yield return playerInfoPair.ReadOnlySelf;
|
||||
yield return playerInfoPair.ReadOnlyOpponent;
|
||||
}
|
||||
}
|
||||
404
SVSim.BattleEngine/Engine/CardCreatorBase.cs
Normal file
404
SVSim.BattleEngine/Engine/CardCreatorBase.cs
Normal file
@@ -0,0 +1,404 @@
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Battle;
|
||||
using Wizard.Battle.Card;
|
||||
using Wizard.Battle.Resource;
|
||||
|
||||
public class CardCreatorBase
|
||||
{
|
||||
private class CardTypeBuildInfo
|
||||
{
|
||||
public bool isActive;
|
||||
|
||||
public Vector3 localPosition;
|
||||
|
||||
public Vector3 localScale;
|
||||
|
||||
public Quaternion localRotation;
|
||||
|
||||
public Transform parent;
|
||||
}
|
||||
|
||||
private readonly GameObject _cardRootObject;
|
||||
|
||||
protected static Dictionary<CardBasePrm.ClanType, Material> _classIconCache = new Dictionary<CardBasePrm.ClanType, Material>();
|
||||
|
||||
private static BattleCardBase _dummyCardInstance;
|
||||
|
||||
public static Material GetSharedClassIconMaterial(CardBasePrm.ClanType clanType)
|
||||
{
|
||||
Material material;
|
||||
if (_classIconCache.ContainsKey(clanType))
|
||||
{
|
||||
material = _classIconCache[clanType];
|
||||
if (material == null || material.mainTexture == null)
|
||||
{
|
||||
if (material != null)
|
||||
{
|
||||
Object.Destroy(material);
|
||||
}
|
||||
_classIconCache.Remove(clanType);
|
||||
}
|
||||
material = null;
|
||||
}
|
||||
if (_classIconCache.ContainsKey(clanType))
|
||||
{
|
||||
material = _classIconCache[clanType];
|
||||
}
|
||||
else
|
||||
{
|
||||
material = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("CardFrameClassIcon", ResourcesManager.AssetLoadPathType.CardFrameMaterialPlus, isfetch: true)) as Material);
|
||||
material.mainTexture = ClassCharaPrm.GetClassIconTexture((int)clanType);
|
||||
_classIconCache[clanType] = material;
|
||||
}
|
||||
return material;
|
||||
}
|
||||
|
||||
public CardCreatorBase(GameObject cardRootObject)
|
||||
{
|
||||
_cardRootObject = cardRootObject;
|
||||
}
|
||||
|
||||
public GameObject LoadRootObject()
|
||||
{
|
||||
return _cardRootObject;
|
||||
}
|
||||
|
||||
public static BattleCardBase CreateCard(int cardId, bool isPlayer, int index, SBattleLoad sBattleLoad, BattleManagerBase battleMgr, IBattleResourceMgr resourceMgr, IInnerOptionsBuilder innerOptionsBuilder, bool isChoiceBrave = false)
|
||||
{
|
||||
bool flag = !isPlayer;
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId);
|
||||
CardBasePrm.CharaType charType = cardParameterFromId.CharType;
|
||||
CardCreatorBase cardCreatorBase = null;
|
||||
switch (charType)
|
||||
{
|
||||
case CardBasePrm.CharaType.NORMAL:
|
||||
cardCreatorBase = new UnitCardCreator(sBattleLoad.UnitCardTemplate.gameObject);
|
||||
break;
|
||||
case CardBasePrm.CharaType.FIELD:
|
||||
case CardBasePrm.CharaType.CHANT_FIELD:
|
||||
cardCreatorBase = new FieldCardCreator(sBattleLoad.FieldCardTemplate.gameObject);
|
||||
break;
|
||||
case CardBasePrm.CharaType.SPELL:
|
||||
cardCreatorBase = new SpellCardCreator(sBattleLoad.SpellCardTemplate.gameObject);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
GameObject gobj = cardCreatorBase.LoadRootObject();
|
||||
GameObject gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, BattleManagerBase.GetIns().Battle3DContainer);
|
||||
CardTemplate component = gameObject.GetComponent<CardTemplate>();
|
||||
if (flag && !GameMgr.GetIns().IsWatchBattle && !sBattleLoad.isDbgEnableEnemyHandView && !GameMgr.GetIns().IsAdmin)
|
||||
{
|
||||
gameObject.GetComponent<CardTemplate>().CardNormalLodGroup.enabled = false;
|
||||
}
|
||||
GameObject gameObject2 = component.CardNormalTemp.gameObject;
|
||||
if (charType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
gameObject2.SetActive(value: false);
|
||||
}
|
||||
component.NormalCardBaseMeshTemp.sharedMaterial = resourceMgr.GetSleeveMaterial(isPlayer);
|
||||
if (charType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
component.EvolCardBaseMeshTemp.sharedMaterial = resourceMgr.GetSleeveMaterial(isPlayer);
|
||||
}
|
||||
Transform transform = gameObject.transform.Find("CardObj");
|
||||
Transform transform2 = gameObject.transform.Find("Collider");
|
||||
string tag = (transform.tag = (gameObject2.tag = (flag ? "Enemy" : "Player")));
|
||||
transform2.tag = tag;
|
||||
GameObject gameObject3 = null;
|
||||
if (component.LifeLabelTemp != null)
|
||||
{
|
||||
gameObject3 = component.LifeLabelTemp.transform.parent.gameObject;
|
||||
}
|
||||
UILabel lifeLabelTemp = component.LifeLabelTemp;
|
||||
if (lifeLabelTemp != null)
|
||||
{
|
||||
lifeLabelTemp.text = cardParameterFromId.Life.ToString();
|
||||
}
|
||||
if (gameObject3 != null)
|
||||
{
|
||||
gameObject3.SetActive(value: false);
|
||||
}
|
||||
if (isChoiceBrave)
|
||||
{
|
||||
component.SetEffectColor(Global.CARD_HBP_LABEL_COST_COLOR);
|
||||
}
|
||||
if (cardParameterFromId.IsVariableCost)
|
||||
{
|
||||
component.NormalSignLabelTemp.text = "-";
|
||||
component.NormalSignedCostLabelTemp.text = "X";
|
||||
component.ShowSignedCostLabel();
|
||||
component.NormalChoiceBraveNameLabelTemp.text = cardParameterFromId.CardName;
|
||||
component.ShowChoiceBraveNameLabel();
|
||||
}
|
||||
else if (isChoiceBrave)
|
||||
{
|
||||
if (cardParameterFromId.Cost != 0)
|
||||
{
|
||||
component.NormalSignLabelTemp.text = ((cardParameterFromId.Cost > 0) ? "-" : "+");
|
||||
component.NormalSignedCostLabelTemp.text = Mathf.Abs(cardParameterFromId.Cost).ToString();
|
||||
component.ShowSignedCostLabel();
|
||||
}
|
||||
else
|
||||
{
|
||||
component.NormalZeroCostLabelTemp.text = "0";
|
||||
component.ShowZeroCostLabel();
|
||||
}
|
||||
component.NormalChoiceBraveNameLabelTemp.text = cardParameterFromId.CardName;
|
||||
component.ShowChoiceBraveNameLabel();
|
||||
}
|
||||
else
|
||||
{
|
||||
component.NormalCostLabelTemp.text = cardParameterFromId.Cost.ToString();
|
||||
component.NormalNameLabelTemp.text = cardParameterFromId.CardName;
|
||||
}
|
||||
component.SetNumberLabelStyle(cardParameterFromId.IsFoil);
|
||||
component.SetNameLabelStyle(cardParameterFromId.IsFoil, isChoiceBrave);
|
||||
component.SetRepositionNameLabel(cardParameterFromId.CardName, isChoiceBrave);
|
||||
if (charType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
component.NormalLifeLabelTemp.text = lifeLabelTemp.text;
|
||||
GameObject gameObject4 = component.AtkLabelTemp.transform.parent.gameObject;
|
||||
UILabel atkLabelTemp = component.AtkLabelTemp;
|
||||
atkLabelTemp.text = cardParameterFromId.Atk.ToString();
|
||||
gameObject4.SetActive(value: false);
|
||||
component.NormalAtkLabelTemp.text = atkLabelTemp.text;
|
||||
}
|
||||
UILabel component2 = gameObject2.transform.Find("Cost(Clone)").Find("CostLabel").GetComponent<UILabel>();
|
||||
if (charType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
UILabel component3 = gameObject2.transform.Find("Life(Clone)").Find("LifeLabel").GetComponent<UILabel>();
|
||||
UILabel component4 = gameObject2.transform.Find("Atk(Clone)").Find("AtkLabel").GetComponent<UILabel>();
|
||||
GameObject gameObject5 = component2.gameObject;
|
||||
GameObject gameObject6 = component3.gameObject;
|
||||
int num = (component4.gameObject.layer = 12);
|
||||
int layer = (gameObject6.layer = num);
|
||||
gameObject5.layer = layer;
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component.NormalAtkLabelTemp, cardParameterFromId.IsFoil);
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component.NormalLifeLabelTemp, cardParameterFromId.IsFoil);
|
||||
}
|
||||
return CreateCard(cardId, gameObject, index, isPlayer, battleMgr, component, transform, innerOptionsBuilder, isChoiceBrave);
|
||||
}
|
||||
|
||||
public static BattleCardBase CreateSpecialSkillCard(int cardId, bool isPlayer, int index, SBattleLoad sBattleLoad, BattleManagerBase battleMgr, IBattleResourceMgr resourceMgr, IInnerOptionsBuilder innerOptionsBuilder, BossRushSpecialSkill skill)
|
||||
{
|
||||
bool flag = !isPlayer;
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId);
|
||||
_ = cardParameterFromId.CharType;
|
||||
GameObject gobj = new SpecialSkillCardCreator(sBattleLoad.SpellCardTemplate.gameObject).LoadRootObject();
|
||||
GameObject gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, BattleManagerBase.GetIns().Battle3DContainer);
|
||||
CardTemplate component = gameObject.GetComponent<CardTemplate>();
|
||||
if (flag && !GameMgr.GetIns().IsWatchBattle && !sBattleLoad.isDbgEnableEnemyHandView && !GameMgr.GetIns().IsAdmin)
|
||||
{
|
||||
gameObject.GetComponent<CardTemplate>().CardNormalLodGroup.enabled = false;
|
||||
}
|
||||
GameObject gameObject2 = component.CardNormalTemp.gameObject;
|
||||
component.NormalCardBaseMeshTemp.sharedMaterial = resourceMgr.GetSleeveMaterial(isPlayer);
|
||||
Transform transform = gameObject.transform.Find("CardObj");
|
||||
Transform transform2 = gameObject.transform.Find("Collider");
|
||||
string tag = (transform.tag = (gameObject2.tag = (flag ? "Enemy" : "Player")));
|
||||
transform2.tag = tag;
|
||||
GameObject gameObject3 = null;
|
||||
if (component.LifeLabelTemp != null)
|
||||
{
|
||||
gameObject3 = component.LifeLabelTemp.transform.parent.gameObject;
|
||||
}
|
||||
UILabel lifeLabelTemp = component.LifeLabelTemp;
|
||||
if (lifeLabelTemp != null)
|
||||
{
|
||||
lifeLabelTemp.text = cardParameterFromId.Life.ToString();
|
||||
}
|
||||
if (gameObject3 != null)
|
||||
{
|
||||
gameObject3.SetActive(value: false);
|
||||
}
|
||||
component.NormalCostLabelTemp.text = cardParameterFromId.Cost.ToString();
|
||||
component.NormalNameLabelTemp.text = skill.Name;
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNumberLabelStyle(component.NormalCostLabelTemp, cardParameterFromId.IsFoil);
|
||||
UIManager.GetInstance().getUIBase_CardManager().SetNameLabelStyle(component.NormalNameLabelTemp, cardParameterFromId.IsFoil);
|
||||
Global.SetRepositionNameLabel(component.NormalNameLabelTemp, skill.Name, is2D: false);
|
||||
string tag2;
|
||||
if (isPlayer)
|
||||
{
|
||||
tag2 = "Player";
|
||||
gameObject.name = "P0";
|
||||
}
|
||||
else
|
||||
{
|
||||
tag2 = "Enemy";
|
||||
gameObject.name = "E0";
|
||||
}
|
||||
CardTypeBuildInfo cardTypeBuildInfo = CreateCardTypeBuildInfo(cardParameterFromId.CharType, isPlayer);
|
||||
gameObject.SetActive(cardTypeBuildInfo.isActive);
|
||||
gameObject.transform.localPosition = cardTypeBuildInfo.localPosition;
|
||||
gameObject.transform.localScale = cardTypeBuildInfo.localScale;
|
||||
gameObject.transform.localRotation = cardTypeBuildInfo.localRotation;
|
||||
gameObject.transform.parent = cardTypeBuildInfo.parent;
|
||||
gameObject.tag = tag2;
|
||||
transform.tag = tag2;
|
||||
transform.transform.Find("NormalField").tag = tag2;
|
||||
transform.transform.Find("EvolField").tag = tag2;
|
||||
SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(cardParameterFromId);
|
||||
BattleCardBase.BuildInfo buildInfo = new BattleCardBase.BuildInfo(gameObject, cardId, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr.GetBattlePlayer(isPlayer), cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, 0, innerOptionsBuilder.CreateCardOptions(), battleMgr, battleMgr.BattleResourceMgr);
|
||||
SpecialSkillBattleCard specialSkillBattleCard = new SpecialSkillBattleCard(skill, buildInfo);
|
||||
specialSkillBattleCard.Setup(createNullView: true);
|
||||
return specialSkillBattleCard;
|
||||
}
|
||||
|
||||
public static BattleCardBase CreateCard(int cardId, GameObject gameObject, int battleCardIndex, bool isPlayer, BattleManagerBase battleMgr, CardTemplate CardTemplateIns, Transform parentObject, IInnerOptionsBuilder innerOptionsBuilder, bool isChoiceBrave)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId);
|
||||
string tag;
|
||||
if (isPlayer)
|
||||
{
|
||||
tag = "Player";
|
||||
gameObject.name = "P" + battleCardIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
tag = "Enemy";
|
||||
gameObject.name = "E" + battleCardIndex;
|
||||
}
|
||||
CardTypeBuildInfo cardTypeBuildInfo = CreateCardTypeBuildInfo(cardParameterFromId.CharType, isPlayer);
|
||||
gameObject.SetActive(cardTypeBuildInfo.isActive);
|
||||
gameObject.transform.localPosition = cardTypeBuildInfo.localPosition;
|
||||
gameObject.transform.localScale = cardTypeBuildInfo.localScale;
|
||||
gameObject.transform.localRotation = cardTypeBuildInfo.localRotation;
|
||||
gameObject.transform.parent = cardTypeBuildInfo.parent;
|
||||
gameObject.tag = tag;
|
||||
parentObject.tag = tag;
|
||||
if (cardParameterFromId.CharType == CardBasePrm.CharaType.NORMAL)
|
||||
{
|
||||
CardTemplateIns.CardNormalTemp.tag = tag;
|
||||
CardTemplateIns.CardNormalTemp.gameObject.SetActive(value: true);
|
||||
}
|
||||
parentObject.transform.Find("NormalField").tag = tag;
|
||||
parentObject.transform.Find("EvolField").tag = tag;
|
||||
SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(cardParameterFromId);
|
||||
return CreateBase(new BattleCardBase.BuildInfo(gameObject, cardId, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr.GetBattlePlayer(isPlayer), cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, battleCardIndex, innerOptionsBuilder.CreateCardOptions(), battleMgr, battleMgr.BattleResourceMgr), createNullView: false, isChoiceBrave);
|
||||
}
|
||||
|
||||
private static BattleCardBase CreateCardWithoutResources(int cardId, int battleCardIndex, bool isPlayer, BattleManagerBase battleMgr, IInnerOptionsBuilder innerOptionsBuilder)
|
||||
{
|
||||
SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId));
|
||||
return CreateBase(new BattleCardBase.BuildInfo(null, cardId, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr.GetBattlePlayer(isPlayer), cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, battleCardIndex, innerOptionsBuilder.CreateCardOptions(), battleMgr, battleMgr.BattleResourceMgr), createNullView: true);
|
||||
}
|
||||
|
||||
public static BattleCardBase CreateVirtualClass(bool isPlayer, BattleManagerBase battleMgr, IInnerOptionsBuilder innerOptionsBuilder)
|
||||
{
|
||||
return new VirtualClassBattleCard(new ClassBattleCardBase.ClassBuildInfo(isPlayer, 20, battleMgr.GetBattlePlayer(isPlayer), battleMgr.GetBattlePlayer(!isPlayer), battleMgr, NullBattleResourceMgr.GetInstance()));
|
||||
}
|
||||
|
||||
public static BattleCardBase CreateVirtualCard(int cardId, int index, bool isPlayer, BattleManagerBase battleMgr, BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer, IInnerOptionsBuilder innerOptionsBuilder)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(cardId);
|
||||
SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(cardParameterFromId);
|
||||
BattleCardBase.BuildInfo buildInfo = new BattleCardBase.BuildInfo(null, cardId, selfBattlePlayer, opponentBattlePlayer, selfBattlePlayer, cardSkillsBuildInfo.normalSkillBuildInfos, cardSkillsBuildInfo.evolveSkillBuildInfos, isPlayer, index, innerOptionsBuilder.CreateCardOptions(), battleMgr, NullBattleResourceMgr.GetInstance());
|
||||
BattleCardBase battleCardBase;
|
||||
switch (cardParameterFromId.CharType)
|
||||
{
|
||||
case CardBasePrm.CharaType.NORMAL:
|
||||
case CardBasePrm.CharaType.EVOLUTION:
|
||||
battleCardBase = new VirtualUnitBattleCard(buildInfo);
|
||||
break;
|
||||
case CardBasePrm.CharaType.FIELD:
|
||||
battleCardBase = new VirtualFieldBattleCard(buildInfo);
|
||||
break;
|
||||
case CardBasePrm.CharaType.CHANT_FIELD:
|
||||
battleCardBase = new VirtualChantFieldBattleCard(buildInfo);
|
||||
break;
|
||||
case CardBasePrm.CharaType.SPELL:
|
||||
battleCardBase = new VirtualSpellBattleCard(buildInfo, isChoiceBrave: false);
|
||||
break;
|
||||
default:
|
||||
battleCardBase = NullBattleCard.Create();
|
||||
break;
|
||||
}
|
||||
battleCardBase.Setup();
|
||||
return battleCardBase;
|
||||
}
|
||||
|
||||
public static BattleCardBase CreateToken(BattleCardBase.BuildInfo buildInfo, bool createNullView = false)
|
||||
{
|
||||
return CreateBase(buildInfo, createNullView);
|
||||
}
|
||||
|
||||
private static BattleCardBase CreateBase(BattleCardBase.BuildInfo buildInfo, bool createNullView = false, bool isChoiceBrave = false)
|
||||
{
|
||||
BattleCardBase battleCardBase;
|
||||
switch (CardMaster.GetInstanceForBattle().GetCardParameterFromId(buildInfo.CardId).CharType)
|
||||
{
|
||||
case CardBasePrm.CharaType.NORMAL:
|
||||
case CardBasePrm.CharaType.EVOLUTION:
|
||||
battleCardBase = new UnitBattleCard(buildInfo);
|
||||
break;
|
||||
case CardBasePrm.CharaType.FIELD:
|
||||
battleCardBase = new FieldBattleCard(buildInfo);
|
||||
break;
|
||||
case CardBasePrm.CharaType.CHANT_FIELD:
|
||||
battleCardBase = new ChantFieldBattleCard(buildInfo);
|
||||
break;
|
||||
case CardBasePrm.CharaType.SPELL:
|
||||
battleCardBase = new SpellBattleCard(buildInfo, isChoiceBrave);
|
||||
battleCardBase.IsChoiceBraveSkillCard = isChoiceBrave;
|
||||
break;
|
||||
default:
|
||||
battleCardBase = NullBattleCard.Create();
|
||||
break;
|
||||
}
|
||||
battleCardBase.Setup(createNullView);
|
||||
return battleCardBase;
|
||||
}
|
||||
|
||||
public static BattleCardBase CreateDummyInstance()
|
||||
{
|
||||
return NullBattleCard.Create();
|
||||
}
|
||||
|
||||
public static BattleCardBase GetDummyInstance()
|
||||
{
|
||||
if (_dummyCardInstance == null)
|
||||
{
|
||||
_dummyCardInstance = NullBattleCard.Create();
|
||||
}
|
||||
return _dummyCardInstance;
|
||||
}
|
||||
|
||||
private static CardTypeBuildInfo CreateCardTypeBuildInfo(CardBasePrm.CharaType type, bool isPlayer)
|
||||
{
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
CardTypeBuildInfo cardTypeBuildInfo = new CardTypeBuildInfo();
|
||||
if (type == CardBasePrm.CharaType.CLASS)
|
||||
{
|
||||
cardTypeBuildInfo.isActive = true;
|
||||
cardTypeBuildInfo.localPosition = (isPlayer ? new Vector3(0f, -400f, 30f) : new Vector3(0f, 420f, 30f));
|
||||
cardTypeBuildInfo.localScale = Global.CLASS_BATTLE_SCALE;
|
||||
cardTypeBuildInfo.localRotation = Quaternion.identity;
|
||||
cardTypeBuildInfo.parent = ins.Battle3DContainer.transform;
|
||||
}
|
||||
else
|
||||
{
|
||||
cardTypeBuildInfo.isActive = false;
|
||||
cardTypeBuildInfo.localPosition = (isPlayer ? ins.CardHolder.transform.localPosition : ins.ECardHolder.transform.localPosition);
|
||||
cardTypeBuildInfo.localScale = Global.CARD_BATTLE_SCALE;
|
||||
cardTypeBuildInfo.localRotation = Quaternion.Euler(0f, -90f, 90f);
|
||||
cardTypeBuildInfo.parent = ins.PCardPlace.transform;
|
||||
}
|
||||
return cardTypeBuildInfo;
|
||||
}
|
||||
|
||||
public static void SetupClassMaterialToCenterCharacterMesh(MeshRenderer insideMesh, MeshRenderer outsideMesh, Material cardArtMaterial, Material cardFrameMaterial)
|
||||
{
|
||||
Material[] materials = insideMesh.materials;
|
||||
Material[] materials2 = outsideMesh.materials;
|
||||
cardFrameMaterial.shader = Shader.Find(cardFrameMaterial.shader.name);
|
||||
cardArtMaterial.shader = Shader.Find(cardArtMaterial.shader.name);
|
||||
materials2[0] = cardFrameMaterial;
|
||||
materials[0] = cardArtMaterial;
|
||||
insideMesh.materials = materials;
|
||||
outsideMesh.materials = materials2;
|
||||
}
|
||||
}
|
||||
175
SVSim.BattleEngine/Engine/CardMake.cs
Normal file
175
SVSim.BattleEngine/Engine/CardMake.cs
Normal file
@@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class CardMake : MonoBehaviour
|
||||
{
|
||||
public const int CAN_CREATE_MAX = 3;
|
||||
|
||||
public const string FORMAT_CARD_CRAFT_PARAM = "{0},{1}";
|
||||
|
||||
private IDictionary<string, string> DestructDict;
|
||||
|
||||
private IDictionary<string, string> _craftDict;
|
||||
|
||||
public Action OnCardSell;
|
||||
|
||||
public Action<int> OnCardSellId;
|
||||
|
||||
public Action OnCardBuy;
|
||||
|
||||
public Action OnClose;
|
||||
|
||||
private Action _onFinishCardDestruct;
|
||||
|
||||
public void StartCardDestruct(int cardId)
|
||||
{
|
||||
if (DestructDict == null)
|
||||
{
|
||||
DestructDict = new Dictionary<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
DestructDict.Clear();
|
||||
}
|
||||
int possessionCardNum = GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard: false);
|
||||
DestructDict = new Dictionary<string, string>();
|
||||
DestructDict.Add(cardId.ToString(), "1," + possessionCardNum);
|
||||
DestructCard();
|
||||
}
|
||||
|
||||
private void DestructCard()
|
||||
{
|
||||
CardDestructTask cardDestructTask = GameMgr.GetIns().GetCardDestructTask();
|
||||
cardDestructTask.SetParameter(DestructDict);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(cardDestructTask, OnRequestFinishDestruct, OnError, OnError));
|
||||
}
|
||||
|
||||
private void OnRequestFinishDestruct(NetworkTask.ResultCode error)
|
||||
{
|
||||
TriggerUpdateUserDeck();
|
||||
if (_onFinishCardDestruct != null)
|
||||
{
|
||||
_onFinishCardDestruct();
|
||||
}
|
||||
}
|
||||
|
||||
private void TriggerUpdateUserDeck()
|
||||
{
|
||||
List<string> list = new List<string>(DestructDict.Keys);
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
int obj = int.Parse(list[i]);
|
||||
if (OnCardSellId != null)
|
||||
{
|
||||
OnCardSellId(obj);
|
||||
}
|
||||
}
|
||||
if (OnCardSell != null)
|
||||
{
|
||||
OnCardSell();
|
||||
}
|
||||
if (OnClose != null)
|
||||
{
|
||||
OnClose();
|
||||
}
|
||||
list = null;
|
||||
}
|
||||
|
||||
public void StartCardCraft(int cardId)
|
||||
{
|
||||
if (_craftDict == null)
|
||||
{
|
||||
_craftDict = new Dictionary<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_craftDict.Clear();
|
||||
}
|
||||
int possessionCardNum = GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard: false);
|
||||
_craftDict.Add(cardId.ToString(), $"{1},{possessionCardNum}");
|
||||
CraftCard();
|
||||
}
|
||||
|
||||
private void CraftCard()
|
||||
{
|
||||
CardCreateTask cardCreateTask = GameMgr.GetIns().GetCardCreateTask();
|
||||
cardCreateTask.SetParameter(_craftDict);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(cardCreateTask, OnRequestFinishCraft, OnError, OnError));
|
||||
}
|
||||
|
||||
private void OnRequestFinishCraft(NetworkTask.ResultCode error)
|
||||
{
|
||||
if (OnCardBuy != null)
|
||||
{
|
||||
OnCardBuy();
|
||||
}
|
||||
if (OnClose != null)
|
||||
{
|
||||
OnClose();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartDestructAll(IDictionary<string, string> destructDict, Action onFinishCallBack = null)
|
||||
{
|
||||
_onFinishCardDestruct = onFinishCallBack;
|
||||
DestructDict = destructDict;
|
||||
if (DestructDict.Count > 0)
|
||||
{
|
||||
DestructCard();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartDestructAll(IDictionary<int, int> destructDict, Action callback = null)
|
||||
{
|
||||
Dictionary<string, string> dictionary = new Dictionary<string, string>();
|
||||
foreach (KeyValuePair<int, int> item in destructDict)
|
||||
{
|
||||
string value = CreateRequestParam(item.Key, item.Value);
|
||||
dictionary.Add(item.Key.ToString(), value);
|
||||
}
|
||||
StartDestructAll(dictionary, callback);
|
||||
}
|
||||
|
||||
public void StartCraftAll(IDictionary<int, int> craftDict)
|
||||
{
|
||||
if (_craftDict == null)
|
||||
{
|
||||
_craftDict = new Dictionary<string, string>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_craftDict.Clear();
|
||||
}
|
||||
foreach (KeyValuePair<int, int> item in craftDict)
|
||||
{
|
||||
if (item.Value > 0)
|
||||
{
|
||||
string value = CreateRequestParam(item.Key, item.Value);
|
||||
_craftDict.Add(item.Key.ToString(), value);
|
||||
}
|
||||
}
|
||||
if (_craftDict.Count > 0)
|
||||
{
|
||||
CraftCard();
|
||||
}
|
||||
}
|
||||
|
||||
private string CreateRequestParam(int cardId, int num)
|
||||
{
|
||||
int possessionCardNum = GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard: false);
|
||||
return $"{num},{possessionCardNum}";
|
||||
}
|
||||
|
||||
private void OnError(NetworkTask.ResultCode code)
|
||||
{
|
||||
OnClose.Call();
|
||||
}
|
||||
|
||||
private void OnError(int code)
|
||||
{
|
||||
OnClose.Call();
|
||||
}
|
||||
}
|
||||
21
SVSim.BattleEngine/Engine/CardPanelMaintenancePlate.cs
Normal file
21
SVSim.BattleEngine/Engine/CardPanelMaintenancePlate.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class CardPanelMaintenancePlate : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private UISprite _sprite;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _label;
|
||||
|
||||
public void SetDepth(int depth)
|
||||
{
|
||||
_sprite.depth = depth;
|
||||
_label.depth = depth + 1;
|
||||
}
|
||||
|
||||
public void SetText(string text)
|
||||
{
|
||||
_label.text = text;
|
||||
}
|
||||
}
|
||||
210
SVSim.BattleEngine/Engine/CardSelectListUI_Positioning.cs
Normal file
210
SVSim.BattleEngine/Engine/CardSelectListUI_Positioning.cs
Normal file
@@ -0,0 +1,210 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CardSelectListUI_Positioning : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private List<GameObject> m_objList = new List<GameObject>();
|
||||
|
||||
[SerializeField]
|
||||
private Vector3 m_offset = Vector3.zero;
|
||||
|
||||
[SerializeField]
|
||||
private Vector3 m_lineDirection = Vector3.down;
|
||||
|
||||
[SerializeField]
|
||||
private float m_lineWidth = 170f;
|
||||
|
||||
[SerializeField]
|
||||
private Vector3 m_breakDirection = Vector3.right;
|
||||
|
||||
[SerializeField]
|
||||
private float m_breakHeight = 130f;
|
||||
|
||||
[SerializeField]
|
||||
private float m_breakNum = 2f;
|
||||
|
||||
[SerializeField]
|
||||
private float m_speed = 0.2f;
|
||||
|
||||
private float m_prog;
|
||||
|
||||
public Vector3 Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_offset = value;
|
||||
StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 LineDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_lineDirection;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_lineDirection = value;
|
||||
StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
public float LineWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_lineWidth;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_lineWidth = value;
|
||||
StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 BreakDirection
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_breakDirection;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_breakDirection = value;
|
||||
StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
public float BreakWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_breakHeight;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_breakHeight = value;
|
||||
StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
public int BreakNum
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)m_breakNum;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_breakNum = value;
|
||||
StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
public float Speed
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_speed;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_speed = value;
|
||||
StartAnim();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsMoving => m_prog < 0.95f;
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_objList.Clear();
|
||||
}
|
||||
|
||||
public void Add(GameObject[] addList)
|
||||
{
|
||||
int num = m_objList.Count;
|
||||
if (num == 0)
|
||||
{
|
||||
m_objList.AddRange(addList);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = addList.Length;
|
||||
int i = 0;
|
||||
int num3 = 0;
|
||||
while (num3 < num && i < num2)
|
||||
{
|
||||
int num4 = 0;
|
||||
while (i < num2 && m_objList[num3] != addList[i])
|
||||
{
|
||||
m_objList.Insert(num3, addList[i]);
|
||||
}
|
||||
i++;
|
||||
num3 += num4;
|
||||
num += num4;
|
||||
num3++;
|
||||
}
|
||||
for (; i < num2; i++)
|
||||
{
|
||||
m_objList.Add(addList[i]);
|
||||
}
|
||||
}
|
||||
StartAnim();
|
||||
}
|
||||
|
||||
public void Change(GameObject[] addList)
|
||||
{
|
||||
m_objList.Clear();
|
||||
m_objList.AddRange(addList);
|
||||
StartAnim();
|
||||
}
|
||||
|
||||
public void Immediate()
|
||||
{
|
||||
float speed = m_speed;
|
||||
m_speed = 1f;
|
||||
Update_Anim();
|
||||
m_speed = speed;
|
||||
}
|
||||
|
||||
public Vector3 GetPositionAtIndex(int idx)
|
||||
{
|
||||
int num = idx % (int)m_breakNum;
|
||||
int num2 = idx / (int)m_breakNum;
|
||||
float num3 = m_lineWidth * (float)num;
|
||||
float num4 = m_breakHeight * (float)num2;
|
||||
return m_offset + m_lineDirection * num3 + m_breakDirection * num4;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
Update_Anim();
|
||||
}
|
||||
|
||||
private void Update_Anim()
|
||||
{
|
||||
m_prog += (1f - m_prog) * m_speed;
|
||||
int count = m_objList.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (!(m_objList[i] == null))
|
||||
{
|
||||
Vector3 localPosition = m_objList[i].transform.localPosition;
|
||||
Vector3 vector = (GetPositionAtIndex(i) - localPosition) * m_speed;
|
||||
m_objList[i].transform.localPosition = localPosition + vector;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartAnim()
|
||||
{
|
||||
m_prog = 0f;
|
||||
}
|
||||
}
|
||||
39
SVSim.BattleEngine/Engine/CardShaderDefine.cs
Normal file
39
SVSim.BattleEngine/Engine/CardShaderDefine.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public static class CardShaderDefine
|
||||
{
|
||||
public const string CARD_SHADER_DEFAULT = "Wizard/Card/Basic_Front0_Back0_Normal";
|
||||
|
||||
public const string CARD_SHADER_FOIL = "Wizard/VariantCardShader";
|
||||
|
||||
public static void ReplaceShader(Material mat)
|
||||
{
|
||||
if (!(mat == null))
|
||||
{
|
||||
if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_FOIL_CARD_ANIMATION))
|
||||
{
|
||||
mat.shader = Shader.Find(mat.shader.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.shader = Shader.Find("Wizard/Card/Basic_Front0_Back0_Normal");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ReplaceBaseShader(Material mat, bool isFoil)
|
||||
{
|
||||
if (!(mat == null))
|
||||
{
|
||||
if (isFoil && mat.shader.name != "Wizard/VariantCardShader")
|
||||
{
|
||||
mat.shader = Shader.Find("Wizard/VariantCardShader");
|
||||
}
|
||||
else
|
||||
{
|
||||
mat.shader = Shader.Find(mat.shader.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
182
SVSim.BattleEngine/Engine/CastleField.cs
Normal file
182
SVSim.BattleEngine/Engine/CastleField.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CastleField : BackGroundBase
|
||||
{
|
||||
public override int FieldId => 2;
|
||||
|
||||
public CastleField(string bgmId = "NONE")
|
||||
: base(bgmId)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void BattleFieldBuild()
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate
|
||||
{
|
||||
base.Field = GameObject.Find(_str3DFieldPath);
|
||||
base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform;
|
||||
GimicAudioList = base.Field.GetComponent<AudioList>().GimicAudioList;
|
||||
_fieldModel = base.Field.transform.Find("md_bf_ocsl_root").gameObject;
|
||||
_fieldParticles = _fieldModel.transform.Find("Particles02").gameObject;
|
||||
_fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles);
|
||||
_fieldObjDictionary.Add("coffin", _fieldModel.transform.Find("md_bf_ocsl_01_coffin").gameObject);
|
||||
_fieldObjDictionary.Add("sword", _fieldModel.transform.Find("md_bf_ocsl_01_sword").gameObject);
|
||||
_fieldObjDictionary.Add("tapestry_a", _fieldModel.transform.Find("md_bf_ocsl_01_tapestry_a").gameObject);
|
||||
_fieldObjDictionary.Add("tapestry_b", _fieldModel.transform.Find("md_bf_ocsl_01_tapestry_b").gameObject);
|
||||
_fieldObjDictionary.Add("chain_a", _fieldModel.transform.Find("md_bf_ocsl_01_chain_a").gameObject);
|
||||
_fieldObjDictionary.Add("chain_b", _fieldModel.transform.Find("md_bf_ocsl_01_chain_b").gameObject);
|
||||
_fieldObjDictionary.Add("chain_c", _fieldModel.transform.Find("md_bf_ocsl_01_chain_c").gameObject);
|
||||
_fieldObjDictionary.Add("chain_d", _fieldModel.transform.Find("md_bf_ocsl_01_chain_d").gameObject);
|
||||
_fieldObjDictionary.Add("chain_e", _fieldModel.transform.Find("md_bf_ocsl_01_chain_e").gameObject);
|
||||
_fieldObjDictionary.Add("grate", _fieldModel.transform.Find("md_bf_ocsl_01_grate").gameObject);
|
||||
m_FieldAnimatorDictionary.Add("coffin", _fieldObjDictionary["coffin"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("sword", _fieldObjDictionary["sword"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("tapestry_a", _fieldObjDictionary["tapestry_a"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("tapestry_b", _fieldObjDictionary["tapestry_b"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("chain_a", _fieldObjDictionary["chain_a"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("chain_b", _fieldObjDictionary["chain_b"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("chain_c", _fieldObjDictionary["chain_c"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("chain_d", _fieldObjDictionary["chain_d"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("chain_e", _fieldObjDictionary["chain_e"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("grate", _fieldObjDictionary["grate"].GetComponent<Animator>());
|
||||
_fieldParticleSystemDictionary.Add("opening", _fieldParticles.transform.Find("opening").GetComponent<ParticleSystem>());
|
||||
_fieldParticleSystemDictionary.Add("coffin_open", _fieldParticles.transform.Find("coffin_open").GetComponent<ParticleSystem>());
|
||||
_fieldParticleSystemDictionary.Add("coffin_close", _fieldParticles.transform.Find("coffin_close").GetComponent<ParticleSystem>());
|
||||
_fieldParticleSystemDictionary.Add("coffin_gimic_1", _fieldParticles.transform.Find("coffin_gimic_1").GetComponent<ParticleSystem>());
|
||||
_fieldParticleSystemDictionary.Add("coffin_gimic_2", _fieldParticles.transform.Find("coffin_gimic_2").GetComponent<ParticleSystem>());
|
||||
_fieldParticleSystemDictionary.Add("fog", _fieldParticles.transform.Find("fog").GetComponent<ParticleSystem>());
|
||||
_fieldParticleSystemDictionary.Add("candle", _fieldParticles.transform.Find("candle").GetComponent<ParticleSystem>());
|
||||
List<string> list = new List<string>(_fieldObjDictionary.Keys);
|
||||
List<GameObject> list2 = new List<GameObject>();
|
||||
for (int i = 0; i < _fieldObjDictionary.Count; i++)
|
||||
{
|
||||
list2.Add(_fieldObjDictionary[list[i]]);
|
||||
}
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate
|
||||
{
|
||||
base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent<SetShaderGlobalColorBG>();
|
||||
base.IsLoadDone = true;
|
||||
}, isBattle: true, isField: true);
|
||||
}));
|
||||
}
|
||||
|
||||
public override void StartFieldSetEffect(Vector3 pos)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_2, pos);
|
||||
}
|
||||
|
||||
public override void StartFieldTapEffect(int areaId, Vector3 pos)
|
||||
{
|
||||
base.StartFieldTapEffect(areaId, pos);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_2_1, pos);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldOpening()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
m_FieldAnimatorDictionary["tapestry_a"].speed = 0.4f + Random.value * 0.2f;
|
||||
m_FieldAnimatorDictionary["tapestry_b"].speed = 0.4f + Random.value * 0.2f;
|
||||
_fieldParticleSystemDictionary["opening"].Play();
|
||||
_fieldParticleSystemDictionary["fog"].gameObject.SetActive(value: false);
|
||||
_fieldParticleSystemDictionary["candle"].gameObject.SetActive(value: false);
|
||||
m_RandomActionTime = 20f;
|
||||
_battleCamera.Camera.transform.localPosition = new Vector3(2550f, -830f, -200f);
|
||||
_battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-19f, -90f, 90f));
|
||||
Vector3[] bezierQuad = MotionUtils.GetBezierQuad(new Vector3(2550f, -830f, -200f), new Vector3(840f, -250f, -200f), new Vector3(-240f, -190f, -70f), 10);
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("path", bezierQuad, "movetopath", false, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-37f, -117f, 107f), "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
yield return new WaitForSeconds(0.6f);
|
||||
m_FieldAnimatorDictionary["grate"].SetTrigger("Open");
|
||||
_fieldParticleSystemDictionary["candle"].gameObject.SetActive(value: true);
|
||||
yield return new WaitForSeconds(1.4f);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT);
|
||||
m_FieldAnimatorDictionary["grate"].SetTrigger("Close");
|
||||
_fieldParticleSystemDictionary["fog"].gameObject.SetActive(value: true);
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo));
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldGimic(GameObject obj)
|
||||
{
|
||||
string tag = obj.tag;
|
||||
if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0)
|
||||
{
|
||||
_gimicCntDictionary[obj.tag]++;
|
||||
int num = Random.Range(1, 3);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
switch (num)
|
||||
{
|
||||
case 1:
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[0], "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[1], "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[2], "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
m_FieldAnimatorDictionary["coffin"].SetTrigger("Open");
|
||||
m_FieldAnimatorDictionary["sword"].SetTrigger("Open");
|
||||
_fieldParticleSystemDictionary["coffin_open"].Play();
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
_fieldParticleSystemDictionary["coffin_gimic_1"].Play();
|
||||
yield return new WaitForSeconds(2.5f);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[4], "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
m_FieldAnimatorDictionary["coffin"].SetTrigger("Close");
|
||||
yield return new WaitForSeconds(1f);
|
||||
m_FieldAnimatorDictionary["sword"].SetTrigger("Close");
|
||||
yield return new WaitForSeconds(1f);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[6], "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
_fieldParticleSystemDictionary["coffin_close"].Play();
|
||||
yield return new WaitForSeconds(1f);
|
||||
break;
|
||||
case 2:
|
||||
m_FieldAnimatorDictionary["coffin"].SetTrigger("Act");
|
||||
m_FieldAnimatorDictionary["sword"].SetTrigger("Act");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
break;
|
||||
}
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr(GimicAudioList[5], "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
_gimicCntDictionary[obj.tag] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldShake()
|
||||
{
|
||||
m_FieldAnimatorDictionary["chain_a"].speed = 0.8f + Random.value * 0.4f;
|
||||
m_FieldAnimatorDictionary["chain_b"].speed = 0.8f + Random.value * 0.4f;
|
||||
m_FieldAnimatorDictionary["chain_c"].speed = 0.8f + Random.value * 0.4f;
|
||||
m_FieldAnimatorDictionary["chain_d"].speed = 0.8f + Random.value * 0.4f;
|
||||
m_FieldAnimatorDictionary["chain_e"].speed = 0.8f + Random.value * 0.4f;
|
||||
m_FieldAnimatorDictionary["chain_a"].SetTrigger("Shake");
|
||||
m_FieldAnimatorDictionary["chain_b"].SetTrigger("Shake");
|
||||
m_FieldAnimatorDictionary["chain_c"].SetTrigger("Shake");
|
||||
m_FieldAnimatorDictionary["chain_d"].SetTrigger("Shake");
|
||||
m_FieldAnimatorDictionary["chain_e"].SetTrigger("Shake");
|
||||
m_FieldAnimatorDictionary["tapestry_a"].speed = 0.8f + Random.value * 0.4f;
|
||||
m_FieldAnimatorDictionary["tapestry_b"].speed = 0.8f + Random.value * 0.4f;
|
||||
m_FieldAnimatorDictionary["tapestry_a"].SetTrigger("Shake");
|
||||
m_FieldAnimatorDictionary["tapestry_b"].SetTrigger("Shake");
|
||||
if (_gimicCntDictionary["FieldGimic1"] == 0)
|
||||
{
|
||||
m_FieldAnimatorDictionary["coffin"].SetTrigger("Shake");
|
||||
m_FieldAnimatorDictionary["sword"].SetTrigger("Shake");
|
||||
}
|
||||
yield return new WaitForSeconds(3f);
|
||||
m_FieldAnimatorDictionary["tapestry_a"].speed = 0.4f + Random.value * 0.2f;
|
||||
m_FieldAnimatorDictionary["tapestry_b"].speed = 0.4f + Random.value * 0.2f;
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
public override void UpdateFieldRandom()
|
||||
{
|
||||
if (IsFieldRandom)
|
||||
{
|
||||
m_RandomActionTime -= Time.deltaTime;
|
||||
if (m_RandomActionTime <= 0f)
|
||||
{
|
||||
m_FieldAnimatorDictionary["tapestry_a"].SetTrigger("LoopRandom");
|
||||
m_FieldAnimatorDictionary["tapestry_b"].SetTrigger("LoopRandom");
|
||||
m_RandomActionTime = Random.value * 20f + 20f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
SVSim.BattleEngine/Engine/ChallengeConfig.cs
Normal file
6
SVSim.BattleEngine/Engine/ChallengeConfig.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
public class ChallengeConfig
|
||||
{
|
||||
public bool UseTwoPickPremiumCard { get; set; }
|
||||
|
||||
public long TwoPickSleeveId { get; set; }
|
||||
}
|
||||
43
SVSim.BattleEngine/Engine/ChallengeData.cs
Normal file
43
SVSim.BattleEngine/Engine/ChallengeData.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using LitJson;
|
||||
using Wizard;
|
||||
|
||||
public class ChallengeData
|
||||
{
|
||||
public TwoPickFormat TwoPickFormat { get; private set; }
|
||||
|
||||
public string CardPoolName { get; private set; }
|
||||
|
||||
public string CardPoolUrl { get; private set; } = string.Empty;
|
||||
|
||||
public string AnnounceId { get; private set; }
|
||||
|
||||
public string StartTime { get; private set; }
|
||||
|
||||
public string EndTime { get; private set; }
|
||||
|
||||
public int LatestCardPackId { get; private set; }
|
||||
|
||||
public int ChaosNum { get; private set; }
|
||||
|
||||
public ChallengeData(JsonData forMatIndoJson)
|
||||
{
|
||||
TwoPickFormat = (TwoPickFormat)forMatIndoJson["two_pick_type"].ToInt();
|
||||
CardPoolName = forMatIndoJson["card_pool_name"].ToString();
|
||||
if (forMatIndoJson.TryGetValue("card_pool_url", out var value))
|
||||
{
|
||||
CardPoolUrl = value.ToString();
|
||||
}
|
||||
AnnounceId = forMatIndoJson["announce_id"].ToString();
|
||||
StartTime = ConvertTime.ToLocal(DateTime.Parse(forMatIndoJson["start_time"].ToString()));
|
||||
EndTime = ConvertTime.ToLocal(DateTime.Parse(forMatIndoJson["end_time"].ToString()));
|
||||
if (forMatIndoJson.TryGetValue("last_card_pack_set_id", out var value2))
|
||||
{
|
||||
LatestCardPackId = value2.ToInt();
|
||||
}
|
||||
if (forMatIndoJson.TryGetValue("strategy_pick_num", out var value3))
|
||||
{
|
||||
ChaosNum = value3.ToInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
52
SVSim.BattleEngine/Engine/ChangeAffiliationVfx.cs
Normal file
52
SVSim.BattleEngine/Engine/ChangeAffiliationVfx.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class ChangeAffiliationVfx : SequentialVfxPlayer
|
||||
{
|
||||
private readonly IBattleCardView _view;
|
||||
|
||||
public ChangeAffiliationVfx(BattleCardBase card, CardBasePrm.ClanType clan)
|
||||
{
|
||||
ChangeAffiliationVfx changeAffiliationVfx = this;
|
||||
GameObject effectGameObject = null;
|
||||
_view = card.BattleCardView;
|
||||
if ((card.IsPlayer || GameMgr.GetIns().IsAdminWatch || !card.IsInHand) && clan != CardBasePrm.ClanType.NONE)
|
||||
{
|
||||
Register(new WaitLoadEffectAndSetSeVfx("cmn_card_classchange_1", "se_cmn_card_classchange_1", delegate(GameObject e)
|
||||
{
|
||||
effectGameObject = e;
|
||||
}));
|
||||
Register(new PlayEffectAndSeVfx(delegate
|
||||
{
|
||||
effectGameObject.GetComponent<Effect>().ChangeParticleColor(changeAffiliationVfx.GetClanColor(clan));
|
||||
return effectGameObject;
|
||||
}, _view.Transform));
|
||||
Register(WaitVfx.Create(0.3f));
|
||||
}
|
||||
}
|
||||
|
||||
private VfxBase ChangeEffectColor(Effect effect, Color color)
|
||||
{
|
||||
return InstantVfx.Create(delegate
|
||||
{
|
||||
effect.ChangeParticleColor(color);
|
||||
});
|
||||
}
|
||||
|
||||
private Color GetClanColor(CardBasePrm.ClanType clan)
|
||||
{
|
||||
return clan switch
|
||||
{
|
||||
CardBasePrm.ClanType.ALL => Color.white,
|
||||
CardBasePrm.ClanType.MIN => new Color(0.2f, 1f, 0.8f),
|
||||
CardBasePrm.ClanType.ROYAL => new Color(1f, 0.9f, 0.5f),
|
||||
CardBasePrm.ClanType.WITCH => new Color(0.7f, 0.5f, 1f),
|
||||
CardBasePrm.ClanType.DRAGON => new Color(1f, 0.5f, 0f),
|
||||
CardBasePrm.ClanType.NECRO => new Color(0.5f, 0.4f, 1f),
|
||||
CardBasePrm.ClanType.VAMPIRE => new Color(1f, 0.2f, 0.2f),
|
||||
CardBasePrm.ClanType.BISHOP => new Color(0.5f, 0.7f, 1f),
|
||||
_ => Color.white,
|
||||
};
|
||||
}
|
||||
}
|
||||
21
SVSim.BattleEngine/Engine/ChantCountAddModifier.cs
Normal file
21
SVSim.BattleEngine/Engine/ChantCountAddModifier.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
public class ChantCountAddModifier : ICardChantCountModifier
|
||||
{
|
||||
public int ChantCount { get; private set; }
|
||||
|
||||
public bool IsClearBeforeModifier => false;
|
||||
|
||||
public ChantCountAddModifier(int chantCount)
|
||||
{
|
||||
ChantCount = chantCount;
|
||||
}
|
||||
|
||||
public int CalcChantCount(int chantCount)
|
||||
{
|
||||
return chantCount + ChantCount;
|
||||
}
|
||||
|
||||
public ICardChantCountModifier Clone()
|
||||
{
|
||||
return new ChantCountAddModifier(ChantCount);
|
||||
}
|
||||
}
|
||||
21
SVSim.BattleEngine/Engine/ChantCountSetModifier.cs
Normal file
21
SVSim.BattleEngine/Engine/ChantCountSetModifier.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
public class ChantCountSetModifier : ICardChantCountModifier
|
||||
{
|
||||
public readonly int ChantCount;
|
||||
|
||||
public bool IsClearBeforeModifier => true;
|
||||
|
||||
public ChantCountSetModifier(int chantCount)
|
||||
{
|
||||
ChantCount = chantCount;
|
||||
}
|
||||
|
||||
public int CalcChantCount(int chantCount)
|
||||
{
|
||||
return ChantCount;
|
||||
}
|
||||
|
||||
public ICardChantCountModifier Clone()
|
||||
{
|
||||
return new ChantCountSetModifier(ChantCount);
|
||||
}
|
||||
}
|
||||
120
SVSim.BattleEngine/Engine/ChantFieldBattleCard.cs
Normal file
120
SVSim.BattleEngine/Engine/ChantFieldBattleCard.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using Wizard;
|
||||
using Wizard.Battle.Card;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public class ChantFieldBattleCard : FieldBattleCard
|
||||
{
|
||||
protected readonly int _baseChantCount;
|
||||
|
||||
public override bool IsChantField => true;
|
||||
|
||||
public ChantFieldBattleCard(BuildInfo buildInfo)
|
||||
: base(buildInfo)
|
||||
{
|
||||
_baseChantCount = base.BaseParameter.ChantCount;
|
||||
AddChantSkill(buildInfo);
|
||||
}
|
||||
|
||||
public void AddChantSkill(BuildInfo buildInfo)
|
||||
{
|
||||
if (!_normalSkillCollection.HaveNotAttachedResidentChantCountChangeSkill())
|
||||
{
|
||||
SkillBase skillBase = CreateSkillCreator(buildInfo.SelfBattlePlayer, buildInfo.OpponentBattlePlayer, buildInfo.ResourceMgr).Create(ChantSkillInfoCreate());
|
||||
SetChantSkill(skillBase);
|
||||
_normalSkillCollection.Add(skillBase);
|
||||
}
|
||||
}
|
||||
|
||||
public override void FlagCardAsDestroyedBySkill()
|
||||
{
|
||||
base.IsDestroyedBySkill = true;
|
||||
base.DeathTypeInfo.ChantDestroy = true;
|
||||
}
|
||||
|
||||
public override VfxBase SetUpInplay()
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
parallelVfxPlayer.Register(base.SetUpInplay());
|
||||
parallelVfxPlayer.Register(new ShowChantCountVfx(this, base.ChantCount, base.SelfBattlePlayer.BattleMgr.BattleResourceMgr));
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
protected override void InitSkillApplyInformationOnWhenReturn()
|
||||
{
|
||||
base.SkillApplyInformation.InitializeInformation(isReturnCard: true);
|
||||
base.SkillApplyInformation.ClearParameterModifier();
|
||||
ClearCostModifier();
|
||||
base.TransformInfo = default(TransformInformation);
|
||||
base.SkillApplyInformation.AttachedSkillsInfo.Clear();
|
||||
_normalSkillCollection.Clear();
|
||||
_evolveSkillCollection.Clear();
|
||||
SkillCreator.CardSkillsBuildInfo cardSkillsBuildInfo = SkillCreator.CreateBuildInfo(CardMaster.GetInstanceForBattle().GetCardParameterFromId(base.CardId));
|
||||
foreach (SkillBase item in CreateSkillCondition(cardSkillsBuildInfo.normalSkillBuildInfos, base.SelfBattlePlayer, base.OpponentBattlePlayer, _buildInfo.ResourceMgr))
|
||||
{
|
||||
_normalSkillCollection.Add(item);
|
||||
item.SetInductionVoiceIndex();
|
||||
}
|
||||
foreach (SkillBase item2 in CreateSkillCondition(cardSkillsBuildInfo.evolveSkillBuildInfos, base.SelfBattlePlayer, base.OpponentBattlePlayer, _buildInfo.ResourceMgr))
|
||||
{
|
||||
_evolveSkillCollection.Add(item2);
|
||||
item2.SetInductionVoiceIndex();
|
||||
}
|
||||
AddChantSkill(_buildInfo);
|
||||
base.Skills = _normalSkillCollection;
|
||||
base.Skills.Complete();
|
||||
}
|
||||
|
||||
public override VfxBase ReturnCard(SkillProcessor skillProcessor)
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(base.SkillApplyInformation.AllSkillEffectStop());
|
||||
InitializeParameterOnWhenReturn();
|
||||
VfxBase vfx = base.ReturnCard(skillProcessor);
|
||||
sequentialVfxPlayer.Register(vfx);
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase RecoveryInPlay(int inPlayIndex, bool newReplayMoveTurn = false)
|
||||
{
|
||||
return ParallelVfxPlayer.Create(base.RecoveryInPlay(inPlayIndex, newReplayMoveTurn), new ShowChantCountVfx(this, base.ChantCount, _buildInfo.ResourceMgr));
|
||||
}
|
||||
|
||||
public override BattleCardBase VirtualClone(BattlePlayerBase virtualSelfBattlePlayer, BattlePlayerBase virtualOpponentBattlePlayer)
|
||||
{
|
||||
VirtualChantFieldBattleCard virtualChantFieldBattleCard = new VirtualChantFieldBattleCard(_buildInfo.VirtualClone(virtualSelfBattlePlayer, virtualOpponentBattlePlayer));
|
||||
CopyToVirtualCardBase(virtualChantFieldBattleCard);
|
||||
return virtualChantFieldBattleCard;
|
||||
}
|
||||
|
||||
public override VfxBase CombineVirtualCardSkill(BattleCardBase target)
|
||||
{
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
base.IsSkillLost = false;
|
||||
foreach (SkillBase item in CreateSkillCondition(target.GetBuildInfo.NormalSkillBuildInfos, base.SelfBattlePlayer, base.OpponentBattlePlayer, _buildInfo.ResourceMgr))
|
||||
{
|
||||
_normalSkillCollection.Add(item);
|
||||
}
|
||||
AddChantSkill(_buildInfo);
|
||||
base.Skills = _normalSkillCollection;
|
||||
base.SkillApplyInformation.Combine(target.SkillApplyInformation);
|
||||
int count = target.BuffInfoList.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
BuffInfo buffInfo = target.BuffInfoList[i];
|
||||
if (!(buffInfo.SkillFrom is Skill_powerup) && !(buffInfo.SkillFrom is Skill_power_down) && !base.BuffInfoList.Contains(buffInfo))
|
||||
{
|
||||
AddBuffInfo(buffInfo);
|
||||
}
|
||||
}
|
||||
base.Skills.Complete();
|
||||
CostModifierList.AddRange(target.CostModifierList);
|
||||
if (!base.SelfBattlePlayer.BattleMgr.IsVirtualBattle && !base.SelfBattlePlayer.BattleMgr.IsRecovery)
|
||||
{
|
||||
parallelVfxPlayer.Register(SequentialVfxPlayer.Create(base.SkillApplyInformation.AllSkillEffectRestart(), InstantVfx.Create(delegate
|
||||
{
|
||||
base.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect();
|
||||
}), base.BattleCardView.BattleCardIconAnimations.Initialize(this, base.Skills)));
|
||||
}
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
}
|
||||
28
SVSim.BattleEngine/Engine/CharIdx.cs
Normal file
28
SVSim.BattleEngine/Engine/CharIdx.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class CharIdx : MonoBehaviour
|
||||
{
|
||||
public int m_Idx { get; protected set; }
|
||||
|
||||
public int m_CardId { get; protected set; }
|
||||
|
||||
public void SetIdx(int idx)
|
||||
{
|
||||
m_Idx = idx;
|
||||
}
|
||||
|
||||
public int GetIdx()
|
||||
{
|
||||
return m_Idx;
|
||||
}
|
||||
|
||||
public void SetCardId(int cardid)
|
||||
{
|
||||
m_CardId = cardid;
|
||||
}
|
||||
|
||||
public int GetCardId()
|
||||
{
|
||||
return m_CardId;
|
||||
}
|
||||
}
|
||||
430
SVSim.BattleEngine/Engine/Charactor3dInformation.cs
Normal file
430
SVSim.BattleEngine/Engine/Charactor3dInformation.cs
Normal file
@@ -0,0 +1,430 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Wizard.Battle.Player.ClassCharacter;
|
||||
|
||||
public class Charactor3dInformation : MonoBehaviour
|
||||
{
|
||||
public GameObject[] Meshes;
|
||||
|
||||
public Material[] Materials;
|
||||
|
||||
public Animator[] Animators;
|
||||
|
||||
public Transform[] LeftEyeInfoObject;
|
||||
|
||||
public Transform[] RightEyeInfoObject;
|
||||
|
||||
public Effect3dInformation EffectInfo;
|
||||
|
||||
public Transform BodyNeck;
|
||||
|
||||
public Transform FaceNeck;
|
||||
|
||||
public Transform BodyHead;
|
||||
|
||||
public Transform FaceHead;
|
||||
|
||||
public Transform BodyHip;
|
||||
|
||||
public Transform TailHip;
|
||||
|
||||
public Transform BodyProp;
|
||||
|
||||
public Transform PropProp;
|
||||
|
||||
public GameObject Prop;
|
||||
|
||||
public Transform HeadAttach;
|
||||
|
||||
public Transform HeadCenterOffset;
|
||||
|
||||
public Transform HeadTubeCenterOffset;
|
||||
|
||||
public Transform HeadAttachR;
|
||||
|
||||
public Transform HeadAttachL;
|
||||
|
||||
private Material EyeMaterial;
|
||||
|
||||
private Material FaceSkinMaterial;
|
||||
|
||||
private Material HairMaterial;
|
||||
|
||||
private Material BodyMaterial;
|
||||
|
||||
public GameObject Quad;
|
||||
|
||||
private string _oldMotion = "";
|
||||
|
||||
private Class3dCharacterBase _characterBase;
|
||||
|
||||
private string _characterId = "";
|
||||
|
||||
private bool _isInitialized;
|
||||
|
||||
private bool _isLoadMesh;
|
||||
|
||||
private bool _isLoadedMesh;
|
||||
|
||||
public bool IsTestScene;
|
||||
|
||||
private List<Mesh> _meshList = new List<Mesh>();
|
||||
|
||||
private Class3dPostImageEffect _postEffect;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
string text = base.name;
|
||||
text = text.Replace("chr", "");
|
||||
_characterId = text.Replace("(Clone)", "");
|
||||
if (Prop != null)
|
||||
{
|
||||
Prop.SetActive(value: true);
|
||||
}
|
||||
if (!IsTestScene)
|
||||
{
|
||||
_isLoadMesh = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if ((_isLoadedMesh && !_isInitialized) || (IsTestScene && !_isInitialized))
|
||||
{
|
||||
Initialize();
|
||||
_isInitialized = true;
|
||||
}
|
||||
if (_isLoadMesh && !_isLoadedMesh)
|
||||
{
|
||||
InitializeMesh(_characterBase, _postEffect);
|
||||
_isLoadedMesh = true;
|
||||
}
|
||||
if (EyeMaterial != null)
|
||||
{
|
||||
Vector4[] values = new Vector4[3]
|
||||
{
|
||||
new Vector4(LeftEyeInfoObject[0].localPosition.x, LeftEyeInfoObject[0].localPosition.y, LeftEyeInfoObject[0].localPosition.z, LeftEyeInfoObject[0].localScale.x),
|
||||
new Vector4(LeftEyeInfoObject[1].localPosition.x, LeftEyeInfoObject[1].localPosition.y, LeftEyeInfoObject[1].localPosition.z, LeftEyeInfoObject[1].localScale.x),
|
||||
new Vector4(LeftEyeInfoObject[2].localPosition.x, LeftEyeInfoObject[2].localPosition.y, LeftEyeInfoObject[2].localPosition.z, LeftEyeInfoObject[2].localScale.x)
|
||||
};
|
||||
EyeMaterial.SetVectorArray("_HighParam1", values);
|
||||
Vector4[] values2 = new Vector4[2]
|
||||
{
|
||||
new Vector4(RightEyeInfoObject[0].localPosition.x, RightEyeInfoObject[0].localPosition.y, RightEyeInfoObject[0].localPosition.z, RightEyeInfoObject[0].localScale.x),
|
||||
new Vector4(RightEyeInfoObject[1].localPosition.x, RightEyeInfoObject[1].localPosition.y, RightEyeInfoObject[1].localPosition.z, RightEyeInfoObject[1].localScale.x)
|
||||
};
|
||||
EyeMaterial.SetVectorArray("_HighParam2", values2);
|
||||
}
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
SkinnedMeshRenderer[] componentsInChildren = GetComponentsInChildren<SkinnedMeshRenderer>();
|
||||
MeshRenderer meshRenderer = null;
|
||||
if (Prop != null)
|
||||
{
|
||||
MeshRenderer[] componentsInChildren2 = Prop.GetComponentsInChildren<MeshRenderer>();
|
||||
if (componentsInChildren2.Length != 0)
|
||||
{
|
||||
meshRenderer = componentsInChildren2[0];
|
||||
}
|
||||
}
|
||||
int num = 0;
|
||||
SkinnedMeshRenderer[] array = componentsInChildren;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
Material[] materials = array[i].materials;
|
||||
num += materials.Length;
|
||||
}
|
||||
num += ((meshRenderer != null) ? 1 : 0);
|
||||
Materials = new Material[num];
|
||||
int num2 = 0;
|
||||
array = componentsInChildren;
|
||||
foreach (SkinnedMeshRenderer skinnedMeshRenderer in array)
|
||||
{
|
||||
Material[] materials2 = skinnedMeshRenderer.materials;
|
||||
for (int j = 0; j < materials2.Length; j++)
|
||||
{
|
||||
skinnedMeshRenderer.sharedMaterials[j].shader = Shader.Find(materials2[j].shader.name);
|
||||
Materials[num2] = skinnedMeshRenderer.sharedMaterials[j];
|
||||
if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("face"))
|
||||
{
|
||||
FaceSkinMaterial = skinnedMeshRenderer.sharedMaterials[j];
|
||||
}
|
||||
if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("hair"))
|
||||
{
|
||||
HairMaterial = skinnedMeshRenderer.sharedMaterials[j];
|
||||
}
|
||||
if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("eye"))
|
||||
{
|
||||
EyeMaterial = skinnedMeshRenderer.sharedMaterials[j];
|
||||
}
|
||||
if (skinnedMeshRenderer.sharedMaterials[j].name.Contains("bdy"))
|
||||
{
|
||||
BodyMaterial = skinnedMeshRenderer.sharedMaterials[j];
|
||||
}
|
||||
num2++;
|
||||
}
|
||||
}
|
||||
if (meshRenderer != null)
|
||||
{
|
||||
meshRenderer.sharedMaterial.shader = Shader.Find(meshRenderer.sharedMaterial.shader.name);
|
||||
Materials[num2] = meshRenderer.sharedMaterial;
|
||||
}
|
||||
InitializeMaterials();
|
||||
EffectInfo = GetComponent<Effect3dInformation>();
|
||||
if (Prop != null)
|
||||
{
|
||||
Prop.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnApplicationFocus(bool focus)
|
||||
{
|
||||
if (focus)
|
||||
{
|
||||
InitializeMaterials();
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeMaterials()
|
||||
{
|
||||
Material[] materials = Materials;
|
||||
foreach (Material material in materials)
|
||||
{
|
||||
if (!(material == null))
|
||||
{
|
||||
material.SetColor("_GlobalToonColor", Color.white);
|
||||
material.SetColor("_GlobalRimColor", Color.white);
|
||||
material.SetFloat("_GlobalOutlineWidth", 1f);
|
||||
material.SetFloat("_GlobalOutlineOffset", 1f);
|
||||
material.SetColor("_Global_FogColor", new Color(0.76f, 1f, 1f, 1f));
|
||||
material.SetVector("_Global_FogMinDistance", Vector4.zero);
|
||||
material.SetVector("_Global_FogLength", new Vector4(1000f, 1000f, 1000f, 1000f));
|
||||
material.SetInt("_Global_MaxDensity", 1);
|
||||
material.SetFloat("_Global_MaxHeight", 100f);
|
||||
material.SetVector("_Global_FogWorld_Origin", Vector4.zero);
|
||||
material.SetColor("_LightColorWizard", Color.white);
|
||||
material.SetFloat("_RimStep", 0.5f);
|
||||
material.SetFloat("_RimStep2", 0.1f);
|
||||
material.SetFloat("_RimSpecRate", 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
AnimatorClipInfo[] currentAnimatorClipInfo = Animators[0].GetCurrentAnimatorClipInfo(0);
|
||||
if (currentAnimatorClipInfo != null && currentAnimatorClipInfo.Length != 0)
|
||||
{
|
||||
string text = currentAnimatorClipInfo[0].clip.name;
|
||||
foreach (ClassCharaPrm.MotionType value5 in Enum.GetValues(typeof(ClassCharaPrm.MotionType)))
|
||||
{
|
||||
if (text.Contains(value5.ToString()))
|
||||
{
|
||||
if (EffectInfo != null)
|
||||
{
|
||||
EffectInfo.UpdateInfo(value5);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Vector3 localScale = HeadAttach.localScale;
|
||||
Color value = new Color(localScale.x, localScale.y, localScale.z);
|
||||
Vector3 vector = HeadAttach.localRotation * Vector3.up;
|
||||
Material[] materials = Materials;
|
||||
foreach (Material material in materials)
|
||||
{
|
||||
if (!(material == null))
|
||||
{
|
||||
material.SetColor("_CharaColor", value);
|
||||
material.SetVector("_WorldSpaceLightPosWizard", vector);
|
||||
}
|
||||
}
|
||||
string value2 = ClassCharaPrm.MotionType.extra.ToString();
|
||||
if (_characterBase != null && _characterBase.IsPlayer)
|
||||
{
|
||||
if (text.Equals(value2) && !_oldMotion.Equals(value2))
|
||||
{
|
||||
_characterBase.EnableEvolve(enable: true);
|
||||
}
|
||||
else if (!text.Equals(value2) && _oldMotion.Equals(value2))
|
||||
{
|
||||
_characterBase.EnableEvolve(enable: false);
|
||||
}
|
||||
}
|
||||
if (_postEffect != null && text.Equals(value2))
|
||||
{
|
||||
AnimatorStateInfo currentAnimatorStateInfo = Animators[0].GetCurrentAnimatorStateInfo(0);
|
||||
float num = (float)currentAnimatorClipInfo.Length * currentAnimatorStateInfo.normalizedTime;
|
||||
int num2 = (int)(85f * num) + 1;
|
||||
if (_postEffect._param.FadeOutEndFrame <= num2)
|
||||
{
|
||||
_postEffect._param.DiffusionThreshold = _postEffect._param.EndDiffusionThreshold;
|
||||
}
|
||||
else if (_postEffect._param.FadeOutStartFrame <= num2)
|
||||
{
|
||||
float num3 = _postEffect._param.FadeOutEndFrame - _postEffect._param.FadeOutStartFrame;
|
||||
float t = 0f;
|
||||
if (num3 > 0f)
|
||||
{
|
||||
t = 1f / num3;
|
||||
}
|
||||
_postEffect._param.DiffusionThreshold = Mathf.Lerp(_postEffect._param.DiffusionThreshold, _postEffect._param.EndDiffusionThreshold, t);
|
||||
}
|
||||
else
|
||||
{
|
||||
_postEffect._param.DiffusionThreshold = _postEffect._param.DefaultDiffusionThreshold;
|
||||
}
|
||||
}
|
||||
if (text != _oldMotion && BodyMaterial != null)
|
||||
{
|
||||
if (text.Contains(ClassCharaPrm.MotionType.idle.ToString()))
|
||||
{
|
||||
BodyMaterial.renderQueue = 1999;
|
||||
}
|
||||
if ((_characterId == "3606" && text.Contains("extra_2")) || (_characterId == "3603" && (text.Contains("extra_2") || text.Contains("shock") || text == "positive")) || (_characterId == "3617" && text.Contains("nagative_2_a")))
|
||||
{
|
||||
BodyMaterial.renderQueue = 2001;
|
||||
}
|
||||
}
|
||||
if (Prop != null)
|
||||
{
|
||||
if (text.Equals(value2) && !_oldMotion.Equals(value2))
|
||||
{
|
||||
Prop.SetActive(value: true);
|
||||
}
|
||||
else if (!text.Equals(value2) && _oldMotion.Equals(value2))
|
||||
{
|
||||
Prop.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
_oldMotion = text;
|
||||
}
|
||||
if (HeadCenterOffset != null && FaceSkinMaterial != null)
|
||||
{
|
||||
Vector3 forward = BodyHead.forward;
|
||||
Vector3 up = BodyHead.up;
|
||||
Vector3 vector2 = BodyHead.position + up * HeadCenterOffset.localPosition.y + forward * HeadCenterOffset.localPosition.z;
|
||||
Vector3 vector3 = BodyHead.position + forward * HeadTubeCenterOffset.localPosition.z;
|
||||
FaceSkinMaterial.SetVector("_FaceCenterPos", vector3);
|
||||
HairMaterial.SetVector("_FaceCenterPos", vector2);
|
||||
EyeMaterial.SetVector("_FaceCenterPos", vector3);
|
||||
FaceSkinMaterial.SetVector("_FaceUp", up);
|
||||
HairMaterial.SetVector("_FaceUp", up);
|
||||
EyeMaterial.SetVector("_FaceUp", up);
|
||||
FaceSkinMaterial.SetVector("_FaceForward", forward);
|
||||
HairMaterial.SetVector("_FaceForward", forward);
|
||||
EyeMaterial.SetVector("_FaceForward", forward);
|
||||
if (HeadAttachR != null)
|
||||
{
|
||||
Material[] materials = Materials;
|
||||
foreach (Material material2 in materials)
|
||||
{
|
||||
if (!(material2 == null))
|
||||
{
|
||||
Vector3 localPosition = HeadAttachR.localPosition;
|
||||
material2.SetFloat("_RimStep", localPosition.x);
|
||||
material2.SetFloat("_RimFeather", localPosition.y);
|
||||
material2.SetFloat("_RimSpecRate", localPosition.z);
|
||||
if (material2.HasProperty("_RimColor"))
|
||||
{
|
||||
Color color = material2.GetColor("_RimColor");
|
||||
Vector3 localScale2 = HeadAttachR.localScale;
|
||||
Color value3 = new Color(localScale2.x, localScale2.y, localScale2.z, color.a);
|
||||
material2.SetColor("_RimColor", value3);
|
||||
}
|
||||
Vector3 localScale3 = HeadAttachL.localScale;
|
||||
Color value4 = new Color(localScale3.x, localScale3.y, localScale3.z, 0f);
|
||||
material2.SetColor("_ToonDarkColor", value4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateTransform(FaceNeck, BodyNeck);
|
||||
FaceHead.localPosition = BodyHead.localPosition;
|
||||
FaceHead.localRotation = BodyHead.localRotation;
|
||||
UpdateTransform(TailHip, BodyHip);
|
||||
if (Prop != null && Prop.activeSelf && BodyProp != null && PropProp != null)
|
||||
{
|
||||
UpdateTransform(PropProp, BodyProp);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateTransform(Transform face, Transform body)
|
||||
{
|
||||
face.position = body.position;
|
||||
face.localRotation = body.rotation;
|
||||
}
|
||||
|
||||
public void InitializeMesh(Class3dCharacterBase characterBase = null, Class3dPostImageEffect postEffect = null)
|
||||
{
|
||||
_characterBase = characterBase;
|
||||
_postEffect = postEffect;
|
||||
Mesh mesh = new Mesh();
|
||||
mesh.vertices = new Vector3[4]
|
||||
{
|
||||
new Vector3(-0.5f, -0.5f, 0f),
|
||||
new Vector3(-0.5f, 0.5f, 0f),
|
||||
new Vector3(0.5f, 0.5f, 0f),
|
||||
new Vector3(0.5f, -0.5f, 0f)
|
||||
};
|
||||
mesh.triangles = new int[6] { 0, 1, 3, 1, 2, 3 };
|
||||
mesh.uv = new Vector2[4]
|
||||
{
|
||||
new Vector2(0.65f, 0.39f),
|
||||
new Vector2(0.65f, 0.69f),
|
||||
new Vector2(0.35f, 0.69f),
|
||||
new Vector2(0.35f, 0.39f)
|
||||
};
|
||||
mesh.RecalculateBounds();
|
||||
mesh.RecalculateNormals();
|
||||
mesh.RecalculateTangents();
|
||||
Quad.GetComponent<MeshFilter>().mesh = mesh;
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
if (Materials != null)
|
||||
{
|
||||
for (int i = 0; i < Materials.Length; i++)
|
||||
{
|
||||
Material material = Materials[i];
|
||||
if (!(material == null))
|
||||
{
|
||||
UnityEngine.Object.Destroy(material);
|
||||
Materials[i] = null;
|
||||
}
|
||||
}
|
||||
Materials = null;
|
||||
}
|
||||
if (Quad != null)
|
||||
{
|
||||
if (Quad.GetComponent<MeshFilter>().mesh != null)
|
||||
{
|
||||
UnityEngine.Object.Destroy(Quad.GetComponent<MeshFilter>().mesh);
|
||||
Quad.GetComponent<MeshFilter>().mesh = null;
|
||||
}
|
||||
MeshRenderer component = Quad.GetComponent<MeshRenderer>();
|
||||
if (component != null && component.sharedMaterial != null)
|
||||
{
|
||||
RenderTexture renderTexture = component.sharedMaterial.mainTexture as RenderTexture;
|
||||
component.sharedMaterial.mainTexture = null;
|
||||
if (renderTexture != null)
|
||||
{
|
||||
renderTexture.Release();
|
||||
}
|
||||
UnityEngine.Object.Destroy(component.sharedMaterial);
|
||||
component.sharedMaterial = null;
|
||||
}
|
||||
UnityEngine.Object.Destroy(Quad);
|
||||
Quad = null;
|
||||
}
|
||||
if (_postEffect != null)
|
||||
{
|
||||
_postEffect.Destroy();
|
||||
_postEffect = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
110
SVSim.BattleEngine/Engine/ChateauField.cs
Normal file
110
SVSim.BattleEngine/Engine/ChateauField.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ChateauField : BackGroundBase
|
||||
{
|
||||
public override int FieldId => 6;
|
||||
|
||||
public ChateauField(string bgmId = "NONE")
|
||||
: base(bgmId)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void BattleFieldBuild()
|
||||
{
|
||||
BattleCoroutine.GetInstance().StartCoroutine(BackGroundBase.ObjectChecker(0.5f, _str3DFieldPath, delegate
|
||||
{
|
||||
base.Field = GameObject.Find(_str3DFieldPath);
|
||||
base.Field.transform.parent = GameMgr.GetIns().m_GameManagerObj.transform;
|
||||
GimicAudioList = base.Field.GetComponent<AudioList>().GimicAudioList;
|
||||
_fieldModel = base.Field.transform.Find("md_bf_hous_root").gameObject;
|
||||
_fieldParticles = _fieldModel.transform.Find("Particles06").gameObject;
|
||||
_fieldObjDictionary.Add(_fieldParticles.name, _fieldParticles);
|
||||
_fieldObjDictionary.Add("door", _fieldModel.transform.Find("md_bf_hous_01_door").gameObject);
|
||||
_fieldObjDictionary.Add("shelf_door", _fieldModel.transform.Find("md_bf_hous_01_shelf_door").gameObject);
|
||||
m_FieldAnimatorDictionary.Add("door", _fieldObjDictionary["door"].GetComponent<Animator>());
|
||||
m_FieldAnimatorDictionary.Add("shelf_door", _fieldObjDictionary["shelf_door"].GetComponent<Animator>());
|
||||
_fieldParticleSystemDictionary.Add("clock_gimic_1", _fieldParticles.transform.Find("clock_gimic_1").GetComponent<ParticleSystem>());
|
||||
_fieldParticleSystemDictionary.Add("clock_gimic_2", _fieldParticles.transform.Find("clock_gimic_2").GetComponent<ParticleSystem>());
|
||||
List<string> list = new List<string>(_fieldObjDictionary.Keys);
|
||||
List<GameObject> list2 = new List<GameObject>();
|
||||
for (int i = 0; i < _fieldObjDictionary.Count; i++)
|
||||
{
|
||||
list2.Add(_fieldObjDictionary[list[i]]);
|
||||
}
|
||||
GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list2, delegate
|
||||
{
|
||||
base.SetShaderGlobalColorBG = base.Field.transform.Find("SetMaterialColorBGManager").GetComponent<SetShaderGlobalColorBG>();
|
||||
base.IsLoadDone = true;
|
||||
}, isBattle: true, isField: true);
|
||||
}));
|
||||
}
|
||||
|
||||
public override void StartFieldSetEffect(Vector3 pos)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_SET_6, pos);
|
||||
}
|
||||
|
||||
public override void StartFieldTapEffect(int areaId, Vector3 pos)
|
||||
{
|
||||
base.StartFieldTapEffect(areaId, pos);
|
||||
switch (areaId)
|
||||
{
|
||||
case 1:
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_6_1, pos);
|
||||
break;
|
||||
case 2:
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_FIELD_TAP_6_2, pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldOpening()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_appear_1", "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
m_FieldAnimatorDictionary["door"].SetTrigger("Open");
|
||||
_battleCamera.Camera.transform.localPosition = new Vector3(-870f, -690f, -40f);
|
||||
_battleCamera.Camera.transform.localRotation = Quaternion.Euler(new Vector3(-37f, 90f, -90f));
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(10f, -10f, -100f), "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-35f, 105f, -100f), "time", 1.7f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeInOutQuad));
|
||||
yield return new WaitForSeconds(2f);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CAMERA_ZOOM_OUT);
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", new Vector3(0f, -20f, -200f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", new Vector3(-35f, 10f, -15f), "time", 1f, "islocal", true, "easetype", iTween.EaseType.easeInExpo));
|
||||
iTween.MoveTo(_battleCamera.Camera.gameObject, iTween.Hash("position", _battleCamera.BattleCameraPos, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.RotateTo(_battleCamera.Camera.gameObject, iTween.Hash("rotation", _battleCamera.BattleCameraRot, "time", 1f, "delay", 1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldGimic(GameObject obj)
|
||||
{
|
||||
string tag = obj.tag;
|
||||
if (tag != null && tag == "FieldGimic1" && _gimicCntDictionary[obj.tag] == 0)
|
||||
{
|
||||
_gimicCntDictionary[obj.tag]++;
|
||||
int num = Random.Range(1, 3);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySeByStr($"se_field_{_str3DFieldNo}_gim_{num}", "se_field_" + _str3DFieldNo, 0f, 0L);
|
||||
switch (num)
|
||||
{
|
||||
case 1:
|
||||
_fieldParticleSystemDictionary["clock_gimic_1"].Play();
|
||||
yield return new WaitForSeconds(5f);
|
||||
break;
|
||||
case 2:
|
||||
m_FieldAnimatorDictionary["shelf_door"].SetTrigger("Open");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
_fieldParticleSystemDictionary["clock_gimic_2"].Play();
|
||||
yield return new WaitForSeconds(5f);
|
||||
break;
|
||||
}
|
||||
_gimicCntDictionary[obj.tag] = 0;
|
||||
}
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
|
||||
protected override IEnumerator RunFieldShake()
|
||||
{
|
||||
yield return new WaitForSeconds(0f);
|
||||
}
|
||||
}
|
||||
339
SVSim.BattleEngine/Engine/Class3dPostImageEffect.cs
Normal file
339
SVSim.BattleEngine/Engine/Class3dPostImageEffect.cs
Normal file
@@ -0,0 +1,339 @@
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteInEditMode]
|
||||
public class Class3dPostImageEffect : MonoBehaviour
|
||||
{
|
||||
public int BLOOM_DIVIDER = 4;
|
||||
|
||||
public float BLOOM_WIDTHMOD = 0.5f;
|
||||
|
||||
private const int PASS_FASTBLOOM_DOWNSAMPLE = 1;
|
||||
|
||||
private const int PASS_FASTBLOOM_VERTICALBLUR = 2;
|
||||
|
||||
private const int PASS_FASTBLOOM_HORIZONTALBLUR = 3;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONBLOOM_VERTICALGAUSS = 0;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONBLOOM_HORIZONGAUSS = 1;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONBLOOM_BLOOM = 2;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONBLOOM_OVERLAY1 = 3;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONBLOOM_OVERLAY2 = 5;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_APPLYBG = 0;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_APPLYBGDEBUG = 1;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_COC2ALPHA = 2;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_DOWNSAMPLE = 3;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_FOGBLOOM = 4;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_BLOOMCOLOR = 5;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_VERTICALGAUSS = 6;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_HORIZONGAUSS = 7;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_BLOOM = 8;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_COCBG_RICH = 9;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_COCBGFG = 10;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY1 = 11;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY1_INVERSE = 12;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY2 = 13;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_OVERLAY2_INVERSE = 14;
|
||||
|
||||
private const int PASS_POSTDIFFUSIONDOFBLOOM_COCFG = 15;
|
||||
|
||||
private const float DOF_HEIGHT_BASE_SIZE_HORIZONTAL = 0.0034722222f;
|
||||
|
||||
private const float DOF_HEIGHT_BASE_SIZE_VERTICAL = 0.0010986328f;
|
||||
|
||||
private const float DIVIDE_SCREEN = 1f;
|
||||
|
||||
private const float DOFONEOVERBASESIZE = 0.001953125f;
|
||||
|
||||
private const float DOFBASESIZE = 512f;
|
||||
|
||||
private float _dofWidthOverHeight = 1.25f;
|
||||
|
||||
private float _dofHeightBaseSize = 0.0024414062f;
|
||||
|
||||
private int _rezworkWidth;
|
||||
|
||||
private int _rezworkHeight;
|
||||
|
||||
[SerializeField]
|
||||
public DofDiffusionBloomOverlayParam _param = new DofDiffusionBloomOverlayParam();
|
||||
|
||||
[SerializeField]
|
||||
private Material _postDiffusionBloomMaterial;
|
||||
|
||||
[SerializeField]
|
||||
private Material _postDiffusionDofBloomMaterial;
|
||||
|
||||
[SerializeField]
|
||||
private Material _fastBloomMaterial;
|
||||
|
||||
[Header("Antialiasing")]
|
||||
public bool EnableAntialiasing = true;
|
||||
|
||||
public float edgeThresholdMin = 0.05f;
|
||||
|
||||
public float edgeThreshold = 0.2f;
|
||||
|
||||
public float edgeshilhouette = 4f;
|
||||
|
||||
private Material antialiasingMaterial;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_postDiffusionDofBloomMaterial = (_postDiffusionBloomMaterial = new Material(Shader.Find("Class3D/ImageEffects/Rich/PostDiffusionDofBloom_Rich")));
|
||||
_fastBloomMaterial = new Material(Shader.Find("Class3D/ImageEffects/FastBloom"));
|
||||
Shader shader = Shader.Find("Hidden/FXAA III (Console)");
|
||||
if (shader != null && shader.isSupported)
|
||||
{
|
||||
antialiasingMaterial = new Material(shader);
|
||||
}
|
||||
_param.TargetCamera = GetComponent<Camera>();
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
if (_fastBloomMaterial != null)
|
||||
{
|
||||
Object.Destroy(_fastBloomMaterial);
|
||||
_fastBloomMaterial = null;
|
||||
}
|
||||
if (_postDiffusionBloomMaterial != null)
|
||||
{
|
||||
Object.Destroy(_postDiffusionBloomMaterial);
|
||||
_postDiffusionBloomMaterial = null;
|
||||
}
|
||||
if (_postDiffusionDofBloomMaterial != null)
|
||||
{
|
||||
Object.Destroy(_postDiffusionDofBloomMaterial);
|
||||
_postDiffusionDofBloomMaterial = null;
|
||||
}
|
||||
if (antialiasingMaterial != null)
|
||||
{
|
||||
Object.Destroy(antialiasingMaterial);
|
||||
antialiasingMaterial = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static float GetLowResolutionDividerBasedOnQuality(float baseDivider)
|
||||
{
|
||||
return baseDivider * 0.5f;
|
||||
}
|
||||
|
||||
private RenderTexture CreateBloomTexture(RenderTexture source, RenderTexture downSample)
|
||||
{
|
||||
RenderTexture renderTexture = null;
|
||||
int width = source.width / BLOOM_DIVIDER;
|
||||
int height = source.height / BLOOM_DIVIDER;
|
||||
if (_param.BloomBlurSize > 0f)
|
||||
{
|
||||
Vector4 zero = Vector4.zero;
|
||||
bool flag = false;
|
||||
RenderTexture renderTexture2 = downSample;
|
||||
if (renderTexture2 == null)
|
||||
{
|
||||
zero.z = 0f;
|
||||
zero.w = 1f;
|
||||
_fastBloomMaterial.SetVector("_Parameter", zero);
|
||||
renderTexture2 = RenderTexture.GetTemporary(width, height, 0);
|
||||
renderTexture2.filterMode = FilterMode.Bilinear;
|
||||
Graphics.Blit(source, renderTexture2, _fastBloomMaterial, 1);
|
||||
flag = true;
|
||||
}
|
||||
float num = 1f * (float)source.width / (1f * (float)source.height);
|
||||
float bloomBlurSize = _param.BloomBlurSize;
|
||||
float num2 = 0.001953125f;
|
||||
zero.x = bloomBlurSize / num * num2;
|
||||
zero.y = bloomBlurSize * num2;
|
||||
zero.z = _param.BloomThreshold;
|
||||
zero.w = _param.BloomIntensity;
|
||||
_fastBloomMaterial.SetVector("_Parameter", zero);
|
||||
RenderTexture temporary = RenderTexture.GetTemporary(width, height, 0);
|
||||
temporary.filterMode = FilterMode.Bilinear;
|
||||
Graphics.Blit(renderTexture2, temporary, _fastBloomMaterial, 2);
|
||||
renderTexture = temporary;
|
||||
temporary = RenderTexture.GetTemporary(width, height, 0);
|
||||
temporary.filterMode = FilterMode.Bilinear;
|
||||
Graphics.Blit(renderTexture, temporary, _fastBloomMaterial, 3);
|
||||
renderTexture.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
if (flag)
|
||||
{
|
||||
renderTexture2.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(renderTexture2);
|
||||
}
|
||||
return temporary;
|
||||
}
|
||||
Vector4 zero2 = Vector4.zero;
|
||||
zero2.z = _param.BloomThreshold;
|
||||
zero2.w = _param.BloomIntensity;
|
||||
_fastBloomMaterial.SetVector("_Parameter", zero2);
|
||||
RenderTexture temporary2 = RenderTexture.GetTemporary(width, height, 0);
|
||||
temporary2.filterMode = FilterMode.Bilinear;
|
||||
Graphics.Blit(source, temporary2, _fastBloomMaterial, 1);
|
||||
return temporary2;
|
||||
}
|
||||
|
||||
private RenderTexture OnRenderImageDiffusionDofBloom(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
PrepareDofParam(source, _postDiffusionDofBloomMaterial);
|
||||
int num = 2;
|
||||
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0);
|
||||
RenderTexture temporary2 = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0);
|
||||
RenderTexture temporary3 = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0);
|
||||
RenderTexture temporary4 = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0);
|
||||
num = 9;
|
||||
if (_param.DofQualityType == DepthBlurAndBloom.DofQuality.BackgroundAndForeground)
|
||||
{
|
||||
_postDiffusionDofBloomMaterial.SetFloat("_dofForegroundSize", _param.DofForegroundSize);
|
||||
num = 10;
|
||||
}
|
||||
Graphics.Blit(source, temporary, _postDiffusionDofBloomMaterial, num);
|
||||
Graphics.Blit(temporary, temporary4, _postDiffusionDofBloomMaterial, 3);
|
||||
BlurBlt(temporary4, temporary2, _param.DofMaxBlurSpread);
|
||||
DiffusionFilterProcess(temporary2, temporary3);
|
||||
_postDiffusionDofBloomMaterial.SetTexture("_TapLowBackground", temporary3);
|
||||
RenderTexture renderTexture = null;
|
||||
if (_param.IsEnableBloom)
|
||||
{
|
||||
renderTexture = CreateBloomTexture(temporary, temporary4);
|
||||
_postDiffusionDofBloomMaterial.SetTexture("_Bloom", renderTexture);
|
||||
_postDiffusionDofBloomMaterial.SetFloat("_BloomIsScreenBlend", (_param.BloomBlendMode == DofDiffusionBloomOverlayParam.BloomScreenBlendMode.Screen) ? 1f : 0f);
|
||||
_param.ScreenOverlay.PostFilmBlit(temporary, destination, _postDiffusionDofBloomMaterial, 8, 11, 13);
|
||||
}
|
||||
else
|
||||
{
|
||||
_postDiffusionDofBloomMaterial.SetFloat("_BloomIsScreenBlend", 0f);
|
||||
_param.ScreenOverlay.PostFilmBlit(temporary, destination, _postDiffusionDofBloomMaterial, -1, 11, 13);
|
||||
}
|
||||
if (renderTexture != null)
|
||||
{
|
||||
renderTexture.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
renderTexture = null;
|
||||
}
|
||||
if (temporary != source)
|
||||
{
|
||||
temporary.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(temporary);
|
||||
temporary = null;
|
||||
}
|
||||
if (temporary2 != null)
|
||||
{
|
||||
temporary2.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(temporary2);
|
||||
temporary2 = null;
|
||||
}
|
||||
if (temporary3 != null)
|
||||
{
|
||||
temporary3.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(temporary3);
|
||||
temporary3 = null;
|
||||
}
|
||||
if (temporary4 != null)
|
||||
{
|
||||
temporary4.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(temporary4);
|
||||
temporary4 = null;
|
||||
}
|
||||
return destination;
|
||||
}
|
||||
|
||||
private void PrepareDofParam(RenderTexture source, Material mtrl)
|
||||
{
|
||||
source.filterMode = FilterMode.Bilinear;
|
||||
source.wrapMode = TextureWrapMode.Clamp;
|
||||
Camera targetCamera = _param.TargetCamera;
|
||||
float num = targetCamera.farClipPlane - targetCamera.nearClipPlane;
|
||||
float num2 = 0.1f;
|
||||
Vector4 zero = Vector4.zero;
|
||||
switch (_param.DofFocalType)
|
||||
{
|
||||
case DepthBlurAndBloom.DofFocalType.Transform:
|
||||
num2 = ((!(_param.DofFocalTransfrom != null)) ? FocalDistance01(_param.DofFocalPoint) : (targetCamera.WorldToViewportPoint(_param.DofFocalTransfrom.position).z / num));
|
||||
break;
|
||||
case DepthBlurAndBloom.DofFocalType.Position:
|
||||
num2 = targetCamera.WorldToViewportPoint(_param.DofFocalPosition).z / num;
|
||||
break;
|
||||
case DepthBlurAndBloom.DofFocalType.Point:
|
||||
num2 = FocalDistance01(_param.DofFocalPoint);
|
||||
break;
|
||||
}
|
||||
if (num2 < 0f)
|
||||
{
|
||||
num2 = 0f;
|
||||
}
|
||||
if (_param.DofSmoothness < 0.1f)
|
||||
{
|
||||
_param.DofSmoothness = 0.1f;
|
||||
}
|
||||
zero.x = 1f / (float)source.width;
|
||||
zero.y = 1f / (float)source.height;
|
||||
mtrl.SetVector("_InvRenderTargetSize", zero);
|
||||
float num3 = num2 * _param.DofSmoothness;
|
||||
float num4 = num3;
|
||||
_dofWidthOverHeight = (float)source.width / (float)source.height;
|
||||
_dofHeightBaseSize = ((source.width > source.height) ? 0.0034722222f : 0.0010986328f);
|
||||
float num5 = 1E-06f;
|
||||
zero.x = ((num3 < num5) ? 0f : (1f / num3));
|
||||
zero.y = ((num4 < num5) ? 0f : (1f / num4));
|
||||
zero.z = _param.DofFocalSize / num * 0.5f + num2;
|
||||
mtrl.SetVector("_CurveParams", zero);
|
||||
mtrl.SetFloat("_bloomDofWeight", _param.BloomDofWeight);
|
||||
float lowResolutionDividerBasedOnQuality = GetLowResolutionDividerBasedOnQuality(1f);
|
||||
_rezworkWidth = (int)((float)source.width * lowResolutionDividerBasedOnQuality);
|
||||
_rezworkHeight = (int)((float)source.height * lowResolutionDividerBasedOnQuality);
|
||||
}
|
||||
|
||||
private float FocalDistance01(float worldDist)
|
||||
{
|
||||
return _param.TargetCamera.WorldToViewportPoint((worldDist - _param.TargetCamera.nearClipPlane) * _param.TargetCamera.transform.forward + _param.TargetCamera.transform.position).z / (_param.TargetCamera.farClipPlane - _param.TargetCamera.nearClipPlane);
|
||||
}
|
||||
|
||||
private void DiffusionFilterProcess(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
float lowResolutionDividerBasedOnQuality = GetLowResolutionDividerBasedOnQuality(1f);
|
||||
RenderTexture temporary = RenderTexture.GetTemporary(_rezworkWidth, _rezworkHeight, 0);
|
||||
Vector4 zero = Vector4.zero;
|
||||
zero.x = _param.DiffusionBlurSize * lowResolutionDividerBasedOnQuality / (float)_rezworkWidth;
|
||||
zero.y = _param.DiffusionBlurSize * lowResolutionDividerBasedOnQuality / (float)_rezworkHeight;
|
||||
_postDiffusionDofBloomMaterial.SetVector("_PixelSize", zero);
|
||||
zero.x = _param.DiffusionBright;
|
||||
zero.y = _param.DiffusionSaturation;
|
||||
zero.z = _param.DiffusionContrast;
|
||||
zero.w = _param.DiffusionThreshold;
|
||||
_postDiffusionDofBloomMaterial.SetVector("_ColorParam", zero);
|
||||
_postDiffusionDofBloomMaterial.mainTexture = source;
|
||||
Graphics.Blit(null, temporary, _postDiffusionDofBloomMaterial, 6);
|
||||
_postDiffusionDofBloomMaterial.mainTexture = temporary;
|
||||
Graphics.Blit(null, destination, _postDiffusionDofBloomMaterial, 7);
|
||||
_postDiffusionDofBloomMaterial.mainTexture = null;
|
||||
if (temporary != null)
|
||||
{
|
||||
temporary.DiscardContents();
|
||||
RenderTexture.ReleaseTemporary(temporary);
|
||||
temporary = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void BlurBlt(RenderTexture from, RenderTexture to, float spread)
|
||||
{
|
||||
}
|
||||
}
|
||||
343
SVSim.BattleEngine/Engine/Class3dScreenOverlay.cs
Normal file
343
SVSim.BattleEngine/Engine/Class3dScreenOverlay.cs
Normal file
@@ -0,0 +1,343 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class Class3dScreenOverlay
|
||||
{
|
||||
[Serializable]
|
||||
public class Overlay
|
||||
{
|
||||
public enum PostFilmMode
|
||||
{
|
||||
None,
|
||||
Lerp,
|
||||
Add,
|
||||
Mul,
|
||||
VignetteLerp,
|
||||
VignetteAdd,
|
||||
VignetteMul,
|
||||
Monochrome,
|
||||
ScreenBlend,
|
||||
VignetteScreenBlend
|
||||
}
|
||||
|
||||
public enum LayerMode
|
||||
{
|
||||
Color,
|
||||
UVMovie,
|
||||
UVMovieNoScale
|
||||
}
|
||||
|
||||
public enum ColorBlend
|
||||
{
|
||||
None,
|
||||
Lerp,
|
||||
Additive,
|
||||
Multiply
|
||||
}
|
||||
|
||||
public static readonly string[] SHADER_KEYWORD_MODE = new string[10] { "MODE_NONE", "MODE_LERP", "MODE_ADD", "MODE_MUL", "MODE_VIGNETTE_LERP", "MODE_VIGNETTE_ADD", "MODE_VIGNETTE_MUL", "MODE_MONOCHROME", "MODE_SCREENBLEND", "MODE_VIGNETT_SCREENBLEND" };
|
||||
|
||||
public static readonly string[] SHADER_KEYWORD_BLEND = new string[5] { "COLOR_ONLY", "BLEND_NONE", "BLEND_LERP", "BLEND_ADD", "BLEND_MUL" };
|
||||
|
||||
public const float DEFAULT_DEPTH_CLIP = 2f;
|
||||
|
||||
public PostFilmMode postFilmMode;
|
||||
|
||||
public float postFilmPower;
|
||||
|
||||
public float depthPower;
|
||||
|
||||
public float DepthClip = 2f;
|
||||
|
||||
public Vector2 postFilmOffsetParam = Vector2.zero;
|
||||
|
||||
public Vector4 postFilmOptionParam = Vector4.zero;
|
||||
|
||||
public Color postFilmColor0 = Color.black;
|
||||
|
||||
public Color postFilmColor1 = Color.black;
|
||||
|
||||
public Color postFilmColor2 = Color.black;
|
||||
|
||||
public Color postFilmColor3 = Color.black;
|
||||
|
||||
public bool inverseVignette;
|
||||
|
||||
public LayerMode layerMode;
|
||||
|
||||
public ColorBlend colorBlend;
|
||||
|
||||
public int movieResId;
|
||||
|
||||
private bool _isExistMovieMask;
|
||||
|
||||
private Texture _movieTexture;
|
||||
|
||||
private Texture _movieMaskTexture;
|
||||
|
||||
private Vector2 _movieTextureScale = Vector2.one;
|
||||
|
||||
private Vector2 _movieTextureOffset = Vector2.zero;
|
||||
|
||||
public float colorBlendFactor;
|
||||
|
||||
public Vector4 RollParameter;
|
||||
|
||||
public Vector4 ScaleParameter = Vector4.one;
|
||||
|
||||
private bool _isUVMovieNoScale;
|
||||
|
||||
public bool IsEnableDepth = true;
|
||||
|
||||
public void SetMovieInfo(Texture texMovie, Texture texMask, Vector2 scale, Vector2 offset)
|
||||
{
|
||||
_movieTexture = texMovie;
|
||||
_movieMaskTexture = texMask;
|
||||
_movieTextureScale = scale;
|
||||
_movieTextureOffset = offset;
|
||||
_isExistMovieMask = !(texMask == null);
|
||||
}
|
||||
|
||||
public void SetScale(Vector2 scale)
|
||||
{
|
||||
ScaleParameter.x = 1f / scale.x;
|
||||
ScaleParameter.y = 1f / scale.y;
|
||||
}
|
||||
|
||||
public void SetRollAngle(float angle)
|
||||
{
|
||||
RollParameter.x = Mathf.Sin(angle * (float)Math.PI / 180f);
|
||||
RollParameter.y = Mathf.Cos(angle * (float)Math.PI / 180f);
|
||||
}
|
||||
|
||||
public Overlay()
|
||||
{
|
||||
SetRollAngle(0f);
|
||||
}
|
||||
|
||||
private static void SetShaderKeyword(int id, string[] _arrKeywords, Material mtrl)
|
||||
{
|
||||
for (int i = 0; i < _arrKeywords.Length; i++)
|
||||
{
|
||||
if (id != i)
|
||||
{
|
||||
mtrl.DisableKeyword(_arrKeywords[i]);
|
||||
}
|
||||
}
|
||||
if (0 < id && id < _arrKeywords.Length)
|
||||
{
|
||||
mtrl.EnableKeyword(_arrKeywords[id]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Material mtrl, RenderTexture mainTexture)
|
||||
{
|
||||
if (mtrl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SetShaderKeyword((int)postFilmMode, SHADER_KEYWORD_MODE, mtrl);
|
||||
switch (layerMode)
|
||||
{
|
||||
case LayerMode.Color:
|
||||
SetShaderKeyword((int)layerMode, SHADER_KEYWORD_BLEND, mtrl);
|
||||
break;
|
||||
case LayerMode.UVMovie:
|
||||
case LayerMode.UVMovieNoScale:
|
||||
SetShaderKeyword((int)layerMode + (int)colorBlend, SHADER_KEYWORD_BLEND, mtrl);
|
||||
if (_movieTexture != null)
|
||||
{
|
||||
mtrl.SetTexture("_texMovie", _movieTexture);
|
||||
float num = 0f;
|
||||
float num2 = (float)mainTexture.width / num;
|
||||
float num3 = (float)mainTexture.height / num;
|
||||
float num4 = 7f;
|
||||
float num5 = 3f;
|
||||
if (2.3333333f > num2 / num3)
|
||||
{
|
||||
num4 *= Mathf.Ceil(num2 / num4);
|
||||
num5 *= Mathf.Ceil(num3 / num5);
|
||||
}
|
||||
ScaleParameter.z = num2 / num4;
|
||||
ScaleParameter.w = num3 / num5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
_isUVMovieNoScale = layerMode == LayerMode.UVMovieNoScale;
|
||||
if (_isExistMovieMask && _movieMaskTexture != null)
|
||||
{
|
||||
mtrl.SetTexture("_texMovieMask", _movieMaskTexture);
|
||||
}
|
||||
mtrl.SetVector("_movieScale", _movieTextureScale);
|
||||
mtrl.SetVector("_movieOffset", _movieTextureOffset);
|
||||
mtrl.SetFloat("_colorBlendFactor", colorBlendFactor);
|
||||
}
|
||||
|
||||
public bool IsDepthValid()
|
||||
{
|
||||
if (!IsEnableDepth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return IsValid();
|
||||
}
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
bool result = true;
|
||||
switch (postFilmMode)
|
||||
{
|
||||
case PostFilmMode.Monochrome:
|
||||
result = postFilmColor0.a > 0f;
|
||||
break;
|
||||
case PostFilmMode.None:
|
||||
result = false;
|
||||
break;
|
||||
default:
|
||||
result = postFilmPower > 0f;
|
||||
break;
|
||||
case PostFilmMode.Mul:
|
||||
case PostFilmMode.VignetteLerp:
|
||||
case PostFilmMode.VignetteMul:
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Blit(RenderTexture source, RenderTexture destination, Material material, int pass)
|
||||
{
|
||||
if (inverseVignette)
|
||||
{
|
||||
pass++;
|
||||
}
|
||||
Update(material, source);
|
||||
Vector4 value = new Vector4(postFilmOffsetParam.x, postFilmOffsetParam.y);
|
||||
material.SetFloat("_PostFilmPower", postFilmPower);
|
||||
material.SetFloat("_DepthPower", depthPower);
|
||||
float value2 = ((!(DepthClip > 1.5f)) ? (1.5f - DepthClip) : 0f);
|
||||
material.SetFloat("_DepthClip", value2);
|
||||
material.SetVector("_PostFilmOffsetParam", value);
|
||||
material.SetVector("_PostFilmOptionParam", postFilmOptionParam);
|
||||
material.SetColor("_PostFilmColor0", postFilmColor0);
|
||||
material.SetColor("_PostFilmColor1", postFilmColor1);
|
||||
material.SetColor("_PostFilmColor2", postFilmColor2);
|
||||
material.SetColor("_PostFilmColor3", postFilmColor3);
|
||||
RollParameter.z = (float)source.width / (float)source.height;
|
||||
material.SetVector("_PostFilmRollParameter", RollParameter);
|
||||
material.SetVector("_PostFilmScaleParameter", ScaleParameter);
|
||||
material.SetFloat("_PostFilmIsUVMovieNoScale", _isUVMovieNoScale ? 1f : 0f);
|
||||
material.SetFloat("_PostFilmIsInverseVignette", inverseVignette ? 1f : 0f);
|
||||
material.SetFloat("_PostFilmIsAlphaMasking", _isExistMovieMask ? 1f : 0f);
|
||||
material.SetFloat("_PostFilmIsWithoutDepth", IsEnableDepth ? 0f : 1f);
|
||||
Graphics.Blit(source, destination, material, pass);
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
[Header("Screen Overlay - First layer")]
|
||||
private Overlay _overlay1 = new Overlay();
|
||||
|
||||
[SerializeField]
|
||||
[Header("Screen Overlay - Second layer")]
|
||||
private Overlay _overlay2 = new Overlay();
|
||||
|
||||
[SerializeField]
|
||||
[Header("Screen Overlay - Third layer")]
|
||||
private Overlay _overlay3 = new Overlay();
|
||||
|
||||
public bool IsScreenOverlay = true;
|
||||
|
||||
public Overlay Overlay1 => _overlay1;
|
||||
|
||||
public Overlay Overlay2 => _overlay2;
|
||||
|
||||
public Overlay Overlay3 => _overlay3;
|
||||
|
||||
public bool IsEnable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_overlay1.IsValid() && !_overlay2.IsValid())
|
||||
{
|
||||
return _overlay3.IsValid();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsUseDepthTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_overlay1.IsDepthValid() && !_overlay2.IsDepthValid())
|
||||
{
|
||||
return _overlay3.IsDepthValid();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void PostFilmBlit(RenderTexture source, RenderTexture destination, Material material, int defaultPass, int filmPass1st, int filmPass2nd)
|
||||
{
|
||||
if (material == null || !IsScreenOverlay)
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
bool num = Overlay1.IsValid();
|
||||
bool flag = Overlay2.IsValid();
|
||||
bool flag2 = Overlay3.IsValid();
|
||||
RenderTexture renderTexture = destination;
|
||||
RenderTexture source2 = source;
|
||||
if (flag || flag2)
|
||||
{
|
||||
renderTexture = RenderTexture.GetTemporary(source.width, source.height, source.depth);
|
||||
}
|
||||
if (num)
|
||||
{
|
||||
Overlay1.Blit(source2, renderTexture, material, filmPass1st);
|
||||
}
|
||||
else if (defaultPass >= 0)
|
||||
{
|
||||
Graphics.Blit(source2, renderTexture, material, defaultPass);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(source2, renderTexture);
|
||||
}
|
||||
source2 = renderTexture;
|
||||
renderTexture = destination;
|
||||
if (flag)
|
||||
{
|
||||
if (flag2)
|
||||
{
|
||||
renderTexture = RenderTexture.GetTemporary(source.width, source.height, source.depth);
|
||||
}
|
||||
Overlay2.Blit(source2, renderTexture, material, filmPass2nd);
|
||||
if (source2 != source)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(source2);
|
||||
source2 = renderTexture;
|
||||
renderTexture = destination;
|
||||
}
|
||||
}
|
||||
if (flag2)
|
||||
{
|
||||
Overlay3.Blit(source2, renderTexture, material, filmPass2nd);
|
||||
if (source2 != source)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(source2);
|
||||
source2 = renderTexture;
|
||||
renderTexture = destination;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetShaderVariantKeyword(List<string> keywordList)
|
||||
{
|
||||
keywordList.AddRange(Overlay.SHADER_KEYWORD_MODE);
|
||||
keywordList.AddRange(Overlay.SHADER_KEYWORD_BLEND);
|
||||
}
|
||||
}
|
||||
387
SVSim.BattleEngine/Engine/ClassBattleCardBase.cs
Normal file
387
SVSim.BattleEngine/Engine/ClassBattleCardBase.cs
Normal file
@@ -0,0 +1,387 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Battle.Card;
|
||||
using Wizard.Battle.Card.InnerOptions;
|
||||
using Wizard.Battle.Resource;
|
||||
using Wizard.Battle.UI;
|
||||
using Wizard.Battle.View;
|
||||
using Wizard.Battle.View.Vfx;
|
||||
|
||||
public abstract class ClassBattleCardBase : BattleCardBase
|
||||
{
|
||||
public class ClassBuildInfo
|
||||
{
|
||||
public int charaId;
|
||||
|
||||
public bool isPlayer;
|
||||
|
||||
public int life;
|
||||
|
||||
public BattlePlayerBase selfBattlePlayer;
|
||||
|
||||
public BattlePlayerBase opponentBattlePlayer;
|
||||
|
||||
public BattleManagerBase battleMgr;
|
||||
|
||||
public IBattleResourceMgr resourceMgr;
|
||||
|
||||
public ClassBuildInfo(bool _isPlayer, int _life, BattlePlayerBase _selfBattlePlayer, BattlePlayerBase _opponentBattlePlayer, BattleManagerBase _battleMgr, IBattleResourceMgr _resourceMgr)
|
||||
{
|
||||
isPlayer = _isPlayer;
|
||||
life = _life;
|
||||
selfBattlePlayer = _selfBattlePlayer;
|
||||
opponentBattlePlayer = _opponentBattlePlayer;
|
||||
battleMgr = _battleMgr;
|
||||
resourceMgr = _resourceMgr;
|
||||
}
|
||||
|
||||
public ClassBuildInfo VirtualClone(BattlePlayerBase virtualSelfBattlePlayer, BattlePlayerBase virtualOpponentBattlePlayer)
|
||||
{
|
||||
return new ClassBuildInfo(isPlayer, life, virtualSelfBattlePlayer, virtualOpponentBattlePlayer, battleMgr, resourceMgr);
|
||||
}
|
||||
}
|
||||
|
||||
protected readonly ClassBuildInfo _classBuildInfo;
|
||||
|
||||
private readonly ClassBattleCardViewBase _classCardView;
|
||||
|
||||
protected int _baseMaxLife;
|
||||
|
||||
public int BossRushStartLife;
|
||||
|
||||
private static SkillCreator.CardSkillsBuildInfo _sharedEmptySkillInfo;
|
||||
|
||||
public override int BaseMaxLife => _baseMaxLife;
|
||||
|
||||
public override bool IsDead
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.IsDead)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (base.SelfBattlePlayer.IsShortageDeck && !base.SelfBattlePlayer.IsShortageDeckWin)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (base.OpponentBattlePlayer.IsShortageDeck && base.OpponentBattlePlayer.IsShortageDeckWin)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsLifeZeroDead
|
||||
{
|
||||
get
|
||||
{
|
||||
if (base.Life <= 0)
|
||||
{
|
||||
return !base.SkillApplyInformation.IsLifeZeroActivateLeonSkill;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int CharaId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_classBuildInfo.isPlayer)
|
||||
{
|
||||
return GameMgr.GetIns().GetDataMgr().GetEnemyCharaId();
|
||||
}
|
||||
return GameMgr.GetIns().GetDataMgr().GetPlayerCharaId();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Attackable => false;
|
||||
|
||||
public override bool IsClass => true;
|
||||
|
||||
public override bool IsOnDraw => false;
|
||||
|
||||
public override bool IsCantAttackClass => base.SkillApplyInformation.IsSkillCantAtkClass;
|
||||
|
||||
public IClassBattleCardView ClassBattleCardView { get; private set; }
|
||||
|
||||
public event Action OnDamageDestroy;
|
||||
|
||||
public event Action<BattlePlayerBase, int> OnForceBerserkChange;
|
||||
|
||||
public event Func<bool, VfxBase> OnBerserkCheck;
|
||||
|
||||
public event Action<BattlePlayerBase, int> OnForceAvariceChange;
|
||||
|
||||
public event Func<bool, VfxBase> OnAvariceCheck;
|
||||
|
||||
public event Action<BattlePlayerBase, int> OnForceWrathChange;
|
||||
|
||||
public event Func<bool, VfxBase> OnWrathCheck;
|
||||
|
||||
public event Func<BattleCardBase, SkillProcessor, VfxBase> OnRetire;
|
||||
|
||||
public VfxBase GetOnBerserkCheck(bool flg)
|
||||
{
|
||||
return this.OnBerserkCheck.GetAllFuncVfxResults(flg);
|
||||
}
|
||||
|
||||
public void CallOnForceBerserkChange(int num)
|
||||
{
|
||||
this.OnForceBerserkChange.Call(base.SelfBattlePlayer, num);
|
||||
}
|
||||
|
||||
public VfxBase GetOnAvariceCheck(bool flag)
|
||||
{
|
||||
return this.OnAvariceCheck.GetAllFuncVfxResults(flag);
|
||||
}
|
||||
|
||||
public void CallOnForceAvariceChange(int number)
|
||||
{
|
||||
this.OnForceAvariceChange.Call(base.SelfBattlePlayer, number);
|
||||
}
|
||||
|
||||
public VfxBase GetOnWrathCheck(bool flag)
|
||||
{
|
||||
return this.OnWrathCheck.GetAllFuncVfxResults(flag);
|
||||
}
|
||||
|
||||
public void CallOnForceWrathChange(int number)
|
||||
{
|
||||
this.OnForceWrathChange.Call(base.SelfBattlePlayer, number);
|
||||
}
|
||||
|
||||
protected ClassBattleCardBase(ClassBuildInfo classBuildInfo)
|
||||
: base(CreateBaseBuildInfo(classBuildInfo))
|
||||
{
|
||||
_classBuildInfo = classBuildInfo;
|
||||
}
|
||||
|
||||
public override void Setup(bool createNullView = false, bool isRecreate = false)
|
||||
{
|
||||
base.Setup();
|
||||
_CacheBattlePlayer();
|
||||
ClassBattleCardView = (IClassBattleCardView)base.BattleCardView;
|
||||
}
|
||||
|
||||
public void InitBaseMaxLife(int baseMaxLife)
|
||||
{
|
||||
_baseMaxLife = baseMaxLife;
|
||||
}
|
||||
|
||||
protected virtual void _CacheBattlePlayer()
|
||||
{
|
||||
base.SelfBattlePlayer = (base.IsPlayer ? ((BattlePlayerBase)_classBuildInfo.battleMgr.BattlePlayer) : ((BattlePlayerBase)_classBuildInfo.battleMgr.BattleEnemy));
|
||||
base.OpponentBattlePlayer = ((!base.IsPlayer) ? ((BattlePlayerBase)_classBuildInfo.battleMgr.BattlePlayer) : ((BattlePlayerBase)_classBuildInfo.battleMgr.BattleEnemy));
|
||||
}
|
||||
|
||||
public override DamageResult ApplyDamage(SkillBase skill, DamageParam damageParam, bool doesAttackerPossessKiller, bool isReflectedDamage, SkillProcessor skillProcessor, BattleCardBase reflectCard)
|
||||
{
|
||||
int damage = damageParam.Damage;
|
||||
bool isSkillDamage = skill != null;
|
||||
bool isSpellDamage = skill?.SkillPrm.ownerCard.IsSpell ?? false;
|
||||
BattleCardBase damageReflectionTarget = GetDamageReflectionTarget(isSkillDamage);
|
||||
if (damageReflectionTarget != this)
|
||||
{
|
||||
return damageReflectionTarget.ApplyDamage(skill, damageParam, doesAttackerPossessKiller: false, isReflectedDamage: true, skillProcessor, this);
|
||||
}
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
damageParam.Damage = CalculateFinalDamageAmount(damageParam.Damage, isSkillDamage, isSpellDamage, parallelVfxPlayer);
|
||||
int damage2 = damageParam.Damage;
|
||||
new SkillConditionCheckerOption
|
||||
{
|
||||
DefaultDamage = new DamageInfo(skill, damage),
|
||||
FixedDamage = new DamageInfo(skill, damage2)
|
||||
};
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
base.SkillApplyInformation.DamageLife(damageParam.Damage, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(CreateVfxWithCardPlayabilityRefresh(base.VfxCreator.CreateDamage(damageParam.Damage, base.Life, base.MaxLife, BaseMaxLife, isReflectedDamage, isSkillDamage)), parallelVfxPlayer));
|
||||
SequentialVfxPlayer sequentialVfxPlayer2 = SequentialVfxPlayer.Create();
|
||||
if (IsDead)
|
||||
{
|
||||
sequentialVfxPlayer2.Register(CreatePullHandInVfx());
|
||||
this.OnDamageDestroy.Call();
|
||||
}
|
||||
base.SelfBattlePlayer.BattleMgr.VfxMgr.RegisterImmediateVfx(this.OnBerserkCheck.GetAllFuncVfxResults(arg1: false));
|
||||
skillProcessor?.Register(base.Skills.CreateWhenDamageInfo(skill, skillProcessor, new BattlePlayerReadOnlyInfoPair(base.SelfBattlePlayer, base.OpponentBattlePlayer), damage, damageParam.Damage));
|
||||
sequentialVfxPlayer.Register(base.ApplyDamage(skill, damageParam, doesAttackerPossessKiller, isReflectedDamage, skillProcessor, reflectCard).Vfx);
|
||||
sequentialVfxPlayer.Register(base.SelfBattlePlayer.StartSkillWhenChangeClassLife(skillProcessor));
|
||||
return new DamageResult(sequentialVfxPlayer, damageParam.Damage, damage2, sequentialVfxPlayer2, null, isReflectedDamage);
|
||||
}
|
||||
|
||||
public override HealResult ApplyHealing(HealParam healParam, SkillProcessor skillProcessor)
|
||||
{
|
||||
BattleManagerBase ins = BattleManagerBase.GetIns();
|
||||
int num = HealLife(healParam.HealAmount, ins.CurrentTurn, ins.BattlePlayer.IsSelfTurn);
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(CreateVfxWithCardPlayabilityRefresh(base.VfxCreator.CreateHealing(num, base.Life, base.MaxLife, BaseMaxLife)));
|
||||
new SkillConditionCheckerOption().HealingCardAndValue = new List<BattlePlayerBase.CardAndValue>
|
||||
{
|
||||
new BattlePlayerBase.CardAndValue(this, num)
|
||||
};
|
||||
base.SelfBattlePlayer.BattleMgr.VfxMgr.RegisterImmediateVfx(this.OnBerserkCheck.GetAllFuncVfxResults(arg1: false));
|
||||
if (skillProcessor != null)
|
||||
{
|
||||
sequentialVfxPlayer.Register(base.SelfBattlePlayer.StartSkillWhenChangeClassLife(skillProcessor));
|
||||
}
|
||||
return new HealResult(num, sequentialVfxPlayer, CreatePullHandInVfx());
|
||||
}
|
||||
|
||||
private VfxBase CreatePullHandInVfx()
|
||||
{
|
||||
return base.SelfBattlePlayer.BattleView.HandView.HandUnfocus();
|
||||
}
|
||||
|
||||
private VfxBase CreatePullHandOutVfx()
|
||||
{
|
||||
if (base.IsSelfTurn)
|
||||
{
|
||||
return base.SelfBattlePlayer.BattleView.HandView.HandFocus();
|
||||
}
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
|
||||
public VfxBase DestroyBySpecialWin()
|
||||
{
|
||||
return ((ClassCardVfxCreatorBase)base.VfxCreator).CreateDestroy(base.DeathTypeInfo, base.SelfBattlePlayer);
|
||||
}
|
||||
|
||||
public VfxBase Retire()
|
||||
{
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
sequentialVfxPlayer.Register(this.OnRetire.GetAllFuncVfxResults(this, new SkillProcessor()));
|
||||
sequentialVfxPlayer.Register(((ClassCardVfxCreatorBase)base.VfxCreator).CreateRetire(base.SelfBattlePlayer));
|
||||
return sequentialVfxPlayer;
|
||||
}
|
||||
|
||||
public VfxBase LifeZeroActivateLeonSkill()
|
||||
{
|
||||
if (base.IsDestroyedBySkill || base.SelfBattlePlayer.IsShortageDeck || base.OpponentBattlePlayer.Class.IsDead || (base.OpponentBattlePlayer.IsShortageDeck && base.OpponentBattlePlayer.IsShortageDeckWin))
|
||||
{
|
||||
base.SkillApplyInformation.DepriveLifeZeroActivateLeonSkill();
|
||||
return NullVfx.GetInstance();
|
||||
}
|
||||
int num = 10;
|
||||
int cardId = 104741020;
|
||||
string fileName = "stt_quest_leon_1";
|
||||
string criSeName = "se_stt_quest_leon_1";
|
||||
float waitTime = 0.6f;
|
||||
string fileName2 = "stt_quest_leon_2";
|
||||
string criSeName2 = "se_stt_quest_leon_2";
|
||||
float waitTime2 = 0.5f;
|
||||
float num2 = 2f;
|
||||
float num3 = 3.5f;
|
||||
float waitTime3 = 0f;
|
||||
float waitTime4 = 1.5f;
|
||||
ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create();
|
||||
SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create();
|
||||
ParallelVfxPlayer parallelVfxPlayer2 = ParallelVfxPlayer.Create();
|
||||
List<BattleCardBase> list = new List<BattleCardBase>();
|
||||
list.AddRange(base.SelfBattlePlayer.InPlayCards);
|
||||
list.AddRange(base.OpponentBattlePlayer.InPlayCards);
|
||||
VfxBase vfxBase = null;
|
||||
vfxBase = ((!base.OpponentBattlePlayer.IsSelfTurn) ? WaitVfx.Create(waitTime3) : WaitVfx.Create(waitTime4));
|
||||
parallelVfxPlayer.Register(SequentialVfxPlayer.Create(vfxBase, base.SelfBattlePlayer.Emotion.PlayEmotion(ClassCharaPrm.EmotionType.PROVOCATION, 0f)));
|
||||
sequentialVfxPlayer.Register(WaitVfx.Create(base.OpponentBattlePlayer.IsSelfTurn ? num3 : num2));
|
||||
MaxLifeSetModifier lifeModifier = new MaxLifeSetModifier(num);
|
||||
sequentialVfxPlayer.Register(base.SkillApplyInformation.GiveCombatValueModifier(null, lifeModifier, new SkillProcessor()));
|
||||
int num4 = ((base.Life < 0) ? (base.Life * -1) : 0);
|
||||
if (num4 != 0)
|
||||
{
|
||||
HealLife(num4, base.SelfBattlePlayer.Turn, base.SelfBattlePlayer.IsSelfTurn);
|
||||
}
|
||||
sequentialVfxPlayer.Register(new LoadAndPlayEffectVfx(fileName, criSeName, base.SelfBattlePlayer.BattleMgr.IsRecovery ? null : base.BattleCardView.Transform, waitTime));
|
||||
HealParam healParam = new HealParam(num, this, this, applyModifier: false);
|
||||
HealResult healResult = ApplyHealing(healParam, new SkillProcessor());
|
||||
sequentialVfxPlayer.Register(healResult.PrehealVfxVfx);
|
||||
sequentialVfxPlayer.Register(healResult.HealVfx);
|
||||
sequentialVfxPlayer.Register(healResult.PosthealVfxVfx);
|
||||
base.SkillApplyInformation.DepriveLifeZeroActivateLeonSkill();
|
||||
sequentialVfxPlayer.Register(new LoadAndPlayEffectVfx(fileName2, criSeName2, Vector3.zero, waitTime2));
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].SkillApplyInformation.IsIndependent)
|
||||
{
|
||||
sequentialVfxPlayer.Register(new OneShotHeavenlyAegisPlayVfx(list[i].BattleCardView));
|
||||
continue;
|
||||
}
|
||||
list[i].FlagCardAsDestroyedBySkill();
|
||||
parallelVfxPlayer2.Register(list[i].SelfBattlePlayer.CardManagement(list[i], new SkillProcessor(), BattlePlayerBase.CARD_MANAGEMENT.BANISH, isRandom: false));
|
||||
}
|
||||
sequentialVfxPlayer.Register(parallelVfxPlayer2);
|
||||
SkillBaseSummon.SummonedCardsList summonedCardsList = new SkillBaseSummon.SummonedCardsList();
|
||||
summonedCardsList.AddCardToSummonedCards(base.SelfBattlePlayer.CreateNextIndexCard(cardId));
|
||||
BattlePlayerBase.SummonInfo summonInfo = new BattlePlayerBase.SummonInfo(base.SelfBattlePlayer.IsPlayer, summonedCardsList, SkillBaseSummon.SUMMON_TYPE.TOKEN);
|
||||
VfxWithLoadingSequential vfxWithLoadingToRegister = base.SelfBattlePlayer.CardManagement(null, new SkillProcessor(), BattlePlayerBase.CARD_MANAGEMENT.SUMMON, isRandom: false, null, null, null, summonInfo) as VfxWithLoadingSequential;
|
||||
base.SelfBattlePlayer.UpdateHandCardsPlayability();
|
||||
StartPickMultiCardVfx vfxToRegister = new StartPickMultiCardVfx(summonedCardsList, BattleManagerBase.GetIns().BattleResourceMgr, base.SelfBattlePlayer.IsPlayer, isToken: true, isIgnoreVoice: false, isRandomVoice: false, isGetoff: false, isEvoVoice: false, 0f);
|
||||
if (!base.SelfBattlePlayer.BattleMgr.IsVirtualBattle)
|
||||
{
|
||||
BattleLogManager.GetInstance().BeginLogBlockTurnChangeReactive();
|
||||
BattleLogManager.GetInstance().AddLogSkillBuffSetLife(this, Wizard.Battle.UI.LogType.WhenDestroy, new List<BattleCardBase> { this }, num, isTargetInOpponentHand: false);
|
||||
BattleLogManager.GetInstance().AddLogSkillHeal(new List<BattleCardBase> { this }, new List<HealResult> { healResult });
|
||||
BattleLogManager.GetInstance().AddLogSkillDeath(list.Where((BattleCardBase c) => !c.SkillApplyInformation.IsIndependent).ToList());
|
||||
BattleLogManager.GetInstance().AddLogSkillSummon(summonedCardsList.summonedCards.ToList());
|
||||
BattleLogManager.GetInstance().EndLogBlockTurnChangeReactive();
|
||||
}
|
||||
VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create();
|
||||
vfxWithLoadingSequential.RegisterToMainVfx(vfxToRegister);
|
||||
vfxWithLoadingSequential.RegisterVfxWithLoading(vfxWithLoadingToRegister);
|
||||
sequentialVfxPlayer.Register(vfxWithLoadingSequential);
|
||||
parallelVfxPlayer.Register(sequentialVfxPlayer);
|
||||
return parallelVfxPlayer;
|
||||
}
|
||||
|
||||
public override VfxBase LoadResource(bool isLogging = false)
|
||||
{
|
||||
return ClassBattleCardView.LoadResource();
|
||||
}
|
||||
|
||||
public override VfxBase UnloadResource()
|
||||
{
|
||||
return ClassBattleCardView.UnloadResource();
|
||||
}
|
||||
|
||||
public override VfxBase RecoveryInPlay(int inPlayIndex, bool newReplayMoveTurn = false)
|
||||
{
|
||||
return SequentialVfxPlayer.Create(base.BattleCardView.RecoveryInPlay(), new RefreshHealthVfx(base.SelfBattlePlayer));
|
||||
}
|
||||
|
||||
public override BattleCardBase VirtualClone(BattlePlayerBase virtualSelfBattlePlayer, BattlePlayerBase virtualOpponentBattlePlayer)
|
||||
{
|
||||
VirtualClassBattleCard virtualClassBattleCard = new VirtualClassBattleCard(_classBuildInfo.VirtualClone(virtualSelfBattlePlayer, virtualOpponentBattlePlayer));
|
||||
virtualClassBattleCard.InitBaseMaxLife(BaseMaxLife);
|
||||
CopyToVirtualCardBase(virtualClassBattleCard);
|
||||
return virtualClassBattleCard;
|
||||
}
|
||||
|
||||
public void ClearSpineObject()
|
||||
{
|
||||
if (ClassBattleCardView != null)
|
||||
{
|
||||
ClassBattleCardView.ClearSpineObject();
|
||||
}
|
||||
}
|
||||
|
||||
private static BuildInfo CreateBaseBuildInfo(ClassBuildInfo classBuildInfo)
|
||||
{
|
||||
CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(0);
|
||||
if (_sharedEmptySkillInfo == null)
|
||||
{
|
||||
_sharedEmptySkillInfo = SkillCreator.CreateBuildInfo(cardParameterFromId);
|
||||
}
|
||||
return new BuildInfo(null, 0, classBuildInfo.selfBattlePlayer, classBuildInfo.opponentBattlePlayer, classBuildInfo.selfBattlePlayer, _isPlayer: classBuildInfo.isPlayer, _innerOptions: new CardInnerOptionsBase(), _normalSkillBuildInfos: _sharedEmptySkillInfo.normalSkillBuildInfos, _evolveSkillBuildInfos: _sharedEmptySkillInfo.evolveSkillBuildInfos, _battleCardIndex: 0, _battleMgr: classBuildInfo.battleMgr, _resourceMgr: classBuildInfo.resourceMgr);
|
||||
}
|
||||
|
||||
protected override ISkillApplyInformation CreateSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator)
|
||||
{
|
||||
return new ClassSkillApplyInformation(card, vfxCreator);
|
||||
}
|
||||
}
|
||||
8
SVSim.BattleEngine/Engine/ClassCharaExp.cs
Normal file
8
SVSim.BattleEngine/Engine/ClassCharaExp.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
public class ClassCharaExp : HeaderData
|
||||
{
|
||||
public int level;
|
||||
|
||||
public int necessary_exp;
|
||||
|
||||
public int accumulate_exp;
|
||||
}
|
||||
208
SVSim.BattleEngine/Engine/ClassSkinPlate.cs
Normal file
208
SVSim.BattleEngine/Engine/ClassSkinPlate.cs
Normal file
@@ -0,0 +1,208 @@
|
||||
using System;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Scripts.Network.Data.TaskData.SkinPurchase;
|
||||
|
||||
public class ClassSkinPlate : MonoBehaviour
|
||||
{
|
||||
private const int MAX_LENGTH_VIEW_SINGLE_PRODUCT_NAME = 15;
|
||||
|
||||
private const int MAX_LENGTH_VIEW_SINGLE_PRODUCT_NAME_ALPHABET = 35;
|
||||
|
||||
private const int MAX_LENGTH_VIEW_LARGE_SIZE_PRODUCT_NAME = 20;
|
||||
|
||||
private const int MAX_LENGTH_VIEW_LARGE_SIZE_PRODUCT_NAME_ALPHABET = 39;
|
||||
|
||||
private const int WIDTH_PRODUCT_BG_SPRITE_NORMAL = 357;
|
||||
|
||||
private const int WIDTH_PRODUCT_BG_SPRITE_LARGE = 411;
|
||||
|
||||
private readonly Vector3 POS_VIEW_SINGLE_PRODUCT_NAME = new Vector3(13f, -52f, 0f);
|
||||
|
||||
private readonly Vector3 POS_VIEW_MULTI_PRODUCT_NAME = new Vector3(0f, -52f, 0f);
|
||||
|
||||
[SerializeField]
|
||||
private UIEventListener _eventListenerSkinImage;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _spritePlateBG;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelFree;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelCostCrystal;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelCostRupy;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _labelCostTicket;
|
||||
|
||||
[SerializeField]
|
||||
private UIButton m_BtnBuy;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel m_LabelBuy;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel m_LabelPurchased;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _LabelProductName;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _uiClassSkinTexture;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _uiClassSkinTextureLarge;
|
||||
|
||||
[SerializeField]
|
||||
private UISprite _spriteClassColorIcon;
|
||||
|
||||
[SerializeField]
|
||||
private UITexture _leaderSkinTicketIcon;
|
||||
|
||||
public SkinProductInfo ProductInfo { get; private set; }
|
||||
|
||||
public SkinSeriesPurchaseInfo SeriesInfo { get; private set; }
|
||||
|
||||
public Texture ImageTexture { get; private set; }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
m_LabelPurchased.text = Data.SystemText.Get("Shop_0100");
|
||||
}
|
||||
|
||||
public void SetMultiData(SkinSeriesPurchaseInfo seriesInfo, EventDelegate onPushBuyBtnCallback = null, Action onTapSkinImage = null)
|
||||
{
|
||||
SetBuyButtonToGrey(isGrey: false);
|
||||
bool isLargeImage = Data.Master.LeaderSkinSeriesIdDic[seriesInfo.series_id].IsLargeImage;
|
||||
ProductInfo = null;
|
||||
SeriesInfo = seriesInfo;
|
||||
Texture mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(seriesInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ShopClassSkin, isfetch: true));
|
||||
if (isLargeImage)
|
||||
{
|
||||
_uiClassSkinTexture.gameObject.SetActive(value: false);
|
||||
_uiClassSkinTextureLarge.gameObject.SetActive(value: true);
|
||||
_uiClassSkinTextureLarge.mainTexture = mainTexture;
|
||||
_spritePlateBG.width = 411;
|
||||
int maxLength = (Global.IsAlphabetLanguage() ? 39 : 20);
|
||||
_LabelProductName.text = ShopCommonUtility.TrimProductName(seriesInfo.saleInfo.name, maxLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
_uiClassSkinTexture.gameObject.SetActive(value: true);
|
||||
_uiClassSkinTextureLarge.gameObject.SetActive(value: false);
|
||||
_uiClassSkinTexture.mainTexture = mainTexture;
|
||||
_spritePlateBG.width = 357;
|
||||
_LabelProductName.text = ShopCommonUtility.TrimProductName(seriesInfo.saleInfo.name);
|
||||
}
|
||||
_LabelProductName.transform.localPosition = POS_VIEW_MULTI_PRODUCT_NAME;
|
||||
_LabelProductName.effectStyle = UILabel.Effect.None;
|
||||
_spriteClassColorIcon.gameObject.SetActive(value: false);
|
||||
m_BtnBuy.onClick.Clear();
|
||||
m_BtnBuy.onClick.Add(onPushBuyBtnCallback);
|
||||
_eventListenerSkinImage.onClick = null;
|
||||
_eventListenerSkinImage.onClick = delegate
|
||||
{
|
||||
onTapSkinImage.Call();
|
||||
};
|
||||
if (seriesInfo.saleInfo.costTicketItemId.HasValue)
|
||||
{
|
||||
_leaderSkinTicketIcon.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(ShopCommonUtility.GetTicketIconPath(seriesInfo.saleInfo.costTicketItemId.Value.ToString(), isFetch: true));
|
||||
}
|
||||
if (seriesInfo.is_completed && seriesInfo._rewardStatus != SkinSeriesPurchaseInfo.RewardStatus.not_got)
|
||||
{
|
||||
_labelCostCrystal.gameObject.SetActive(value: false);
|
||||
_labelCostRupy.gameObject.SetActive(value: false);
|
||||
_labelFree.gameObject.SetActive(value: false);
|
||||
_labelCostTicket.gameObject.SetActive(value: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShopCommonUtility.SetCostInfo(seriesInfo.saleInfo, _labelCostCrystal, _labelCostRupy, _labelFree, _labelCostTicket);
|
||||
}
|
||||
_SetMultiBuyButton(seriesInfo);
|
||||
}
|
||||
|
||||
public void SetBuyButtonToGrey(bool isGrey)
|
||||
{
|
||||
UIManager.SetObjectToGrey(m_BtnBuy.gameObject, isGrey);
|
||||
}
|
||||
|
||||
public void SetData(SkinProductInfo productInfo, EventDelegate onPushBuyBtnCallback = null, Action onTapSkinImage = null)
|
||||
{
|
||||
SeriesInfo = null;
|
||||
ProductInfo = productInfo;
|
||||
ClassCharacterMasterData charaPrmBySkinId = GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId(productInfo.leader_skin_id);
|
||||
_LabelProductName.transform.localPosition = POS_VIEW_SINGLE_PRODUCT_NAME;
|
||||
int maxLength = (Global.IsAlphabetLanguage() ? 35 : 15);
|
||||
_LabelProductName.text = ShopCommonUtility.TrimProductName(productInfo.saleInfo.name, maxLength);
|
||||
ClassCharaPrm.SetClassLabelSetting(_LabelProductName, charaPrmBySkinId.ClassColorId);
|
||||
_uiClassSkinTextureLarge.gameObject.SetActive(value: false);
|
||||
_uiClassSkinTexture.gameObject.SetActive(value: true);
|
||||
_uiClassSkinTexture.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(Toolbox.ResourcesManager.GetAssetTypePath(productInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isfetch: true));
|
||||
_spritePlateBG.width = 357;
|
||||
_spriteClassColorIcon.gameObject.SetActive(value: true);
|
||||
_spriteClassColorIcon.spriteName = ClassCharaPrm.GetIconSpriteName(charaPrmBySkinId.clan);
|
||||
m_BtnBuy.onClick.Clear();
|
||||
m_BtnBuy.onClick.Add(onPushBuyBtnCallback);
|
||||
_eventListenerSkinImage.onClick = null;
|
||||
_eventListenerSkinImage.onClick = delegate
|
||||
{
|
||||
onTapSkinImage.Call();
|
||||
};
|
||||
if (productInfo.IsEnableBuyTicket)
|
||||
{
|
||||
_leaderSkinTicketIcon.mainTexture = Toolbox.ResourcesManager.LoadObject<Texture>(ShopCommonUtility.GetTicketIconPath(productInfo.saleInfo.costTicketItemId.Value.ToString(), isFetch: true));
|
||||
}
|
||||
ShopCommonUtility.SetCostInfo(productInfo.saleInfo, _labelCostCrystal, _labelCostRupy, _labelFree, _labelCostTicket);
|
||||
_SetBuyButton(productInfo);
|
||||
}
|
||||
|
||||
private void _SetBuyButton(SkinProductInfo productInfo)
|
||||
{
|
||||
if (!productInfo.is_purchased)
|
||||
{
|
||||
m_BtnBuy.gameObject.SetActive(value: true);
|
||||
m_BtnBuy.isEnabled = true;
|
||||
m_LabelPurchased.gameObject.SetActive(value: false);
|
||||
if (productInfo.saleInfo.isFree)
|
||||
{
|
||||
m_LabelBuy.text = Data.SystemText.Get("Shop_0099");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LabelBuy.text = Data.SystemText.Get("Shop_0095");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_BtnBuy.gameObject.SetActive(value: false);
|
||||
m_LabelPurchased.gameObject.SetActive(value: true);
|
||||
}
|
||||
}
|
||||
|
||||
private void _SetMultiBuyButton(SkinSeriesPurchaseInfo seriesInfo)
|
||||
{
|
||||
if (seriesInfo.is_completed && seriesInfo._rewardStatus != SkinSeriesPurchaseInfo.RewardStatus.not_got)
|
||||
{
|
||||
m_BtnBuy.gameObject.SetActive(value: false);
|
||||
m_LabelPurchased.gameObject.SetActive(value: true);
|
||||
return;
|
||||
}
|
||||
m_BtnBuy.gameObject.SetActive(value: true);
|
||||
m_BtnBuy.isEnabled = true;
|
||||
m_LabelPurchased.gameObject.SetActive(value: false);
|
||||
if (seriesInfo.saleInfo.isFree)
|
||||
{
|
||||
m_LabelBuy.text = Data.SystemText.Get("Shop_0099");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LabelBuy.text = Data.SystemText.Get("Shop_0095");
|
||||
}
|
||||
}
|
||||
}
|
||||
691
SVSim.BattleEngine/Engine/ClassSkinPurchasePage.cs
Normal file
691
SVSim.BattleEngine/Engine/ClassSkinPurchasePage.cs
Normal file
@@ -0,0 +1,691 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
using Wizard.Scripts.Network.Data.TaskData.SkinPurchase;
|
||||
|
||||
public class ClassSkinPurchasePage : BaseShopPurchasePage
|
||||
{
|
||||
private enum eBuyType
|
||||
{
|
||||
single,
|
||||
multi,
|
||||
rewardOnly
|
||||
}
|
||||
|
||||
private const int DEFAULT_INDEX = 0;
|
||||
|
||||
[SerializeField]
|
||||
private UITable _uiTableProducts;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _PrefabDialogSelectBuyMeans;
|
||||
|
||||
[SerializeField]
|
||||
private PurchaseConfirm _PrefabDialogPurchaseConfirm;
|
||||
|
||||
[SerializeField]
|
||||
private ClassSkinDetailWindow _PrefabDialogSkinDetail;
|
||||
|
||||
[SerializeField]
|
||||
private ShopDrumrollScrollManager _drumrollManager;
|
||||
|
||||
private SkinSeriesPurchaseInfo _selectSeriesInfo;
|
||||
|
||||
private string _purchaseProductName;
|
||||
|
||||
private SkinProductInfo _purchaseProductInfo;
|
||||
|
||||
private ClassSkinPlate _selectPlate;
|
||||
|
||||
private GameObject _MultiPlateObj;
|
||||
|
||||
private DialogBase _tempCloseDialog;
|
||||
|
||||
private DialogBase _dialogPurchaseConfirm;
|
||||
|
||||
private DialogBase _dialogSelectBuyMeans;
|
||||
|
||||
private DialogBase _dialogProductDetail;
|
||||
|
||||
private DialogBase _dialogCrystalShortage;
|
||||
|
||||
private bool _isBuyConnect;
|
||||
|
||||
private List<GameObject> _productPlateObjList = new List<GameObject>();
|
||||
|
||||
private readonly List<string> _loadedVoiceList = new List<string>();
|
||||
|
||||
public override void onFirstStart()
|
||||
{
|
||||
CreateTopBar(Data.SystemText.Get("Shop_0104"), delegate
|
||||
{
|
||||
MyPageMenu.Instance.GoToShopSupply();
|
||||
});
|
||||
base.onFirstStart();
|
||||
}
|
||||
|
||||
protected override void SetupScrollView()
|
||||
{
|
||||
_productPlateOriginal.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
protected override void ResetProductListScroll(int productCount)
|
||||
{
|
||||
if (productCount > _productPlateObjList.Count)
|
||||
{
|
||||
int num = productCount - _productPlateObjList.Count;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
GameObject item = NGUITools.AddChild(_uiTableProducts.gameObject, _productPlateOriginal);
|
||||
_productPlateObjList.Add(item);
|
||||
}
|
||||
}
|
||||
for (int j = 0; j < _productPlateObjList.Count; j++)
|
||||
{
|
||||
UpdateScrollItem(_productPlateObjList[j], j);
|
||||
}
|
||||
_uiTableProducts.Reposition();
|
||||
_scrollView.ResetPosition();
|
||||
}
|
||||
|
||||
protected override void onOpen()
|
||||
{
|
||||
base.onOpen();
|
||||
_loadedResourceList = new List<string>();
|
||||
StartGetClassSkinInfo(OnClassSkinInfoRequestFinished);
|
||||
}
|
||||
|
||||
protected override void onClose()
|
||||
{
|
||||
if (_loadedVoiceList.Count > 0)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().StopVoiceAll(0f);
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedVoiceList);
|
||||
_loadedVoiceList.Clear();
|
||||
}
|
||||
base.onClose();
|
||||
}
|
||||
|
||||
private void StartGetClassSkinInfo(Action<NetworkTask.ResultCode> callbackOnSuccess)
|
||||
{
|
||||
SkinPurchaseInfoTask skinPurchaseInfoTask = new SkinPurchaseInfoTask();
|
||||
skinPurchaseInfoTask.SetParameter();
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(skinPurchaseInfoTask, callbackOnSuccess));
|
||||
}
|
||||
|
||||
private void StartBuySkin(eBuyType buyType, ShopCommonUtility.SalesType costType, int id, long? itemId)
|
||||
{
|
||||
if (!_isBuyConnect)
|
||||
{
|
||||
_isBuyConnect = true;
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
switch (buyType)
|
||||
{
|
||||
case eBuyType.single:
|
||||
{
|
||||
SkinBuySingleTask skinBuySingleTask = new SkinBuySingleTask();
|
||||
skinBuySingleTask.SetParameter(id, costType, itemId);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(skinBuySingleTask, onSuccessPurchaseSingle, _OnFailurePurchase, _OnResultCodeError));
|
||||
break;
|
||||
}
|
||||
case eBuyType.multi:
|
||||
{
|
||||
SkinBuyMultiTask skinBuyMultiTask = new SkinBuyMultiTask();
|
||||
skinBuyMultiTask.SetParameter(id, costType, itemId);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(skinBuyMultiTask, onSuccessPurchaseMulti, _OnFailurePurchase, _OnResultCodeError));
|
||||
break;
|
||||
}
|
||||
case eBuyType.rewardOnly:
|
||||
{
|
||||
SkinBuyMultiRewardTask skinBuyMultiRewardTask = new SkinBuyMultiRewardTask();
|
||||
skinBuyMultiRewardTask.SetParameter(id);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(skinBuyMultiRewardTask, onSuccessPurchaseMulti, _OnFailurePurchase, _OnResultCodeError));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetFirstDisplaySeries(int seriesId)
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.SCENE_TRANSITION_VIEW_SKIN_SERIES_ID, seriesId);
|
||||
}
|
||||
|
||||
private int GetViewSeriesId()
|
||||
{
|
||||
int series_id = Data.SkinPurchaseInfo.seriesList[0].series_id;
|
||||
int value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LATEST_SKIN_SERIES_ID);
|
||||
if (series_id != value)
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LATEST_SKIN_SERIES_ID, series_id);
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID, series_id);
|
||||
}
|
||||
int value2 = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.SCENE_TRANSITION_VIEW_SKIN_SERIES_ID);
|
||||
if (value2 > -1)
|
||||
{
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.SCENE_TRANSITION_VIEW_SKIN_SERIES_ID, -1);
|
||||
return value2;
|
||||
}
|
||||
return PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID);
|
||||
}
|
||||
|
||||
private void OnClassSkinInfoRequestFinished(NetworkTask.ResultCode error)
|
||||
{
|
||||
List<int> seriesIdList = GetSeriesIdList();
|
||||
Dictionary<int, BaseSeriesData> seriesDataDictionary = GetSeriesDataDictionary();
|
||||
StartCoroutine(loadSeriesImages(ResourcesManager.AssetLoadPathType.ShopClassSkin, seriesIdList, seriesDataDictionary, delegate
|
||||
{
|
||||
if (_drumrollSeriesImageList.Count <= 0)
|
||||
{
|
||||
UIManager.GetInstance().OnReadyViewScene(isFadein: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
int viewSeriesId = GetViewSeriesId();
|
||||
int seriesIndex = Data.SkinPurchaseInfo.seriesList.FindIndex((SkinSeriesPurchaseInfo data) => data.series_id == viewSeriesId);
|
||||
if (seriesIndex < 0)
|
||||
{
|
||||
seriesIndex = 0;
|
||||
}
|
||||
List<SkinSeriesPurchaseInfo> seriesList = Data.SkinPurchaseInfo.seriesList;
|
||||
List<ShopDrumrollScrollManager.DrumrollItem> itemList = _drumrollSeriesImageList.Select((Texture tex, int index) => new ShopDrumrollScrollManager.DrumrollItem(tex, seriesList[index].IsNew)).ToList();
|
||||
StartCoroutine(_drumrollManager.CreateDrumrollScroll_Coroutine(itemList, seriesIndex, onSelectSeries, delegate
|
||||
{
|
||||
onSelectSeries(seriesIndex, delegate
|
||||
{
|
||||
UIManager.GetInstance().OnReadyViewScene(isFadein: true);
|
||||
});
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private List<int> GetSeriesIdList()
|
||||
{
|
||||
return Data.SkinPurchaseInfo.seriesList.ConvertAll((SkinSeriesPurchaseInfo info) => info.series_id);
|
||||
}
|
||||
|
||||
private Dictionary<int, BaseSeriesData> GetSeriesDataDictionary()
|
||||
{
|
||||
Dictionary<int, BaseSeriesData> dictionary = new Dictionary<int, BaseSeriesData>();
|
||||
foreach (KeyValuePair<int, LeaderSkinSeries> item in Data.Master.LeaderSkinSeriesIdDic)
|
||||
{
|
||||
dictionary.Add(item.Key, item.Value);
|
||||
}
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
private void onSelectSeries(int seriesIndex)
|
||||
{
|
||||
onSelectSeries(seriesIndex, null);
|
||||
}
|
||||
|
||||
private void onSelectSeries(int seriesIndex, Action onFinish)
|
||||
{
|
||||
SkinSeriesPurchaseInfo seriesInfo = Data.SkinPurchaseInfo.seriesList[seriesIndex];
|
||||
_selectSeriesInfo = seriesInfo;
|
||||
_titleLogoTexture.mainTexture = _seriesTitleImageList[seriesIndex];
|
||||
_labelSeriesDescription.text = seriesInfo.description;
|
||||
int num = _cacheSeriesIdList.IndexOf(seriesInfo.series_id);
|
||||
if (num != -1)
|
||||
{
|
||||
_cacheRefCountList[num]++;
|
||||
ResetProductListScroll(seriesInfo.GetProductCount());
|
||||
onFinish.Call();
|
||||
return;
|
||||
}
|
||||
if (_cacheSeriesIdList.Count >= 4)
|
||||
{
|
||||
int num2 = _cacheRefCountList[0];
|
||||
int cacheIndex = 0;
|
||||
for (int i = 1; i < _cacheRefCountList.Count; i++)
|
||||
{
|
||||
if (num2 > _cacheRefCountList[i])
|
||||
{
|
||||
num2 = _cacheRefCountList[i];
|
||||
cacheIndex = i;
|
||||
}
|
||||
}
|
||||
DeleteCacheSeriesByCashIndex(cacheIndex);
|
||||
}
|
||||
StartCoroutine(loadClassSkins(delegate
|
||||
{
|
||||
if (_selectSeriesInfo == seriesInfo)
|
||||
{
|
||||
ResetProductListScroll(seriesInfo.GetProductCount());
|
||||
}
|
||||
_cacheSeriesIdList.Add(seriesInfo.series_id);
|
||||
_cacheRefCountList.Add(1);
|
||||
onFinish.Call();
|
||||
}));
|
||||
}
|
||||
|
||||
private void DeleteCacheSeriesByCashIndex(int cacheIndex)
|
||||
{
|
||||
List<string> listResource = new List<string>();
|
||||
SkinSeriesPurchaseInfo skinSeriesPurchaseInfo = Data.SkinPurchaseInfo.seriesList.Find((SkinSeriesPurchaseInfo m) => m.series_id == _cacheSeriesIdList[cacheIndex]);
|
||||
if (skinSeriesPurchaseInfo != null)
|
||||
{
|
||||
if (skinSeriesPurchaseInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None)
|
||||
{
|
||||
listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(skinSeriesPurchaseInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ShopClassSkin));
|
||||
}
|
||||
skinSeriesPurchaseInfo.productList.ForEach(delegate(SkinProductInfo s)
|
||||
{
|
||||
listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(s.saleInfo.path, ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail));
|
||||
});
|
||||
}
|
||||
Toolbox.ResourcesManager.RemoveAssetGroup(listResource);
|
||||
_cacheSeriesIdList.RemoveAt(cacheIndex);
|
||||
_cacheRefCountList.RemoveAt(cacheIndex);
|
||||
for (int num = 0; num < listResource.Count; num++)
|
||||
{
|
||||
_cacheResourceList.Remove(listResource[num]);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator loadClassSkins(Action callBack = null)
|
||||
{
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
List<string> listResource = new List<string>();
|
||||
if (_selectSeriesInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None)
|
||||
{
|
||||
listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(_selectSeriesInfo.saleInfo.path, ResourcesManager.AssetLoadPathType.ShopClassSkin));
|
||||
}
|
||||
foreach (SkinProductInfo product in _selectSeriesInfo.productList)
|
||||
{
|
||||
if (product.IsEnableBuyTicket)
|
||||
{
|
||||
listResource.Add(ShopCommonUtility.GetTicketIconPath(product.saleInfo.costTicketItemId.Value.ToString(), isFetch: false));
|
||||
listResource.Add(ShopCommonUtility.GetTicketIconRightDownPath(product.saleInfo.costTicketItemId.Value.ToString(), isFetch: false));
|
||||
}
|
||||
}
|
||||
_selectSeriesInfo.productList.ForEach(delegate(SkinProductInfo s)
|
||||
{
|
||||
listResource.Add(Toolbox.ResourcesManager.GetAssetTypePath(s.saleInfo.path, ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail));
|
||||
});
|
||||
yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(listResource, null));
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
for (int num = 0; num < listResource.Count; num++)
|
||||
{
|
||||
_cacheResourceList.Add(listResource[num]);
|
||||
}
|
||||
callBack.Call();
|
||||
}
|
||||
|
||||
private void UpdateScrollItem(GameObject go, int index)
|
||||
{
|
||||
if (_selectSeriesInfo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (index >= _selectSeriesInfo.GetProductCount() || index < 0)
|
||||
{
|
||||
go.SetActive(value: false);
|
||||
return;
|
||||
}
|
||||
go.SetActive(value: true);
|
||||
ClassSkinPlate plate = go.GetComponent<ClassSkinPlate>();
|
||||
EventDelegate eventDelegate = new EventDelegate(this, "onPushBuyButton");
|
||||
eventDelegate.parameters[0].value = plate;
|
||||
plate.SetBuyButtonToGrey(isGrey: false);
|
||||
if (_selectSeriesInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None)
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
_MultiPlateObj = go;
|
||||
eventDelegate.parameters[1].value = true;
|
||||
plate.SetMultiData(_selectSeriesInfo, eventDelegate, delegate
|
||||
{
|
||||
_onTapClassSkinImage(plate, isMulti: true);
|
||||
});
|
||||
if (_selectSeriesInfo.SetSalesStatus == SkinSeriesPurchaseInfo.eSetSalesStatus.Disable)
|
||||
{
|
||||
plate.SetBuyButtonToGrey(isGrey: true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_MultiPlateObj == go)
|
||||
{
|
||||
_MultiPlateObj = null;
|
||||
}
|
||||
eventDelegate.parameters[1].value = false;
|
||||
plate.SetData(_selectSeriesInfo.productList[index - 1], eventDelegate, delegate
|
||||
{
|
||||
_onTapClassSkinImage(plate, isMulti: false);
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_MultiPlateObj = null;
|
||||
eventDelegate.parameters[1].value = false;
|
||||
plate.SetData(_selectSeriesInfo.productList[index], eventDelegate, delegate
|
||||
{
|
||||
_onTapClassSkinImage(plate, isMulti: false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void _onTapClassSkinImage(ClassSkinPlate plate, bool isMulti)
|
||||
{
|
||||
if (!(_dialogProductDetail != null))
|
||||
{
|
||||
_dialogProductDetail = UIManager.GetInstance().CreateDialogClose();
|
||||
_dialogProductDetail.SetSize(DialogBase.Size.M);
|
||||
_dialogProductDetail.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_003_Title"));
|
||||
_dialogProductDetail.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
||||
ClassSkinDetailWindow component = UnityEngine.Object.Instantiate(_PrefabDialogSkinDetail).GetComponent<ClassSkinDetailWindow>();
|
||||
_dialogProductDetail.SetObj(component.gameObject);
|
||||
if (isMulti)
|
||||
{
|
||||
component.SetMultiData(plate.SeriesInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
component.SetSingleData(plate.ProductInfo, _loadedVoiceList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onPushBuyButton(ClassSkinPlate plate, bool isMulti)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
_selectPlate = plate;
|
||||
if (isMulti)
|
||||
{
|
||||
createClassSkinSelectBuyMeansMultiDialog(plate.SeriesInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
createClassSkinSelectBuyMeansDialog(plate.ProductInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void createClassSkinSelectBuyMeansMultiDialog(SkinSeriesPurchaseInfo sInfo)
|
||||
{
|
||||
if (_dialogSelectBuyMeans != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (sInfo.is_completed)
|
||||
{
|
||||
_ = sInfo._rewardStatus;
|
||||
_ = 2;
|
||||
}
|
||||
_dialogSelectBuyMeans = _createBaseDialogForSelectBuyMeans(sInfo.saleInfo);
|
||||
ClassSkinSelectBuyMeansDialog component = UnityEngine.Object.Instantiate(_PrefabDialogSelectBuyMeans).GetComponent<ClassSkinSelectBuyMeansDialog>();
|
||||
_dialogSelectBuyMeans.SetObj(component.gameObject);
|
||||
Action onPushBuyCrystalBtnCallBack = null;
|
||||
Action onPushBuyRupyBtnCallBack = null;
|
||||
Action onPushBuyTicketButtonCallBack = null;
|
||||
if (sInfo.saleInfo.isFree)
|
||||
{
|
||||
_dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
_dialogSelectBuyMeans.SetButtonText(Data.SystemText.Get("Shop_0082"));
|
||||
_dialogSelectBuyMeans.onPushButton1 = delegate
|
||||
{
|
||||
_purchaseProductName = sInfo.saleInfo.name;
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
if (sInfo.is_completed && sInfo._rewardStatus == SkinSeriesPurchaseInfo.RewardStatus.not_got)
|
||||
{
|
||||
StartBuySkin(eBuyType.rewardOnly, ShopCommonUtility.SalesType.free, sInfo.series_id, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.free, sInfo.series_id, null);
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
_dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.NONE);
|
||||
onPushBuyCrystalBtnCallBack = delegate
|
||||
{
|
||||
_createPurchaseConfirmDialog(sInfo.saleInfo, ShopCommonUtility.SalesType.crystal, delegate
|
||||
{
|
||||
StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.crystal, sInfo.series_id, null);
|
||||
});
|
||||
};
|
||||
onPushBuyRupyBtnCallBack = delegate
|
||||
{
|
||||
_createPurchaseConfirmDialog(sInfo.saleInfo, ShopCommonUtility.SalesType.rupy, delegate
|
||||
{
|
||||
StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.rupy, sInfo.series_id, null);
|
||||
});
|
||||
};
|
||||
onPushBuyTicketButtonCallBack = delegate
|
||||
{
|
||||
_createPurchaseConfirmDialog(sInfo.saleInfo, ShopCommonUtility.SalesType.ticket, delegate
|
||||
{
|
||||
StartBuySkin(eBuyType.multi, ShopCommonUtility.SalesType.ticket, sInfo.series_id, sInfo.saleInfo.costTicketItemId);
|
||||
});
|
||||
};
|
||||
}
|
||||
component.Init(sInfo, _dialogSelectBuyMeans, onPushBuyCrystalBtnCallBack, onPushBuyRupyBtnCallBack, onPushBuyTicketButtonCallBack);
|
||||
}
|
||||
|
||||
private void createClassSkinSelectBuyMeansDialog(SkinProductInfo pInfo)
|
||||
{
|
||||
if (_dialogSelectBuyMeans != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_ = pInfo.is_purchased;
|
||||
_dialogSelectBuyMeans = _createBaseDialogForSelectBuyMeans(pInfo.saleInfo);
|
||||
ClassSkinSelectBuyMeansDialog component = UnityEngine.Object.Instantiate(_PrefabDialogSelectBuyMeans).GetComponent<ClassSkinSelectBuyMeansDialog>();
|
||||
_dialogSelectBuyMeans.SetObj(component.gameObject);
|
||||
Action onPushBuyCrystalBtnCallBack = null;
|
||||
Action onPushBuyRupyBtnCallBack = null;
|
||||
Action onPushBuyTicketButtonCallBack = null;
|
||||
if (pInfo.saleInfo.isFree)
|
||||
{
|
||||
_dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
_dialogSelectBuyMeans.SetButtonText(Data.SystemText.Get("Shop_0082"));
|
||||
_dialogSelectBuyMeans.onPushButton1 = delegate
|
||||
{
|
||||
_purchaseProductName = pInfo.saleInfo.name;
|
||||
_purchaseProductInfo = pInfo;
|
||||
UIManager.GetInstance().createInSceneCenterLoading();
|
||||
StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.free, pInfo.product_id, null);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
_dialogSelectBuyMeans.SetButtonLayout(DialogBase.ButtonLayout.NONE);
|
||||
onPushBuyCrystalBtnCallBack = delegate
|
||||
{
|
||||
_createPurchaseConfirmDialog(pInfo.saleInfo, ShopCommonUtility.SalesType.crystal, delegate
|
||||
{
|
||||
_purchaseProductInfo = pInfo;
|
||||
StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.crystal, pInfo.product_id, null);
|
||||
});
|
||||
};
|
||||
onPushBuyRupyBtnCallBack = delegate
|
||||
{
|
||||
_createPurchaseConfirmDialog(pInfo.saleInfo, ShopCommonUtility.SalesType.rupy, delegate
|
||||
{
|
||||
_purchaseProductInfo = pInfo;
|
||||
StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.rupy, pInfo.product_id, null);
|
||||
});
|
||||
};
|
||||
onPushBuyTicketButtonCallBack = delegate
|
||||
{
|
||||
_createPurchaseConfirmDialog(pInfo.saleInfo, ShopCommonUtility.SalesType.ticket, delegate
|
||||
{
|
||||
_purchaseProductInfo = pInfo;
|
||||
StartBuySkin(eBuyType.single, ShopCommonUtility.SalesType.ticket, pInfo.product_id, pInfo.saleInfo.costTicketItemId);
|
||||
});
|
||||
};
|
||||
}
|
||||
component.Init(pInfo, _dialogSelectBuyMeans, onPushBuyCrystalBtnCallBack, onPushBuyRupyBtnCallBack, onPushBuyTicketButtonCallBack);
|
||||
}
|
||||
|
||||
private DialogBase _createBaseDialogForSelectBuyMeans(ShopCommonSaleInfo info)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetSize(DialogBase.Size.M);
|
||||
dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_002_Title"));
|
||||
dialogBase.SetReturnMsg(null, "");
|
||||
return dialogBase;
|
||||
}
|
||||
|
||||
private void _createPurchaseConfirmDialog(ShopCommonSaleInfo info, ShopCommonUtility.SalesType costType, Action buyApiFunc)
|
||||
{
|
||||
if (!(_dialogPurchaseConfirm != null) && ShopCommonUtility.IsHaveEnoughCost(info, costType, delegate
|
||||
{
|
||||
if (_dialogCrystalShortage == null)
|
||||
{
|
||||
_dialogCrystalShortage = ShopCommonUtility.CreateCrystalShortagePopup();
|
||||
}
|
||||
}))
|
||||
{
|
||||
_dialogPurchaseConfirm = ShopCommonUtility.CreatePurchaseConfirmPopup(info, costType, _PrefabDialogPurchaseConfirm, delegate
|
||||
{
|
||||
_purchaseProductName = info.name;
|
||||
buyApiFunc();
|
||||
});
|
||||
_dialogPurchaseConfirm.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_001_Title"));
|
||||
}
|
||||
}
|
||||
|
||||
private void _OnFailurePurchase(NetworkTask.ResultCode code)
|
||||
{
|
||||
_isBuyConnect = false;
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
|
||||
private void _OnResultCodeError(int code)
|
||||
{
|
||||
if (code != 110)
|
||||
{
|
||||
_isBuyConnect = false;
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
_ReloadSkinInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private void onSuccessPurchaseSingle(NetworkTask.ResultCode error)
|
||||
{
|
||||
_isBuyConnect = false;
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID, _selectSeriesInfo.series_id);
|
||||
if (_purchaseProductName != null)
|
||||
{
|
||||
DialogBase diaChange = UIManager.GetInstance().CreateDialogClose();
|
||||
int skinId = _purchaseProductInfo.leader_skin_id;
|
||||
ClassCharacterMasterData charaData = GameMgr.GetIns().GetDataMgr().GetCharaPrmBySkinId(skinId);
|
||||
string text = Data.SystemText.Get("Shop_0022", _purchaseProductName.Replace("\n", ""));
|
||||
text = text + "\n\n" + Data.SystemText.Get("Shop_0108", GameMgr.GetIns().GetDataMgr().GetClanNameByKey(charaData.class_id), charaData.chara_name);
|
||||
diaChange.SetText(text);
|
||||
diaChange.SetTitleLabel(Data.SystemText.Get("Dia_BuySkin_004_Title"));
|
||||
diaChange.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
||||
diaChange.SetButtonText(Data.SystemText.Get("Dia_BuySkin_001_Button"));
|
||||
diaChange.onPushButton1 = delegate
|
||||
{
|
||||
_tempCloseDialog = diaChange;
|
||||
LeaderSkinUpdateTask leaderSkinUpdateTask = new LeaderSkinUpdateTask();
|
||||
leaderSkinUpdateTask.SetParameter(charaData.class_id, skinId);
|
||||
StartCoroutine(Toolbox.NetworkManager.Connect(leaderSkinUpdateTask, onSuccessChangeSkin));
|
||||
};
|
||||
}
|
||||
_ReloadSkinInfo();
|
||||
}
|
||||
|
||||
private void onSuccessChangeSkin(NetworkTask.ResultCode error)
|
||||
{
|
||||
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
||||
dialogBase.SetText(Data.SystemText.Get("Shop_0109"));
|
||||
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
||||
_purchaseProductInfo = null;
|
||||
if (_tempCloseDialog != null)
|
||||
{
|
||||
_tempCloseDialog.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void onSuccessPurchaseMulti(NetworkTask.ResultCode error)
|
||||
{
|
||||
_isBuyConnect = false;
|
||||
PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.LAST_PURCHASE_SKIN_SERIES_ID, _selectSeriesInfo.series_id);
|
||||
if (_purchaseProductName != null)
|
||||
{
|
||||
ShopCommonUtility.CreatePurchaseSuccess(_purchaseProductName.Replace("\n", ""));
|
||||
_purchaseProductName = null;
|
||||
}
|
||||
_ReloadSkinInfo();
|
||||
}
|
||||
|
||||
private void _ReloadSkinInfo()
|
||||
{
|
||||
MyPageMenu.Instance.UpdateCrystalCount();
|
||||
MyPageMenu.Instance.UpdateRupyCount();
|
||||
List<SkinSeriesPurchaseInfo> oldSeriesList = new List<SkinSeriesPurchaseInfo>(Data.SkinPurchaseInfo.seriesList);
|
||||
StartGetClassSkinInfo(delegate
|
||||
{
|
||||
bool flag = false;
|
||||
List<SkinSeriesPurchaseInfo> seriesList = Data.SkinPurchaseInfo.seriesList;
|
||||
for (int i = 0; i < seriesList.Count; i++)
|
||||
{
|
||||
if (oldSeriesList[i].series_id != seriesList[i].series_id)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
if (seriesList[i].series_id == _selectSeriesInfo.series_id)
|
||||
{
|
||||
if (_selectPlate.ProductInfo == null)
|
||||
{
|
||||
onSelectSeries(i);
|
||||
}
|
||||
else if (_selectPlate.ProductInfo.product_id == _purchaseProductInfo.product_id)
|
||||
{
|
||||
_selectSeriesInfo = seriesList[i];
|
||||
int num = ((_selectSeriesInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None) ? 1 : 0);
|
||||
for (int j = 0; j < _selectSeriesInfo.productList.Count; j++)
|
||||
{
|
||||
UpdateScrollItem(_productPlateObjList[j + num], j + num);
|
||||
}
|
||||
if (_MultiPlateObj != null)
|
||||
{
|
||||
UpdateScrollItem(_MultiPlateObj, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
onSelectSeries(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oldSeriesList.Count != seriesList.Count)
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
_purchaseProductName = null;
|
||||
_purchaseProductInfo = null;
|
||||
_selectPlate = null;
|
||||
if (flag)
|
||||
{
|
||||
List<int> seriesIdList = GetSeriesIdList();
|
||||
Dictionary<int, BaseSeriesData> seriesDataDictionary = GetSeriesDataDictionary();
|
||||
StartCoroutine(loadSeriesImages(ResourcesManager.AssetLoadPathType.ShopClassSkin, seriesIdList, seriesDataDictionary, delegate
|
||||
{
|
||||
List<SkinSeriesPurchaseInfo> seriesList2 = Data.SkinPurchaseInfo.seriesList;
|
||||
List<ShopDrumrollScrollManager.DrumrollItem> itemList = _drumrollSeriesImageList.Select((Texture tex, int index) => new ShopDrumrollScrollManager.DrumrollItem(tex, seriesList2[index].IsNew)).ToList();
|
||||
StartCoroutine(_drumrollManager.CreateDrumrollScroll_Coroutine(itemList, 0, onSelectSeries, delegate
|
||||
{
|
||||
onSelectSeries(0);
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}));
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.GetInstance().closeInSceneCenterLoading();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
4
SVSim.BattleEngine/Engine/ColosseumBattleFinish.cs
Normal file
4
SVSim.BattleEngine/Engine/ColosseumBattleFinish.cs
Normal file
@@ -0,0 +1,4 @@
|
||||
public class ColosseumBattleFinish : HeaderData
|
||||
{
|
||||
public ColosseumBattleFinishDetail data;
|
||||
}
|
||||
3
SVSim.BattleEngine/Engine/ColosseumBattleFinishDetail.cs
Normal file
3
SVSim.BattleEngine/Engine/ColosseumBattleFinishDetail.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
public class ColosseumBattleFinishDetail : MatchFinishBase
|
||||
{
|
||||
}
|
||||
220
SVSim.BattleEngine/Engine/ColosseumResultAnimationAgent.cs
Normal file
220
SVSim.BattleEngine/Engine/ColosseumResultAnimationAgent.cs
Normal file
@@ -0,0 +1,220 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class ColosseumResultAnimationAgent : ResultAnimationAgent
|
||||
{
|
||||
private const float OBJECT_APPEAR_MOVE_SEC = 0.5f;
|
||||
|
||||
private const float RESULT_TITLE_DELAY_SEC = 0f;
|
||||
|
||||
private const float CLASS_CHAR_DELAY_SEC = 0.1f;
|
||||
|
||||
private const float CLASS_INFO_DELAY_SEC = 0.3f;
|
||||
|
||||
private const float GAUGE_WAIT_SEC = 0.5f;
|
||||
|
||||
public override IEnumerator RunUI(BattleResultUIController battleResultControl, INextSceneSelector nextSceneSelector, bool isWin)
|
||||
{
|
||||
m_BattleCamera.m_CutInCamera.gameObject.SetActive(value: false);
|
||||
if (battleResultControl.ResultReporter.LotteryData.IsEnable)
|
||||
{
|
||||
yield return LoadLotteryImage(battleResultControl.ResultReporter.LotteryData);
|
||||
}
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
battleResultControl.TitleWin.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleLose.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleDraw.gameObject.SetActive(value: true);
|
||||
battleResultControl.TitleDraw.transform.localScale = Vector3.one * 10f;
|
||||
battleResultControl.TitleDraw.alpha = 0f;
|
||||
battleResultControl.Bg.color = new Color32(0, 48, 16, 0);
|
||||
battleResultControl.ResultTitle.spriteName = "result_top_lose";
|
||||
}
|
||||
else if (isWin)
|
||||
{
|
||||
battleResultControl.TitleWin.gameObject.SetActive(value: true);
|
||||
battleResultControl.TitleLose.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleDraw.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleWin.transform.localScale = Vector3.one * 10f;
|
||||
battleResultControl.TitleWin.alpha = 0f;
|
||||
battleResultControl.Bg.color = new Color32(32, 24, 0, 0);
|
||||
battleResultControl.ResultTitle.spriteName = "result_top_win";
|
||||
}
|
||||
else
|
||||
{
|
||||
battleResultControl.TitleWin.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleLose.gameObject.SetActive(value: true);
|
||||
battleResultControl.TitleDraw.gameObject.SetActive(value: false);
|
||||
battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f;
|
||||
battleResultControl.TitleLose.alpha = 0f;
|
||||
battleResultControl.Bg.color = new Color32(0, 24, 48, 0);
|
||||
battleResultControl.ResultTitle.spriteName = "result_top_lose";
|
||||
}
|
||||
battleResultControl.MainPanel.alpha = 1f;
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE);
|
||||
}
|
||||
else if (isWin)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOUWIN);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_WIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_YOULOSE);
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_JINGLE_LOSE);
|
||||
}
|
||||
TweenAlpha.Begin(battleResultControl.Bg.gameObject, 0.5f, 0.75f);
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
TweenAlpha.Begin(battleResultControl.ArcaneIn.gameObject, 0.5f, 1f);
|
||||
TweenAlpha.Begin(battleResultControl.ArcaneOut.gameObject, 0.5f, 1f);
|
||||
iTween.ScaleTo(battleResultControl.ArcaneIn.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.ScaleTo(battleResultControl.ArcaneOut.gameObject, iTween.Hash("scale", Vector3.one, "time", 2f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_3, Vector3.zero);
|
||||
battleResultControl.TitleDraw.transform.localScale = Vector3.one;
|
||||
iTween.ScaleTo(battleResultControl.TitleDraw.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear));
|
||||
}
|
||||
else if (isWin)
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_1, Vector3.zero);
|
||||
battleResultControl.TitleWin.transform.localScale = Vector3.one;
|
||||
iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear));
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_TITLE_2, Vector3.zero);
|
||||
battleResultControl.TitleLose.transform.localScale = Vector3.one;
|
||||
iTween.ScaleTo(battleResultControl.TitleLose.gameObject, iTween.Hash("scale", Vector3.one * 1.1f, "time", 2f, "islocal", true, "easetype", iTween.EaseType.linear));
|
||||
}
|
||||
HideEmotionMessage();
|
||||
if (battleResultControl.ResultMsgWindowFlag)
|
||||
{
|
||||
StartCoroutine(battleResultControl.ShowSpecialResultInfo());
|
||||
}
|
||||
yield return new WaitForSeconds(2f);
|
||||
if (battleResultControl.IsDraw)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleDraw.gameObject, 0.2f, 0f);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_3, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShowRewardDialog(battleResultControl))
|
||||
{
|
||||
while (battleResultControl.IsRewardWait)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
if (battleResultControl.ResultReporter.LotteryData.IsEnable)
|
||||
{
|
||||
yield return CreateLotteryDialog(battleResultControl.ResultReporter.LotteryData);
|
||||
}
|
||||
if (isWin)
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleWin.gameObject, 0.2f, 0f);
|
||||
iTween.ScaleTo(battleResultControl.TitleWin.gameObject, iTween.Hash("scale", Vector3.one * 3f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad));
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_1, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
TweenAlpha.Begin(battleResultControl.TitleLose.gameObject, 0.2f, 0f);
|
||||
GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_RESULT_BACK_2, battleResultControl.AnchorBottom.transform.position, battleResultControl.AnchorBottom.gameObject);
|
||||
}
|
||||
}
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
if (isWin)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_WIN_LOOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlayBGM(Bgm.BGM_TYPE.SYS_LOSE_LOOP);
|
||||
}
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_WINDOW_APPER);
|
||||
iTween.MoveTo(battleResultControl.ClassCharObj.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassCharObj"], "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.MoveTo(battleResultControl.ResultTitle.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ResultTitle"], "time", 0.5f, "delay", 0f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
iTween.MoveTo(battleResultControl.ClassInfo.gameObject, iTween.Hash("position", battleResultControl.DefaultPosDict["ClassInfo"], "time", 0.5f, "delay", 0.3f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo));
|
||||
yield return new WaitForSeconds(1f);
|
||||
if (isWin)
|
||||
{
|
||||
PlayWinVoice();
|
||||
}
|
||||
if (battleResultControl.AddClassExp > 0)
|
||||
{
|
||||
battleResultControl.SettingAddClassExpTextAnimation();
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
yield return PlayGaugeUpSe();
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
ArenaColosseum colosseumData = Data.ArenaData.ColosseumData;
|
||||
if (colosseumData.ResultEffect != ArenaColosseum.eResultEffect.None)
|
||||
{
|
||||
if (colosseumData.ResultEffect == ArenaColosseum.eResultEffect.GroupA)
|
||||
{
|
||||
battleResultControl.TitleMatch.spriteName = "colosseum_battle_title_01";
|
||||
}
|
||||
else if (colosseumData.ResultEffect == ArenaColosseum.eResultEffect.Final)
|
||||
{
|
||||
battleResultControl.TitleMatch.spriteName = "colosseum_battle_title_02";
|
||||
}
|
||||
else
|
||||
{
|
||||
battleResultControl.TitleMatch.spriteName = "colosseum_battle_title_03";
|
||||
}
|
||||
StartCoroutine(battleResultControl.RunMatch());
|
||||
yield return new WaitForSeconds(3f);
|
||||
}
|
||||
bool isFinishBattlePass = false;
|
||||
battleResultControl.SetBattlePassGauge(delegate
|
||||
{
|
||||
isFinishBattlePass = true;
|
||||
});
|
||||
while (!isFinishBattlePass)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
if (Data.RedEtherCampaignResultData != null)
|
||||
{
|
||||
bool isFinishRedEther = false;
|
||||
RedEtherCampaignPanel.Create(battleResultControl.gameObject, Data.RedEtherCampaignResultData, battleResultControl, delegate
|
||||
{
|
||||
isFinishRedEther = true;
|
||||
});
|
||||
while (!isFinishRedEther)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield return ShowRewardDialog(Data.RedEtherCampaignResultData.RewardList);
|
||||
}
|
||||
nextSceneSelector.Show();
|
||||
battleResultControl.PrepareAchievementLog();
|
||||
battleResultControl.FinishResult();
|
||||
battleResultControl.GreySpriteBGVisible = false;
|
||||
}
|
||||
|
||||
private IEnumerator PlayGaugeUpSe()
|
||||
{
|
||||
SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr();
|
||||
int i = 0;
|
||||
while (i < 10)
|
||||
{
|
||||
soundMgr.PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP);
|
||||
yield return new WaitForSeconds(0.05f);
|
||||
int num = i + 1;
|
||||
i = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
SVSim.BattleEngine/Engine/ColosseumResultAnimationHandler.cs
Normal file
22
SVSim.BattleEngine/Engine/ColosseumResultAnimationHandler.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ColosseumResultAnimationHandler : IResultAnimationHandler
|
||||
{
|
||||
private readonly GameObject m_resultAnimationAgentObj;
|
||||
|
||||
private readonly ColosseumResultAnimationAgent m_resultAnimationAgentIns;
|
||||
|
||||
public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns;
|
||||
|
||||
public ColosseumResultAnimationHandler(BattleCamera battleCamera)
|
||||
{
|
||||
m_resultAnimationAgentObj = new GameObject();
|
||||
m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent<ColosseumResultAnimationAgent>();
|
||||
m_resultAnimationAgentIns.GetComponent<ColosseumResultAnimationAgent>().SetBattleCamera(battleCamera);
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
Object.Destroy(m_resultAnimationAgentObj);
|
||||
}
|
||||
}
|
||||
63
SVSim.BattleEngine/Engine/ColosseumResultReporter.cs
Normal file
63
SVSim.BattleEngine/Engine/ColosseumResultReporter.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
using Wizard;
|
||||
using Wizard.Lottery;
|
||||
|
||||
public class ColosseumResultReporter : IBattleResultReporter
|
||||
{
|
||||
public bool IsEnd => Data.ColosseumBattleFinish.data != null;
|
||||
|
||||
public int ClassExp => GetClassExp();
|
||||
|
||||
public List<UserAchievement> UserAchievement => GetUserAchievementList();
|
||||
|
||||
public List<UserMission> UserMission => GetUserMissionList();
|
||||
|
||||
public List<ReceivedReward> MissionRewards => Data.ColosseumBattleFinish.data._missionRewards;
|
||||
|
||||
public List<ReceivedReward> VictoryRewards => null;
|
||||
|
||||
public LotteryApplyData LotteryData => Data.ColosseumBattleFinish.data.AchievedInfo._lotteryData;
|
||||
|
||||
public bool IsDataExist
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Data.ColosseumBattleFinish.data != null)
|
||||
{
|
||||
return Data.ColosseumBattleFinish.data.IsProcessed;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public MyPageHomeDialogData HomeDialogData => null;
|
||||
|
||||
public void Report(bool isWin)
|
||||
{
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
}
|
||||
|
||||
public JsonData GetFinishResponseData()
|
||||
{
|
||||
return Data.ColosseumBattleFinish.data._responseData;
|
||||
}
|
||||
|
||||
public List<UserAchievement> GetUserAchievementList()
|
||||
{
|
||||
return Data.ColosseumBattleFinish.data.achieved_achievement_list;
|
||||
}
|
||||
|
||||
public List<UserMission> GetUserMissionList()
|
||||
{
|
||||
return Data.ColosseumBattleFinish.data.achieved_mission_list;
|
||||
}
|
||||
|
||||
public int GetClassExp()
|
||||
{
|
||||
return Data.ColosseumBattleFinish.data.get_class_chara_experience;
|
||||
}
|
||||
}
|
||||
12
SVSim.BattleEngine/Engine/ConnectionReportTrigger.cs
Normal file
12
SVSim.BattleEngine/Engine/ConnectionReportTrigger.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Wizard;
|
||||
|
||||
public class ConnectionReportTrigger
|
||||
{
|
||||
public static void ConnectionReport(NetworkBattleManagerBase networkBattleManager)
|
||||
{
|
||||
LocalLog.AddGungnirLog("ConnectionReport");
|
||||
networkBattleManager.disconnectToDispChecker.StartChecker();
|
||||
networkBattleManager.disconnectToDispChecker.EraseDisp();
|
||||
networkBattleManager.disconnectToLoseChecker.StartChecker();
|
||||
}
|
||||
}
|
||||
51
SVSim.BattleEngine/Engine/ConnectionReporter.cs
Normal file
51
SVSim.BattleEngine/Engine/ConnectionReporter.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class ConnectionReporter
|
||||
{
|
||||
private const float DEFAULT_INTERVAL = 10f;
|
||||
|
||||
private Coroutine coroutine;
|
||||
|
||||
private readonly MonoBehaviour runner;
|
||||
|
||||
private readonly Action report;
|
||||
|
||||
private readonly float interval;
|
||||
|
||||
public ConnectionReporter(MonoBehaviour runner, Action report, float interval = 10f)
|
||||
{
|
||||
this.runner = runner;
|
||||
this.report = report;
|
||||
this.interval = interval;
|
||||
}
|
||||
|
||||
public void StopReporter()
|
||||
{
|
||||
if (coroutine != null)
|
||||
{
|
||||
runner.StopCoroutine(coroutine);
|
||||
coroutine = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartReporter()
|
||||
{
|
||||
if (coroutine == null && runner != null)
|
||||
{
|
||||
coroutine = runner.StartCoroutine(LoopCoroutine());
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator LoopCoroutine()
|
||||
{
|
||||
WaitForSeconds secondWait = new WaitForSeconds(interval);
|
||||
while (true)
|
||||
{
|
||||
report.Call();
|
||||
yield return secondWait;
|
||||
}
|
||||
}
|
||||
}
|
||||
16
SVSim.BattleEngine/Engine/ConventionList.cs
Normal file
16
SVSim.BattleEngine/Engine/ConventionList.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
|
||||
public class ConventionList
|
||||
{
|
||||
public List<ConventionInfo> List { get; private set; }
|
||||
|
||||
public void Parse(JsonData data)
|
||||
{
|
||||
List = new List<ConventionInfo>();
|
||||
for (int i = 0; i < data.Count; i++)
|
||||
{
|
||||
List.Add(new ConventionInfo(data[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
59
SVSim.BattleEngine/Engine/ConventionListPlate.cs
Normal file
59
SVSim.BattleEngine/Engine/ConventionListPlate.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class ConventionListPlate : MonoBehaviour
|
||||
{
|
||||
private const string DECK_ENTRY_SPRITE = "btn_decklogin";
|
||||
|
||||
private const string GAME_START_SPRITE = "btn_competition";
|
||||
|
||||
[SerializeField]
|
||||
private UIButton _button;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _conventionName;
|
||||
|
||||
[SerializeField]
|
||||
private UILabel _deckSetTimeLimit;
|
||||
|
||||
private ConventionInfo _conventionInfo;
|
||||
|
||||
public Action<ConventionInfo> OnSelect { get; set; }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_button.onClick.Add(new EventDelegate(delegate
|
||||
{
|
||||
OnClickConvention();
|
||||
}));
|
||||
}
|
||||
|
||||
public void Initialize(ConventionInfo convention)
|
||||
{
|
||||
_conventionInfo = convention;
|
||||
_conventionName.text = convention.Name;
|
||||
if (convention.Status == ConventionInfo.ConventionStatus.GameStart)
|
||||
{
|
||||
_deckSetTimeLimit.gameObject.SetActive(value: false);
|
||||
_button.normalSprite = "btn_competition";
|
||||
return;
|
||||
}
|
||||
_deckSetTimeLimit.gameObject.SetActive(value: true);
|
||||
_deckSetTimeLimit.text = Data.SystemText.Get("Arena_0126", convention.DeckEntryLimitText);
|
||||
_button.normalSprite = "btn_decklogin";
|
||||
}
|
||||
|
||||
public void FadeOutHide()
|
||||
{
|
||||
FadeUtility.FadeOutObjectAndNonActive(_button.gameObject);
|
||||
_button.enabled = false;
|
||||
}
|
||||
|
||||
private void OnClickConvention()
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
|
||||
OnSelect.Call(_conventionInfo);
|
||||
}
|
||||
}
|
||||
86
SVSim.BattleEngine/Engine/ConventionListUI.cs
Normal file
86
SVSim.BattleEngine/Engine/ConventionListUI.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Cute;
|
||||
using UnityEngine;
|
||||
|
||||
public class ConventionListUI : UIBase
|
||||
{
|
||||
private const int SCROLL_CONVENTION_COUNT = 3;
|
||||
|
||||
[SerializeField]
|
||||
private ConventionListPlate _conventionItemOriginal;
|
||||
|
||||
[SerializeField]
|
||||
private UIScrollView _scrollView;
|
||||
|
||||
[SerializeField]
|
||||
private UIGrid _grid;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _conventionListPlateRoot;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _backGround;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _layout1;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject[] _layout2;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _scrollBar;
|
||||
|
||||
private List<ConventionListPlate> _plateList = new List<ConventionListPlate>();
|
||||
|
||||
public Action<ConventionInfo> OnSelect { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_conventionItemOriginal.gameObject.SetActive(value: false);
|
||||
}
|
||||
|
||||
public void Show(ConventionList conventionList)
|
||||
{
|
||||
List<ConventionInfo> list = conventionList.List;
|
||||
int num = 0;
|
||||
foreach (ConventionInfo item in list)
|
||||
{
|
||||
GameObject parent = _conventionListPlateRoot;
|
||||
switch (list.Count)
|
||||
{
|
||||
case 1:
|
||||
parent = _layout1;
|
||||
break;
|
||||
case 2:
|
||||
parent = _layout2[num];
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
GameObject obj = NGUITools.AddChild(parent, _conventionItemOriginal.gameObject);
|
||||
obj.SetActive(value: true);
|
||||
ConventionListPlate component = obj.GetComponent<ConventionListPlate>();
|
||||
component.Initialize(item);
|
||||
component.OnSelect = OnSelectConvention;
|
||||
_plateList.Add(component);
|
||||
}
|
||||
_backGround.SetActive(list.Count > 3);
|
||||
_grid.Reposition();
|
||||
_scrollView.ResetPosition();
|
||||
}
|
||||
|
||||
private void OnSelectConvention(ConventionInfo convention)
|
||||
{
|
||||
OnSelect.Call(convention);
|
||||
foreach (ConventionListPlate plate in _plateList)
|
||||
{
|
||||
plate.FadeOutHide();
|
||||
}
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
_backGround.SetActive(value: false);
|
||||
_scrollBar.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
24
SVSim.BattleEngine/Engine/CostAddModifier.cs
Normal file
24
SVSim.BattleEngine/Engine/CostAddModifier.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
public class CostAddModifier : ICardCostModifier
|
||||
{
|
||||
public int Cost { get; private set; }
|
||||
|
||||
public bool IsClearBeforeModifier => false;
|
||||
|
||||
public bool IsResidentModifier { get; }
|
||||
|
||||
public CostAddModifier(int cost, bool isResidentModifier = false)
|
||||
{
|
||||
Cost = cost;
|
||||
IsResidentModifier = isResidentModifier;
|
||||
}
|
||||
|
||||
public int CalcCost(int cost)
|
||||
{
|
||||
return cost + Cost;
|
||||
}
|
||||
|
||||
public ICardCostModifier Clone()
|
||||
{
|
||||
return new CostAddModifier(Cost, IsResidentModifier);
|
||||
}
|
||||
}
|
||||
195
SVSim.BattleEngine/Engine/CostCurveUI.cs
Normal file
195
SVSim.BattleEngine/Engine/CostCurveUI.cs
Normal file
@@ -0,0 +1,195 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
public class CostCurveUI : MonoBehaviour
|
||||
{
|
||||
[Serializable]
|
||||
private class CostStruct
|
||||
{
|
||||
[SerializeField]
|
||||
public GameObject Parent;
|
||||
|
||||
[SerializeField]
|
||||
public UILabel LabelCost;
|
||||
|
||||
[SerializeField]
|
||||
public UILabel LabelCount;
|
||||
|
||||
[SerializeField]
|
||||
public UIProgressBar Bar;
|
||||
|
||||
public int Count;
|
||||
}
|
||||
|
||||
[SerializeField]
|
||||
private int m_maxBarValue = 15;
|
||||
|
||||
[SerializeField]
|
||||
private CostStruct m_original;
|
||||
|
||||
[SerializeField]
|
||||
private UIProgressBar m_barAdditiveEffect;
|
||||
|
||||
[SerializeField]
|
||||
private int m_barNum = 8;
|
||||
|
||||
[SerializeField]
|
||||
private int m_minCost = 1;
|
||||
|
||||
[SerializeField]
|
||||
private float m_barWidth = 25f;
|
||||
|
||||
private CostStruct[] m_costArray;
|
||||
|
||||
private CardMaster.CardMasterId _cardMasterId;
|
||||
|
||||
public void Initialize(CardMaster.CardMasterId cardMasterId)
|
||||
{
|
||||
_cardMasterId = cardMasterId;
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
if (m_costArray != null)
|
||||
{
|
||||
for (int i = 0; i < m_costArray.Length; i++)
|
||||
{
|
||||
m_costArray[i].Count = 0;
|
||||
m_costArray[i].LabelCount.text = "0";
|
||||
m_costArray[i].Bar.value = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh(int[] array)
|
||||
{
|
||||
Refresh();
|
||||
if (array != null)
|
||||
{
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
Add(array[i], withAnim: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh(UIBase_CardManager.CardObjData[] array)
|
||||
{
|
||||
Refresh();
|
||||
if (array == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
int num = array[i].mainCardNum + array[i].subCardNum;
|
||||
for (int j = 0; j < num; j++)
|
||||
{
|
||||
Add(array[i].ids, withAnim: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(int cardId, bool withAnim)
|
||||
{
|
||||
ChangeValue(1, cardId, withAnim);
|
||||
}
|
||||
|
||||
public void Add(UIBase_CardManager.CardObjData card, bool withAnim)
|
||||
{
|
||||
Add(card.ids, withAnim);
|
||||
}
|
||||
|
||||
public void Sub(int cardId, bool withAnim)
|
||||
{
|
||||
ChangeValue(-1, cardId, withAnim);
|
||||
}
|
||||
|
||||
public void Sub(UIBase_CardManager.CardObjData card, bool withAnim)
|
||||
{
|
||||
Sub(card.ids, withAnim);
|
||||
}
|
||||
|
||||
private void ChangeValue(int addnum, int cardId, bool withAnim)
|
||||
{
|
||||
int num = Mathf.Min(Mathf.Max(CardMaster.GetInstance(_cardMasterId).GetCardParameterFromId(cardId).Cost, m_minCost), m_barNum) - m_minCost;
|
||||
CostStruct cost_this = m_costArray[num];
|
||||
cost_this.Count += addnum;
|
||||
if (withAnim && m_barAdditiveEffect != null)
|
||||
{
|
||||
m_barAdditiveEffect.gameObject.SetActive(value: true);
|
||||
UIProgressBar barAdditiveEffect = m_barAdditiveEffect;
|
||||
float value = (cost_this.Bar.value = (float)(cost_this.Count + addnum) / (float)m_maxBarValue);
|
||||
barAdditiveEffect.value = value;
|
||||
m_barAdditiveEffect.transform.position = cost_this.Bar.transform.position;
|
||||
m_barAdditiveEffect.alpha = 0.8f;
|
||||
TweenAlpha.Begin(m_barAdditiveEffect.gameObject, 0.4f, 0f);
|
||||
TweenScale anim = TweenScale.Begin(cost_this.LabelCount.gameObject, 0.2f, Vector3.one * 1.2f);
|
||||
TweenAlpha.Begin(cost_this.LabelCount.gameObject, 0.2f, 0f);
|
||||
EventDelegate ev = null;
|
||||
ev = new EventDelegate(delegate
|
||||
{
|
||||
anim.RemoveOnFinished(ev);
|
||||
cost_this.Bar.value = (float)cost_this.Count / (float)m_maxBarValue;
|
||||
cost_this.LabelCount.text = cost_this.Count.ToString() ?? "";
|
||||
cost_this.LabelCount.transform.localScale = Vector3.one * 0.8f;
|
||||
TweenScale.Begin(cost_this.LabelCount.gameObject, 0.2f, Vector3.one);
|
||||
TweenAlpha.Begin(cost_this.LabelCount.gameObject, 0.2f, 1f);
|
||||
});
|
||||
anim.onFinished.Add(ev);
|
||||
}
|
||||
else
|
||||
{
|
||||
cost_this.LabelCount.text = cost_this.Count.ToString() ?? "";
|
||||
cost_this.Bar.value = (float)cost_this.Count / (float)m_maxBarValue;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
m_costArray = new CostStruct[m_barNum];
|
||||
m_original.LabelCost.text = m_minCost.ToString() ?? "";
|
||||
m_original.LabelCount.text = 0.ToString() ?? "";
|
||||
m_original.Bar.value = 0f;
|
||||
m_costArray[0] = m_original;
|
||||
for (int i = 1; i < m_barNum; i++)
|
||||
{
|
||||
m_costArray[i] = new CostStruct();
|
||||
GameObject obj = (m_costArray[i].Parent = UnityEngine.Object.Instantiate(m_original.Parent));
|
||||
obj.transform.parent = m_original.Parent.transform.parent;
|
||||
obj.transform.localScale = m_original.Parent.transform.localScale;
|
||||
Vector3 localPosition = m_original.Parent.transform.localPosition;
|
||||
localPosition.x += m_barWidth * (float)i;
|
||||
obj.transform.localPosition = localPosition;
|
||||
UIWidget[] componentsInChildren = obj.GetComponentsInChildren<UIWidget>();
|
||||
for (int j = 0; j < componentsInChildren.Length; j++)
|
||||
{
|
||||
if (componentsInChildren[j].name == m_original.LabelCost.name)
|
||||
{
|
||||
m_costArray[i].LabelCost = componentsInChildren[j].GetComponent<UILabel>();
|
||||
m_costArray[i].LabelCost.text = (i + m_minCost).ToString() ?? "";
|
||||
if (i == m_barNum - 1)
|
||||
{
|
||||
m_costArray[i].LabelCost.text += "⁺";
|
||||
}
|
||||
}
|
||||
else if (componentsInChildren[j].name == m_original.LabelCount.name)
|
||||
{
|
||||
m_costArray[i].LabelCount = componentsInChildren[j].GetComponent<UILabel>();
|
||||
m_costArray[i].LabelCount.text = 0.ToString() ?? "";
|
||||
}
|
||||
else if (componentsInChildren[j].name == m_original.Bar.name)
|
||||
{
|
||||
m_costArray[i].Bar = componentsInChildren[j].GetComponent<UIProgressBar>();
|
||||
m_costArray[i].Bar.value = 0f;
|
||||
}
|
||||
m_costArray[i].Count = 0;
|
||||
}
|
||||
}
|
||||
if (m_barAdditiveEffect != null)
|
||||
{
|
||||
m_barAdditiveEffect.gameObject.SetActive(value: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
17
SVSim.BattleEngine/Engine/CostHalfModifier.cs
Normal file
17
SVSim.BattleEngine/Engine/CostHalfModifier.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
public abstract class CostHalfModifier : ICardCostModifier
|
||||
{
|
||||
public int Cost { get; private set; }
|
||||
|
||||
public bool IsClearBeforeModifier => false;
|
||||
|
||||
public bool IsResidentModifier { get; }
|
||||
|
||||
public CostHalfModifier(bool isResidentModifier)
|
||||
{
|
||||
IsResidentModifier = isResidentModifier;
|
||||
}
|
||||
|
||||
public abstract int CalcCost(int cost);
|
||||
|
||||
public abstract ICardCostModifier Clone();
|
||||
}
|
||||
19
SVSim.BattleEngine/Engine/CostHalfRoundUpModifier.cs
Normal file
19
SVSim.BattleEngine/Engine/CostHalfRoundUpModifier.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
public class CostHalfRoundUpModifier : CostHalfModifier
|
||||
{
|
||||
public CostHalfRoundUpModifier(bool isResidentModifier)
|
||||
: base(isResidentModifier)
|
||||
{
|
||||
}
|
||||
|
||||
public override int CalcCost(int cost)
|
||||
{
|
||||
return (int)Math.Ceiling((float)cost / 2f);
|
||||
}
|
||||
|
||||
public override ICardCostModifier Clone()
|
||||
{
|
||||
return new CostHalfRoundUpModifier(base.IsResidentModifier);
|
||||
}
|
||||
}
|
||||
24
SVSim.BattleEngine/Engine/CostSetModifier.cs
Normal file
24
SVSim.BattleEngine/Engine/CostSetModifier.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
public class CostSetModifier : ICardCostModifier
|
||||
{
|
||||
public int Cost { get; private set; }
|
||||
|
||||
public bool IsClearBeforeModifier => true;
|
||||
|
||||
public bool IsResidentModifier { get; }
|
||||
|
||||
public CostSetModifier(int cost, bool isResidentModifier = false)
|
||||
{
|
||||
Cost = cost;
|
||||
IsResidentModifier = isResidentModifier;
|
||||
}
|
||||
|
||||
public int CalcCost(int cost)
|
||||
{
|
||||
return Cost;
|
||||
}
|
||||
|
||||
public ICardCostModifier Clone()
|
||||
{
|
||||
return new CostSetModifier(Cost, IsResidentModifier);
|
||||
}
|
||||
}
|
||||
17
SVSim.BattleEngine/Engine/Cute/AssetBundleObject.cs
Normal file
17
SVSim.BattleEngine/Engine/Cute/AssetBundleObject.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class AssetBundleObject
|
||||
{
|
||||
public AssetBundle assetBundle { get; set; }
|
||||
|
||||
public List<AssetObject> objectArray { get; set; }
|
||||
|
||||
public AssetBundleObject()
|
||||
{
|
||||
assetBundle = null;
|
||||
objectArray = new List<AssetObject>();
|
||||
}
|
||||
}
|
||||
1554
SVSim.BattleEngine/Engine/Cute/AssetManager.cs
Normal file
1554
SVSim.BattleEngine/Engine/Cute/AssetManager.cs
Normal file
File diff suppressed because it is too large
Load Diff
16
SVSim.BattleEngine/Engine/Cute/AssetObject.cs
Normal file
16
SVSim.BattleEngine/Engine/Cute/AssetObject.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class AssetObject
|
||||
{
|
||||
public string basePath { get; private set; }
|
||||
|
||||
public Object baseObject { get; private set; }
|
||||
|
||||
public AssetObject(string path, Object obj)
|
||||
{
|
||||
basePath = path;
|
||||
baseObject = obj;
|
||||
}
|
||||
}
|
||||
182
SVSim.BattleEngine/Engine/Cute/AsyncJob.cs
Normal file
182
SVSim.BattleEngine/Engine/Cute/AsyncJob.cs
Normal file
@@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class AsyncJob
|
||||
{
|
||||
private class Unit
|
||||
{
|
||||
public object action;
|
||||
|
||||
public Action cancelAction;
|
||||
|
||||
public Unit(object action, Action cancelAction)
|
||||
{
|
||||
this.action = action;
|
||||
this.cancelAction = cancelAction;
|
||||
}
|
||||
}
|
||||
|
||||
private int num;
|
||||
|
||||
private MonoBehaviour mono;
|
||||
|
||||
private List<Unit> jobList = new List<Unit>();
|
||||
|
||||
private bool isCancel;
|
||||
|
||||
private int? _waitFramesBetweenJobs;
|
||||
|
||||
private int _waitFramesBetweenJobsMin;
|
||||
|
||||
private FramerateProfiler _framerateProfiler = new FramerateProfiler();
|
||||
|
||||
public int WAIT_FRAMES_INCREMENT = 5;
|
||||
|
||||
public int WAIT_FRAMES_DECREMENT = 1;
|
||||
|
||||
public bool IsIdle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!isCancel)
|
||||
{
|
||||
return jobList.Count == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int? WantedWaitFramesBetweenJobs
|
||||
{
|
||||
set
|
||||
{
|
||||
_waitFramesBetweenJobs = value;
|
||||
_waitFramesBetweenJobsMin = value.GetValueOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public AsyncJob(MonoBehaviour mono, int num)
|
||||
{
|
||||
this.mono = mono;
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public void Add(IEnumerator enumerator)
|
||||
{
|
||||
jobList.Add(new Unit(enumerator, null));
|
||||
}
|
||||
|
||||
public void Add(IEnumerator enumerator, Action calcelAction)
|
||||
{
|
||||
jobList.Add(new Unit(enumerator, calcelAction));
|
||||
}
|
||||
|
||||
public void Add(Action action)
|
||||
{
|
||||
jobList.Add(new Unit(action, null));
|
||||
}
|
||||
|
||||
public void Add(Action action, Action calcelAction)
|
||||
{
|
||||
jobList.Add(new Unit(action, calcelAction));
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
if (!isCancel && jobList.Count != 0)
|
||||
{
|
||||
isCancel = true;
|
||||
Add(CancelTerminator, CancelTerminator);
|
||||
}
|
||||
}
|
||||
|
||||
public void CancelTerminator()
|
||||
{
|
||||
isCancel = false;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
mono.StartCoroutine(MicroThread());
|
||||
}
|
||||
_framerateProfiler = new FramerateProfiler();
|
||||
mono.StartCoroutine(RunFpsProfiler());
|
||||
}
|
||||
|
||||
private IEnumerator RunFpsProfiler()
|
||||
{
|
||||
_framerateProfiler.Init();
|
||||
while (true)
|
||||
{
|
||||
_framerateProfiler.Update();
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator MicroThread()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (jobList.Count <= 0)
|
||||
{
|
||||
yield return null;
|
||||
continue;
|
||||
}
|
||||
Unit unit = jobList[0];
|
||||
jobList.RemoveAt(0);
|
||||
if (isCancel)
|
||||
{
|
||||
if (unit.cancelAction != null)
|
||||
{
|
||||
unit.cancelAction();
|
||||
}
|
||||
}
|
||||
else if (unit.action is IEnumerator)
|
||||
{
|
||||
yield return mono.StartCoroutine((IEnumerator)unit.action);
|
||||
if (!_waitFramesBetweenJobs.HasValue)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
float? fps = _framerateProfiler.Fps;
|
||||
if (fps.HasValue)
|
||||
{
|
||||
if (fps < 20f)
|
||||
{
|
||||
_waitFramesBetweenJobs += WAIT_FRAMES_INCREMENT;
|
||||
_framerateProfiler.Init();
|
||||
}
|
||||
else if (fps > 30f)
|
||||
{
|
||||
_waitFramesBetweenJobs -= WAIT_FRAMES_INCREMENT;
|
||||
if (_waitFramesBetweenJobs.Value < _waitFramesBetweenJobsMin)
|
||||
{
|
||||
_waitFramesBetweenJobs = _waitFramesBetweenJobsMin;
|
||||
}
|
||||
_framerateProfiler.Init();
|
||||
}
|
||||
}
|
||||
yield return WaitFrames(_waitFramesBetweenJobs.Value);
|
||||
}
|
||||
else if (unit.action is Action)
|
||||
{
|
||||
((Action)unit.action)();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerator WaitFrames(int frameCount)
|
||||
{
|
||||
while (frameCount > 0)
|
||||
{
|
||||
frameCount--;
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
808
SVSim.BattleEngine/Engine/Cute/AudioManager.cs
Normal file
808
SVSim.BattleEngine/Engine/Cute/AudioManager.cs
Normal file
@@ -0,0 +1,808 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using CriWare;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class AudioManager : MonoBehaviour, IManager
|
||||
{
|
||||
[SerializeField]
|
||||
private GameObject _bgmParent;
|
||||
|
||||
[SerializeField]
|
||||
private CriAtomSource[] _bgm;
|
||||
|
||||
private int _bgmSourceCount;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _seParent;
|
||||
|
||||
[SerializeField]
|
||||
private CriAtomSource[] _se;
|
||||
|
||||
private int _seSourceCount;
|
||||
|
||||
private SoundData[] _playingSe;
|
||||
|
||||
[SerializeField]
|
||||
private GameObject _voiceParent;
|
||||
|
||||
[SerializeField]
|
||||
private CriAtomSource[] _voice;
|
||||
|
||||
private int _voiceSourceCount;
|
||||
|
||||
private bool _bgmPlaySuspend;
|
||||
|
||||
private const int BGM_FADEOUT_TIME = 500;
|
||||
|
||||
private const int SONG_PREVIEW_FADE_TIME = 500;
|
||||
|
||||
private const int SONG_PREVIEW_FADE_SPACE_TIME = 1500;
|
||||
|
||||
private const float SE_FADE_TIME = 0.5f;
|
||||
|
||||
public const int DELAY_TIME_OFFSET = -4;
|
||||
|
||||
private const float VOULMN_BOOST_FACTOR = 1.5f;
|
||||
|
||||
public const string ACB_EXTENSION_WITHPARAM = "{0}.acb";
|
||||
|
||||
public const string ACB_EXTENSION = ".acb";
|
||||
|
||||
public const string AWB_EXTENSION_WITHPARAM = "{0}.awb";
|
||||
|
||||
public const string AWB_EXTENSION = ".awb";
|
||||
|
||||
private const string STR_SUBFOLDER_BGM = "b/";
|
||||
|
||||
public const string STR_SUBFOLDER_SE = "s/";
|
||||
|
||||
private const string STR_SUBFOLDER_SONG = "l/";
|
||||
|
||||
private const string STR_SUBFOLDER_VOICE = "v/";
|
||||
|
||||
private const string STR_SUBFOLDER_STORY = "c/";
|
||||
|
||||
private const string STR_SUBFOLDER_ROOM = "r/";
|
||||
|
||||
public bool isDownloadVoiceUse = true;
|
||||
|
||||
protected bool _isRedy;
|
||||
|
||||
private bool _noSeMode;
|
||||
|
||||
private CriAtomExPlayback _playback;
|
||||
|
||||
private CriAtomExPlayback _bgmPlayback;
|
||||
|
||||
private float _sampleTime;
|
||||
|
||||
private int _delayTime;
|
||||
|
||||
private int _criDelayTime;
|
||||
|
||||
private int _criInitializeCount;
|
||||
|
||||
private const int CRI_RETRY_COUNT = 3;
|
||||
|
||||
private Dictionary<string, CriAtomExAcb> _acbDictionary = new Dictionary<string, CriAtomExAcb>();
|
||||
|
||||
private string[] STR_PREINSTALL_FILENAME = new string[1] { "preinstall" };
|
||||
|
||||
public const float VOICE_MASTER_VOLUME = 0.8f;
|
||||
|
||||
private Action _callbackVoiseEnd;
|
||||
|
||||
private string _bgmName = "";
|
||||
|
||||
private int _cueId = -1;
|
||||
|
||||
private string _bgmCue = "";
|
||||
|
||||
public bool isRedy => _isRedy;
|
||||
|
||||
public int delayTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return _delayTime;
|
||||
}
|
||||
set
|
||||
{
|
||||
_delayTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string bgmName
|
||||
{
|
||||
get
|
||||
{
|
||||
return _bgmName;
|
||||
}
|
||||
set
|
||||
{
|
||||
_bgmName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int cueId
|
||||
{
|
||||
get
|
||||
{
|
||||
return _cueId;
|
||||
}
|
||||
set
|
||||
{
|
||||
_cueId = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string bgmCue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _bgmCue;
|
||||
}
|
||||
set
|
||||
{
|
||||
_bgmCue = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
_bgm = _bgmParent.GetComponentsInChildren<CriAtomSource>();
|
||||
_bgmSourceCount = _bgm.Length;
|
||||
for (int i = 0; i < _bgmSourceCount; i++)
|
||||
{
|
||||
CriAtomExPlayer player = _bgm[i].player;
|
||||
player.AttachFader();
|
||||
player.ResetFaderParameters();
|
||||
player.SetFadeOutTime(500);
|
||||
}
|
||||
_se = _seParent.GetComponentsInChildren<CriAtomSource>();
|
||||
_seSourceCount = _se.Length;
|
||||
_playingSe = new SoundData[_seSourceCount];
|
||||
for (int j = 0; j < _seSourceCount; j++)
|
||||
{
|
||||
CriAtomExPlayer player2 = _se[j].player;
|
||||
player2.AttachFader();
|
||||
player2.ResetFaderParameters();
|
||||
}
|
||||
_voice = _voiceParent.GetComponentsInChildren<CriAtomSource>();
|
||||
_voiceSourceCount = _voice.Length;
|
||||
for (int k = 0; k < _voiceSourceCount; k++)
|
||||
{
|
||||
CriAtomExPlayer player3 = _voice[k].player;
|
||||
player3.AttachFader();
|
||||
player3.ResetFaderParameters();
|
||||
}
|
||||
Toolbox.AudioManager = this;
|
||||
yield break;
|
||||
}
|
||||
|
||||
public void ResetSoundMode()
|
||||
{
|
||||
_noSeMode = false;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public void PauseAllBgm(bool pauseStatus)
|
||||
{
|
||||
if (pauseStatus)
|
||||
{
|
||||
_bgmPlaySuspend = false;
|
||||
for (int i = 0; i < _bgmSourceCount; i++)
|
||||
{
|
||||
if (_bgm[i].status == CriAtomSource.Status.Prep || _bgm[i].status == CriAtomSource.Status.Playing)
|
||||
{
|
||||
_bgm[i].Pause(sw: true);
|
||||
_bgmPlaySuspend = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_bgmPlaySuspend)
|
||||
{
|
||||
for (int j = 0; j < _bgmSourceCount; j++)
|
||||
{
|
||||
_bgm[j].Pause(sw: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public long GetMusicLength(string acbName)
|
||||
{
|
||||
CriAtomExAcb acb = CriAtom.GetAcb(acbName);
|
||||
if (acb != null && acb.GetCueInfo(0, out var info))
|
||||
{
|
||||
return info.length;
|
||||
}
|
||||
return -1L;
|
||||
}
|
||||
|
||||
public bool IsAvailableCueSheet(string cueName)
|
||||
{
|
||||
CriAtomCueSheet cueSheet = CriAtom.GetCueSheet(cueName);
|
||||
if (cueSheet != null)
|
||||
{
|
||||
return cueSheet.acb != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AddCueSheet(string _name, string acbFile, string subFolderPath, string awbname = "")
|
||||
{
|
||||
_name = _name.Replace(".acb", "");
|
||||
if (CriAtom.GetCueSheet(_name) != null || CriAtom.GetCueSheet(acbFile) != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool flag = false;
|
||||
int num = STR_PREINSTALL_FILENAME.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
if (string.Compare(_name, STR_PREINSTALL_FILENAME[i]) == 0)
|
||||
{
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
acbFile = $"{subFolderPath}{acbFile}";
|
||||
awbname = $"{subFolderPath}{awbname}";
|
||||
}
|
||||
else
|
||||
{
|
||||
acbFile = string.Format("{0}{1}{2}{3}", Application.persistentDataPath, "/", subFolderPath, acbFile);
|
||||
awbname = string.Format("{0}{1}{2}{3}", Application.persistentDataPath, "/", subFolderPath, awbname);
|
||||
}
|
||||
CriAtomCueSheet criAtomCueSheet = CriAtom.AddCueSheet(_name, acbFile, awbname);
|
||||
if (criAtomCueSheet == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (criAtomCueSheet.acb == null)
|
||||
{
|
||||
RemoveCueSheet(_name);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool AddCueSheetFromFileName(string _name, string acbFile, string awbname)
|
||||
{
|
||||
_name = _name.Replace(".acb", "");
|
||||
int num = STR_PREINSTALL_FILENAME.Length;
|
||||
for (int i = 0; i < num && string.Compare(_name, STR_PREINSTALL_FILENAME[i]) != 0; i++)
|
||||
{
|
||||
}
|
||||
if (CriAtom.GetCueSheet(_name) != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
CriAtomCueSheet criAtomCueSheet = CriAtom.AddCueSheet(_name, acbFile, awbname);
|
||||
if (criAtomCueSheet == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (criAtomCueSheet.acb == null)
|
||||
{
|
||||
RemoveCueSheet(_name);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void RemoveCueSheet(string name)
|
||||
{
|
||||
name = name.Replace(".awb", "");
|
||||
name = name.Replace(".acb", "");
|
||||
name = name.Replace("s/", "");
|
||||
name = name.Replace("b/", "");
|
||||
CriAtom.RemoveCueSheet(name);
|
||||
}
|
||||
|
||||
public void RemoveCueSheet(List<string> nameList)
|
||||
{
|
||||
for (int i = 0; i < nameList.Count; i++)
|
||||
{
|
||||
RemoveCueSheet(nameList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public float GetSampleTime()
|
||||
{
|
||||
long numSamples = 0L;
|
||||
int samplingRate = 0;
|
||||
if (_playback.GetNumPlayedSamples(out numSamples, out samplingRate))
|
||||
{
|
||||
_sampleTime = (float)numSamples / (float)samplingRate;
|
||||
}
|
||||
return _sampleTime;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
foreach (KeyValuePair<string, CriAtomExAcb> item in _acbDictionary)
|
||||
{
|
||||
item.Value.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public int GetDelayTimeFromCRI()
|
||||
{
|
||||
int result = 0;
|
||||
if (_criInitializeCount >= 3)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
return _criDelayTime / 10;
|
||||
}
|
||||
|
||||
public CriAtomSource GetBgmSource(int bgmId)
|
||||
{
|
||||
return _bgm[bgmId];
|
||||
}
|
||||
|
||||
public int GetBgmMaxCount()
|
||||
{
|
||||
return _bgmSourceCount;
|
||||
}
|
||||
|
||||
public void VolumeUpdate_Bgm(int level, bool mute, int bgmId = -1)
|
||||
{
|
||||
if (bgmId < 0)
|
||||
{
|
||||
int num = _bgm.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
Volume_Bgm((float)level * 0.1f, mute, i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Volume_Bgm((float)level * 0.1f, mute, bgmId);
|
||||
}
|
||||
}
|
||||
|
||||
public void Volume_Bgm(float level, bool mute, int bgmId = -1)
|
||||
{
|
||||
if (mute)
|
||||
{
|
||||
level = 0f;
|
||||
}
|
||||
if (bgmId < 0)
|
||||
{
|
||||
int num = _bgm.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
_bgm[i].volume = level;
|
||||
_bgm[i].player.Update(_bgmPlayback);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_bgm[bgmId].volume = level;
|
||||
_bgm[bgmId].player.Update(_bgmPlayback);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPlayBgm(int bgmId = 0)
|
||||
{
|
||||
if (_bgm[bgmId].status == CriAtomSource.Status.Prep || _bgm[bgmId].status == CriAtomSource.Status.Playing)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int PlayBgmFromName(string cueSheet, string cueName, string acbName, string awbName = "", int bgmId = 0, bool loop = true, float FadeInfime = 0f, float OffsetTime = 0f, long startTime = 0L)
|
||||
{
|
||||
if (_bgmName == cueName)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
string acbFile = "";
|
||||
string awbname = "";
|
||||
if (acbName.CompareTo("") != 0)
|
||||
{
|
||||
acbFile = acbName + ".acb";
|
||||
}
|
||||
if (awbName.CompareTo("") != 0)
|
||||
{
|
||||
awbname = awbName + ".awb";
|
||||
}
|
||||
if (AddCueSheet(cueSheet, acbFile, "b/", awbname))
|
||||
{
|
||||
StopBgm(bgmId);
|
||||
_bgm[bgmId].cueSheet = cueSheet;
|
||||
_bgm[bgmId].cueName = cueName;
|
||||
_bgm[bgmId].player.ResetFaderParameters();
|
||||
_bgm[bgmId].player.SetStartTime(startTime);
|
||||
_bgm[bgmId].player.SetFadeInTime((int)(FadeInfime * 1000f));
|
||||
_bgm[bgmId].player.SetFadeInStartOffset((int)(OffsetTime * 1000f));
|
||||
_bgm[bgmId].loop = loop;
|
||||
_bgmPlayback = _bgm[bgmId].Play();
|
||||
_bgmName = cueName;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int PlayBgmFromId(string cueSheet, int cueId, int bgmId = 0, bool loop = true, float FadeInfime = 0f, float OffsetTime = 0f, long startTime = 0L)
|
||||
{
|
||||
if (_bgmCue == cueSheet && cueId == _cueId)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (CriAtom.GetCueSheet(cueSheet) != null)
|
||||
{
|
||||
StopBgm(bgmId);
|
||||
_bgm[bgmId].cueSheet = cueSheet;
|
||||
_bgm[bgmId].player.ResetFaderParameters();
|
||||
_bgm[bgmId].player.SetStartTime(startTime);
|
||||
_bgm[bgmId].player.SetFadeInTime((int)(FadeInfime * 1000f));
|
||||
_bgm[bgmId].player.SetFadeInStartOffset((int)(OffsetTime * 1000f));
|
||||
_bgm[bgmId].loop = loop;
|
||||
_bgmPlayback = _bgm[bgmId].Play(cueId);
|
||||
_cueId = cueId;
|
||||
_bgmCue = "";
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void StopBgm(int bgmId = 0)
|
||||
{
|
||||
_bgmName = "";
|
||||
_bgm[bgmId].Stop();
|
||||
}
|
||||
|
||||
public void PauseBgm(bool isPause, int bgmId = 0)
|
||||
{
|
||||
_bgm[bgmId].Pause(isPause);
|
||||
}
|
||||
|
||||
public void StopFadeBgm(int bgmId = 0, float time = 0.5f)
|
||||
{
|
||||
_bgm[bgmId].player.SetFadeOutTime((int)(time * 1000f));
|
||||
StopBgm(bgmId);
|
||||
}
|
||||
|
||||
public void SetBgmVolume(float volume)
|
||||
{
|
||||
GameMgr.GetIns().GetSoundMgr().SetBgmVolume(volume);
|
||||
}
|
||||
|
||||
public void StartCoroutine_DelayMethod(float waitTime, Action process)
|
||||
{
|
||||
StartCoroutine(Timer.DelayMethod(waitTime, process));
|
||||
}
|
||||
|
||||
public void VolumeUpdate_Se(int level, bool mute)
|
||||
{
|
||||
Volume_Se((float)level * 0.1f, mute);
|
||||
}
|
||||
|
||||
public void Volume_Se(float level, bool mute)
|
||||
{
|
||||
if (mute)
|
||||
{
|
||||
level = 0f;
|
||||
}
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
_se[i].volume = level;
|
||||
}
|
||||
}
|
||||
|
||||
public int PlaySeFromId(ref SoundData seData, bool loop = false)
|
||||
{
|
||||
int index = -1;
|
||||
CriAtomSource criAtomSource = FindSe(ref seData, out index);
|
||||
if (criAtomSource != null)
|
||||
{
|
||||
criAtomSource.cueSheet = seData._acbName;
|
||||
criAtomSource.loop = loop;
|
||||
CriAtomExPlayer player = criAtomSource.player;
|
||||
player.ResetFaderParameters();
|
||||
player.SetFadeOutTime(0);
|
||||
criAtomSource.Play(seData._cueName);
|
||||
return index;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public int PlaySeFromId(string cueName, int cueId, bool loop = false)
|
||||
{
|
||||
if (!IsAvailableCueSheet(cueName))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
if (_se[i].status == CriAtomSource.Status.PlayEnd)
|
||||
{
|
||||
_se[i].Stop();
|
||||
}
|
||||
if (_se[i].status == CriAtomSource.Status.Stop)
|
||||
{
|
||||
_se[i].cueSheet = cueName;
|
||||
_se[i].loop = loop;
|
||||
_se[i].Play(cueId);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
private CriAtomSource FindSe(ref SoundData seData, out int index)
|
||||
{
|
||||
index = -1;
|
||||
if (_noSeMode)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!IsAvailableCueSheet(seData._acbName))
|
||||
{
|
||||
Debug.LogError($"No Include Acb!!!:{seData._acbName},{seData._cueName}");
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
if (_se[i].status == CriAtomSource.Status.PlayEnd)
|
||||
{
|
||||
_se[i].Stop();
|
||||
}
|
||||
if (_se[i].status == CriAtomSource.Status.Stop)
|
||||
{
|
||||
index = i;
|
||||
return _se[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int PlaySe(string cueName, int cueId, bool loop = false)
|
||||
{
|
||||
if (!IsAvailableCueSheet(cueName))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
if (_se[i].status == CriAtomSource.Status.PlayEnd)
|
||||
{
|
||||
_se[i].Stop();
|
||||
}
|
||||
if (_se[i].status == CriAtomSource.Status.Stop)
|
||||
{
|
||||
_se[i].cueSheet = cueName;
|
||||
_se[i].loop = loop;
|
||||
_se[i].Play(cueId);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void StopSe(int index, float fadeout = 500f)
|
||||
{
|
||||
if (index >= 0 && index < _seSourceCount)
|
||||
{
|
||||
ResumeSe(index);
|
||||
_se[index].player.SetFadeOutTime((int)(fadeout * 1000f));
|
||||
_se[index].Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void StopSe(string cuename, float fadeout = 500f)
|
||||
{
|
||||
for (int i = 0; i < _se.Length; i++)
|
||||
{
|
||||
if (_se[i].cueName.CompareTo(cuename) == 0)
|
||||
{
|
||||
ResumeSe(i);
|
||||
_se[i].player.SetFadeOutTime((int)(fadeout * 1000f));
|
||||
_se[i].Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StopSeAll(float fadeout = 500f)
|
||||
{
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
StopSe(i, fadeout);
|
||||
}
|
||||
}
|
||||
|
||||
public void PauseSe(int index)
|
||||
{
|
||||
if (index >= 0 && index < _seSourceCount && (_se[index].status == CriAtomSource.Status.Playing || _se[index].status == CriAtomSource.Status.Prep))
|
||||
{
|
||||
_se[index].Pause(sw: true);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResumeSe(int index)
|
||||
{
|
||||
if (index >= 0 && index < _seSourceCount && _se[index].status == CriAtomSource.Status.Playing)
|
||||
{
|
||||
_se[index].Pause(sw: false);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPlaySe(string cueName, int cueId)
|
||||
{
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
if (_playingSe[i]._cueName == cueName && _playingSe[i]._cueId == cueId && (_se[i].status == CriAtomSource.Status.Prep || _se[i].status == CriAtomSource.Status.Playing))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsPlaySe(string cueSheetName, string cueName, out int number)
|
||||
{
|
||||
number = 0;
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
if (_playingSe[i]._acbName == cueSheetName && _playingSe[i]._cueName == cueName && _se[i].status == CriAtomSource.Status.Playing)
|
||||
{
|
||||
number++;
|
||||
}
|
||||
}
|
||||
if (number > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsPrepSe(string cueSheetName, string cueName, out int number)
|
||||
{
|
||||
number = 0;
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
if (_playingSe[i]._acbName == cueSheetName && _playingSe[i]._cueName == cueName && _se[i].status == CriAtomSource.Status.Prep)
|
||||
{
|
||||
number++;
|
||||
}
|
||||
}
|
||||
if (number > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ResetSe()
|
||||
{
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
_se[i].Stop();
|
||||
_se[i].Pause(sw: false);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPlaySe(int index)
|
||||
{
|
||||
if (_se[index].status == CriAtomSource.Status.Prep || _se[index].status == CriAtomSource.Status.Playing)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetAisac(string cuename, string param, float num)
|
||||
{
|
||||
for (int i = 0; i < _se.Length; i++)
|
||||
{
|
||||
if (_se[i].cueName.CompareTo(cuename) == 0)
|
||||
{
|
||||
_se[i].SetAisacControl(param, num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int PlaySeFromName(string acbName, string seName, bool loop = false, float fadeInfime = 0f, long startTime = 0L)
|
||||
{
|
||||
if (!IsAvailableCueSheet(acbName))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0; i < _seSourceCount; i++)
|
||||
{
|
||||
if (_se[i].status == CriAtomSource.Status.PlayEnd)
|
||||
{
|
||||
_se[i].Stop();
|
||||
}
|
||||
if (_se[i].status == CriAtomSource.Status.Stop)
|
||||
{
|
||||
_se[i].cueSheet = acbName;
|
||||
_se[i].cueName = seName;
|
||||
_se[i].loop = loop;
|
||||
_se[i].player.ResetFaderParameters();
|
||||
_se[i].player.SetStartTime(startTime);
|
||||
_se[i].player.SetFadeInTime((int)(fadeInfime * 1000f));
|
||||
_se[i].Play(seName);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int GetVoiceSourceCount()
|
||||
{
|
||||
return _voiceSourceCount;
|
||||
}
|
||||
|
||||
public void VolumeUpdate_Voice(int level, bool mute, int voiceId = -1)
|
||||
{
|
||||
Volume_Voice((float)level * 0.1f, mute, voiceId);
|
||||
}
|
||||
|
||||
public void Volume_Voice(float level, bool mute, int voiceId = -1)
|
||||
{
|
||||
if (mute)
|
||||
{
|
||||
level = 0f;
|
||||
}
|
||||
if (voiceId < 0)
|
||||
{
|
||||
int num = _voice.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
_voice[i].volume = level;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_voice[voiceId].volume = level;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPlayVoice(int index)
|
||||
{
|
||||
if (_voice[index].status == CriAtomSource.Status.Prep || _voice[index].status == CriAtomSource.Status.Playing)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void PlayVoice(int voiceId, string acbFile, string cueSheet, string cueName)
|
||||
{
|
||||
AddCueSheet(cueSheet, acbFile, "v/");
|
||||
_voice[voiceId].Play(cueName);
|
||||
}
|
||||
|
||||
public void PlayVoice(int voiceId, string cueName)
|
||||
{
|
||||
_voice[voiceId].Play(cueName);
|
||||
}
|
||||
|
||||
public void StopVoice(int voiceId, float fadetout = 500f)
|
||||
{
|
||||
CriAtomSource criAtomSource = _voice[voiceId];
|
||||
if (criAtomSource != null && criAtomSource.player != null)
|
||||
{
|
||||
criAtomSource.player.SetFadeOutTime((int)(fadetout * 1000f));
|
||||
criAtomSource.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
93
SVSim.BattleEngine/Engine/Cute/BootNetwork.cs
Normal file
93
SVSim.BattleEngine/Engine/Cute/BootNetwork.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class BootNetwork : MonoBehaviour
|
||||
{
|
||||
public bool _autoSetup;
|
||||
|
||||
public static bool IsDoneLanguageSetting;
|
||||
|
||||
public bool IsDoneGameStartCheck { get; set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Object.DontDestroyOnLoad(base.gameObject);
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
while (Toolbox.BootSystem == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
while (Toolbox.NetworkManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
Toolbox.BootNetwork = this;
|
||||
if (_autoSetup)
|
||||
{
|
||||
SetupNetwork();
|
||||
}
|
||||
SetupNetworkLanguage();
|
||||
while (!IsDoneLanguageSetting)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetupNetwork()
|
||||
{
|
||||
if (!IsDoneGameStartCheck)
|
||||
{
|
||||
StartCoroutine(SetupNetworkCoroutine());
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupNetworkLanguage()
|
||||
{
|
||||
string text = Toolbox.SavedataManager.GetString("LANG_SETTING");
|
||||
if (text == "Jpn")
|
||||
{
|
||||
Toolbox.SavedataManager.DeleteKey("LANG_SETTING");
|
||||
Toolbox.SavedataManager.DeleteKey("LANG_SOUND_SETTING");
|
||||
text = "";
|
||||
Toolbox.AssetManager.ClearAllAssetFile();
|
||||
Toolbox.AssetManager.ClearAssetCacheAssetBundle();
|
||||
}
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
CustomPreference.SetScemeMode(CustomPreference.eSchemeType.Https);
|
||||
CustomPreference.SetApplicationServerURL("utoongaize.shadowverse.jp/shadowverse/");
|
||||
}
|
||||
else
|
||||
{
|
||||
IsDoneLanguageSetting = true;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator SetupNetworkCoroutine()
|
||||
{
|
||||
if (!IsDoneGameStartCheck)
|
||||
{
|
||||
yield return StartCoroutine(Toolbox.NetworkManager._certification.Login());
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator SetupNetworkCertification()
|
||||
{
|
||||
SetupNetwork();
|
||||
while (!IsDoneGameStartCheck)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
yield return StartCoroutine(Toolbox.AssetManager.InitializeManifest(null, Data.Load.data._userTutorial.tutorial_step != 100));
|
||||
}
|
||||
}
|
||||
145
SVSim.BattleEngine/Engine/Cute/BootSystem.cs
Normal file
145
SVSim.BattleEngine/Engine/Cute/BootSystem.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
#define STEAM
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using com.adjust.sdk;
|
||||
using RedShellUnity;
|
||||
using Steamworks;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class BootSystem : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
[Tooltip("チェックするとMaxFramerateが有効")]
|
||||
private bool _dontVsync;
|
||||
|
||||
[SerializeField]
|
||||
[Range(0f, 60f)]
|
||||
private int _maxFramerate;
|
||||
|
||||
public static bool isRootBootCamera;
|
||||
|
||||
private Coroutine _logCoroutine;
|
||||
|
||||
private string _logMsg = "";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_logMsg += "Awake";
|
||||
if (isRootBootCamera)
|
||||
{
|
||||
UnityEngine.Object.Destroy(GameObject.Find("BootCamera"));
|
||||
isRootBootCamera = false;
|
||||
}
|
||||
VisibleBootCamera(enable: true);
|
||||
UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
_logCoroutine = StartCoroutine(WaitToAccumulateTraceLog());
|
||||
_logMsg += " Start";
|
||||
while (Toolbox.DeviceManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " DeviceManager";
|
||||
while (Toolbox.SavedataManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " SavedataManager";
|
||||
while (Toolbox.QualityManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " QualityManager";
|
||||
while (Toolbox.SceneManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " SceneManager";
|
||||
while (Toolbox.ResourcesManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " ResourcesManager";
|
||||
while (Toolbox.AssetManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " AssetManager";
|
||||
while (Toolbox.AudioManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " AudioManager";
|
||||
while (Toolbox.MovieManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
_logMsg += " MovieManager";
|
||||
SocialServiceUtility.CreateInstance();
|
||||
bootAdjust();
|
||||
setupRedShell();
|
||||
if (_dontVsync)
|
||||
{
|
||||
QualitySettings.vSyncCount = 0;
|
||||
Application.targetFrameRate = _maxFramerate;
|
||||
}
|
||||
StopCoroutine(_logCoroutine);
|
||||
Toolbox.BootSystem = this;
|
||||
}
|
||||
|
||||
private IEnumerator WaitToAccumulateTraceLog()
|
||||
{
|
||||
yield return new WaitForSeconds(5f);
|
||||
LocalLog.AccumulateTraceInquiryLog("BootSystem " + _logMsg);
|
||||
}
|
||||
|
||||
private void bootAdjust()
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LocalLog.AccumulateTraceLog(ex.ToString());
|
||||
}
|
||||
Adjust.addSessionCallbackParameter("viewer_id", Certification.ViewerId.ToString());
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public void VisibleBootCamera(bool enable)
|
||||
{
|
||||
GameObject gameObject = base.transform.Find("BootCamera").gameObject;
|
||||
if (gameObject != null)
|
||||
{
|
||||
gameObject.SetActive(enable);
|
||||
}
|
||||
}
|
||||
|
||||
[Conditional("STEAM")]
|
||||
private void setupRedShell()
|
||||
{
|
||||
RedShell.SetVerboseLogs(verboseLogs: true);
|
||||
RedShell.SetApiKey("04b8d4a58416140132fdcd680b17a0d8");
|
||||
try
|
||||
{
|
||||
RedShell.SetUserId(SteamUser.GetSteamID().m_SteamID.ToString());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError("<color=aqua>steam client が起動していない。steamの機能を使えません。</color>");
|
||||
Debug.LogError(ex.Message);
|
||||
Debug.LogError(ex.StackTrace);
|
||||
}
|
||||
RedShell.MarkConversion();
|
||||
}
|
||||
}
|
||||
248
SVSim.BattleEngine/Engine/Cute/CryptAES.cs
Normal file
248
SVSim.BattleEngine/Engine/Cute/CryptAES.cs
Normal file
@@ -0,0 +1,248 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class CryptAES
|
||||
{
|
||||
public static byte[] encrypt(byte[] byteSrc)
|
||||
{
|
||||
return EncryptRJ256Api(byteSrc);
|
||||
}
|
||||
|
||||
public static string encrypt(string byteSrc)
|
||||
{
|
||||
return Convert.ToBase64String(EncryptRJ256Api(Encoding.UTF8.GetBytes(byteSrc)));
|
||||
}
|
||||
|
||||
public static string encryptForNode(string src)
|
||||
{
|
||||
return EncryptRJ256ForNode(src);
|
||||
}
|
||||
|
||||
public static byte[] decrypt(string src)
|
||||
{
|
||||
return DecryptRJ256Api(Convert.FromBase64String(src));
|
||||
}
|
||||
|
||||
public static string decryptForNode(string src)
|
||||
{
|
||||
return DecryptRJ256ForNode(src);
|
||||
}
|
||||
|
||||
private static byte[] EncryptRJ256Api(byte[] toEncryptData)
|
||||
{
|
||||
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
|
||||
rijndaelManaged.Mode = CipherMode.CBC;
|
||||
rijndaelManaged.KeySize = 256;
|
||||
rijndaelManaged.BlockSize = 128;
|
||||
byte[] array = new byte[0];
|
||||
byte[] array2 = new byte[0];
|
||||
string s = Cryptographer.generateKeyString();
|
||||
string s2 = Certification.Udid.Replace("-", "").Substring(0, 16);
|
||||
array = Encoding.UTF8.GetBytes(s);
|
||||
array2 = Encoding.UTF8.GetBytes(s2);
|
||||
ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2);
|
||||
using MemoryStream memoryStream = new MemoryStream();
|
||||
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write);
|
||||
cryptoStream.Write(toEncryptData, 0, toEncryptData.Length);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
byte[] array3 = memoryStream.ToArray();
|
||||
byte[] array4 = new byte[array3.Length + array.Length];
|
||||
Array.Copy(array3, 0, array4, 0, array3.Length);
|
||||
Array.Copy(array, 0, array4, array3.Length, array.Length);
|
||||
rijndaelManaged.Clear();
|
||||
memoryStream.Flush();
|
||||
memoryStream.Close();
|
||||
cryptoStream.Flush();
|
||||
cryptoStream.Close();
|
||||
return array4;
|
||||
}
|
||||
|
||||
public static string EncryptRJ256(string prm_text_to_encrypt)
|
||||
{
|
||||
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
|
||||
rijndaelManaged.Padding = PaddingMode.Zeros;
|
||||
rijndaelManaged.Mode = CipherMode.CBC;
|
||||
rijndaelManaged.KeySize = 256;
|
||||
rijndaelManaged.BlockSize = 256;
|
||||
byte[] array = new byte[0];
|
||||
byte[] array2 = new byte[0];
|
||||
string s = Cryptographer.generateKeyString();
|
||||
string s2 = Certification.Udid.Replace("-", "");
|
||||
array = Encoding.UTF8.GetBytes(s);
|
||||
array2 = Encoding.UTF8.GetBytes(s2);
|
||||
ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2);
|
||||
using MemoryStream memoryStream = new MemoryStream();
|
||||
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(prm_text_to_encrypt);
|
||||
cryptoStream.Write(bytes, 0, bytes.Length);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
byte[] array3 = memoryStream.ToArray();
|
||||
byte[] array4 = new byte[array3.Length + array.Length];
|
||||
Array.Copy(array3, 0, array4, 0, array3.Length);
|
||||
Array.Copy(array, 0, array4, array3.Length, array.Length);
|
||||
rijndaelManaged.Clear();
|
||||
memoryStream.Flush();
|
||||
memoryStream.Close();
|
||||
cryptoStream.Flush();
|
||||
cryptoStream.Close();
|
||||
return Convert.ToBase64String(array4);
|
||||
}
|
||||
|
||||
public static string EncryptRJ256ForNode(string prm_text_to_encrypt)
|
||||
{
|
||||
using AesManaged aesManaged = new AesManaged();
|
||||
string text = Cryptographer.generateKeyString();
|
||||
string s = text.Substring(0, 16);
|
||||
aesManaged.BlockSize = 128;
|
||||
aesManaged.KeySize = 256;
|
||||
aesManaged.IV = Encoding.UTF8.GetBytes(s);
|
||||
aesManaged.Key = Encoding.UTF8.GetBytes(text);
|
||||
aesManaged.Mode = CipherMode.CBC;
|
||||
aesManaged.Padding = PaddingMode.PKCS7;
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(prm_text_to_encrypt);
|
||||
using ICryptoTransform cryptoTransform = aesManaged.CreateEncryptor();
|
||||
byte[] inArray = cryptoTransform.TransformFinalBlock(bytes, 0, bytes.Length);
|
||||
aesManaged.Clear();
|
||||
return text + Convert.ToBase64String(inArray);
|
||||
}
|
||||
|
||||
private static byte[] DecryptRJ256Api(byte[] sEncryptedString)
|
||||
{
|
||||
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
|
||||
rijndaelManaged.Mode = CipherMode.CBC;
|
||||
rijndaelManaged.KeySize = 256;
|
||||
rijndaelManaged.BlockSize = 128;
|
||||
byte[] array = new byte[32];
|
||||
byte[] array2 = new byte[16];
|
||||
byte[] array3 = new byte[sEncryptedString.Length - array.Length];
|
||||
Array.Copy(sEncryptedString, 0, array3, 0, array3.Length);
|
||||
Array.Copy(sEncryptedString, sEncryptedString.Length - array.Length, array, 0, array.Length);
|
||||
array2 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", "").Substring(0, 16));
|
||||
ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array, array2);
|
||||
byte[] array4 = new byte[array3.Length];
|
||||
using MemoryStream memoryStream = new MemoryStream(array3);
|
||||
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
|
||||
cryptoStream.Read(array4, 0, array4.Length);
|
||||
rijndaelManaged.Clear();
|
||||
cryptoStream.Flush();
|
||||
cryptoStream.Close();
|
||||
memoryStream.Flush();
|
||||
memoryStream.Close();
|
||||
return array4;
|
||||
}
|
||||
|
||||
public static string DecryptRJ256(string prm_text_to_decrypt)
|
||||
{
|
||||
byte[] array = Convert.FromBase64String(prm_text_to_decrypt);
|
||||
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
|
||||
rijndaelManaged.Padding = PaddingMode.Zeros;
|
||||
rijndaelManaged.Mode = CipherMode.CBC;
|
||||
rijndaelManaged.KeySize = 256;
|
||||
rijndaelManaged.BlockSize = 256;
|
||||
byte[] array2 = new byte[32];
|
||||
byte[] array3 = new byte[32];
|
||||
byte[] array4 = new byte[array.Length - array2.Length];
|
||||
Array.Copy(array, 0, array4, 0, array4.Length);
|
||||
Array.Copy(array, array.Length - array2.Length, array2, 0, array2.Length);
|
||||
array3 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", ""));
|
||||
ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array2, array3);
|
||||
byte[] array5 = new byte[array4.Length];
|
||||
using MemoryStream memoryStream = new MemoryStream(array4);
|
||||
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
|
||||
cryptoStream.Read(array5, 0, array5.Length);
|
||||
rijndaelManaged.Clear();
|
||||
cryptoStream.Flush();
|
||||
cryptoStream.Close();
|
||||
memoryStream.Flush();
|
||||
memoryStream.Close();
|
||||
return Encoding.UTF8.GetString(array5).TrimEnd(default(char));
|
||||
}
|
||||
|
||||
public static string DecryptRJ256ForNode(string prm_text_to_decrypt)
|
||||
{
|
||||
using AesManaged aesManaged = new AesManaged();
|
||||
string text = prm_text_to_decrypt.Substring(0, 32);
|
||||
string s = text.Substring(0, 16);
|
||||
string s2 = prm_text_to_decrypt.Substring(32);
|
||||
aesManaged.BlockSize = 128;
|
||||
aesManaged.KeySize = 256;
|
||||
aesManaged.Key = Encoding.UTF8.GetBytes(text);
|
||||
aesManaged.IV = Encoding.UTF8.GetBytes(s);
|
||||
aesManaged.Mode = CipherMode.CBC;
|
||||
aesManaged.Padding = PaddingMode.PKCS7;
|
||||
byte[] array = Convert.FromBase64String(s2);
|
||||
using ICryptoTransform cryptoTransform = aesManaged.CreateDecryptor();
|
||||
byte[] bytes = cryptoTransform.TransformFinalBlock(array, 0, array.Length);
|
||||
string result = Encoding.UTF8.GetString(bytes);
|
||||
aesManaged.Clear();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte[] EncryptRJ256(byte[] binData)
|
||||
{
|
||||
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
|
||||
rijndaelManaged.Padding = PaddingMode.PKCS7;
|
||||
rijndaelManaged.Mode = CipherMode.CBC;
|
||||
rijndaelManaged.KeySize = 256;
|
||||
rijndaelManaged.BlockSize = 256;
|
||||
byte[] array = new byte[0];
|
||||
byte[] array2 = new byte[0];
|
||||
string s = Cryptographer.generateKeyString();
|
||||
string s2 = Certification.Udid.Replace("-", "");
|
||||
array = Encoding.UTF8.GetBytes(s);
|
||||
array2 = Encoding.UTF8.GetBytes(s2);
|
||||
ICryptoTransform transform = rijndaelManaged.CreateEncryptor(array, array2);
|
||||
using MemoryStream memoryStream = new MemoryStream();
|
||||
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write);
|
||||
byte[] bytes = BitConverter.GetBytes(binData.Length);
|
||||
byte[] array3 = new byte[4 + binData.Length];
|
||||
Array.Copy(bytes, 0, array3, 0, 4);
|
||||
Array.Copy(binData, 0, array3, 4, binData.Length);
|
||||
cryptoStream.Write(array3, 0, array3.Length);
|
||||
cryptoStream.FlushFinalBlock();
|
||||
byte[] array4 = memoryStream.ToArray();
|
||||
byte[] array5 = new byte[array.Length + array4.Length];
|
||||
Array.Copy(array4, 0, array5, 0, array4.Length);
|
||||
Array.Copy(array, 0, array5, array4.Length, array.Length);
|
||||
rijndaelManaged.Clear();
|
||||
memoryStream.Flush();
|
||||
memoryStream.Close();
|
||||
cryptoStream.Flush();
|
||||
cryptoStream.Close();
|
||||
return array5;
|
||||
}
|
||||
|
||||
public static byte[] DecryptRJ256(byte[] binData)
|
||||
{
|
||||
using RijndaelManaged rijndaelManaged = new RijndaelManaged();
|
||||
rijndaelManaged.Padding = PaddingMode.PKCS7;
|
||||
rijndaelManaged.Mode = CipherMode.CBC;
|
||||
rijndaelManaged.KeySize = 256;
|
||||
rijndaelManaged.BlockSize = 256;
|
||||
byte[] array = new byte[32];
|
||||
byte[] array2 = new byte[32];
|
||||
byte[] array3 = new byte[binData.Length - array.Length];
|
||||
Array.Copy(binData, 0, array3, 0, array3.Length);
|
||||
Array.Copy(binData, binData.Length - array.Length, array, 0, array.Length);
|
||||
array2 = Encoding.UTF8.GetBytes(Certification.Udid.Replace("-", ""));
|
||||
ICryptoTransform transform = rijndaelManaged.CreateDecryptor(array, array2);
|
||||
byte[] array4 = new byte[array3.Length];
|
||||
using MemoryStream memoryStream = new MemoryStream(array3);
|
||||
using CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
|
||||
cryptoStream.Read(array4, 0, array4.Length);
|
||||
byte[] array5 = new byte[4];
|
||||
Array.Copy(array4, 0, array5, 0, 4);
|
||||
byte[] array6 = new byte[BitConverter.ToInt32(array5, 0)];
|
||||
Array.Copy(array4, 4, array6, 0, array6.Length);
|
||||
rijndaelManaged.Clear();
|
||||
memoryStream.Flush();
|
||||
memoryStream.Close();
|
||||
cryptoStream.Flush();
|
||||
cryptoStream.Close();
|
||||
return array6;
|
||||
}
|
||||
}
|
||||
144
SVSim.BattleEngine/Engine/Cute/Cryptographer.cs
Normal file
144
SVSim.BattleEngine/Engine/Cute/Cryptographer.cs
Normal file
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class Cryptographer
|
||||
{
|
||||
public const int FBENCRYPT_BLOCK_SIZE = 32;
|
||||
|
||||
private static string encode_buf;
|
||||
|
||||
private static Random cRandom = new Random();
|
||||
|
||||
private static SHA1CryptoServiceProvider sha1 = null;
|
||||
|
||||
private static UTF8Encoding utf8 = null;
|
||||
|
||||
private static int random()
|
||||
{
|
||||
return cRandom.Next(1, 9);
|
||||
}
|
||||
|
||||
public static string generateIvString()
|
||||
{
|
||||
string text = "";
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
text += $"{random()}";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public static string generateKeyString()
|
||||
{
|
||||
string text = "";
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
text += $"{cRandom.Next(0, 65535):x}";
|
||||
}
|
||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(text.ToString())).Substring(0, 32);
|
||||
}
|
||||
|
||||
public static string encode(string dat)
|
||||
{
|
||||
int length = dat.Length;
|
||||
encode_buf = $"{length:x4}";
|
||||
foreach (char value in dat)
|
||||
{
|
||||
encode_buf += $"{random(),1:x}";
|
||||
encode_buf += $"{random(),1:x}";
|
||||
encode_buf += (char)(Convert.ToInt32(value) + 10);
|
||||
encode_buf += $"{random(),1:x}";
|
||||
}
|
||||
encode_buf += generateIvString();
|
||||
return encode_buf;
|
||||
}
|
||||
|
||||
public static string decode(string dat)
|
||||
{
|
||||
if (dat == null || dat.Length < 4)
|
||||
{
|
||||
return dat;
|
||||
}
|
||||
int num = int.Parse(dat.Substring(0, 4), NumberStyles.AllowHexSpecifier);
|
||||
string text = "";
|
||||
int num2 = 2;
|
||||
string text2 = dat.Substring(4, dat.Length - 4);
|
||||
foreach (char value in text2)
|
||||
{
|
||||
if (num2 % 4 == 0)
|
||||
{
|
||||
text += (char)(Convert.ToInt32(value) - 10);
|
||||
}
|
||||
num2++;
|
||||
if (text.Length >= num)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public static string ComputeHash(string data)
|
||||
{
|
||||
if (string.IsNullOrEmpty(data))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
SHA1CryptoServiceProvider sHA1CryptoServiceProvider = new SHA1CryptoServiceProvider();
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(data);
|
||||
byte[] array = sHA1CryptoServiceProvider.ComputeHash(bytes);
|
||||
string text = "";
|
||||
byte[] array2 = array;
|
||||
foreach (byte b in array2)
|
||||
{
|
||||
text += $"{b:x2}";
|
||||
}
|
||||
sHA1CryptoServiceProvider.Clear();
|
||||
return text;
|
||||
}
|
||||
|
||||
public static string MakeMd5(string input)
|
||||
{
|
||||
MD5CryptoServiceProvider mD5CryptoServiceProvider = new MD5CryptoServiceProvider();
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(input + "r!I@ws8e5i=");
|
||||
byte[] array = mD5CryptoServiceProvider.ComputeHash(bytes);
|
||||
string text = "";
|
||||
byte[] array2 = array;
|
||||
foreach (byte b in array2)
|
||||
{
|
||||
text += b.ToString("x2");
|
||||
}
|
||||
mD5CryptoServiceProvider.Clear();
|
||||
return text;
|
||||
}
|
||||
|
||||
public static string ComputeSHA1(string seed)
|
||||
{
|
||||
if (sha1 == null)
|
||||
{
|
||||
sha1 = new SHA1CryptoServiceProvider();
|
||||
}
|
||||
if (utf8 == null)
|
||||
{
|
||||
utf8 = new UTF8Encoding();
|
||||
}
|
||||
if (string.IsNullOrEmpty(seed))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
byte[] bytes = utf8.GetBytes(seed);
|
||||
byte[] array = sha1.ComputeHash(bytes);
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int num = array.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
stringBuilder.Append(Convert.ToString(array[i], 16).PadLeft(2, '0'));
|
||||
}
|
||||
sha1.Initialize();
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
}
|
||||
318
SVSim.BattleEngine/Engine/Cute/CustomPreference.cs
Normal file
318
SVSim.BattleEngine/Engine/Cute/CustomPreference.cs
Normal file
@@ -0,0 +1,318 @@
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class CustomPreference
|
||||
{
|
||||
public enum eSchemeType
|
||||
{
|
||||
Http,
|
||||
Https,
|
||||
File,
|
||||
Node,
|
||||
StreamingAssets
|
||||
}
|
||||
|
||||
public enum PlatformType
|
||||
{
|
||||
NONE,
|
||||
APPLE,
|
||||
GOOGLE,
|
||||
DMM,
|
||||
STEAM
|
||||
}
|
||||
|
||||
public enum SmallResourceStatus
|
||||
{
|
||||
NO_SELECT,
|
||||
USE_NORMAL,
|
||||
USE_SMALL
|
||||
}
|
||||
|
||||
private const string fileScheme = "file:///";
|
||||
|
||||
private const string httpScheme = "http://";
|
||||
|
||||
private const string httpsScheme = "https://";
|
||||
|
||||
private const string jarFileScheme = "jar:file://";
|
||||
|
||||
private static string nodeServerScheme = "ws://";
|
||||
|
||||
private const string directoryLowLevelResources = "Low/";
|
||||
|
||||
private const string directoryHighLevelResources = "High/";
|
||||
|
||||
private static string directoryRoot = "dl/";
|
||||
|
||||
private static string _applicationServerUrl = "";
|
||||
|
||||
private static string _resourceServerUrl = "";
|
||||
|
||||
private static string _nodeServerUrl = "";
|
||||
|
||||
private static string _deckBuilderServerUrl = "";
|
||||
|
||||
public static string _localePref = "Eng";
|
||||
|
||||
private static string _signaturePref = "";
|
||||
|
||||
private static string _languagePref = "Eng";
|
||||
|
||||
private static string _languageSoundPref = "Eng";
|
||||
|
||||
private static string _assetbundleurl = "";
|
||||
|
||||
private static string _manifestsuburl = "";
|
||||
|
||||
private static string _soundurl = "";
|
||||
|
||||
private static string _movieurl = "";
|
||||
|
||||
private static string _manifestUrl = "";
|
||||
|
||||
private static eSchemeType _schemeType = eSchemeType.Http;
|
||||
|
||||
private static eSchemeType _schemeCDNType = eSchemeType.Http;
|
||||
|
||||
private static bool _isPreferenceComplete = false;
|
||||
|
||||
private static bool _isLocalAssetBundles = false;
|
||||
|
||||
public static bool isPreferenceComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isPreferenceComplete;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isPreferenceComplete = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool isLocalAssetBundles
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isLocalAssetBundles;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isLocalAssetBundles = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsNormalResource => !IsSmallResource;
|
||||
|
||||
public static bool IsSmallResource => PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 2;
|
||||
|
||||
public static string GetApplicationServerURL()
|
||||
{
|
||||
return GetScheme() + _applicationServerUrl;
|
||||
}
|
||||
|
||||
public static void SetApplicationServerURL(string strApplicationServer)
|
||||
{
|
||||
_applicationServerUrl = strApplicationServer;
|
||||
}
|
||||
|
||||
public static string GetResourceServerURL()
|
||||
{
|
||||
return GetCDNScheme() + _resourceServerUrl;
|
||||
}
|
||||
|
||||
public static void SetResourceServerURL(string strResourceServer)
|
||||
{
|
||||
_resourceServerUrl = strResourceServer;
|
||||
}
|
||||
|
||||
public static string GetNodeServerURL()
|
||||
{
|
||||
return nodeServerScheme + _nodeServerUrl;
|
||||
}
|
||||
|
||||
public static void SetNodeServerURL(string strNodeServer)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(strNodeServer))
|
||||
{
|
||||
_nodeServerUrl = strNodeServer;
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetDeckBuilderServerURL()
|
||||
{
|
||||
return GetScheme() + _deckBuilderServerUrl;
|
||||
}
|
||||
|
||||
public static void SetDeckBuilderServerURL(string strDeckBuilderServer)
|
||||
{
|
||||
_deckBuilderServerUrl = strDeckBuilderServer;
|
||||
}
|
||||
|
||||
public static int GetPlatform()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
public static string GetAssetBundleURL()
|
||||
{
|
||||
return _assetbundleurl;
|
||||
}
|
||||
|
||||
public static string GetManifestURL()
|
||||
{
|
||||
return _manifestUrl;
|
||||
}
|
||||
|
||||
public static string GetSubManifestURL()
|
||||
{
|
||||
if (_isLocalAssetBundles)
|
||||
{
|
||||
_manifestsuburl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
_manifestsuburl = GetResourceServerURL() + directoryRoot + "Manifest/" + GetVersionFolderName() + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
|
||||
}
|
||||
return _manifestsuburl;
|
||||
}
|
||||
|
||||
public static string GetSoundResourceURL()
|
||||
{
|
||||
return _soundurl;
|
||||
}
|
||||
|
||||
public static string GetMoiveResourceURL()
|
||||
{
|
||||
return _movieurl;
|
||||
}
|
||||
|
||||
public static string GetScheme()
|
||||
{
|
||||
return _schemeType switch
|
||||
{
|
||||
eSchemeType.Http => "http://",
|
||||
eSchemeType.Https => "https://",
|
||||
eSchemeType.File => "file:///",
|
||||
eSchemeType.Node => nodeServerScheme,
|
||||
eSchemeType.StreamingAssets => "file:///",
|
||||
_ => "http://",
|
||||
};
|
||||
}
|
||||
|
||||
public static string GetCDNScheme()
|
||||
{
|
||||
return _schemeCDNType switch
|
||||
{
|
||||
eSchemeType.Http => "http://",
|
||||
eSchemeType.Https => "https://",
|
||||
_ => "http://",
|
||||
};
|
||||
}
|
||||
|
||||
public static string GetVersionFolderName()
|
||||
{
|
||||
return Toolbox.SavedataManager.GetResourceVersion() + "/";
|
||||
}
|
||||
|
||||
public static void SetScemeMode(eSchemeType schemeType)
|
||||
{
|
||||
_schemeType = schemeType;
|
||||
}
|
||||
|
||||
public static void SetScemeModeCDN(eSchemeType schemeCDNType)
|
||||
{
|
||||
_schemeCDNType = schemeCDNType;
|
||||
}
|
||||
|
||||
public static void SetOptionalNodeSceme()
|
||||
{
|
||||
if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SELECT_WSS))
|
||||
{
|
||||
SetNodeSceme("wss://");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetNodeSceme("ws://");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetNodeSceme(string scheme)
|
||||
{
|
||||
nodeServerScheme = scheme;
|
||||
}
|
||||
|
||||
public static void SetRootFolderName(string strDir)
|
||||
{
|
||||
directoryRoot = strDir;
|
||||
}
|
||||
|
||||
public static void SetTextLanguage(string strLanguage)
|
||||
{
|
||||
_languagePref = strLanguage;
|
||||
}
|
||||
|
||||
public static void SetLocale(string strLocale)
|
||||
{
|
||||
_localePref = strLocale;
|
||||
}
|
||||
|
||||
public static string GetLanguageFolderName()
|
||||
{
|
||||
return _languagePref + "/";
|
||||
}
|
||||
|
||||
public static string GetTextLanguage()
|
||||
{
|
||||
return GetResourceLanguage();
|
||||
}
|
||||
|
||||
public static string GetResourceLanguage()
|
||||
{
|
||||
return _languagePref;
|
||||
}
|
||||
|
||||
public static void SetSoundLanguage(string strLanguage)
|
||||
{
|
||||
_languageSoundPref = strLanguage;
|
||||
}
|
||||
|
||||
public static string GetSoundMovieLanguageFolderName()
|
||||
{
|
||||
return _languageSoundPref + "/";
|
||||
}
|
||||
|
||||
public static string GetSoundMovieLanguage()
|
||||
{
|
||||
return _languageSoundPref;
|
||||
}
|
||||
|
||||
public static void SetSignature(string strSignature)
|
||||
{
|
||||
_signaturePref = strSignature;
|
||||
}
|
||||
|
||||
public static string GetSignaturePath()
|
||||
{
|
||||
return "/../" + _signaturePref;
|
||||
}
|
||||
|
||||
public static void createResourcePath()
|
||||
{
|
||||
if (_isLocalAssetBundles)
|
||||
{
|
||||
_assetbundleurl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/";
|
||||
_manifestsuburl = GetResourceServerURL() + Utility.GetRuntimePlatform() + "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
_assetbundleurl = GetResourceServerURL() + directoryRoot + "Resource/" + GetLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
|
||||
string text = "Manifest/";
|
||||
_manifestsuburl = GetResourceServerURL() + directoryRoot + text + GetVersionFolderName() + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
|
||||
_manifestUrl = GetResourceServerURL() + directoryRoot + text + GetVersionFolderName() + GetLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
|
||||
}
|
||||
_soundurl = GetResourceServerURL() + directoryRoot + "Sound/" + GetSoundMovieLanguageFolderName();
|
||||
_movieurl = GetResourceServerURL() + directoryRoot + "Resource/" + GetSoundMovieLanguageFolderName() + Utility.GetRuntimePlatform() + "/";
|
||||
}
|
||||
}
|
||||
190
SVSim.BattleEngine/Engine/Cute/CuteNetworkDefine.cs
Normal file
190
SVSim.BattleEngine/Engine/Cute/CuteNetworkDefine.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public static class CuteNetworkDefine
|
||||
{
|
||||
public enum ApiType
|
||||
{
|
||||
SignUp,
|
||||
GameStartCheck,
|
||||
CheckSpecialTitle,
|
||||
PaymentItemList,
|
||||
PaymentStart,
|
||||
PaymentCancel,
|
||||
PaymentFinish,
|
||||
PaymentSendLog,
|
||||
PaymentPCItemList,
|
||||
PaymentPCStart,
|
||||
PaymentPCCancel,
|
||||
PaymentPCFinish,
|
||||
SteamGetUserInfo,
|
||||
SteamMicroTxnInit,
|
||||
BirthUpdate,
|
||||
AccountMigration,
|
||||
GetGameDataBySocialAccount,
|
||||
GetTransitionCode,
|
||||
TransitionCodeMigration,
|
||||
GetGameDataByTransitionCode,
|
||||
GetFacebookNonce,
|
||||
CheckiCloudUser,
|
||||
MigrateiCloudUser
|
||||
}
|
||||
|
||||
public enum ACCOUNT_TYPE
|
||||
{
|
||||
NONE,
|
||||
GOOGLE_PLAY,
|
||||
GAME_CENTER,
|
||||
FACEBOOK,
|
||||
DMM,
|
||||
STEAM,
|
||||
APPLE_ID
|
||||
}
|
||||
|
||||
public enum CONNECT_TYPE
|
||||
{
|
||||
SOCIAL_ACCOUNT_CONNECT = 1,
|
||||
SOCIAL_ACCOUNT_DISCONNECT,
|
||||
SOCIAL_ACCOUNT_GAME_DATA_UPDATE,
|
||||
TRANS_CODE_GAME_DATA_UPDATE
|
||||
}
|
||||
|
||||
public const int API_RESULT_SUCCESS_CODE = 1;
|
||||
|
||||
public const int RESULT_CODE_DATABASE_ERROR = 100;
|
||||
|
||||
public const int RESULT_CODE_MAINTENANCE_COMMON = 101;
|
||||
|
||||
public const int RESULT_CODE_SERVER_ERROR = 102;
|
||||
|
||||
public const int API_RESULT_SESSION_ERROR = 201;
|
||||
|
||||
public const int RESULT_CODE_ACCOUNT_BLOCK_ERROR = 203;
|
||||
|
||||
public const int RESULT_CODE_ACCOUNT_LIMITED_BLOCK_ERROR = 217;
|
||||
|
||||
public const string ACCOUNT_LIMITED_BLOCK_END_TIME = "account_block_end_time";
|
||||
|
||||
public const int RESULT_CODE_NETEASE_ACCOUNT_BLOCK_ERROR = 330;
|
||||
|
||||
public const int API_RESULT_VERSION_ERROR = 204;
|
||||
|
||||
public const int RESULT_CODE_PROCESSED_ERROR = 213;
|
||||
|
||||
public const int RESULT_CODE_PAYMENT_VALIDATION_ERROR = 308;
|
||||
|
||||
public const int RESULT_CODE_DMM_ONETIMETOKEN_EXPIRED = 317;
|
||||
|
||||
public const int RESULT_CODE_SOLO_PLAY_ALREADY_FINISH = 1352;
|
||||
|
||||
public const int RESULT_CODE_MAINTENANCE_FROM = 2000;
|
||||
|
||||
public const int RESULT_CODE_MAINTENANCE_TO = 2999;
|
||||
|
||||
public const string MAINTENACE_END_TIME = "maintenance_end_time";
|
||||
|
||||
public const int RESULT_CODE_MAINTENANCE_CARD_TWO_PICK = 1710;
|
||||
|
||||
public const int RESULT_CODE_MAINTENANCE_CARD_OPEN_SIX = 5013;
|
||||
|
||||
public const int RESULT_CODE_ALREADY_BATTLE_RESULT = 3502;
|
||||
|
||||
public const int RC_OPEN_ROOM_SET_DECK_IN_BATTLE_PHASE = 1768;
|
||||
|
||||
public static Dictionary<ApiType, string> ApiUrlList = new Dictionary<ApiType, string>
|
||||
{
|
||||
{
|
||||
ApiType.SignUp,
|
||||
"tool/signup"
|
||||
},
|
||||
{
|
||||
ApiType.CheckSpecialTitle,
|
||||
"check/special_title"
|
||||
},
|
||||
{
|
||||
ApiType.GameStartCheck,
|
||||
"check/game_start"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentItemList,
|
||||
"payment/item_list"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentStart,
|
||||
"payment/start"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentCancel,
|
||||
"payment/cancel"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentFinish,
|
||||
"payment/finish"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentSendLog,
|
||||
"payment/send_log"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentPCItemList,
|
||||
"payment_pc/item_list"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentPCStart,
|
||||
"payment_pc/start"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentPCCancel,
|
||||
"payment_pc/cancel"
|
||||
},
|
||||
{
|
||||
ApiType.PaymentPCFinish,
|
||||
"payment_pc/finish"
|
||||
},
|
||||
{
|
||||
ApiType.SteamGetUserInfo,
|
||||
"payment_pc/steam_get_user_info"
|
||||
},
|
||||
{
|
||||
ApiType.SteamMicroTxnInit,
|
||||
"payment_pc/steam_micro_txn_init"
|
||||
},
|
||||
{
|
||||
ApiType.BirthUpdate,
|
||||
"account/update_birth"
|
||||
},
|
||||
{
|
||||
ApiType.AccountMigration,
|
||||
"account/chain_by_social_account"
|
||||
},
|
||||
{
|
||||
ApiType.GetGameDataBySocialAccount,
|
||||
"account/get_by_social_account"
|
||||
},
|
||||
{
|
||||
ApiType.GetTransitionCode,
|
||||
"account/publish_transition_code"
|
||||
},
|
||||
{
|
||||
ApiType.TransitionCodeMigration,
|
||||
"account/chain_by_transition_code"
|
||||
},
|
||||
{
|
||||
ApiType.GetGameDataByTransitionCode,
|
||||
"account/get_by_transition_code"
|
||||
},
|
||||
{
|
||||
ApiType.GetFacebookNonce,
|
||||
"account/get_facebook_nonce"
|
||||
},
|
||||
{
|
||||
ApiType.CheckiCloudUser,
|
||||
"account/get_by_icloud_data"
|
||||
},
|
||||
{
|
||||
ApiType.MigrateiCloudUser,
|
||||
"account/chain_by_icloud_data"
|
||||
}
|
||||
};
|
||||
}
|
||||
102
SVSim.BattleEngine/Engine/Cute/DebugManager.cs
Normal file
102
SVSim.BattleEngine/Engine/Cute/DebugManager.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class DebugManager : MonoBehaviour
|
||||
{
|
||||
public enum LOG_LEVEL
|
||||
{
|
||||
NORMAL,
|
||||
HIGH,
|
||||
VERY_HIGH,
|
||||
VERY_HIGH2,
|
||||
VERY_HIGH3,
|
||||
VERY_HIGH4
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void Log(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void LogWarning(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void LogAppend(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void LogAppendWarning(string text)
|
||||
{
|
||||
}
|
||||
|
||||
public void ClearLog()
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void TextLog(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void SoundLog(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void SoundLogWarning(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void SoundLogAppend(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void SoundLogAppendWarning(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void ClearSoundLog()
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void BattleLogAppend(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void BattleLogAppendWarning(string text)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void ClearBattleLog()
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void Log(object log, LOG_LEVEL level)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void LogError(object log)
|
||||
{
|
||||
}
|
||||
|
||||
[Conditional("USE_DBGSYS")]
|
||||
public void LogException(Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
284
SVSim.BattleEngine/Engine/Cute/DeviceManager.cs
Normal file
284
SVSim.BattleEngine/Engine/Cute/DeviceManager.cs
Normal file
@@ -0,0 +1,284 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class DeviceManager : MonoBehaviour, IManager
|
||||
{
|
||||
public enum TextureCompression
|
||||
{
|
||||
ETC,
|
||||
DXT,
|
||||
ATC,
|
||||
PVRTC
|
||||
}
|
||||
|
||||
public enum DeviceType
|
||||
{
|
||||
NONE,
|
||||
IPHONE,
|
||||
ANDROID,
|
||||
WINDOWS,
|
||||
OSX
|
||||
}
|
||||
|
||||
private const string BUILDPARAMFILE = "/CuteBuildParam.xml";
|
||||
|
||||
private string strBuildVersionName = "9.9.9";
|
||||
|
||||
private TextureCompression textureCommpression;
|
||||
|
||||
private IPAddress _ipAddress;
|
||||
|
||||
private string _winOsVersion;
|
||||
|
||||
private bool tokenSent;
|
||||
|
||||
private string _getIpAddressWithFamilyTypeLog = "";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CheckTextureCompression();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SetBuildVersionName();
|
||||
Toolbox.DeviceManager = this;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public TextureCompression GetTextureCompression()
|
||||
{
|
||||
return textureCommpression;
|
||||
}
|
||||
|
||||
private void CheckTextureCompression()
|
||||
{
|
||||
textureCommpression = TextureCompression.DXT;
|
||||
}
|
||||
|
||||
public string GetModelName()
|
||||
{
|
||||
return SystemInfo.deviceModel;
|
||||
}
|
||||
|
||||
public string GetOsVersion()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_winOsVersion))
|
||||
{
|
||||
try
|
||||
{
|
||||
string operatingSystem = SystemInfo.operatingSystem;
|
||||
string value = Environment.OSVersion.Version.ToString();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append(operatingSystem.Substring(0, operatingSystem.IndexOf('(') + 1));
|
||||
stringBuilder.Append(value);
|
||||
stringBuilder.Append(operatingSystem.Substring(operatingSystem.IndexOf(')')));
|
||||
_winOsVersion = stringBuilder.ToString();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
_winOsVersion = SystemInfo.operatingSystem;
|
||||
}
|
||||
}
|
||||
return _winOsVersion;
|
||||
}
|
||||
|
||||
public int GetDeviceType()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
public string GetAppVersionName()
|
||||
{
|
||||
return strBuildVersionName;
|
||||
}
|
||||
|
||||
public string GetLocale()
|
||||
{
|
||||
return CustomPreference._localePref;
|
||||
}
|
||||
|
||||
public string getSignature()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public bool isRootUser()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GetDeviceUniqueIdentifier()
|
||||
{
|
||||
string text = "";
|
||||
text = SystemInfo.deviceUniqueIdentifier;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
{
|
||||
text = "";
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
public string GetDeviceName()
|
||||
{
|
||||
return SystemInfo.deviceModel;
|
||||
}
|
||||
|
||||
public string GetGraphicsDeviceName(bool textureCheck = false)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.Append(SystemInfo.graphicsDeviceName);
|
||||
if (textureCheck)
|
||||
{
|
||||
if (SystemInfo.SupportsTextureFormat(TextureFormat.ETC2_RGB) && SystemInfo.SupportsTextureFormat(TextureFormat.ETC2_RGBA8))
|
||||
{
|
||||
stringBuilder.Append("[ETC2=1]");
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append("[ETC2=0]");
|
||||
}
|
||||
if (SystemInfo.SupportsTextureFormat(TextureFormat.ASTC_6x6) && SystemInfo.SupportsTextureFormat(TextureFormat.ASTC_6x6))
|
||||
{
|
||||
stringBuilder.Append("[ASTC=1]");
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append("[ASTC=0]");
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
private IPAddress GetIpAddressWithFamilyType(AddressFamily family = AddressFamily.InterNetwork)
|
||||
{
|
||||
_getIpAddressWithFamilyTypeLog = "";
|
||||
_getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType ";
|
||||
if (family == AddressFamily.InterNetworkV6 && !Socket.OSSupportsIPv6)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
UnicastIPAddressInformation unicastIPAddressInformation = null;
|
||||
NetworkInterface[] allNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
|
||||
_getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType2 ";
|
||||
NetworkInterface[] array = allNetworkInterfaces;
|
||||
foreach (NetworkInterface networkInterface in array)
|
||||
{
|
||||
if (networkInterface.OperationalStatus != OperationalStatus.Up)
|
||||
{
|
||||
_getIpAddressWithFamilyTypeLog = _getIpAddressWithFamilyTypeLog + " OperationalStatus" + networkInterface.OperationalStatus;
|
||||
continue;
|
||||
}
|
||||
NetworkInterfaceType networkInterfaceType = networkInterface.NetworkInterfaceType;
|
||||
if (networkInterfaceType != NetworkInterfaceType.Wireless80211 && networkInterfaceType != NetworkInterfaceType.Ethernet)
|
||||
{
|
||||
_getIpAddressWithFamilyTypeLog = _getIpAddressWithFamilyTypeLog + " Type " + networkInterfaceType;
|
||||
continue;
|
||||
}
|
||||
IPInterfaceProperties iPProperties = networkInterface.GetIPProperties();
|
||||
if (iPProperties.GatewayAddresses.Count == 0)
|
||||
{
|
||||
_getIpAddressWithFamilyTypeLog += " GatewayAddresses.Count 0 ";
|
||||
continue;
|
||||
}
|
||||
foreach (UnicastIPAddressInformation unicastAddress in iPProperties.UnicastAddresses)
|
||||
{
|
||||
if (unicastAddress.Address.AddressFamily != family)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (IPAddress.IsLoopback(unicastAddress.Address))
|
||||
{
|
||||
_getIpAddressWithFamilyTypeLog += " IsLoopback ";
|
||||
continue;
|
||||
}
|
||||
if (!unicastAddress.IsDnsEligible)
|
||||
{
|
||||
if (unicastIPAddressInformation == null)
|
||||
{
|
||||
unicastIPAddressInformation = unicastAddress;
|
||||
}
|
||||
_getIpAddressWithFamilyTypeLog += " ip.IsDnsEligible ";
|
||||
continue;
|
||||
}
|
||||
return unicastAddress.Address;
|
||||
}
|
||||
}
|
||||
_getIpAddressWithFamilyTypeLog += "GetIpAddressWithFamilyType3 ";
|
||||
return unicastIPAddressInformation?.Address;
|
||||
}
|
||||
|
||||
public string GetIpAddress()
|
||||
{
|
||||
if (_ipAddress != null)
|
||||
{
|
||||
return _ipAddress.ToString();
|
||||
}
|
||||
LocalLog.AccumulateTraceInquiryLog("GetIpAddress " + StackTraceUtility.ExtractStackTrace());
|
||||
_ipAddress = GetIpAddressWithFamilyType();
|
||||
if (_ipAddress == null)
|
||||
{
|
||||
LocalLog.AccumulateTraceInquiryLog("GetIpAddress Empty " + _getIpAddressWithFamilyTypeLog + " " + StackTraceUtility.ExtractStackTrace());
|
||||
return string.Empty;
|
||||
}
|
||||
return _ipAddress.ToString();
|
||||
}
|
||||
|
||||
public void ClearIpAddress()
|
||||
{
|
||||
_ipAddress = null;
|
||||
LocalLog.AccumulateTraceInquiryLog("ClearIpAddress " + StackTraceUtility.ExtractStackTrace());
|
||||
}
|
||||
|
||||
public string GetCarrier()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public void SetVersionName()
|
||||
{
|
||||
SetBuildVersionName();
|
||||
}
|
||||
|
||||
public void SetBuildVersionName()
|
||||
{
|
||||
string text = Application.streamingAssetsPath + "/CuteBuildParam.xml";
|
||||
if (!File.Exists(text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
XmlDocument xmlDocument = new XmlDocument();
|
||||
xmlDocument.Load(text);
|
||||
if (xmlDocument.FirstChild == null || xmlDocument.FirstChild.NextSibling == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
IEnumerator enumerator = xmlDocument.FirstChild.NextSibling.GetEnumerator();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
XmlNode xmlNode = (XmlNode)enumerator.Current;
|
||||
if (xmlNode.Name.Equals("versionName"))
|
||||
{
|
||||
strBuildVersionName = xmlNode.InnerText;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
139
SVSim.BattleEngine/Engine/Cute/GameStartCheckTask.cs
Normal file
139
SVSim.BattleEngine/Engine/Cute/GameStartCheckTask.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System.Collections.Generic;
|
||||
using LitJson;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class GameStartCheckTask : NetworkTask
|
||||
{
|
||||
private class CheckParams : PostParams
|
||||
{
|
||||
public int app_type;
|
||||
|
||||
public string campaign_data = "";
|
||||
|
||||
public string campaign_sign = "";
|
||||
|
||||
public int campaign_user;
|
||||
}
|
||||
|
||||
private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.GameStartCheck;
|
||||
|
||||
public static bool IsSocialAccountDataTransNotSetAndTutorialClear = false;
|
||||
|
||||
public static bool IsTutorialClear = false;
|
||||
|
||||
public static List<CuteNetworkDefine.ACCOUNT_TYPE> IsSocialAccountDataTransSet;
|
||||
|
||||
public static bool IsSetTransitionPassword;
|
||||
|
||||
public static int _tosId;
|
||||
|
||||
public static int _privacyPolicyId;
|
||||
|
||||
public static bool HasAppliedForAccountDeletion { get; private set; } = false;
|
||||
|
||||
public static string RefundUrl { get; private set; } = string.Empty;
|
||||
|
||||
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
|
||||
|
||||
public GameStartCheckTask()
|
||||
{
|
||||
if (Toolbox.BootNetwork != null)
|
||||
{
|
||||
Toolbox.BootNetwork.IsDoneGameStartCheck = false;
|
||||
}
|
||||
IsSocialAccountDataTransSet = new List<CuteNetworkDefine.ACCOUNT_TYPE>();
|
||||
}
|
||||
|
||||
public void SetParameter()
|
||||
{
|
||||
CheckParams checkParams = new CheckParams();
|
||||
if (URLScheme.AppType != 0)
|
||||
{
|
||||
checkParams.campaign_data = URLScheme.CampaignData;
|
||||
checkParams.app_type = URLScheme.AppType;
|
||||
}
|
||||
checkParams.campaign_sign = Toolbox.DeviceManager.getSignature();
|
||||
int num = Random.Range(0, 100000);
|
||||
if (Toolbox.DeviceManager.isRootUser())
|
||||
{
|
||||
checkParams.campaign_user = 2 * num + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
checkParams.campaign_user = 2 * num;
|
||||
}
|
||||
base.Params = checkParams;
|
||||
}
|
||||
|
||||
protected override int Parse()
|
||||
{
|
||||
int num = base.Parse();
|
||||
if (num != 1)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
IsSocialAccountDataTransNotSetAndTutorialClear = false;
|
||||
IsSocialAccountDataTransSet.Clear();
|
||||
IsSetTransitionPassword = false;
|
||||
RefundUrl = string.Empty;
|
||||
if (base.ResponseData["data"].Keys.Contains("transition_account_data"))
|
||||
{
|
||||
JsonData jsonData = base.ResponseData["data"]["transition_account_data"];
|
||||
for (int i = 0; i < jsonData.Count; i++)
|
||||
{
|
||||
if (jsonData[i]["social_account_type"].ToInt() == 1)
|
||||
{
|
||||
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.GOOGLE_PLAY);
|
||||
}
|
||||
else if (jsonData[i]["social_account_type"].ToInt() == 2)
|
||||
{
|
||||
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.GAME_CENTER);
|
||||
}
|
||||
else if (jsonData[i]["social_account_type"].ToInt() == 3)
|
||||
{
|
||||
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.FACEBOOK);
|
||||
}
|
||||
else if (jsonData[i]["social_account_type"].ToInt() == 6)
|
||||
{
|
||||
IsSocialAccountDataTransSet.Add(CuteNetworkDefine.ACCOUNT_TYPE.APPLE_ID);
|
||||
}
|
||||
}
|
||||
if (base.ResponseData["data"]["now_tutorial_step"].ToInt() == 100)
|
||||
{
|
||||
IsTutorialClear = true;
|
||||
}
|
||||
if (jsonData.Count == 0 && base.ResponseData["data"]["now_tutorial_step"].ToInt() == 100)
|
||||
{
|
||||
IsSocialAccountDataTransNotSetAndTutorialClear = true;
|
||||
}
|
||||
}
|
||||
if (base.ResponseData["data"].Keys.Contains("rewrite_viewer_id"))
|
||||
{
|
||||
Certification.ViewerId = base.ResponseData["data"]["rewrite_viewer_id"].ToInt();
|
||||
}
|
||||
if (base.ResponseData["data"].Keys.Contains("is_set_transition_password"))
|
||||
{
|
||||
IsSetTransitionPassword = base.ResponseData["data"]["is_set_transition_password"].ToBoolean();
|
||||
}
|
||||
HasAppliedForAccountDeletion = base.ResponseData["data"].Keys.Contains("account_delete_reservation_status");
|
||||
ParseAgreementData(base.ResponseData);
|
||||
if (base.ResponseData["data"].Keys.Contains("refund_url"))
|
||||
{
|
||||
RefundUrl = base.ResponseData["data"]["refund_url"].ToString();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private void ParseAgreementData(JsonData responseData)
|
||||
{
|
||||
PlayerStaticData._tosAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["tos_state"].ToInt();
|
||||
PlayerStaticData._privacyPolicyAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["policy_state"].ToInt();
|
||||
PlayerStaticData.KorAuthorityAgreementState = (PlayerStaticData.AgreementState)responseData["data"]["kor_authority_state"].ToInt();
|
||||
AcceptAgreementTask._tosId = responseData["data"]["tos_id"].ToInt();
|
||||
AcceptAgreementTask._privacyPolicyId = responseData["data"]["policy_id"].ToInt();
|
||||
AcceptAgreementTask.KorAuthorityId = responseData["data"]["kor_authority_id"].ToInt();
|
||||
}
|
||||
}
|
||||
77
SVSim.BattleEngine/Engine/Cute/GetiCloudUserDataTask.cs
Normal file
77
SVSim.BattleEngine/Engine/Cute/GetiCloudUserDataTask.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using LitJson;
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class GetiCloudUserDataTask : NetworkTask
|
||||
{
|
||||
private class iCloudUserParams : PostParams
|
||||
{
|
||||
public string icloud_data = "";
|
||||
}
|
||||
|
||||
public class VerifiediCloudBackupUserData
|
||||
{
|
||||
public int iCloudViewerId { get; set; }
|
||||
|
||||
public string iCloudUserName { get; set; } = " - ";
|
||||
|
||||
public string UserRankRotation { get; set; }
|
||||
|
||||
public string UserRankUnlimited { get; set; }
|
||||
|
||||
public bool HasUserData()
|
||||
{
|
||||
return iCloudViewerId != 0;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
iCloudViewerId = 0;
|
||||
iCloudUserName = " - ";
|
||||
}
|
||||
}
|
||||
|
||||
private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.CheckiCloudUser;
|
||||
|
||||
public static readonly VerifiediCloudBackupUserData VerifiediCloudUserData = new VerifiediCloudBackupUserData();
|
||||
|
||||
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
|
||||
|
||||
public void SetParameter(string iCloudData)
|
||||
{
|
||||
iCloudUserParams iCloudUserParams = new iCloudUserParams();
|
||||
iCloudUserParams.icloud_data = iCloudData;
|
||||
base.Params = iCloudUserParams;
|
||||
}
|
||||
|
||||
protected override int Parse()
|
||||
{
|
||||
if (resultCode != 1)
|
||||
{
|
||||
return resultCode;
|
||||
}
|
||||
JsonData jsonData = base.ResponseData["data"];
|
||||
if (jsonData["icloud_data_verified"].ToBoolean())
|
||||
{
|
||||
VerifiediCloudUserData.iCloudViewerId = jsonData["icloud_viewer_id"].ToInt();
|
||||
VerifiediCloudUserData.iCloudUserName = jsonData["icloud_name"].ToString();
|
||||
string text = 1.ToString();
|
||||
string text2 = 2.ToString();
|
||||
SystemText systemText = Data.SystemText;
|
||||
if (base.ResponseData["data"].Keys.Contains("rank") && base.ResponseData["data"]["rank"] != null)
|
||||
{
|
||||
JsonData jsonData2 = base.ResponseData["data"]["rank"];
|
||||
if (jsonData2.Keys.Contains(text))
|
||||
{
|
||||
VerifiediCloudUserData.UserRankRotation = systemText.Get(jsonData2[text].ToString());
|
||||
}
|
||||
if (jsonData2.Keys.Contains(text2))
|
||||
{
|
||||
VerifiediCloudUserData.UserRankUnlimited = systemText.Get(jsonData2[text2].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultCode;
|
||||
}
|
||||
}
|
||||
224
SVSim.BattleEngine/Engine/Cute/HangulManager.cs
Normal file
224
SVSim.BattleEngine/Engine/Cute/HangulManager.cs
Normal file
@@ -0,0 +1,224 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public static class HangulManager
|
||||
{
|
||||
private class JosiConversionRule
|
||||
{
|
||||
public char Type { get; private set; }
|
||||
|
||||
public string Text1 { get; private set; }
|
||||
|
||||
public string Text2 { get; private set; }
|
||||
|
||||
public Func<char, bool> IsConvertToText1 { get; private set; }
|
||||
|
||||
public JosiConversionRule(char type, string text1, string text2, Func<char, bool> isConvertToText1)
|
||||
{
|
||||
Type = type;
|
||||
Text1 = text1;
|
||||
Text2 = text2;
|
||||
IsConvertToText1 = isConvertToText1;
|
||||
}
|
||||
}
|
||||
|
||||
private class DecomposedHangul
|
||||
{
|
||||
public char? Chosung { get; set; }
|
||||
|
||||
public char? Jungsung { get; set; }
|
||||
|
||||
public char? Jongsung { get; set; }
|
||||
|
||||
public DecomposedHangul()
|
||||
{
|
||||
Chosung = null;
|
||||
Jungsung = null;
|
||||
Jongsung = null;
|
||||
}
|
||||
|
||||
public DecomposedHangul(char hangulCharacter)
|
||||
{
|
||||
int num = hangulCharacter - 44032;
|
||||
int num2 = (int)Mathf.Floor((float)num / (float)JUNGSUNG_TABLE.Length / (float)JONGSUNG_TABLE.Length);
|
||||
Chosung = CHOSUNG_TABLE[num2];
|
||||
int num3 = (int)Mathf.Floor((float)num / (float)JONGSUNG_TABLE.Length - (float)(num2 * JUNGSUNG_TABLE.Length));
|
||||
Jungsung = JUNGSUNG_TABLE[num3];
|
||||
Jongsung = JONGSUNG_TABLE[num % JONGSUNG_TABLE.Length];
|
||||
}
|
||||
}
|
||||
|
||||
private const int STRING_BUILDER_CAPACITY = 512;
|
||||
|
||||
private const char dHANGUL_START = '가';
|
||||
|
||||
private const char dHANGUL_END = '힣';
|
||||
|
||||
private const char JOSI_TYPE_IDENTIFIER = '@';
|
||||
|
||||
private static readonly char[] CHOSUNG_TABLE = new char[19]
|
||||
{
|
||||
'ㄱ', 'ㄲ', 'ㄴ', 'ㄷ', 'ㄸ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅃ', 'ㅅ',
|
||||
'ㅆ', 'ㅇ', 'ㅈ', 'ㅉ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
|
||||
};
|
||||
|
||||
private static readonly char[] JUNGSUNG_TABLE = new char[21]
|
||||
{
|
||||
'ㅏ', 'ㅐ', 'ㅑ', 'ㅒ', 'ㅓ', 'ㅔ', 'ㅕ', 'ㅖ', 'ㅗ', 'ㅘ',
|
||||
'ㅙ', 'ㅚ', 'ㅛ', 'ㅜ', 'ㅝ', 'ㅞ', 'ㅟ', 'ㅠ', 'ㅡ', 'ㅢ',
|
||||
'ㅣ'
|
||||
};
|
||||
|
||||
private static readonly char?[] JONGSUNG_TABLE = new char?[28]
|
||||
{
|
||||
null, 'ㄱ', 'ㄲ', 'ㄳ', 'ㄴ', 'ㄵ', 'ㄶ', 'ㄷ', 'ㄹ', 'ㄺ',
|
||||
'ㄻ', 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', 'ㅁ', 'ㅂ', 'ㅄ', 'ㅅ',
|
||||
'ㅆ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ', 'ㅌ', 'ㅍ', 'ㅎ'
|
||||
};
|
||||
|
||||
private static readonly JosiConversionRule[] RULE_TABLE = new JosiConversionRule[6]
|
||||
{
|
||||
new JosiConversionRule('a', "이", "가", IsConvertToText1_common),
|
||||
new JosiConversionRule('b', "은", "는", IsConvertToText1_common),
|
||||
new JosiConversionRule('c', "을", "를", IsConvertToText1_common),
|
||||
new JosiConversionRule('d', "과", "와", IsConvertToText1_common),
|
||||
new JosiConversionRule('e', "으로", "로", IsConvertToText1_typeE),
|
||||
new JosiConversionRule('f', "이라면", "라면", IsConvertToText1_common)
|
||||
};
|
||||
|
||||
private static StringBuilder _strBuilder = new StringBuilder(512);
|
||||
|
||||
private const string START_TAG = "START_TAG";
|
||||
|
||||
private const string END_TAG = "END_TAG";
|
||||
|
||||
private const string ENCLOSED = "ENCLOSED";
|
||||
|
||||
private const string NUMERAL_PATTERN = "(?<START_TAG>\\[num\\])(?<ENCLOSED>.*?)(?<END_TAG>\\[/num\\])";
|
||||
|
||||
private static readonly string[] NUMERAL_TABLE = new string[100]
|
||||
{
|
||||
"0", "하나", "둘", "셋", "넷", "다섯", "여섯", "일곱", "여덟", "아홉",
|
||||
"열", "열하나", "열둘", "열셋", "열넷", "열다섯", "열여섯", "열일곱", "열여덟", "열아홉",
|
||||
"스물", "스물하나", "스물둘", "스물셋", "스물넷", "스물다섯", "스물여섯", "스물일곱", "스물여덟", "스물아홉",
|
||||
"서른", "서른하나", "서른둘", "서른셋", "서른넷", "서른다섯", "서른여섯", "서른일곱", "서른여덟", "서른아홉",
|
||||
"마흔", "마흔하나", "마흔둘", "마흔셋", "마흔넷", "마흔다섯", "마흔여섯", "마흔일곱", "마흔여덟", "마흔아홉",
|
||||
"쉰", "쉰하나", "쉰둘", "쉰셋", "쉰넷", "쉰다섯", "쉰여섯", "쉰일곱", "쉰여덟", "쉰아홉",
|
||||
"예순", "예순하나", "예순둘", "예순셋", "예순넷", "예순다섯", "예순여섯", "예순일곱", "예순여덟", "예순아홉",
|
||||
"일흔", "일흔하나", "일흔둘", "일흔셋", "일흔넷", "일흔다섯", "일흔여섯", "일흔일곱", "일흔여덟", "일흔아홉",
|
||||
"여든", "여든하나", "여든둘", "여든셋", "여든넷", "여든다섯", "여든여섯", "여든일곱", "여든여덟", "여든아홉",
|
||||
"아흔", "아흔하나", "아흔둘", "아흔셋", "아흔넷", "아흔다섯", "아흔여섯", "아흔일곱", "아흔여덟", "아흔아홉"
|
||||
};
|
||||
|
||||
public static string ConvertRule(string inputStr)
|
||||
{
|
||||
return ConvertJosiType(ConvertNumeral(inputStr));
|
||||
}
|
||||
|
||||
private static string ConvertNumeral(string inputStr)
|
||||
{
|
||||
foreach (Match item in Regex.Matches(inputStr, "(?<START_TAG>\\[num\\])(?<ENCLOSED>.*?)(?<END_TAG>\\[/num\\])").Cast<Match>().Reverse())
|
||||
{
|
||||
Group obj = item.Groups["END_TAG"];
|
||||
inputStr = inputStr.Remove(obj.Index, obj.Length);
|
||||
Group obj2 = item.Groups["ENCLOSED"];
|
||||
foreach (Match item2 in Regex.Matches(obj2.Value, "\\d+").Cast<Match>().Reverse())
|
||||
{
|
||||
Group obj3 = item2.Groups[0];
|
||||
int num = int.Parse(obj3.Value);
|
||||
if (0 < num && num < NUMERAL_TABLE.Length)
|
||||
{
|
||||
int startIndex = obj2.Index + obj3.Index;
|
||||
inputStr = inputStr.Remove(startIndex, obj3.Length).Insert(startIndex, NUMERAL_TABLE[num]);
|
||||
}
|
||||
}
|
||||
Group obj4 = item.Groups["START_TAG"];
|
||||
inputStr = inputStr.Remove(obj4.Index, obj4.Length);
|
||||
}
|
||||
return inputStr;
|
||||
}
|
||||
|
||||
private static string ConvertJosiType(string inputStr)
|
||||
{
|
||||
if (inputStr.Length <= 0)
|
||||
{
|
||||
return inputStr;
|
||||
}
|
||||
_strBuilder.Length = 0;
|
||||
_strBuilder.Append(inputStr[0]);
|
||||
int length = inputStr.Length;
|
||||
for (int i = 1; i < length; i++)
|
||||
{
|
||||
char c = inputStr[i];
|
||||
if (c != '@')
|
||||
{
|
||||
_strBuilder.Append(c);
|
||||
continue;
|
||||
}
|
||||
if (i + 1 == length)
|
||||
{
|
||||
_strBuilder.Append(c);
|
||||
break;
|
||||
}
|
||||
bool flag = false;
|
||||
char c2 = inputStr[i + 1];
|
||||
for (int j = 0; j < RULE_TABLE.Length; j++)
|
||||
{
|
||||
JosiConversionRule josiConversionRule = RULE_TABLE[j];
|
||||
if (josiConversionRule.Type == c2)
|
||||
{
|
||||
flag = true;
|
||||
_strBuilder.Append(josiConversionRule.IsConvertToText1(inputStr[i - 1]) ? josiConversionRule.Text1 : josiConversionRule.Text2);
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
_strBuilder.Append(c);
|
||||
}
|
||||
}
|
||||
return _strBuilder.ToString();
|
||||
}
|
||||
|
||||
private static char? GetJongsung(char character)
|
||||
{
|
||||
if (character < '가' || '힣' < character)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return JONGSUNG_TABLE[(character - 44032) % JONGSUNG_TABLE.Length];
|
||||
}
|
||||
|
||||
private static bool IsConvertToText1_common(char latestCharacter)
|
||||
{
|
||||
if (GetJongsung(latestCharacter).HasValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ("013678".IndexOf(latestCharacter) >= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsConvertToText1_typeE(char latestCharacter)
|
||||
{
|
||||
char? jongsung = GetJongsung(latestCharacter);
|
||||
if (jongsung.HasValue && jongsung.Value != 'ㄹ')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ("036".IndexOf(latestCharacter) >= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
18
SVSim.BattleEngine/Engine/Cute/IAchievementCallback.cs
Normal file
18
SVSim.BattleEngine/Engine/Cute/IAchievementCallback.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using UnityEngine.SocialPlatforms;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public interface IAchievementCallback
|
||||
{
|
||||
void OnSignIn(bool success);
|
||||
|
||||
void OnSignOut();
|
||||
|
||||
void OnReleaseAchievement(bool success);
|
||||
|
||||
void OnProceedAchievement(bool success);
|
||||
|
||||
void OnLoadAchievements(IAchievement[] achievements);
|
||||
|
||||
void OnLoadAchievementDescriptions(IAchievementDescription[] descriptions);
|
||||
}
|
||||
20
SVSim.BattleEngine/Engine/Cute/ILocalKVS.cs
Normal file
20
SVSim.BattleEngine/Engine/Cute/ILocalKVS.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public interface ILocalKVS : IDisposable
|
||||
{
|
||||
string savePath { get; }
|
||||
|
||||
string Get(string key);
|
||||
|
||||
void Set(string key, string value);
|
||||
|
||||
void Delete(string key);
|
||||
|
||||
void DeleteAll();
|
||||
|
||||
void Transaction(Action block);
|
||||
|
||||
void Optimize();
|
||||
}
|
||||
281
SVSim.BattleEngine/Engine/Cute/LocalSqliteKVS.cs
Normal file
281
SVSim.BattleEngine/Engine/Cute/LocalSqliteKVS.cs
Normal file
@@ -0,0 +1,281 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using Sqlite3Plugin;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class LocalSqliteKVS : ILocalKVS, IDisposable
|
||||
{
|
||||
protected DBProxy _db;
|
||||
|
||||
protected PreparedQuery _keyQuery;
|
||||
|
||||
protected PreparedQuery _upsertQuery;
|
||||
|
||||
protected PreparedQuery _deleteQuery;
|
||||
|
||||
protected PreparedQuery _likeQuery;
|
||||
|
||||
protected PreparedQuery _selectAllQuery;
|
||||
|
||||
protected bool _enableCache;
|
||||
|
||||
protected Dictionary<string, string> _tableCache;
|
||||
|
||||
public string savePath => _db.dbPath;
|
||||
|
||||
protected LocalSqliteKVS(string path, bool enableCache)
|
||||
{
|
||||
try
|
||||
{
|
||||
string directoryName = Path.GetDirectoryName(path);
|
||||
if (!Directory.Exists(directoryName))
|
||||
{
|
||||
Directory.CreateDirectory(directoryName);
|
||||
}
|
||||
_db = new DBProxy();
|
||||
if (!_db.OpenWritable(path))
|
||||
{
|
||||
throw new ApplicationException($"Failed to open LocalKVS at {path}");
|
||||
}
|
||||
if (!_db.Exec("CREATE TABLE IF NOT EXISTS t (k TEXT NOT NULL, v TEXT NOT NULL, PRIMARY KEY(k));"))
|
||||
{
|
||||
throw new ApplicationException($"Failed to initialize LocalKVS at {path}");
|
||||
}
|
||||
_db.Exec("pragma cache_size=0");
|
||||
_keyQuery = _db.PreparedQuery("SELECT v FROM t WHERE k=?;");
|
||||
_upsertQuery = _db.PreparedQuery("REPLACE INTO t(k,v)VALUES(?,?);");
|
||||
_deleteQuery = _db.PreparedQuery("DELETE FROM t WHERE k=?;");
|
||||
_likeQuery = _db.PreparedQuery("SELECT k FROM t WHERE k LIKE ? ESCAPE '!';");
|
||||
_selectAllQuery = _db.PreparedQuery("SELECT k FROM t;");
|
||||
_enableCache = enableCache;
|
||||
if (!_enableCache)
|
||||
{
|
||||
return;
|
||||
}
|
||||
using (Query query = _db.Query("SELECT COUNT(*) FROM t;"))
|
||||
{
|
||||
query.Step();
|
||||
int capacity = query.GetInt(0);
|
||||
_tableCache = new Dictionary<string, string>(capacity);
|
||||
}
|
||||
using Query query2 = _db.Query("SELECT k,v FROM t;");
|
||||
while (query2.Step())
|
||||
{
|
||||
string text = query2.GetText(0);
|
||||
string text2 = query2.GetText(1);
|
||||
_tableCache[text] = text2;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Dispose();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public static LocalSqliteKVS Open(string path, bool enableCache)
|
||||
{
|
||||
return new LocalSqliteKVS(path, enableCache);
|
||||
}
|
||||
|
||||
~LocalSqliteKVS()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
if (_db != null)
|
||||
{
|
||||
if (_keyQuery != null)
|
||||
{
|
||||
_keyQuery.Dispose();
|
||||
_keyQuery = null;
|
||||
}
|
||||
if (_upsertQuery != null)
|
||||
{
|
||||
_upsertQuery.Dispose();
|
||||
_upsertQuery = null;
|
||||
}
|
||||
if (_deleteQuery != null)
|
||||
{
|
||||
_deleteQuery.Dispose();
|
||||
_deleteQuery = null;
|
||||
}
|
||||
if (_likeQuery != null)
|
||||
{
|
||||
_likeQuery.Dispose();
|
||||
_likeQuery = null;
|
||||
}
|
||||
if (_selectAllQuery != null)
|
||||
{
|
||||
_selectAllQuery.Dispose();
|
||||
_selectAllQuery = null;
|
||||
}
|
||||
_db.Dispose();
|
||||
_db = null;
|
||||
_tableCache = null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> FindLike(string pattern)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
try
|
||||
{
|
||||
_likeQuery.BindText(1, pattern);
|
||||
while (_likeQuery.Step())
|
||||
{
|
||||
list.Add(_likeQuery.GetText(0));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_likeQuery.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public string EscapeLikePattern(string pattern)
|
||||
{
|
||||
return Regex.Replace(pattern, "[_%\\[!]", "!$0");
|
||||
}
|
||||
|
||||
public void DisableCache()
|
||||
{
|
||||
_enableCache = false;
|
||||
_tableCache = null;
|
||||
}
|
||||
|
||||
public List<string> GetAll()
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
try
|
||||
{
|
||||
while (_selectAllQuery.Step())
|
||||
{
|
||||
list.Add(_selectAllQuery.GetText(0));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_selectAllQuery.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public string Get(string key)
|
||||
{
|
||||
if (_enableCache)
|
||||
{
|
||||
if (!_tableCache.TryGetValue(key, out var value))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
try
|
||||
{
|
||||
_keyQuery.BindText(1, key);
|
||||
if (_keyQuery.Step())
|
||||
{
|
||||
return _keyQuery.GetText(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_keyQuery.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void Set(string key, string value)
|
||||
{
|
||||
if (_enableCache)
|
||||
{
|
||||
_tableCache[key] = value;
|
||||
}
|
||||
try
|
||||
{
|
||||
_upsertQuery.BindText(1, key);
|
||||
_upsertQuery.BindText(2, value);
|
||||
_upsertQuery.Step();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_upsertQuery.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string key)
|
||||
{
|
||||
if (_enableCache && !_tableCache.Remove(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
_deleteQuery.BindText(1, key);
|
||||
_deleteQuery.Step();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_deleteQuery.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void Transaction(Action block)
|
||||
{
|
||||
if (!_db.Begin())
|
||||
{
|
||||
throw new ApplicationException("Failed to begin LocalKVS transaction");
|
||||
}
|
||||
try
|
||||
{
|
||||
block();
|
||||
_db.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_db.Rollback();
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteAll()
|
||||
{
|
||||
_db.Exec("DELETE FROM t;");
|
||||
if (_enableCache)
|
||||
{
|
||||
_tableCache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void Optimize()
|
||||
{
|
||||
_db.Vacuum();
|
||||
}
|
||||
}
|
||||
123
SVSim.BattleEngine/Engine/Cute/ManifestDatahashKVS.cs
Normal file
123
SVSim.BattleEngine/Engine/Cute/ManifestDatahashKVS.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class ManifestDatahashKVS : ILocalKVS, IDisposable
|
||||
{
|
||||
protected LocalSqliteKVS _kvs;
|
||||
|
||||
public string savePath => _kvs.savePath;
|
||||
|
||||
public ManifestDatahashKVS(string path)
|
||||
{
|
||||
_kvs = LocalSqliteKVS.Open(path, enableCache: true);
|
||||
}
|
||||
|
||||
~ManifestDatahashKVS()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
if (_kvs != null)
|
||||
{
|
||||
_kvs.Dispose();
|
||||
_kvs = null;
|
||||
}
|
||||
}
|
||||
|
||||
public string Get(string name)
|
||||
{
|
||||
string text = _kvs.Get(name);
|
||||
return (text == null) ? "" : text;
|
||||
}
|
||||
|
||||
public void Set(string name, string hash)
|
||||
{
|
||||
_kvs.Set(name, hash);
|
||||
}
|
||||
|
||||
public void Set(Dictionary<string, string> _dictionary)
|
||||
{
|
||||
if (_dictionary.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (KeyValuePair<string, string> item in _dictionary)
|
||||
{
|
||||
Set(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
|
||||
public void Delete(string name)
|
||||
{
|
||||
_kvs.Delete(name);
|
||||
}
|
||||
|
||||
public void DeleteAll()
|
||||
{
|
||||
_kvs.DeleteAll();
|
||||
Optimize();
|
||||
}
|
||||
|
||||
public void DisableCache()
|
||||
{
|
||||
_kvs.DisableCache();
|
||||
}
|
||||
|
||||
public void DeleteByList(List<string> _deleteList)
|
||||
{
|
||||
if (_deleteList.Count > 0)
|
||||
{
|
||||
Transaction(delegate
|
||||
{
|
||||
_deleteList.ForEach(Delete);
|
||||
});
|
||||
Optimize();
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteByPrefix(string prefix)
|
||||
{
|
||||
List<string> deleteList = _kvs.FindLike(_kvs.EscapeLikePattern(prefix) + "%");
|
||||
if (deleteList.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Transaction(delegate
|
||||
{
|
||||
foreach (string item in deleteList)
|
||||
{
|
||||
Delete(item);
|
||||
}
|
||||
});
|
||||
Optimize();
|
||||
}
|
||||
|
||||
public List<string> GetAll()
|
||||
{
|
||||
return _kvs.GetAll();
|
||||
}
|
||||
|
||||
public List<string> FindLike(string patternEscaped)
|
||||
{
|
||||
return _kvs.FindLike(patternEscaped);
|
||||
}
|
||||
|
||||
public string EscapeLikePattern(string patternNoEscape)
|
||||
{
|
||||
return _kvs.EscapeLikePattern(patternNoEscape);
|
||||
}
|
||||
|
||||
public void Optimize()
|
||||
{
|
||||
_kvs.Optimize();
|
||||
}
|
||||
|
||||
public void Transaction(Action block)
|
||||
{
|
||||
_kvs.Transaction(block);
|
||||
}
|
||||
}
|
||||
217
SVSim.BattleEngine/Engine/Cute/MovieManager.cs
Normal file
217
SVSim.BattleEngine/Engine/Cute/MovieManager.cs
Normal file
@@ -0,0 +1,217 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class MovieManager : MonoBehaviour, IManager
|
||||
{
|
||||
private string fileRootPath;
|
||||
|
||||
private string streamingAssetfileRootPath;
|
||||
|
||||
private MoviePlayer _player;
|
||||
|
||||
private float _volume = 1f;
|
||||
|
||||
private MovieSubtitles _movieSubtitles;
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
Toolbox.MovieManager = this;
|
||||
while (!CustomPreference.isPreferenceComplete)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
fileRootPath = "file:///" + Application.persistentDataPath + "/";
|
||||
streamingAssetfileRootPath = "file:///" + Application.streamingAssetsPath + "/";
|
||||
}
|
||||
|
||||
private void CreateMoviePlayer()
|
||||
{
|
||||
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("Prefab/Movie/MoviePlayer")) as GameObject;
|
||||
gameObject.transform.parent = base.transform;
|
||||
_player = gameObject.GetComponent<MoviePlayer>();
|
||||
_player.SetVolume(_volume);
|
||||
}
|
||||
|
||||
public void Load(string filename)
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
CreateMoviePlayer();
|
||||
}
|
||||
_player.Load(fileRootPath + filename);
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
if ((bool)_player)
|
||||
{
|
||||
UnityEngine.Object.Destroy(_player.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
if (IsReady() || IsPaused() || IsStopped())
|
||||
{
|
||||
_player.Play();
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayWithSubtitles(string subtitlesCSV)
|
||||
{
|
||||
GameObject prefab = (GameObject)Resources.Load("UI/MovieSubtitles");
|
||||
_movieSubtitles = NGUITools.AddChild(UIManager.GetInstance().UIManagerRoot.gameObject, prefab).GetComponent<MovieSubtitles>();
|
||||
SetCallbackStart(delegate
|
||||
{
|
||||
_movieSubtitles.PlaySubtitles(subtitlesCSV);
|
||||
});
|
||||
Play();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (_movieSubtitles != null)
|
||||
{
|
||||
_movieSubtitles.Finish();
|
||||
_movieSubtitles = null;
|
||||
}
|
||||
if (IsPlaying() || IsPaused())
|
||||
{
|
||||
_player.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
if (IsPlaying())
|
||||
{
|
||||
_player.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVolume(float volume)
|
||||
{
|
||||
_volume = volume;
|
||||
if ((bool)_player)
|
||||
{
|
||||
_player.SetVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetSeekPosition()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return _player.GetSeekPosition();
|
||||
}
|
||||
|
||||
public int GetDuration()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return _player.GetDuration();
|
||||
}
|
||||
|
||||
public int GetCurrentSeekPercent()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return _player.GetCurrentSeekPercent();
|
||||
}
|
||||
|
||||
public void SeekTo(int seek)
|
||||
{
|
||||
if ((bool)_player)
|
||||
{
|
||||
_player.SeekTo(seek);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsReady()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _player.IsReady();
|
||||
}
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _player.IsPlaying();
|
||||
}
|
||||
|
||||
public bool IsPaused()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _player.IsPaused();
|
||||
}
|
||||
|
||||
public bool IsStopped()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _player.IsStopped();
|
||||
}
|
||||
|
||||
public bool IsFinished()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return _player.IsFinished();
|
||||
}
|
||||
|
||||
public bool IsError()
|
||||
{
|
||||
if (!_player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return _player.IsError();
|
||||
}
|
||||
|
||||
public void SetCallbackReady(Action callback)
|
||||
{
|
||||
if ((bool)_player)
|
||||
{
|
||||
_player.CallbackReady += callback;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCallbackStart(Action callback)
|
||||
{
|
||||
if ((bool)_player)
|
||||
{
|
||||
_player.CallbackStart += callback;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCallbackEnd(Action callback)
|
||||
{
|
||||
if ((bool)_player)
|
||||
{
|
||||
_player.CallbackEnd += callback;
|
||||
}
|
||||
}
|
||||
}
|
||||
155
SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs
Normal file
155
SVSim.BattleEngine/Engine/Cute/MoviePlayer.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using CriWare;
|
||||
using CriWare.CriMana;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class MoviePlayer : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private CriManaMovieMaterial _movieController;
|
||||
|
||||
[SerializeField]
|
||||
private Camera _camera;
|
||||
|
||||
public event Action CallbackReady;
|
||||
|
||||
public event Action CallbackStart;
|
||||
|
||||
public event Action CallbackEnd;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_movieController.player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (_movieController.player.status)
|
||||
{
|
||||
case Player.Status.Playing:
|
||||
if (this.CallbackStart != null)
|
||||
{
|
||||
this.CallbackStart();
|
||||
this.CallbackStart = null;
|
||||
}
|
||||
break;
|
||||
case Player.Status.PlayEnd:
|
||||
Stop();
|
||||
if (this.CallbackEnd != null)
|
||||
{
|
||||
this.CallbackEnd();
|
||||
this.CallbackEnd = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Load(string filePath)
|
||||
{
|
||||
filePath = filePath.Replace("file:///", "");
|
||||
_movieController.maxFrameDrop = CriManaMovieMaterial.MaxFrameDrop.Ten;
|
||||
_movieController.player.Stop();
|
||||
_movieController.player.SetFile(null, filePath);
|
||||
_movieController.player.Prepare();
|
||||
if (this.CallbackReady != null)
|
||||
{
|
||||
this.CallbackReady();
|
||||
this.CallbackReady = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
_camera.enabled = true;
|
||||
if (IsPaused())
|
||||
{
|
||||
_movieController.player.Pause(sw: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_movieController.player.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
QualitySettings.vSyncCount = 0;
|
||||
_camera.enabled = false;
|
||||
_movieController.player.Stop();
|
||||
}
|
||||
|
||||
public void Pause()
|
||||
{
|
||||
_movieController.player.Pause(!_movieController.player.IsPaused());
|
||||
}
|
||||
|
||||
public void SetVolume(float volume)
|
||||
{
|
||||
_movieController.player.SetVolume(volume);
|
||||
}
|
||||
|
||||
public int GetSeekPosition()
|
||||
{
|
||||
return (int)(_movieController.player.GetTime() / 1000);
|
||||
}
|
||||
|
||||
public int GetDuration()
|
||||
{
|
||||
int totalFrames = (int)_movieController.player.movieInfo.totalFrames;
|
||||
int num = (int)(_movieController.player.movieInfo.framerateN / 1000);
|
||||
if (num == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return totalFrames / num * 1000;
|
||||
}
|
||||
|
||||
public int GetCurrentSeekPercent()
|
||||
{
|
||||
return GetSeekPosition() / GetDuration() * 100;
|
||||
}
|
||||
|
||||
public void SeekTo(int seek)
|
||||
{
|
||||
int num = (int)(_movieController.player.movieInfo.framerateN / 1000);
|
||||
int seekPosition = seek * num / 1000;
|
||||
_movieController.player.Stop();
|
||||
_movieController.player.SetSeekPosition(seekPosition);
|
||||
_movieController.player.Start();
|
||||
}
|
||||
|
||||
public bool IsReady()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.Ready;
|
||||
}
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
if (_movieController.player.status == Player.Status.Playing)
|
||||
{
|
||||
return !IsPaused();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsPaused()
|
||||
{
|
||||
return _movieController.player.IsPaused();
|
||||
}
|
||||
|
||||
public bool IsStopped()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.Stop;
|
||||
}
|
||||
|
||||
public bool IsFinished()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.PlayEnd;
|
||||
}
|
||||
|
||||
public bool IsError()
|
||||
{
|
||||
return _movieController.player.status == Player.Status.Error;
|
||||
}
|
||||
}
|
||||
36
SVSim.BattleEngine/Engine/Cute/ParallelJob.cs
Normal file
36
SVSim.BattleEngine/Engine/Cute/ParallelJob.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class ParallelJob
|
||||
{
|
||||
private Action _action;
|
||||
|
||||
public bool isDone { get; private set; }
|
||||
|
||||
public static ParallelJob Dispatch(Action action)
|
||||
{
|
||||
ParallelJob parallelJob = new ParallelJob(action);
|
||||
LeanThreadPool.Instance.AddJob(parallelJob);
|
||||
return parallelJob;
|
||||
}
|
||||
|
||||
private ParallelJob(Action action)
|
||||
{
|
||||
isDone = false;
|
||||
_action = action;
|
||||
}
|
||||
|
||||
internal void Run()
|
||||
{
|
||||
if (!isDone)
|
||||
{
|
||||
if (_action != null)
|
||||
{
|
||||
_action();
|
||||
_action = null;
|
||||
}
|
||||
isDone = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
69
SVSim.BattleEngine/Engine/Cute/PaymentPCFinishTask.cs
Normal file
69
SVSim.BattleEngine/Engine/Cute/PaymentPCFinishTask.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using Wizard;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class PaymentPCFinishTask : NetworkTask
|
||||
{
|
||||
public class PaymentPCFinishParams : PostParams
|
||||
{
|
||||
public string product_id = "";
|
||||
|
||||
public string steam_app_id = "";
|
||||
|
||||
public string steam_order_id = "";
|
||||
|
||||
public string steam_user_country = "";
|
||||
}
|
||||
|
||||
private CuteNetworkDefine.ApiType apiType = CuteNetworkDefine.ApiType.PaymentPCFinish;
|
||||
|
||||
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
|
||||
|
||||
public void SetParameter(string ProductId, string StreamAppID = "", string SteamOrderId = "")
|
||||
{
|
||||
PaymentPCFinishParams paymentPCFinishParams = new PaymentPCFinishParams();
|
||||
paymentPCFinishParams.product_id = ProductId;
|
||||
paymentPCFinishParams.steam_app_id = StreamAppID;
|
||||
paymentPCFinishParams.steam_order_id = SteamOrderId;
|
||||
paymentPCFinishParams.steam_user_country = PCPlatformSTEAM.Country;
|
||||
base.Params = paymentPCFinishParams;
|
||||
}
|
||||
|
||||
protected override int Parse()
|
||||
{
|
||||
int num = base.Parse();
|
||||
if (num != 1)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
if (base.ResponseData["data"].Count > 0)
|
||||
{
|
||||
if (base.ResponseData["data"]["purchased_times_data"] != null)
|
||||
{
|
||||
Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber = base.ResponseData["data"]["purchased_times_data"]["number_of_product_purchased"].ToInt();
|
||||
if (base.ResponseData["data"]["purchased_times_data"].Keys.Contains("csv_data_id"))
|
||||
{
|
||||
Data.Load.data._userCrystalCount._lastPaymentId = base.ResponseData["data"]["purchased_times_data"]["csv_data_id"].ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber = 0;
|
||||
Data.Load.data._userCrystalCount._lastPaymentId = null;
|
||||
}
|
||||
Data.Load.data._userCrystalCount.total_crystal = base.ResponseData["data"]["after_free_crystal"].ToInt() + base.ResponseData["data"]["after_crystal"].ToInt();
|
||||
Data.Load.data._userCrystalCount.free_crystal = base.ResponseData["data"]["after_free_crystal"].ToInt();
|
||||
Data.Load.data._userCrystalCount.charge_crystal = base.ResponseData["data"]["after_crystal"].ToInt();
|
||||
MyPageMenu.Instance.UpdateCrystalCount();
|
||||
if (CreateItemList.GetInstance() != null)
|
||||
{
|
||||
CreateItemList.GetInstance().UpdateCrystalCount();
|
||||
}
|
||||
if (GachaUI.GetInstance() != null)
|
||||
{
|
||||
GachaUI.GetInstance().UpdateUserItemCount();
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
340
SVSim.BattleEngine/Engine/Cute/QualityManager.cs
Normal file
340
SVSim.BattleEngine/Engine/Cute/QualityManager.cs
Normal file
@@ -0,0 +1,340 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class QualityManager : MonoBehaviour, IManager
|
||||
{
|
||||
public enum GPUQualityLevel
|
||||
{
|
||||
Level_1,
|
||||
Level_2,
|
||||
Level_3,
|
||||
Level_4
|
||||
}
|
||||
|
||||
public enum AssetQualityLevel
|
||||
{
|
||||
None,
|
||||
Level_1,
|
||||
Level_2,
|
||||
Max
|
||||
}
|
||||
|
||||
public enum SoundQualityLevel
|
||||
{
|
||||
None,
|
||||
Level_1,
|
||||
Level_2,
|
||||
Max
|
||||
}
|
||||
|
||||
public enum MovieQualityLevel
|
||||
{
|
||||
None,
|
||||
Level_1,
|
||||
Level_2,
|
||||
Max
|
||||
}
|
||||
|
||||
public enum MemoryQualityLevel
|
||||
{
|
||||
Level_1,
|
||||
Level_2
|
||||
}
|
||||
|
||||
public enum GameQualityLevel
|
||||
{
|
||||
Level_1,
|
||||
Level_2,
|
||||
Level_3,
|
||||
Level_4
|
||||
}
|
||||
|
||||
public enum OutLineLevel
|
||||
{
|
||||
OutLine_On,
|
||||
OutLine_Off
|
||||
}
|
||||
|
||||
private GPUQualityLevel _gpuQualityLevel;
|
||||
|
||||
private AssetQualityLevel _assetQualityLevel;
|
||||
|
||||
private SoundQualityLevel _soundQualityLevel;
|
||||
|
||||
private MovieQualityLevel _movieQualityLevel;
|
||||
|
||||
private MemoryQualityLevel _memoryQualityLevel;
|
||||
|
||||
private Vector2 _deviceResolution = Vector2.zero;
|
||||
|
||||
private Vector2 _gameResolution = Vector2.zero;
|
||||
|
||||
private int _defaultFrameRate = 60;
|
||||
|
||||
private bool _isDeviceResolutionSetting;
|
||||
|
||||
public bool isFullScreen;
|
||||
|
||||
private GameQualityLevel _gameQualityLevel;
|
||||
|
||||
private OutLineLevel _outlineLevel;
|
||||
|
||||
public Vector2 deviceResolution => _deviceResolution;
|
||||
|
||||
public Vector2 gameResolution => _gameResolution;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
UpdateFromUnity();
|
||||
}
|
||||
|
||||
private IEnumerator Start()
|
||||
{
|
||||
while (Toolbox.SavedataManager == null)
|
||||
{
|
||||
yield return 0;
|
||||
}
|
||||
Initialize();
|
||||
Toolbox.QualityManager = this;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
CheckGPUQuality();
|
||||
CheckMemoryQuality();
|
||||
CheckAssetQuality();
|
||||
CheckSoundQuality();
|
||||
CheckMovieQuality();
|
||||
InitializeGameQuality();
|
||||
}
|
||||
|
||||
private void CheckGPUQuality()
|
||||
{
|
||||
_gpuQualityLevel = GPUQualityLevel.Level_4;
|
||||
}
|
||||
|
||||
private void CheckMemoryQuality()
|
||||
{
|
||||
_memoryQualityLevel = MemoryQualityLevel.Level_2;
|
||||
}
|
||||
|
||||
private void CheckAssetQuality()
|
||||
{
|
||||
_assetQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? AssetQualityLevel.Level_1 : AssetQualityLevel.Level_2);
|
||||
SetAssetQualityLevel(_assetQualityLevel);
|
||||
}
|
||||
|
||||
private void CheckSoundQuality()
|
||||
{
|
||||
int num = Toolbox.SavedataManager.GetInt("SOUNDQUALIY");
|
||||
if (num != 0)
|
||||
{
|
||||
_soundQualityLevel = (SoundQualityLevel)num;
|
||||
}
|
||||
else
|
||||
{
|
||||
_soundQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? SoundQualityLevel.Level_1 : SoundQualityLevel.Level_2);
|
||||
}
|
||||
SetSoundQualityLevel(_soundQualityLevel);
|
||||
}
|
||||
|
||||
private void CheckMovieQuality()
|
||||
{
|
||||
_movieQualityLevel = ((_memoryQualityLevel == MemoryQualityLevel.Level_1) ? MovieQualityLevel.Level_1 : MovieQualityLevel.Level_2);
|
||||
}
|
||||
|
||||
public static GPUQualityLevel GetGPUQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return GPUQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._gpuQualityLevel;
|
||||
}
|
||||
|
||||
public static MemoryQualityLevel GetMemoryQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return MemoryQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._memoryQualityLevel;
|
||||
}
|
||||
|
||||
public static void SetAssetQualityLevel(AssetQualityLevel _AssetQualityLevel)
|
||||
{
|
||||
if (Toolbox.QualityManager != null)
|
||||
{
|
||||
Toolbox.QualityManager._assetQualityLevel = _AssetQualityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public static AssetQualityLevel GetAssetQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return AssetQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._assetQualityLevel;
|
||||
}
|
||||
|
||||
public static void SetSoundQualityLevel(SoundQualityLevel _SoundQualityLevel)
|
||||
{
|
||||
if (Toolbox.QualityManager != null)
|
||||
{
|
||||
Toolbox.QualityManager._soundQualityLevel = _SoundQualityLevel;
|
||||
Toolbox.SavedataManager.SetInt("SOUNDQUALIY", (int)Toolbox.QualityManager._soundQualityLevel);
|
||||
}
|
||||
}
|
||||
|
||||
public static SoundQualityLevel GetSoundQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return SoundQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._soundQualityLevel;
|
||||
}
|
||||
|
||||
public static void SetMovieQualityLevel(MovieQualityLevel _MovieQualityLevel)
|
||||
{
|
||||
if (Toolbox.QualityManager != null)
|
||||
{
|
||||
Toolbox.QualityManager._movieQualityLevel = _MovieQualityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
public static MovieQualityLevel GetMovieQualityLevel()
|
||||
{
|
||||
if (Toolbox.QualityManager == null)
|
||||
{
|
||||
return MovieQualityLevel.Level_1;
|
||||
}
|
||||
return Toolbox.QualityManager._movieQualityLevel;
|
||||
}
|
||||
|
||||
public void LimitResolution()
|
||||
{
|
||||
_gameResolution = _deviceResolution;
|
||||
if (_deviceResolution.x > 1280f || _deviceResolution.y > 1280f)
|
||||
{
|
||||
float num = 1280f / _deviceResolution.x;
|
||||
_gameResolution = new Vector2(_deviceResolution.x * num, _deviceResolution.y * num);
|
||||
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeResolution(float rate, bool saveratio = true)
|
||||
{
|
||||
LimitResolution();
|
||||
float num = _gameResolution.x * rate / _gameResolution.x;
|
||||
_gameResolution = new Vector2(_gameResolution.x * num, _gameResolution.y * num);
|
||||
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
|
||||
}
|
||||
|
||||
public void ChangeResolutionToDeviceSetting()
|
||||
{
|
||||
_gameResolution = _deviceResolution;
|
||||
Screen.SetResolution((int)_gameResolution.x, (int)_gameResolution.y, isFullScreen);
|
||||
}
|
||||
|
||||
public void ChangeResolution(float width, float height, bool fullscreen)
|
||||
{
|
||||
if (width == 0f || height == 0f)
|
||||
{
|
||||
width = Screen.width;
|
||||
height = Screen.height;
|
||||
}
|
||||
isFullScreen = fullscreen;
|
||||
_deviceResolution = new Vector2(width, height);
|
||||
Screen.SetResolution((int)width, (int)height, fullscreen);
|
||||
}
|
||||
|
||||
private void InitializeGameQuality()
|
||||
{
|
||||
if (_gpuQualityLevel == GPUQualityLevel.Level_4)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_4;
|
||||
}
|
||||
else if (_gpuQualityLevel == GPUQualityLevel.Level_3)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_3;
|
||||
}
|
||||
else if (_gpuQualityLevel == GPUQualityLevel.Level_2)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_2;
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_1;
|
||||
}
|
||||
if (_memoryQualityLevel == MemoryQualityLevel.Level_1)
|
||||
{
|
||||
_gameQualityLevel = GameQualityLevel.Level_1;
|
||||
}
|
||||
if (!_isDeviceResolutionSetting)
|
||||
{
|
||||
_deviceResolution = new Vector2(Screen.width, Screen.height);
|
||||
_isDeviceResolutionSetting = true;
|
||||
}
|
||||
if (_gpuQualityLevel <= GPUQualityLevel.Level_2 && Toolbox.SavedataManager.GetInt("SOUNDQUALIY") == 0)
|
||||
{
|
||||
SetSoundQualityLevel(SoundQualityLevel.Level_1);
|
||||
}
|
||||
DecideDeviceSetting();
|
||||
}
|
||||
|
||||
private void DecideDeviceSetting()
|
||||
{
|
||||
string graphicsDeviceName = SystemInfo.graphicsDeviceName;
|
||||
if (graphicsDeviceName.Contains("PowerVR") && graphicsDeviceName.Contains("SGX 540"))
|
||||
{
|
||||
_outlineLevel = OutLineLevel.OutLine_Off;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetGameQualityLevel(GPUQualityLevel level)
|
||||
{
|
||||
_gpuQualityLevel = level;
|
||||
}
|
||||
|
||||
public GameQualityLevel GetGameQualityLevel()
|
||||
{
|
||||
return _gameQualityLevel;
|
||||
}
|
||||
|
||||
public void SetFrameRate(int frameRate)
|
||||
{
|
||||
_defaultFrameRate = frameRate;
|
||||
}
|
||||
|
||||
public int GetFrameRate()
|
||||
{
|
||||
return _defaultFrameRate;
|
||||
}
|
||||
|
||||
public void ChangeResolutionFixedHalf()
|
||||
{
|
||||
}
|
||||
|
||||
public void ChangeResolutionFixedBack()
|
||||
{
|
||||
}
|
||||
|
||||
public OutLineLevel GetOutLineLevel()
|
||||
{
|
||||
return _outlineLevel;
|
||||
}
|
||||
|
||||
public void UpdateFromUnity()
|
||||
{
|
||||
isFullScreen = Screen.fullScreen;
|
||||
_deviceResolution = new Vector2(Screen.width, Screen.height);
|
||||
}
|
||||
}
|
||||
90
SVSim.BattleEngine/Engine/Cute/SavedataManager.cs
Normal file
90
SVSim.BattleEngine/Engine/Cute/SavedataManager.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using CodeStage.AntiCheat.ObscuredTypes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class SavedataManager : MonoBehaviour, IManager
|
||||
{
|
||||
public const string RESOURCE_VERSION_KEY = "RES_VER";
|
||||
|
||||
public const string LANGUAGE_FIRST_SET = "LANG_FIRST_SET";
|
||||
|
||||
public const string LANGUAGE_KEY = "LANG_SETTING";
|
||||
|
||||
public const string LANGUAGE_SOUND_KEY = "LANG_SOUND_SETTING";
|
||||
|
||||
public const string LANGUAGE_FONT_KEY = "LANG_FONT";
|
||||
|
||||
public static string OMOTENASHI_COUNTRY_KEY = "OMOTE_COUNTRY";
|
||||
|
||||
public static string LANGUAGE_CHANGE = "LANG_CHANGE";
|
||||
|
||||
private void Start()
|
||||
{
|
||||
Toolbox.SavedataManager = this;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteAll()
|
||||
{
|
||||
ObscuredPrefs.DeleteAll();
|
||||
}
|
||||
|
||||
public void DeleteKey(string key)
|
||||
{
|
||||
ObscuredPrefs.DeleteKey(key);
|
||||
}
|
||||
|
||||
public float GetFloat(string key, float defaultValue = 0f)
|
||||
{
|
||||
return ObscuredPrefs.GetFloat(key, defaultValue);
|
||||
}
|
||||
|
||||
public void SetFloat(string key, float value)
|
||||
{
|
||||
ObscuredPrefs.SetFloat(key, value);
|
||||
}
|
||||
|
||||
public int GetInt(string key, int defaultValue = 0)
|
||||
{
|
||||
return ObscuredPrefs.GetInt(key, defaultValue);
|
||||
}
|
||||
|
||||
public void SetInt(string key, int value)
|
||||
{
|
||||
ObscuredPrefs.SetInt(key, value);
|
||||
}
|
||||
|
||||
public string GetString(string key, string defaultValue = "")
|
||||
{
|
||||
return ObscuredPrefs.GetString(key, defaultValue);
|
||||
}
|
||||
|
||||
public void SetString(string key, string value)
|
||||
{
|
||||
ObscuredPrefs.SetString(key, value);
|
||||
}
|
||||
|
||||
public bool HasKey(string key)
|
||||
{
|
||||
return ObscuredPrefs.HasKey(key);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
ObscuredPrefs.Save();
|
||||
}
|
||||
|
||||
public void SetResourceVersion(string version)
|
||||
{
|
||||
SetString("RES_VER", version);
|
||||
}
|
||||
|
||||
public string GetResourceVersion()
|
||||
{
|
||||
return GetString("RES_VER", "00000000");
|
||||
}
|
||||
}
|
||||
72
SVSim.BattleEngine/Engine/Cute/SignUpTask.cs
Normal file
72
SVSim.BattleEngine/Engine/Cute/SignUpTask.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using LitJson;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public class SignUpTask : NetworkTask
|
||||
{
|
||||
private class LoginPostParams : PostParams
|
||||
{
|
||||
public string device_name = "";
|
||||
|
||||
public string client_type = "";
|
||||
|
||||
public string os_version = "";
|
||||
|
||||
public string app_version = "";
|
||||
|
||||
public string resource_version = "";
|
||||
|
||||
public string carrier = "";
|
||||
}
|
||||
|
||||
private CuteNetworkDefine.ApiType apiType;
|
||||
|
||||
public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[apiType]}";
|
||||
|
||||
public void SetParameter()
|
||||
{
|
||||
LoginPostParams loginPostParams = new LoginPostParams();
|
||||
loginPostParams.device_name = Toolbox.DeviceManager.GetModelName();
|
||||
loginPostParams.client_type = Toolbox.DeviceManager.GetDeviceType().ToString();
|
||||
loginPostParams.os_version = Toolbox.DeviceManager.GetOsVersion();
|
||||
loginPostParams.app_version = Toolbox.DeviceManager.GetAppVersionName();
|
||||
loginPostParams.resource_version = "00000000";
|
||||
loginPostParams.carrier = Toolbox.DeviceManager.GetCarrier();
|
||||
base.Params = loginPostParams;
|
||||
}
|
||||
|
||||
protected override int Parse()
|
||||
{
|
||||
JsonData jsonData = base.ResponseData["data_headers"];
|
||||
resultCode = jsonData["result_code"].ToInt();
|
||||
if (resultCode != 1)
|
||||
{
|
||||
return resultCode;
|
||||
}
|
||||
int viewerId = jsonData["viewer_id"].ToInt();
|
||||
int shortUdid = jsonData["short_udid"].ToInt();
|
||||
string text = jsonData["udid"].ToString();
|
||||
if (Certification.Udid != text)
|
||||
{
|
||||
Debug.LogError("udid一致しません。不正のアクセスです。");
|
||||
}
|
||||
else
|
||||
{
|
||||
Certification.ViewerId = viewerId;
|
||||
Certification.ShortUdid = shortUdid;
|
||||
Certification.SessionId = "";
|
||||
AdjustManager.ViewerIDEvent();
|
||||
GameObject gameObject = GameObject.Find("OmotePlugin");
|
||||
if (gameObject != null)
|
||||
{
|
||||
OmotePlugin component = gameObject.GetComponent<OmotePlugin>();
|
||||
if (component != null)
|
||||
{
|
||||
component.SendConversion(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultCode;
|
||||
}
|
||||
}
|
||||
48
SVSim.BattleEngine/Engine/Cute/SoftwareResetBase.cs
Normal file
48
SVSim.BattleEngine/Engine/Cute/SoftwareResetBase.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Cute;
|
||||
|
||||
public static class SoftwareResetBase
|
||||
{
|
||||
public static bool isSoftwareReset;
|
||||
|
||||
private static Action resetAction;
|
||||
|
||||
public static bool IsSoftwareReset()
|
||||
{
|
||||
return isSoftwareReset;
|
||||
}
|
||||
|
||||
public static void setSoftwareResetAction(Action _action)
|
||||
{
|
||||
resetAction = _action;
|
||||
}
|
||||
|
||||
public static void SoftwareReset(string sceneName, Action _resetAction)
|
||||
{
|
||||
isSoftwareReset = true;
|
||||
if (_resetAction != null)
|
||||
{
|
||||
resetAction = _resetAction;
|
||||
}
|
||||
resetAction.Call();
|
||||
GameObject gameObject = GameObject.Find("OmotePlugin");
|
||||
if (gameObject != null)
|
||||
{
|
||||
UnityEngine.Object.Destroy(gameObject);
|
||||
}
|
||||
Toolbox.BootSystem.VisibleBootCamera(enable: true);
|
||||
GameObject gameObject2 = GameObject.Find("BootCamera");
|
||||
if (gameObject2 != null)
|
||||
{
|
||||
gameObject2.transform.parent = null;
|
||||
UnityEngine.Object.DontDestroyOnLoad(gameObject2);
|
||||
BootSystem.isRootBootCamera = true;
|
||||
}
|
||||
Screen.sleepTimeout = -2;
|
||||
BootApp.BootScene = sceneName;
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene("_SoftwareReset");
|
||||
}
|
||||
}
|
||||
17
SVSim.BattleEngine/Engine/Cute/SoundData.cs
Normal file
17
SVSim.BattleEngine/Engine/Cute/SoundData.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Cute;
|
||||
|
||||
public struct SoundData
|
||||
{
|
||||
public string _acbName;
|
||||
|
||||
public string _cueName;
|
||||
|
||||
public int _cueId;
|
||||
|
||||
public SoundData(string acbName, string cueName, int cueId)
|
||||
{
|
||||
_acbName = acbName;
|
||||
_cueName = cueName;
|
||||
_cueId = cueId;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user