using System;
using System.Collections.Generic;
using System.Linq;
using LitJson;
using UnityEngine;
using Wizard;
using Wizard.Battle.UI;
using Wizard.Battle.View;
using Wizard.RoomMatch;

public class NetworkBattleReceiver
{
	public enum JudgeEndType
	{
		JUDGE = 1,
		VALIDATE,
		FIRSTCARD
	}

	public class ReceiveData
	{
		public long _timeSent;

		public NetworkBattleDefine.NetworkBattleURI dataUri;

		public NetworkBattleDefine.NetworkBattleURI receiveUri;

		public int idx;

		public bool isSelf;

		public bool _isPlayerCard;

		public NetworkBattleDefine.PlayActionType actionType;

		public JudgeEndType judgeEndType;

		public int playCardIndex;

		public List<CardDataModel> unapprovedList = new List<CardDataModel>();

		public List<CardDataModel> SkillConditionCheckList = new List<CardDataModel>();

		public List<TargetData> OpponentTargetDataList = new List<TargetData>();

		public List<TargetData> PlayerTargetDataList = new List<TargetData>();

		public int oppoChatStamp;

		public int playChatStamp;

		public bool isWin;

		public bool IsPlayerDead;

		public bool IsEnemyDead;

		public bool _isBurialRiteSelect;

		public bool IsChoiceBraveSelect;

		public List<CardDataModel> knownCardList = new List<CardDataModel>();

		public List<CardDataModel> watchCardList = new List<CardDataModel>();

		public RESULT_CODE result;

		public NetworkBattleDefine.ReceiveNodeResultCode NodeResultCode;

		public RESULT_CODE opponentResult;

		public List<int> validateSkillIndexList = new List<int>();

		public NetworkBattleSender.SELECT_SKILL_OPERATION _selectSkillOperation;

		public int _selectedCardIndex;

		public List<int> ActiveSelectSkillIndexList = new List<int>();

		public List<int> _selectedChoiceCardIdList = new List<int>();

		public bool _isEvolveTargetSelect;

		public NetworkBattleSender.SELECT_OBJECT_TARGET_TYPE _selectObjectTargetType;

		public bool _isShortenedTurn;

		public bool _isNotTurnEndReady;

		public NetworkBattleSender.SLIDE_OBJECT_TYPE _slideObjectType;

		public bool IsTransformChoice;

		public List<int> choiceIdList = new List<int>();

		public List<int> burialRateList = new List<int>();

		public int mutationAfterCardId;

		public bool _isSettingMutationAfterCardId;

		public int transformBeforeCardId;

		public int mutationAfterCost;

		public List<SendKeyActionDataManager.KeyActionType> keyActionType = new List<SendKeyActionDataManager.KeyActionType>();

		public List<int> selfIdxList = new List<int>();

		public List<int> oppoIdxList = new List<int>();

		public int spin;

		public bool IsChoice => keyActionType.Exists((SendKeyActionDataManager.KeyActionType x) => x == SendKeyActionDataManager.KeyActionType.Choice || x == SendKeyActionDataManager.KeyActionType.HaveBeforeSkillChoice);

		public bool IsChoiceEvolution => keyActionType.Exists((SendKeyActionDataManager.KeyActionType x) => x == SendKeyActionDataManager.KeyActionType.ChoiceEvolution);

		public bool IsChoiceBrave => keyActionType.Exists((SendKeyActionDataManager.KeyActionType x) => x == SendKeyActionDataManager.KeyActionType.ChoiceBrave);

		public bool IsBurialRate => keyActionType.Exists((SendKeyActionDataManager.KeyActionType x) => x == SendKeyActionDataManager.KeyActionType.BurialRate);

		public bool IsAcceleratedOrCrystallize => keyActionType.Exists((SendKeyActionDataManager.KeyActionType x) => x == SendKeyActionDataManager.KeyActionType.Accelerated || x == SendKeyActionDataManager.KeyActionType.Crystallize);

		public bool IsFusion => keyActionType.Exists((SendKeyActionDataManager.KeyActionType x) => x == SendKeyActionDataManager.KeyActionType.Fusion);

		public List<CardDataModel> GetReceiveCardList()
		{
			if (!GameMgr.GetIns().IsWatchBattle && !BattleManagerBase.GetIns().IsRecovery)
			{
				return knownCardList;
			}
			return watchCardList;
		}
	}

	public class ReplayReceiveData : ReceiveData
	{
		public ReplayOperationType Operation;

		public int AddPpTotalCount;

		public int Pp;

		public int Bp;

		public int Ep;

		public int CardIndex;

		public List<int> CardIndexList;

		public List<int> TargetIndexList;

		public List<int> CardIdList;

		public string SelectCard;

		public string OwnerCardName;

		public List<string> CardNameList = new List<string>();

		public List<string> DestroyCardNameList = new List<string>();

		public List<string> BanishCardNameList = new List<string>();

		public List<string> IndestructibleCardNameList = new List<string>();

		public List<string> EffectTargetCardNameList = new List<string>();

		public string PlayVoiceOnDeathCard = string.Empty;

		public CardInfo CardInfo;

		public List<CardInfo> CardInfoList;

		public EffectInfo EffectInfo;

		public int Attack;

		public int Life;

		public int MultiplyAttack;

		public int MultiplyLife;

		public int MaxLife;

		public List<int> RemoveCostChangeList;

		public List<int> DepriveOffenseBuffList;

		public List<int> DepriveLifeBuffList;

		public int Cost;

		public List<int> AddCostList;

		public List<int> SetCostList;

		public List<int> AddSpellChargeList;

		public int TransformCardId;

		public BattleCardBase.TransformType TransformType;

		public bool IsOpen;

		public bool IsOpenDrawSkill;

		public bool IsReserved;

		public List<int> DealDamageList;

		public List<bool> IsReflectionDamage;

		public List<int> HealList;

		public bool IsAttackerDead;

		public bool IsTargetDead;

		public int ReceiveDamage;

		public bool IsEvolve;

		public bool IsActive;

		public bool IsNotConsumeEp;

		public int EvolveMeWhenAttackIndex;

		public bool IsDeckSelf;

		public bool IsBurialRite;

		public int ChangeCount;

		public bool IsDestroy;

		public bool IsChange;

		public List<bool> IsCostUpList;

		public bool IsSpellCharge;

		public bool IsOpenCard;

		public bool IsHalf;

		public bool IsAdd;

		public bool IsTransformSelect;

		public bool IsFusionNecromance;

		public bool IsFusionMetamorphose;

		public int FusionMetamorphoseCardId;

		public int SkillHashCode;

		public bool IsOnSummonSkill;

		public bool IsInvoked;

		public string SkillVoice;

		public bool IsLastDrawOpenCard;

		public bool IsOwnerEffect;

		public bool IsIgnoreVoice;

		public bool IsRandomVoice;

		public bool IsEvoVoice;

		public bool IsImmediate;

		public bool BySkill;

		public bool OnlyEffect;

		public bool OnlyAttackEffect;

		public bool UpdateAttackEffect;

		public bool UseRecordAttackEffect;

		public CardBasePrm.ClanType Clan;

		public CardBasePrm.TribeInfo Tribe;

		public ClassCharaPrm.EmotionType EmoteType;

		public List<DestroyType> DestroyTypeList;

		public SkillCollectionBase.WhenPlayEffectType WhenPlayEffectType;

		public int BattleLogIndex;

		public List<SideLogSkillInfo> SideLogSkillInfoList;

		public StatusPanelInfo PlayerStatusPanelInfo;

		public StatusPanelInfo EnemyStatusPanelInfo;

		public ClassInfoUiInfo PlayerClassInfo;

		public ClassInfoUiInfo EnemyClassInfo;

		public List<MyRotationBonusInfo> MyRotationBonusInfoList = new List<MyRotationBonusInfo>();

		public AvatarBattleDescriptionValueInfo PlayerAvatarBattleDescInfo;

		public AvatarBattleDescriptionValueInfo EnemyAvatarBattleDescInfo;

		public BattleManagerBase.FINISH_TYPE FinishType;

		public RESULT_CODE ResultCode;

		public int MaxSelectCount;

		public bool CanFusionMetamorphose;

		public bool IsChoiceBraveData;
	}

	public class CardInfo
	{
		public int Id;

		public int Index;

		public bool IsSelf;

		public int Cost;

		public bool IsEvolution;

		public int ExecutedFixedUseCostIndex = -1;

		public List<NewReplayBattleMgr.ParameterModifierInfo> ParameterModifierList = new List<NewReplayBattleMgr.ParameterModifierInfo>();

		public List<int> UnionBurstModifierValueList = new List<int>();

		public List<int> SkyboundArtModifierValueList = new List<int>();

		public List<int> SuperSkyboundArtModifierValueList = new List<int>();

		public List<int> FusionIngredientIdxList = new List<int>();

		public HandCardFrameEffectType HandCardFrameEffectType;

		public bool IsHandEffectActive;

		public List<InplaySkillEffect> InplaySkillEffectList;

		public int InductionNumber;

		public bool Attackable;

		public bool IsCantAttackClass;

		public int AttackableCount;

		public bool ForceHideAttackEffect;

		public List<int> SkillDescriptionValueList;

		public List<int> EvoSkillDescriptionValueList;

		public List<ReplayBuffInfo> BuffInfoList = new List<ReplayBuffInfo>();

		public List<string> NoConsumeEpBuffInfoNameList = new List<string>();

		public List<ReplayBuffInfoLabel> BuffInfoLabelList = new List<ReplayBuffInfoLabel>();

		public List<int> Tribe = new List<int>();

		public bool IsSameBuff;

		public bool IsOverflow;

		public int SpellChargeCount = -1;

		public int ChantCount;

		public int WhiteRitualCount = -1;

		public int MaxAttackableCount = -1;

		public int MetamorphoseCount;
	}

	public class ReplayBuffInfo
	{
		public BuffCardInfo OwnerCardInfo;

		public BuffCardInfo PreviousOwnerCardInfo;

		public ReplayBuffType BuffType;

		public int CardIdFrom;

		public bool IsEvolutionSkill;

		public bool IsPlayer;

		public string DivergenceIdList;

		public List<int> CopiedSkillDescriptionValueList = new List<int>();

		public List<int> CopiedEvoSkillDescriptionValueList = new List<int>();
	}

	public class BuffCardInfo
	{
		public string CardName;

		public int CardId;

		public int MetamorphoseCount;
	}

	public class EffectInfo
	{
		public string EffectPath;

		public EffectMgr.EngineType EngineType;

		public string SePath;

		public EffectMgr.MoveType EffectMoveType;

		public EffectMgr.TargetType EffectTargetType;

		public float EffectTime;

		public bool IsFollowInHand;

		public bool IsTargetPosition;

		public bool IsWhenFusioned;
	}

	public class SideLogSkillInfo
	{
		public int Index;

		public bool IsSelf;

		public int CardId;

		public int SkillHashCode;

		public bool IsEvolve;

		public bool IsOnSummonSkill;

		public bool IsInvoked;

		public bool IsPrivate;

		public bool IsInDeck;

		public CardInfo CardInfo;
	}

	public class StatusPanelInfo
	{
		public int HandCount;

		public int CemetaryCount;

		public int DeckCount;

		public bool IsDrew;
	}

	public class ClassInfoUiInfo
	{
		public int TurnPlayCount;

		public int CemetaryCount;

		public int Life;

		public bool IsForceBerserk;

		public bool IsEnterForceBerserk;

		public bool IsChangeResonance;
	}

	public class MyRotationBonusInfo
	{
		public string AbilityId;

		public bool IsSelf;

		public int RemainingIncreaseAddPptotalTurn;

		public bool IsRemainIncreaseAddPptotalTurn;

		public int RemainingSkillCount;

		public bool IsRemainSkill;
	}

	public class AvatarBattleDescriptionValueInfo
	{
		public List<int> PassiveSkillDescriotionValueList = new List<int>();

		public List<List<int>> ChoiceBraveDescriotionValueListList = new List<List<int>>();
	}

	public enum DestroyType
	{
		None,
		BurialRite,
		WhiteRitual,
		ChantCount,
		WhenDestroy,
		Killer,
		WhenDestroyAndKiller
	}

	public enum InplaySkillEffect
	{
		Guard,
		Killer,
		Untouchable,
		NotBeAttacked,
		Sneak,
		SkillCantAtkAll,
		Independent,
		DamageCutProtection,
		Indestructible,
		ReflectionClass,
		Drain,
		Destroy,
		WhiteRitual,
		StackWhiteRitual,
		Induction,
		InductionNumber,
		Geton,
		GetonAfter
	}

	public enum ReplayReceiveDataType
	{
		Operation,
		IsSelf,
		SelfCards,
		OppoCards,
		AddPpTotalCount,
		Pp,
		Bp,
		EpCount,
		CardIndexList,
		Index,
		TargetIndexList,
		CardInfo,
		CardInfoList,
		AddCostList,
		SetCostList,
		AddSpellChargeList,
		Cost,
		Attack,
		Life,
		MultiplyAttack,
		MultiplyLife,
		MaxLife,
		RemoveCostChangeList,
		DepriveOffenseBuffList,
		DepriveLifeBuffList,
		CardId,
		CardIdList,
		IsOpen,
		IsOpenDrawSkill,
		IsReserved,
		DealDamageList,
		ReceiveDamage,
		IsReflectionDamage,
		HealList,
		IsAttackerDead,
		IsTargetDead,
		SelectCard,
		OwnerCardName,
		CardNameList,
		DestroyCardNameList,
		BanishCardNameList,
		IndestructibleCardNameList,
		EffectTargetCardNameList,
		SkillSideLogList,
		PlayVoiceOnDeathCard,
		IsEvolve,
		IsActive,
		IsNotConsumeEp,
		EvolveMeWhenAttackIndex,
		TransformCardId,
		TransformType,
		IsDeckSelf,
		IsInDeck,
		IsPrivate,
		IsBurialRite,
		ChangeCount,
		IsDestroy,
		IsChange,
		IsCostUpList,
		IsSpellCharge,
		IsOpenCard,
		IsHalf,
		IsAdd,
		IsTransformSelect,
		IsFusionNecromance,
		IsFusionMetamorphose,
		FusionMetamorphoseCardId,
		EffectInfo,
		DestroyTypeList,
		WhenPlayEffectType,
		AttachedCardList,
		PlayerStatusPanelInfo,
		EnemyStatusPanelInfo,
		PlayerBattleInfo,
		EnemyBattleInfo,
		PlayerClassInfo,
		EnemyClassInfo,
		MyRotationBonusList,
		PlayerAvatarBattleDescInfo,
		EnemyAvatarBattleDescInfo,
		BattleLogIndex,
		IsWin,
		IsPlayerDead,
		IsEnemyDead,
		FinishType,
		ResultCode,
		SkillHashCode,
		IsOnSummonSkill,
		IsInvoked,
		SkillVoice,
		IsLastDrawOpenCard,
		IsOwnerEffect,
		IsIgnoreVoice,
		IsRandomVoice,
		IsEvoVoice,
		IsImmediate,
		BySkill,
		OnlyEffect,
		OnlyAttackEffect,
		UpdateAttackEffect,
		UseRecordAttackEffect,
		Clan,
		Tribe,
		TribeType,
		TribeChangeType,
		EmoteType,
		EnemyTurnNum,
		MaxSelectCount,
		CanFusionMetamorphose,
		IsChoiceBrave
	}

	public enum ReplayOperationType
	{
		MulliganStart,
		MulliganEnd,
		TurnStart,
		TurnStartFinish,
		TurnEnd,
		TurnEndFinish,
		AddPpTotal,
		AddPp,
		AddBp,
		AddEp,
		SetEp,
		Draw,
		TokenDraw,
		Play,
		ShowWhenPlayEffect,
		SummonToken,
		SummonCard,
		AttackStart,
		Attack,
		CostChange,
		RemoveCostChange,
		PowerUp,
		GainPowerDown,
		SetPowerDown,
		DepriveBuff,
		SpellCharge,
		Damage,
		Heal,
		Discard,
		DestroyOrBanish,
		Evolve,
		SkillEvolve,
		Return,
		StartSelect,
		Select,
		CompSelect,
		CancelSelect,
		StartChoice,
		CompChoice,
		CancelChoice,
		StartFusion,
		SelectFusion,
		CompFusion,
		CancelFusion,
		ChantCountChange,
		ChangeWhiteRitualStack,
		Necromance,
		ChangeMaxAttackableCount,
		UpdateDeck,
		IndexChange,
		Metamorphose,
		Geton,
		Getoff,
		Unite,
		OpenCard,
		CreateReservedCard,
		AttachSkill,
		ShowSkillEffect,
		ShowSkillInductionEffect,
		ShowIndependentEffect,
		ChangeAffiliation,
		OnChangeUnionBurstAndSkyboundArt,
		ShowRepeatSkillEffect,
		GiveCantActivateFanfare,
		DepriveCantActivateFanfare,
		LoseSkill,
		UpdateHandInfo,
		UpdateInplayInfo,
		UpdateDeckInfo,
		UpdateAttachedCardInfo,
		UpdateFusionCardInfo,
		UpdateStatusPanel,
		UpdateBattleInfo,
		UpdateClassInfoUi,
		UpdateMyRotationBonus,
		UpdateAvatarBattleDescInfo,
		UpdateAttackableEffect,
		UpdateChoiceBraveButtonEffet,
		SkillProcessStart,
		SkillVfxStart,
		SkillVfxEnd,
		ClearSideLog,
		ClearDestroyedCardList,
		PlayEmotion,
		AttachShortageDeckWin,
		ShortageDeckWin,
		ShortageDeckLose,
		SpecialWin,
		SpecialLose,
		BattleFinish
	}

	public enum ReplayItemType
	{
		Id,
		Index,
		IsSelf,
		Turn,
		Cost,
		Atk,
		Life,
		MaxLife,
		IsEvolution,
		ExecutedFixedUseCostIndex,
		ParameterModifierList,
		UnionBurstModifierValueList,
		SkyboundArtModifierValueList,
		SuperSkyboundArtModifierValueList,
		FusionIngredientIdxList,
		HandEffect,
		IsHandEffectActive,
		InplaySkillEffect,
		InductionNumber,
		Attackable,
		IsCantAttackClass,
		MaxAttackableCount,
		AttackableCount,
		ForceHideAttackEffect,
		SkillDescriptionValueList,
		EvoSkillDescriptionValueList,
		PassiveSkillDescriptionValueList,
		ChoiceBraveDescriptionValueListList,
		BuffInfoList,
		EffectPath,
		EngineType,
		SePath,
		EffectMoveType,
		EffectTargetType,
		EffectTime,
		IsFollowInHand,
		IsTargetPosition,
		IsWhenFusioned,
		MaxPp,
		Pp,
		Bp,
		Ep,
		EpTotal,
		CemetaryCount,
		DeckCount,
		HandCard,
		InplayCard,
		HandCount,
		PlayCount,
		Player,
		Enemy,
		IsDrew,
		DeckCard,
		CemetaryCard,
		NecromanceZoneCard,
		BanishCard,
		FusionIngredientCard,
		GetonCard,
		UniteCard,
		ReservedCard,
		BlackHole,
		ChoiceBraveCardList,
		CardTotalNum,
		Name,
		LogType,
		RightValue,
		CardWithCount,
		RandomArray,
		LogItemType,
		IsMinus,
		IsNecromance,
		IsDead,
		IsDrain,
		IsForceBerserk,
		IsEnterForceBerserk,
		IsChangeResonance,
		BuffInfo,
		BuffOwnerCardInfo,
		PreviousBuffOwnerCardInfo,
		CardName,
		BuffType,
		NoConsumeEpCardName,
		BuffTextLabel,
		BuffTextType,
		BuffTextValue,
		PreviousOwner,
		DivergenceId,
		CopiedSkillDescriptionValueList,
		CopiedEvoSkillDescriptionValueList,
		IsSameBuff,
		IsOverFlow,
		SpellChargeCount,
		Tribe,
		ChantCount,
		WhiteRitualCount,
		IsShortageDeckWin,
		IsEpEvolveThisTurn,
		CantActivateFanfareCount,
		CumulativeEvolutionCount,
		IsEvolutionSkill,
		TextureOption,
		PlayedCardList,
		PlayedCardIdList,
		DestroyedCardList,
		FusionCardList,
		IsPlayerSideTurn,
		MulliganChangedCount,
		CardIdFrom,
		AbilityId,
		RemainingIncreaseAddPptotalTurn,
		IsRemainIncreaseAddPptotalTurn,
		RemainingSkillCount,
		IsRemainSkill,
		Priority,
		BattleInfoValue,
		BattleInfoTargetCardList,
		BattleInfoTargetCardIdList,
		ParameterModifierType,
		ParameterModifierValue,
		MetamorphoseCount
	}

	public enum ReplayBuffType
	{
		None,
		Copied,
		SaveBurialRite,
		Geton,
		IsReserveTokenDrawSkill,
		IsHiddenClassLogSkill
	}

	public enum ReplayBuffInfoTextType
	{
		Cost,
		StatusBuff,
		Quick,
		Rush,
		Killer,
		Drain,
		AttackCount,
		IgnoreGuard,
		ConsumeEpModifier,
		AllDamageShield,
		NextDamageShield,
		SkillDamageShield,
		SpellDamageShield,
		AllDamageCut,
		NextDamageCut,
		SkillDamageCut,
		DamageClipping
	}

	public enum ReplayParameterModifierType
	{
		OffenseAddModifier,
		OffenseMultiplyModifier,
		OffenseSetModifier,
		LifeAddModifier,
		LifeMultiplyModifier,
		LifeSetModifier,
		MaxLifeAddModifier,
		MaxLifeSetModifier,
		DamageCardParameterModifier,
		HealCardParameterModifier,
		CostHalfRoundUpModifier,
		CostAddModifier,
		CostSetModifier
	}

	public class TargetData
	{
		public int TargetIndex { get; private set; }

		public int ViewId { get; private set; }

		public bool IsSelf { get; private set; }

		public List<int> SelectSkillIndexList { get; private set; }

		public TargetData(int target, int viewId, bool isSelf, List<int> selectSkillIndexList)
		{
			TargetIndex = target;
			ViewId = viewId;
			IsSelf = isSelf;
			SelectSkillIndexList = selectSkillIndexList;
		}
	}

	public struct ReplayBuffInfoLabel
	{
		public ReplayBuffInfoTextType Type { get; set; }

		public int Value { get; set; }

		public ReplayBuffInfoLabel(ReplayBuffInfoTextType type, int value = -1)
		{
			Type = type;
			Value = value;
		}
	}

	public enum RESULT_CODE
	{
		NotFinish = 0,
		NoContest = 1,
		Invalid = 2,
		LifeWin = 101,
		LifeLose = 102,
		DeckoutWin = 103,
		DeckoutLose = 104,
		RetireWin = 105,
		RetireLose = 106,
		SpecialWin = 107,
		SpecialLose = 108,
		DisconnectWin = 201,
		DisconnectLose = 202,
		FirstcardWin = 203,
		FirstcardLose = 204,
		TurnendWin = 205,
		TurnendLose = 206,
		TurnstartWin = 207,
		TurnstartLose = 208,
		MaxTurnLose = 210,
		Error = 999
	}

	protected NetworkBattleManagerBase networkBattleMgr;

	protected ReceiveData _receiveData;

	protected ReplayReceiveData _replayReceiveData;

	protected bool receiveStop;

	public Action OnFinishSetupVirtualCard;

	public NetworkBattleReceiver(NetworkBattleManagerBase battlemgr)
	{
		networkBattleMgr = battlemgr;
		_receiveData = new ReceiveData();
	}

	public bool ReceivedMessage(NetworkBattleDefine.NetworkBattleURI uri, bool isHaveSequence, Dictionary<string, object> data, bool isPlayer = false, WatchDataHandler handler = null, bool checkBreakData = true)
	{
		if (!ConvertReceiveDataToMakeData(uri, isHaveSequence, data, isPlayer, handler) && !RealTimeNetworkAgent.IsFromResumeData(data) && checkBreakData)
		{
			return false;
		}
		if (receiveStop)
		{
			return true;
		}
		if (isHaveSequence)
		{
			networkBattleMgr.ConductReceiveData(_receiveData, isPlayer);
		}
		else
		{
			networkBattleMgr.ConductReceiveData_NotHaveSequence(_receiveData, isPlayer);
		}
		return true;
	}

	public void ReceivedReplayMessage(Dictionary<string, object> data)
	{
		ConvertReplayReceiveDataToMakeData(data);
		if (!receiveStop)
		{
			networkBattleMgr.ConductReplayReceiveData(_replayReceiveData);
		}
	}

	public virtual void ReceivedTouchData(NetworkBattleDefine.NetworkBattleURI uri, bool isHaveSequence, Dictionary<string, object> data, bool isPlayer = false, WatchDataHandler handler = null)
	{
	}

	protected virtual bool ConvertReceiveDataToMakeData(NetworkBattleDefine.NetworkBattleURI uri, bool isHaveSequence, Dictionary<string, object> datas, bool isPlayer = false, WatchDataHandler handler = null)
	{
		if (isHaveSequence)
		{
			_receiveData = new ReceiveData();
		}
		_receiveData.dataUri = uri;
		string text = "URI : " + uri;
		try
		{
			foreach (KeyValuePair<string, object> data in datas)
			{
				if (!Enum.IsDefined(typeof(NetworkBattleDefine.NetworkParameter), data.Key.ToString()))
				{
					continue;
				}
				text = text + ", " + data.Key;
				if (data.Value is List<object> list)
				{
					text += "[";
					for (int i = 0; i < list.Count; i++)
					{
						if (!(list[i] is Dictionary<string, object> dictionary))
						{
							continue;
						}
						foreach (KeyValuePair<string, object> item in dictionary)
						{
							text = text + item.Key + " : " + item.Value.ToString() + ",";
						}
					}
					text += "]";
				}
				else
				{
					text = text + " : " + data.Value.ToString();
				}
				switch ((NetworkBattleDefine.NetworkParameter)Enum.Parse(typeof(NetworkBattleDefine.NetworkParameter), data.Key.ToString()))
				{
				case NetworkBattleDefine.NetworkParameter.time:
					_receiveData._timeSent = long.Parse(data.Value.ToString());
					break;
				case NetworkBattleDefine.NetworkParameter.idx:
					_receiveData.idx = ConvertToInt(data.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.self:
					_receiveData.selfIdxList = MakeReceiveCardIndexSortList(data.Value as List<object>);
					break;
				case NetworkBattleDefine.NetworkParameter.oppo:
					_receiveData.oppoIdxList = MakeReceiveCardIndexSortList(data.Value as List<object>);
					break;
				case NetworkBattleDefine.NetworkParameter.isSelf:
					_receiveData.isSelf = ConvertToInt(data.Value) == 1;
					break;
				case NetworkBattleDefine.NetworkParameter.type:
					_receiveData.actionType = (NetworkBattleDefine.PlayActionType)ConvertToInt(data.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.endType:
					_receiveData.judgeEndType = (JudgeEndType)ConvertToInt(data.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.targetUri:
					_receiveData.receiveUri = (NetworkBattleDefine.NetworkBattleURI)Enum.Parse(typeof(NetworkBattleDefine.NetworkBattleURI), data.Value.ToString());
					break;
				case NetworkBattleDefine.NetworkParameter.playIdx:
					_receiveData.playCardIndex = ConvertToInt(data.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.cards:
					_receiveData.watchCardList = MakeReceiveCardDataList(data.Value as List<object>, networkBattleMgr, handler);
					switch (uri)
					{
					case NetworkBattleDefine.NetworkBattleURI.Deal:
						_receiveData.selfIdxList = (from model in _receiveData.watchCardList
							where !model.isOpponent
							orderby model.RedrawCardPosition
							select model.Index).ToList();
						_receiveData.oppoIdxList = (from model in _receiveData.watchCardList
							where model.isOpponent
							orderby model.RedrawCardPosition
							select model.Index).ToList();
						break;
					case NetworkBattleDefine.NetworkBattleURI.Swap:
					case NetworkBattleDefine.NetworkBattleURI.Ready:
						_receiveData.selfIdxList = GetSwappedIndexList(isPlayer: true, _receiveData.watchCardList);
						_receiveData.oppoIdxList = GetSwappedIndexList(isPlayer: false, _receiveData.watchCardList);
						break;
					}
					break;
				case NetworkBattleDefine.NetworkParameter.idxChangeSeed:
					networkBattleMgr.CreateXorShift(ConvertToInt(data.Value));
					break;
				case NetworkBattleDefine.NetworkParameter.oppoIdxChangeSeed:
					networkBattleMgr.CreateXorShift(-1, ConvertToInt(data.Value));
					break;
				case NetworkBattleDefine.NetworkParameter.targetList:
				{
					List<TargetData> list3 = CreateTargetList(data, isWatch: true, handler);
					if (isPlayer)
					{
						_receiveData.PlayerTargetDataList = list3;
					}
					else
					{
						_receiveData.OpponentTargetDataList = list3;
					}
					break;
				}
				case NetworkBattleDefine.NetworkParameter.oppoTargetList:
					_receiveData.OpponentTargetDataList = CreateTargetList(data);
					break;
				case NetworkBattleDefine.NetworkParameter.chatStamp:
					if (data.Value is Dictionary<string, object> dictionary3)
					{
						int num2 = ConvertToInt(dictionary3[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.stamp]]);
						if (isPlayer)
						{
							_receiveData.playChatStamp = num2;
						}
						else
						{
							_receiveData.oppoChatStamp = num2;
						}
					}
					break;
				case NetworkBattleDefine.NetworkParameter.isWin:
					_receiveData.isWin = ((ConvertToInt(data.Value) != 0) ? true : false);
					break;
				case NetworkBattleDefine.NetworkParameter.knownList:
					_receiveData.knownCardList = MakeReceiveCardDataList(data.Value as List<object>, networkBattleMgr, handler);
					break;
				case NetworkBattleDefine.NetworkParameter.uList:
					_receiveData.unapprovedList = MakeReceiveCardDataList(data.Value as List<object>, networkBattleMgr, handler);
					break;
				case NetworkBattleDefine.NetworkParameter.result:
					_receiveData.result = (RESULT_CODE)ConvertToInt(data.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.resultCode:
					_receiveData.NodeResultCode = (NetworkBattleDefine.ReceiveNodeResultCode)Convert.ToInt32(data.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.keyAction:
				{
					List<object> obj = data.Value as List<object>;
					bool flag = false;
					foreach (object item2 in obj)
					{
						Dictionary<string, object> dictionary2 = item2 as Dictionary<string, object>;
						SendKeyActionDataManager.KeyActionType keyActionType = (SendKeyActionDataManager.KeyActionType)Enum.Parse(typeof(SendKeyActionDataManager.KeyActionType), dictionary2[SendKeyActionDataManager.KeyActionParameter.type.ToString()].ToString());
						_receiveData.keyActionType.Add(keyActionType);
						if (dictionary2.ContainsKey(SendKeyActionDataManager.KeyActionParameter.cardId.ToString()) && (!flag || keyActionType != SendKeyActionDataManager.KeyActionType.Choice))
						{
							_receiveData.transformBeforeCardId = ConvertToInt(dictionary2[SendKeyActionDataManager.KeyActionParameter.cardId.ToString()]);
							if (keyActionType == SendKeyActionDataManager.KeyActionType.Accelerated)
							{
								flag = true;
							}
						}
						switch (keyActionType)
						{
						case SendKeyActionDataManager.KeyActionType.Choice:
						case SendKeyActionDataManager.KeyActionType.HaveBeforeSkillChoice:
						case SendKeyActionDataManager.KeyActionType.ChoiceEvolution:
						{
							_receiveData.choiceIdList = new List<int>();
							if (dictionary2 != null && dictionary2.ContainsKey(SendKeyActionDataManager.KeyActionParameter.selectCard.ToString()))
							{
								_receiveData.choiceIdList = ConvertToListInt(dictionary2[SendKeyActionDataManager.KeyActionParameter.selectCard.ToString()]);
							}
							CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(_receiveData.transformBeforeCardId);
							BattleCardBase battleCardBase = BattleManagerBase.GetIns().CreateBattleCard(cardParameterFromId.BaseCardId, isPlayer: false, null, cardParameterFromId, BattleManagerBase.GetIns().BattlePlayer, 0);
							UnityEngine.Object.DestroyImmediate(battleCardBase.BattleCardView.GameObject);
							bool isEvol = _receiveData.actionType == NetworkBattleDefine.PlayActionType.EVOLUTION || _receiveData.actionType == NetworkBattleDefine.PlayActionType.EVOLUTION_SELECT;
							if (!(NetworkBattleGenericTool.GetChoiceSkill(battleCardBase, isEvol) is Skill_transform))
							{
								break;
							}
							_receiveData.IsTransformChoice = true;
							if (_receiveData.choiceIdList.Count <= 0)
							{
								break;
							}
							string text2 = BattleLogManager.ConvertPremiumIdToNormalId(_receiveData.choiceIdList[0]).ToString();
							if (!(battleCardBase.Skills.FirstOrDefault((SkillBase s) => s is Skill_choice) as Skill_choice).OptionValue.GetString(SkillFilterCreator.ContentKeyword.card_id).Contains(text2))
							{
								LocalLog.AccumulateTraceLog("Illegal Choice Id Received !：" + text2);
								List<int> list2 = new List<int>();
								for (int num = 0; num < _receiveData.choiceIdList.Count; num++)
								{
									list2.Add((_receiveData.choiceIdList[num] == 100011010) ? 100011020 : 100011010);
								}
								_receiveData.choiceIdList = list2;
							}
							break;
						}
						case SendKeyActionDataManager.KeyActionType.ChoiceBrave:
							_receiveData.choiceIdList = new List<int>();
							if (dictionary2 != null && dictionary2.ContainsKey(SendKeyActionDataManager.KeyActionParameter.selectCard.ToString()))
							{
								_receiveData.choiceIdList = ConvertToListInt(dictionary2[SendKeyActionDataManager.KeyActionParameter.selectCard.ToString()]);
							}
							break;
						case SendKeyActionDataManager.KeyActionType.BurialRate:
							_receiveData.burialRateList = ConvertToListInt(dictionary2[SendKeyActionDataManager.KeyActionParameter.cardIdx.ToString()]);
							break;
						}
					}
					break;
				}
				case NetworkBattleDefine.NetworkParameter.spin:
					_receiveData.spin = GetSpinCount(data.Value);
					break;
				}
			}
			if (networkBattleMgr.IsRecovery && uri != NetworkBattleDefine.NetworkBattleURI.OppoDisconnect && uri != NetworkBattleDefine.NetworkBattleURI.RecoveryStart && uri != NetworkBattleDefine.NetworkBattleURI.RecoveryEnd)
			{
				networkBattleMgr._lastReceivedData = _receiveData;
			}
			return true;
		}
		catch
		{
			LocalLog.AccumulateLastTraceLog("ConvertReciveDataToMakeData Error\n" + text);
			Debug.LogError("ConvertReciveDataToMakeData Error");
			return false;
		}
	}

	protected virtual void ConvertReplayReceiveDataToMakeData(Dictionary<string, object> data, bool isPlayer = false)
	{
		_replayReceiveData = new ReplayReceiveData();
		try
		{
			for (int i = 0; i < data.Keys.Count; i++)
			{
				string text = data.Keys.ElementAt(i);
				switch ((ReplayReceiveDataType)int.Parse(text))
				{
				case ReplayReceiveDataType.Operation:
					_replayReceiveData.Operation = (ReplayOperationType)ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.IsSelf:
					_replayReceiveData.isSelf = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.SelfCards:
				{
					List<object> list5 = data[text] as List<object>;
					_replayReceiveData.CardInfoList = new List<CardInfo>();
					for (int num4 = 0; num4 < list5.Count; num4++)
					{
						_replayReceiveData.CardInfoList.Add(CreateCardInfo(list5[num4] as JsonData));
					}
					_replayReceiveData.selfIdxList = _replayReceiveData.CardInfoList.Select((CardInfo c) => c.Index).ToList();
					break;
				}
				case ReplayReceiveDataType.OppoCards:
					_replayReceiveData.oppoIdxList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.AddPpTotalCount:
					_replayReceiveData.AddPpTotalCount = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.Pp:
					_replayReceiveData.Pp = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.Bp:
					_replayReceiveData.Bp = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.EpCount:
					_replayReceiveData.Ep = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.CardIndexList:
					_replayReceiveData.CardIndexList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.Index:
					_replayReceiveData.CardIndex = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.TargetIndexList:
					_replayReceiveData.TargetIndexList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.CardInfo:
					_replayReceiveData.CardInfo = CreateCardInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.CardInfoList:
				{
					List<object> list3 = data[text] as List<object>;
					_replayReceiveData.CardInfoList = new List<CardInfo>();
					for (int num2 = 0; num2 < list3.Count; num2++)
					{
						_replayReceiveData.CardInfoList.Add(CreateCardInfo(list3[num2] as JsonData));
					}
					break;
				}
				case ReplayReceiveDataType.RemoveCostChangeList:
					_replayReceiveData.RemoveCostChangeList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.DepriveOffenseBuffList:
					_replayReceiveData.DepriveOffenseBuffList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.DepriveLifeBuffList:
					_replayReceiveData.DepriveLifeBuffList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.AddCostList:
					_replayReceiveData.AddCostList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.SetCostList:
					_replayReceiveData.SetCostList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.AddSpellChargeList:
					_replayReceiveData.AddSpellChargeList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.Cost:
					_replayReceiveData.Cost = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.Attack:
					_replayReceiveData.Attack = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.Life:
					_replayReceiveData.Life = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.MultiplyAttack:
					_replayReceiveData.MultiplyAttack = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.MultiplyLife:
					_replayReceiveData.MultiplyLife = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.MaxLife:
					_replayReceiveData.MaxLife = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.CardIdList:
					_replayReceiveData.CardIdList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.IsOpen:
					_replayReceiveData.IsOpen = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsOpenDrawSkill:
					_replayReceiveData.IsOpenDrawSkill = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsReserved:
					_replayReceiveData.IsReserved = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.DealDamageList:
					_replayReceiveData.DealDamageList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.ReceiveDamage:
					_replayReceiveData.ReceiveDamage = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.IsReflectionDamage:
				{
					List<object> list6 = data[text] as List<object>;
					_replayReceiveData.IsReflectionDamage = new List<bool>();
					for (int num5 = 0; num5 < list6.Count; num5++)
					{
						_replayReceiveData.IsReflectionDamage.Add(ConvertToInt(list6[num5]) == 1);
					}
					break;
				}
				case ReplayReceiveDataType.HealList:
					_replayReceiveData.HealList = (data[text] as List<object>).Select((object o) => ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.IsAttackerDead:
					_replayReceiveData.IsAttackerDead = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsTargetDead:
					_replayReceiveData.IsTargetDead = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.SelectCard:
					_replayReceiveData.SelectCard = data[text].ToString();
					break;
				case ReplayReceiveDataType.OwnerCardName:
					_replayReceiveData.OwnerCardName = data[text].ToString();
					break;
				case ReplayReceiveDataType.CardNameList:
					_replayReceiveData.CardNameList = (data[text] as List<object>).Select((object o) => o.ToString()).ToList();
					break;
				case ReplayReceiveDataType.DestroyCardNameList:
					_replayReceiveData.DestroyCardNameList = (data[text] as List<object>).Select((object o) => o.ToString()).ToList();
					break;
				case ReplayReceiveDataType.BanishCardNameList:
					_replayReceiveData.BanishCardNameList = (data[text] as List<object>).Select((object o) => o.ToString()).ToList();
					break;
				case ReplayReceiveDataType.IndestructibleCardNameList:
					_replayReceiveData.IndestructibleCardNameList = (data[text] as List<object>).Select((object o) => o.ToString()).ToList();
					break;
				case ReplayReceiveDataType.EffectTargetCardNameList:
					_replayReceiveData.EffectTargetCardNameList = (data[text] as List<object>).Select((object o) => o.ToString()).ToList();
					break;
				case ReplayReceiveDataType.SkillSideLogList:
				{
					List<object> list4 = data[text] as List<object>;
					_replayReceiveData.SideLogSkillInfoList = new List<SideLogSkillInfo>();
					for (int num3 = 0; num3 < list4.Count; num3++)
					{
						_replayReceiveData.SideLogSkillInfoList.Add(CreateSideLogSkillInfo(list4[num3] as JsonData));
					}
					break;
				}
				case ReplayReceiveDataType.PlayVoiceOnDeathCard:
					_replayReceiveData.PlayVoiceOnDeathCard = data[text].ToString();
					break;
				case ReplayReceiveDataType.IsEvolve:
					_replayReceiveData.IsEvolve = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsActive:
					_replayReceiveData.IsActive = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsNotConsumeEp:
					_replayReceiveData.IsNotConsumeEp = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.EvolveMeWhenAttackIndex:
					_replayReceiveData.EvolveMeWhenAttackIndex = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.TransformCardId:
					_replayReceiveData.TransformCardId = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.TransformType:
					_replayReceiveData.TransformType = (BattleCardBase.TransformType)ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.IsDeckSelf:
					_replayReceiveData.IsDeckSelf = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsBurialRite:
					_replayReceiveData.IsBurialRite = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.ChangeCount:
					_replayReceiveData.ChangeCount = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.IsDestroy:
					_replayReceiveData.IsDestroy = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsChange:
					_replayReceiveData.IsChange = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsCostUpList:
					_replayReceiveData.IsCostUpList = (data[text] as List<object>).Select((object o) => ConvertToInt(o) == 1).ToList();
					break;
				case ReplayReceiveDataType.IsSpellCharge:
					_replayReceiveData.IsSpellCharge = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsOpenCard:
					_replayReceiveData.IsOpenCard = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsHalf:
					_replayReceiveData.IsHalf = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsAdd:
					_replayReceiveData.IsAdd = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsTransformSelect:
					_replayReceiveData.IsTransformSelect = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsFusionNecromance:
					_replayReceiveData.IsFusionNecromance = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsFusionMetamorphose:
					_replayReceiveData.IsFusionMetamorphose = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.FusionMetamorphoseCardId:
					_replayReceiveData.FusionMetamorphoseCardId = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.EffectInfo:
					_replayReceiveData.EffectInfo = CreateEffectInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.DestroyTypeList:
					_replayReceiveData.DestroyTypeList = (data[text] as List<object>).Select((object o) => (DestroyType)ConvertToInt(o)).ToList();
					break;
				case ReplayReceiveDataType.WhenPlayEffectType:
					_replayReceiveData.WhenPlayEffectType = (SkillCollectionBase.WhenPlayEffectType)ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.PlayerStatusPanelInfo:
					_replayReceiveData.PlayerStatusPanelInfo = CreateStatusPanelInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.EnemyStatusPanelInfo:
					_replayReceiveData.EnemyStatusPanelInfo = CreateStatusPanelInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.PlayerBattleInfo:
					UpdateBattleInfo(data[text] as List<object>, isPlayer: true);
					break;
				case ReplayReceiveDataType.EnemyBattleInfo:
					UpdateBattleInfo(data[text] as List<object>, isPlayer: false);
					break;
				case ReplayReceiveDataType.PlayerClassInfo:
					_replayReceiveData.PlayerClassInfo = CreateClassInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.EnemyClassInfo:
					_replayReceiveData.EnemyClassInfo = CreateClassInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.MyRotationBonusList:
				{
					List<object> list2 = data[text] as List<object>;
					_replayReceiveData.MyRotationBonusInfoList = new List<MyRotationBonusInfo>();
					for (int num = 0; num < list2.Count; num++)
					{
						_replayReceiveData.MyRotationBonusInfoList.Add(CreateMyRotationBonusInfo(list2[num] as JsonData));
					}
					break;
				}
				case ReplayReceiveDataType.PlayerAvatarBattleDescInfo:
					_replayReceiveData.PlayerAvatarBattleDescInfo = CreateAvatarBattleDescriotionValueInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.EnemyAvatarBattleDescInfo:
					_replayReceiveData.EnemyAvatarBattleDescInfo = CreateAvatarBattleDescriotionValueInfo(data[text] as JsonData);
					break;
				case ReplayReceiveDataType.BattleLogIndex:
					_replayReceiveData.BattleLogIndex = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.IsWin:
					_replayReceiveData.isWin = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsPlayerDead:
					_replayReceiveData.IsPlayerDead = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsEnemyDead:
					_replayReceiveData.IsEnemyDead = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.FinishType:
					_replayReceiveData.FinishType = (BattleManagerBase.FINISH_TYPE)ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.ResultCode:
					_replayReceiveData.ResultCode = (RESULT_CODE)ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.SkillHashCode:
					_replayReceiveData.SkillHashCode = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.IsOnSummonSkill:
					_replayReceiveData.IsOnSummonSkill = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsInvoked:
					_replayReceiveData.IsInvoked = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.SkillVoice:
					_replayReceiveData.SkillVoice = data[text].ToString();
					break;
				case ReplayReceiveDataType.IsLastDrawOpenCard:
					_replayReceiveData.IsLastDrawOpenCard = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsOwnerEffect:
					_replayReceiveData.IsOwnerEffect = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsIgnoreVoice:
					_replayReceiveData.IsIgnoreVoice = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsRandomVoice:
					_replayReceiveData.IsRandomVoice = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsEvoVoice:
					_replayReceiveData.IsEvoVoice = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsImmediate:
					_replayReceiveData.IsImmediate = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.BySkill:
					_replayReceiveData.BySkill = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.OnlyEffect:
					_replayReceiveData.OnlyEffect = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.OnlyAttackEffect:
					_replayReceiveData.OnlyAttackEffect = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.UpdateAttackEffect:
					_replayReceiveData.UpdateAttackEffect = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.UseRecordAttackEffect:
					_replayReceiveData.UseRecordAttackEffect = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.Clan:
					_replayReceiveData.Clan = (CardBasePrm.ClanType)ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.Tribe:
				{
					JsonData jsonData = data[text] as JsonData;
					List<CardBasePrm.TribeType> list = new List<CardBasePrm.TribeType>();
					JsonData jsonData2 = jsonData[103.ToString()];
					for (int j = 0; j < jsonData2.Count; j++)
					{
						list.Add((CardBasePrm.TribeType)ConvertToInt(jsonData2[j]));
					}
					_replayReceiveData.Tribe = new CardBasePrm.TribeInfo(list, (CardBasePrm.TribeChangeType)ConvertToInt(jsonData[104.ToString()]));
					break;
				}
				case ReplayReceiveDataType.EmoteType:
					_replayReceiveData.EmoteType = (ClassCharaPrm.EmotionType)ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.MaxSelectCount:
					_replayReceiveData.MaxSelectCount = ConvertToInt(data[text]);
					break;
				case ReplayReceiveDataType.CanFusionMetamorphose:
					_replayReceiveData.CanFusionMetamorphose = ConvertToInt(data[text]) == 1;
					break;
				case ReplayReceiveDataType.IsChoiceBrave:
					_replayReceiveData.IsChoiceBraveData = ConvertToInt(data[text]) == 1;
					break;
				}
			}
		}
		catch
		{
			LocalLog.AccumulateLastTraceLog("ConvertReciveDataToMakeData Error");
			Debug.LogError("ConvertReciveDataToMakeData Error");
		}
	}

	public void UpdateBattleInfo(JsonData battleInfoData, bool isPlayer)
	{
		List<object> list = new List<object>();
		for (int i = 0; i < battleInfoData.Count; i++)
		{
			list.Add(battleInfoData[i]);
		}
		UpdateBattleInfo(list, isPlayer);
	}

	public void UpdateBattleInfo(List<object> battleInfoData, bool isPlayer)
	{
		List<NewReplayBattleMgr.BattleInfoData> list = (isPlayer ? (networkBattleMgr as NewReplayBattleMgr).PlayerBattleInfoData : (networkBattleMgr as NewReplayBattleMgr).EnemyBattleInfoData);
		list.Clear();
		for (int i = 0; i < battleInfoData.Count; i++)
		{
			JsonData jsonData = battleInfoData[i] as JsonData;
			list.Add(CreateBattleInfoData(jsonData));
		}
	}

	public NewReplayBattleMgr.BattleInfoData CreateBattleInfoData(JsonData jsonData)
	{
		NewReplayBattleMgr.BattleInfoData battleInfoData = new NewReplayBattleMgr.BattleInfoData();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.Priority:
				battleInfoData.Priority = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.BattleInfoValue:
				battleInfoData.Value = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.BattleInfoTargetCardList:
			{
				battleInfoData.DisplayCardIndexList = new List<int>();
				JsonData jsonData3 = jsonData[text];
				for (int k = 0; k < jsonData3.Count; k++)
				{
					battleInfoData.DisplayCardIndexList.Add(ConvertToInt(jsonData3[k]));
				}
				break;
			}
			case ReplayItemType.BattleInfoTargetCardIdList:
			{
				battleInfoData.DisplayCardIdList = new List<int>();
				JsonData jsonData2 = jsonData[text];
				for (int j = 0; j < jsonData2.Count; j++)
				{
					battleInfoData.DisplayCardIdList.Add(ConvertToInt(jsonData2[j]));
				}
				break;
			}
			}
		}
		return battleInfoData;
	}

	public CardInfo CreateCardInfo(JsonData jsonData)
	{
		CardInfo cardInfo = new CardInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.Id:
				cardInfo.Id = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.Index:
				cardInfo.Index = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.IsSelf:
				cardInfo.IsSelf = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.Cost:
				cardInfo.Cost = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.IsEvolution:
				cardInfo.IsEvolution = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.ExecutedFixedUseCostIndex:
				cardInfo.ExecutedFixedUseCostIndex = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.ParameterModifierList:
			{
				cardInfo.ParameterModifierList = new List<NewReplayBattleMgr.ParameterModifierInfo>();
				JsonData jsonData14 = jsonData[text];
				for (int num7 = 0; num7 < jsonData14.Count; num7++)
				{
					NewReplayBattleMgr.ParameterModifierInfo item2 = new NewReplayBattleMgr.ParameterModifierInfo((ReplayParameterModifierType)ConvertToInt(jsonData14[num7][117.ToString()]), ConvertToInt(jsonData14[num7][118.ToString()]));
					cardInfo.ParameterModifierList.Add(item2);
				}
				break;
			}
			case ReplayItemType.UnionBurstModifierValueList:
			{
				cardInfo.UnionBurstModifierValueList = new List<int>();
				JsonData jsonData12 = jsonData[text];
				for (int num5 = 0; num5 < jsonData12.Count; num5++)
				{
					cardInfo.UnionBurstModifierValueList.Add(ConvertToInt(jsonData12[num5]));
				}
				break;
			}
			case ReplayItemType.SkyboundArtModifierValueList:
			{
				cardInfo.SkyboundArtModifierValueList = new List<int>();
				JsonData jsonData11 = jsonData[text];
				for (int num4 = 0; num4 < jsonData11.Count; num4++)
				{
					cardInfo.SkyboundArtModifierValueList.Add(ConvertToInt(jsonData11[num4]));
				}
				break;
			}
			case ReplayItemType.SuperSkyboundArtModifierValueList:
			{
				cardInfo.SuperSkyboundArtModifierValueList = new List<int>();
				JsonData jsonData10 = jsonData[text];
				for (int num3 = 0; num3 < jsonData10.Count; num3++)
				{
					cardInfo.SuperSkyboundArtModifierValueList.Add(ConvertToInt(jsonData10[num3]));
				}
				break;
			}
			case ReplayItemType.FusionIngredientIdxList:
			{
				cardInfo.FusionIngredientIdxList = new List<int>();
				JsonData jsonData3 = jsonData[text];
				for (int k = 0; k < jsonData3.Count; k++)
				{
					cardInfo.FusionIngredientIdxList.Add(ConvertToInt(jsonData3[k]));
				}
				break;
			}
			case ReplayItemType.HandEffect:
				cardInfo.HandCardFrameEffectType = (HandCardFrameEffectType)ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.IsHandEffectActive:
				cardInfo.IsHandEffectActive = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.InplaySkillEffect:
			{
				cardInfo.InplaySkillEffectList = new List<InplaySkillEffect>();
				JsonData jsonData16 = jsonData[text];
				for (int num9 = 0; num9 < jsonData16.Count; num9++)
				{
					cardInfo.InplaySkillEffectList.Add((InplaySkillEffect)ConvertToInt(jsonData16[num9]));
				}
				break;
			}
			case ReplayItemType.InductionNumber:
				cardInfo.InductionNumber = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.Attackable:
				cardInfo.Attackable = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.IsCantAttackClass:
				cardInfo.IsCantAttackClass = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.AttackableCount:
				cardInfo.AttackableCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.ForceHideAttackEffect:
				cardInfo.ForceHideAttackEffect = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.SkillDescriptionValueList:
			{
				cardInfo.SkillDescriptionValueList = new List<int>();
				JsonData jsonData15 = jsonData[text];
				for (int num8 = 0; num8 < jsonData15.Count; num8++)
				{
					cardInfo.SkillDescriptionValueList.Add(ConvertToInt(jsonData15[num8]));
				}
				break;
			}
			case ReplayItemType.EvoSkillDescriptionValueList:
			{
				cardInfo.EvoSkillDescriptionValueList = new List<int>();
				JsonData jsonData13 = jsonData[text];
				for (int num6 = 0; num6 < jsonData13.Count; num6++)
				{
					cardInfo.EvoSkillDescriptionValueList.Add(ConvertToInt(jsonData13[num6]));
				}
				break;
			}
			case ReplayItemType.BuffInfoList:
			{
				JsonData jsonData4 = jsonData[text];
				if (jsonData4.Keys.Contains(89.ToString()))
				{
					cardInfo.IsSameBuff = true;
					break;
				}
				JsonData jsonData5 = jsonData4[76.ToString()];
				for (int l = 0; l < jsonData5.Count; l++)
				{
					ReplayBuffInfo replayBuffInfo = new ReplayBuffInfo();
					replayBuffInfo.OwnerCardInfo = CreateBuffCardInfo(jsonData5[l][77.ToString()]);
					if (jsonData5[l].Keys.Contains(78.ToString()))
					{
						replayBuffInfo.PreviousOwnerCardInfo = CreateBuffCardInfo(jsonData5[l][78.ToString()]);
					}
					replayBuffInfo.BuffType = (ReplayBuffType)jsonData5[l][80.ToString()].ToInt();
					replayBuffInfo.CardIdFrom = jsonData5[l][107.ToString()].ToInt();
					replayBuffInfo.IsEvolutionSkill = jsonData5[l][99.ToString()].ToBoolean();
					replayBuffInfo.IsPlayer = jsonData5[l][2.ToString()].ToBoolean();
					replayBuffInfo.DivergenceIdList = jsonData5[l][86.ToString()].ToString();
					if (jsonData5[l].Keys.Contains(87.ToString()))
					{
						new List<int>();
						JsonData jsonData6 = jsonData5[l][87.ToString()];
						for (int m = 0; m < jsonData6.Count; m++)
						{
							replayBuffInfo.CopiedSkillDescriptionValueList.Add(ConvertToInt(jsonData6[m]));
						}
					}
					if (jsonData5[l].Keys.Contains(88.ToString()))
					{
						new List<int>();
						JsonData jsonData7 = jsonData5[l][88.ToString()];
						for (int n = 0; n < jsonData7.Count; n++)
						{
							replayBuffInfo.CopiedEvoSkillDescriptionValueList.Add(ConvertToInt(jsonData7[n]));
						}
					}
					cardInfo.BuffInfoList.Add(replayBuffInfo);
				}
				JsonData jsonData8 = jsonData4[81.ToString()];
				for (int num = 0; num < jsonData8.Count; num++)
				{
					cardInfo.NoConsumeEpBuffInfoNameList.Add(jsonData8[num].ToString());
				}
				JsonData jsonData9 = jsonData4[82.ToString()];
				for (int num2 = 0; num2 < jsonData9.Count; num2++)
				{
					ReplayBuffInfoLabel item = new ReplayBuffInfoLabel
					{
						Type = (ReplayBuffInfoTextType)jsonData9[num2][83.ToString()].ToInt()
					};
					if (jsonData9[num2].Keys.Contains(84.ToString()))
					{
						item.Value = jsonData9[num2][84.ToString()].ToInt();
					}
					cardInfo.BuffInfoLabelList.Add(item);
				}
				break;
			}
			case ReplayItemType.IsOverFlow:
				cardInfo.IsOverflow = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.SpellChargeCount:
				cardInfo.SpellChargeCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.Tribe:
			{
				cardInfo.Tribe = new List<int>();
				JsonData jsonData2 = jsonData[text];
				for (int j = 0; j < jsonData2.Count; j++)
				{
					cardInfo.Tribe.Add(ConvertToInt(jsonData2[j]));
				}
				break;
			}
			case ReplayItemType.ChantCount:
				cardInfo.ChantCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.WhiteRitualCount:
				cardInfo.WhiteRitualCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.MaxAttackableCount:
				cardInfo.MaxAttackableCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.MetamorphoseCount:
				cardInfo.MetamorphoseCount = ConvertToInt(jsonData[text]);
				break;
			}
		}
		return cardInfo;
	}

	private BuffCardInfo CreateBuffCardInfo(JsonData jsonData)
	{
		BuffCardInfo buffCardInfo = new BuffCardInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.CardName:
				buffCardInfo.CardName = jsonData[text].ToString();
				break;
			case ReplayItemType.Id:
				buffCardInfo.CardId = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.MetamorphoseCount:
				buffCardInfo.MetamorphoseCount = ConvertToInt(jsonData[text]);
				break;
			}
		}
		return buffCardInfo;
	}

	private EffectInfo CreateEffectInfo(JsonData jsonData)
	{
		EffectInfo effectInfo = new EffectInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.EffectPath:
				effectInfo.EffectPath = jsonData[text].ToString();
				effectInfo.SePath = "se_" + effectInfo.EffectPath;
				break;
			case ReplayItemType.EngineType:
				effectInfo.EngineType = (EffectMgr.EngineType)ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.EffectMoveType:
				effectInfo.EffectMoveType = (EffectMgr.MoveType)ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.EffectTargetType:
				effectInfo.EffectTargetType = (EffectMgr.TargetType)ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.EffectTime:
				effectInfo.EffectTime = float.Parse(jsonData[text].ToString());
				break;
			case ReplayItemType.IsFollowInHand:
				effectInfo.IsFollowInHand = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.IsTargetPosition:
				effectInfo.IsTargetPosition = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.IsWhenFusioned:
				effectInfo.IsWhenFusioned = ConvertToInt(jsonData[text]) == 1;
				break;
			}
		}
		return effectInfo;
	}

	private SideLogSkillInfo CreateSideLogSkillInfo(JsonData jsonData)
	{
		SideLogSkillInfo sideLogSkillInfo = new SideLogSkillInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayReceiveDataType)int.Parse(text))
			{
			case ReplayReceiveDataType.Index:
				sideLogSkillInfo.Index = ConvertToInt(jsonData[text]);
				break;
			case ReplayReceiveDataType.IsSelf:
				sideLogSkillInfo.IsSelf = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayReceiveDataType.CardId:
				sideLogSkillInfo.CardId = ConvertToInt(jsonData[text]);
				break;
			case ReplayReceiveDataType.SkillHashCode:
				sideLogSkillInfo.SkillHashCode = ConvertToInt(jsonData[text]);
				break;
			case ReplayReceiveDataType.IsEvolve:
				sideLogSkillInfo.IsEvolve = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayReceiveDataType.IsOnSummonSkill:
				sideLogSkillInfo.IsOnSummonSkill = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayReceiveDataType.IsInvoked:
				sideLogSkillInfo.IsInvoked = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayReceiveDataType.IsInDeck:
				sideLogSkillInfo.IsInDeck = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayReceiveDataType.IsPrivate:
				sideLogSkillInfo.IsPrivate = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayReceiveDataType.CardInfo:
				sideLogSkillInfo.CardInfo = CreateCardInfo(jsonData[text]);
				break;
			}
		}
		return sideLogSkillInfo;
	}

	private StatusPanelInfo CreateStatusPanelInfo(JsonData jsonData)
	{
		StatusPanelInfo statusPanelInfo = new StatusPanelInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.HandCount:
				statusPanelInfo.HandCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.CemetaryCount:
				statusPanelInfo.CemetaryCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.DeckCount:
				statusPanelInfo.DeckCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.IsDrew:
				statusPanelInfo.IsDrew = ConvertToInt(jsonData[text]) == 1;
				break;
			}
		}
		return statusPanelInfo;
	}

	public ClassInfoUiInfo CreateClassInfo(JsonData jsonData)
	{
		ClassInfoUiInfo classInfoUiInfo = new ClassInfoUiInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.PlayCount:
				classInfoUiInfo.TurnPlayCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.CemetaryCount:
				classInfoUiInfo.CemetaryCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.Life:
				classInfoUiInfo.Life = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.IsForceBerserk:
				classInfoUiInfo.IsForceBerserk = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.IsEnterForceBerserk:
				classInfoUiInfo.IsEnterForceBerserk = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.IsChangeResonance:
				classInfoUiInfo.IsChangeResonance = ConvertToInt(jsonData[text]) == 1;
				break;
			}
		}
		return classInfoUiInfo;
	}

	public MyRotationBonusInfo CreateMyRotationBonusInfo(JsonData jsonData)
	{
		MyRotationBonusInfo myRotationBonusInfo = new MyRotationBonusInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.AbilityId:
				myRotationBonusInfo.AbilityId = jsonData[text].ToString();
				break;
			case ReplayItemType.IsSelf:
				myRotationBonusInfo.IsSelf = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.RemainingIncreaseAddPptotalTurn:
				myRotationBonusInfo.RemainingIncreaseAddPptotalTurn = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.IsRemainIncreaseAddPptotalTurn:
				myRotationBonusInfo.IsRemainIncreaseAddPptotalTurn = ConvertToInt(jsonData[text]) == 1;
				break;
			case ReplayItemType.RemainingSkillCount:
				myRotationBonusInfo.RemainingSkillCount = ConvertToInt(jsonData[text]);
				break;
			case ReplayItemType.IsRemainSkill:
				myRotationBonusInfo.IsRemainSkill = ConvertToInt(jsonData[text]) == 1;
				break;
			}
		}
		return myRotationBonusInfo;
	}

	public AvatarBattleDescriptionValueInfo CreateAvatarBattleDescriotionValueInfo(JsonData jsonData)
	{
		AvatarBattleDescriptionValueInfo avatarBattleDescriptionValueInfo = new AvatarBattleDescriptionValueInfo();
		for (int i = 0; i < jsonData.Keys.Count; i++)
		{
			string text = jsonData.Keys.ElementAt(i);
			switch ((ReplayItemType)int.Parse(text))
			{
			case ReplayItemType.PassiveSkillDescriptionValueList:
			{
				JsonData jsonData4 = jsonData[text];
				for (int l = 0; l < jsonData4.Count; l++)
				{
					avatarBattleDescriptionValueInfo.PassiveSkillDescriotionValueList.Add(ConvertToInt(jsonData4[l]));
				}
				break;
			}
			case ReplayItemType.ChoiceBraveDescriptionValueListList:
			{
				JsonData jsonData2 = jsonData[text];
				for (int j = 0; j < jsonData2.Count; j++)
				{
					JsonData jsonData3 = jsonData2[j];
					List<int> list = new List<int>();
					for (int k = 0; k < jsonData3.Count; k++)
					{
						list.Add(ConvertToInt(jsonData3[k]));
					}
					avatarBattleDescriptionValueInfo.ChoiceBraveDescriotionValueListList.Add(list);
				}
				break;
			}
			}
		}
		return avatarBattleDescriptionValueInfo;
	}

	protected void CreateSlideObjectReceiveData(string startPoint, string endPoint)
	{
		_receiveData._slideObjectType = (NetworkBattleSender.SLIDE_OBJECT_TYPE)Enum.Parse(typeof(NetworkBattleSender.SLIDE_OBJECT_TYPE), startPoint[0].ToString());
		switch (_receiveData._slideObjectType)
		{
		case NetworkBattleSender.SLIDE_OBJECT_TYPE.Attack:
			_receiveData.idx = int.Parse(startPoint.Substring(1, startPoint.Length - 1));
			_receiveData._selectedCardIndex = int.Parse(endPoint);
			break;
		case NetworkBattleSender.SLIDE_OBJECT_TYPE.Evolve:
			_receiveData._selectedCardIndex = int.Parse(endPoint);
			break;
		case NetworkBattleSender.SLIDE_OBJECT_TYPE.Cancel:
			break;
		}
	}

	private List<TargetData> CreateTargetList(KeyValuePair<string, object> data, bool isWatch = false, WatchDataHandler handler = null)
	{
		List<object> obj = data.Value as List<object>;
		List<TargetData> list = new List<TargetData>();
		_receiveData.validateSkillIndexList = new List<int>();
		foreach (object item2 in obj)
		{
			int target = 0;
			int num = 0;
			bool isSelf = false;
			Dictionary<string, object> dictionary = item2 as Dictionary<string, object>;
			string key = NetworkBattleDefine.NetworkParameter.targetIdx.ToString();
			if (dictionary.ContainsKey(key))
			{
				target = ConvertToInt(dictionary[key]);
			}
			if (isWatch)
			{
				key = NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.vid];
				if (dictionary.ContainsKey(key))
				{
					num = ConvertToInt(dictionary[key].ToString());
					isSelf = ((!networkBattleMgr.IsRecovery) ? (!handler.isOwner(dictionary[key].ToString())) : ((num != PlayerStaticData.UserViewerID) ? true : false));
				}
			}
			else
			{
				key = NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.isSelf];
				if (dictionary.ContainsKey(key))
				{
					isSelf = ConvertToInt(dictionary[key]) == 1;
				}
			}
			key = NetworkBattleDefine.NetworkParameter.skillIndex.ToString();
			if (dictionary.ContainsKey(key))
			{
				foreach (int item3 in ConvertToListInt(dictionary[key]))
				{
					_receiveData.validateSkillIndexList.Add(item3);
				}
			}
			List<int> selectSkillIndexList = new List<int>();
			key = NetworkBattleDefine.NetworkParameter.selectSkillIndex.ToString();
			if (dictionary.ContainsKey(key))
			{
				selectSkillIndexList = ConvertToListInt(dictionary[key]);
			}
			TargetData item = new TargetData(target, num, isSelf, selectSkillIndexList);
			list.Add(item);
		}
		return list;
	}

	public void ReceiveStop()
	{
		LocalLog.AccumulateLastTraceLog("ReceiveBattleFinish StopReceiveData");
		receiveStop = true;
	}

	protected virtual void CheckDuplicateDataAddtoList(List<CardDataModel> list, CardDataModel cardDataModel)
	{
		list.Add(cardDataModel);
	}

	private List<int> MakeReceiveCardIndexSortList(List<object> mulliganList)
	{
		Dictionary<int, int> dictionary = new Dictionary<int, int>();
		foreach (object mulligan in mulliganList)
		{
			Dictionary<string, object> dictionary2 = mulligan as Dictionary<string, object>;
			int key = ConvertToInt(dictionary2[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.pos]]);
			int value = ConvertToInt(dictionary2[NetworkBattleDefine.NetworkParameter.idx.ToString()]);
			dictionary.Add(key, value);
		}
		return (from data in dictionary
			orderby data.Key
			select data.Value).ToList();
	}

	private List<int> GetSwappedIndexList(bool isPlayer, List<CardDataModel> cardList)
	{
		List<CardDataModel> list = (from param in cardList
			where param.isOpponent == !isPlayer
			where param.ToStateList.First() == NetworkBattleDefine.NetworkCardPlaceState.Hand
			select param).ToList();
		List<int> list2 = (isPlayer ? new List<int>(networkBattleMgr.MulliganMgr.PlayerMlgCtrl.DealIdxList) : new List<int>(networkBattleMgr.MulliganMgr.OpponentMlgCtrl.DealIdxList));
		for (int num = 0; num < list.Count; num++)
		{
			int redrawCardPosition = list[num].RedrawCardPosition;
			list2[redrawCardPosition] = list[num].Index;
		}
		return list2;
	}

	private List<CardDataModel> MakeReceiveCardDataList(List<object> cardData, BattleManagerBase mgr, WatchDataHandler handler)
	{
		List<CardDataModel> list = new List<CardDataModel>();
		foreach (object cardDatum in cardData)
		{
			if (!(cardDatum as Dictionary<string, object>).ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.activate]) && !(cardDatum as Dictionary<string, object>).ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.count]) && !(cardDatum as Dictionary<string, object>).ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.callCount]) && !(cardDatum as Dictionary<string, object>).ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.param]))
			{
				foreach (CardDataModel item in MakeReceiveCardData(cardDatum, mgr, handler))
				{
					CheckDuplicateDataAddtoList(list, item);
				}
				continue;
			}
			foreach (CardDataModel item2 in MakeReceiveCardData(cardDatum, mgr, handler))
			{
				_receiveData.SkillConditionCheckList.Add(item2);
			}
		}
		List<CardDataModel> list2 = new List<CardDataModel>();
		foreach (CardDataModel skillConditionCheck in _receiveData.SkillConditionCheckList)
		{
			if (list2.Contains(skillConditionCheck))
			{
				continue;
			}
			int num = 0;
			foreach (CardDataModel skillConditionCheck2 in _receiveData.SkillConditionCheckList)
			{
				if (skillConditionCheck.Index == skillConditionCheck2.Index && skillConditionCheck.publishedActiveSkillCount == skillConditionCheck2.publishedActiveSkillCount)
				{
					skillConditionCheck2.skillMovementNum = num;
					num++;
					list2.Add(skillConditionCheck2);
				}
			}
		}
		if (!_receiveData._isSettingMutationAfterCardId && _receiveData.IsAcceleratedOrCrystallize)
		{
			_receiveData._isSettingMutationAfterCardId = true;
			_receiveData.mutationAfterCardId = list[0].CardId;
			_receiveData.mutationAfterCost = list[0].playCardCost;
			list[0].CardId = _receiveData.transformBeforeCardId;
		}
		return list;
	}

	protected virtual List<CardDataModel> MakeReceiveCardData(object cardData, BattleManagerBase mgr, WatchDataHandler handler)
	{
		Dictionary<string, object> dictionary = cardData as Dictionary<string, object>;
		List<CardDataModel> list = new List<CardDataModel>();
		List<int> list2 = new List<int>();
		if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx]))
		{
			list2.Add(ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx]]));
		}
		else if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idxList]))
		{
			list2 = ConvertToListInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idxList]]);
		}
		else
		{
			Debug.LogError("BaseMakeReceiveCardData Not idx ");
		}
		for (int i = 0; i < list2.Count; i++)
		{
			CardDataModel cardDataModel = new CardDataModel();
			cardDataModel.Index = list2[i];
			foreach (KeyValuePair<string, object> item in dictionary)
			{
				if (!Enum.IsDefined(typeof(NetworkBattleDefine.NetworkParameter), item.Key))
				{
					continue;
				}
				switch ((NetworkBattleDefine.NetworkParameter)Enum.Parse(typeof(NetworkBattleDefine.NetworkParameter), item.Key))
				{
				case NetworkBattleDefine.NetworkParameter.cardId:
					cardDataModel.CardId = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.to:
					cardDataModel.ToStateList.Add((NetworkBattleDefine.NetworkCardPlaceState)ConvertToInt(item.Value));
					break;
				case NetworkBattleDefine.NetworkParameter.isSelf:
					cardDataModel.isOpponent = ConvertToInt(item.Value) != 1;
					break;
				case NetworkBattleDefine.NetworkParameter.skillKeyCardIdx:
				{
					cardDataModel.skillKeyCardIdxList = new List<int>();
					if (item.Value is List<object>)
					{
						cardDataModel.skillKeyCardIdxList = ConvertToListInt(item.Value);
						break;
					}
					JsonData jsonData = item.Value as JsonData;
					for (int j = 0; j < jsonData.Count; j++)
					{
						cardDataModel.skillKeyCardIdxList.Add(jsonData[j].ToInt());
					}
					break;
				}
				case NetworkBattleDefine.NetworkParameter.pos:
					cardDataModel.RedrawCardPosition = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.cost:
					cardDataModel.playCardCost = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.activate:
					cardDataModel.activate = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.addLife:
					cardDataModel.AddLife = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.setLife:
					cardDataModel.SetLife = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.addAtk:
					cardDataModel.AddAtk = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.setAtk:
					cardDataModel.SetAtk = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.clan:
					cardDataModel.Clan = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.tribe:
					cardDataModel.Tribe = item.Value.ToString();
					break;
				case NetworkBattleDefine.NetworkParameter.skillIdx:
					cardDataModel.SkillIndex = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.skillCount:
					cardDataModel.publishedActiveSkillCount = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.count:
					cardDataModel.activate = 1;
					cardDataModel.SkillValueCount = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.callCount:
					cardDataModel.activate = 1;
					cardDataModel.SkillCallCount = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.param:
					cardDataModel.activate = 1;
					cardDataModel.SkillValueParameter = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.attachTarget:
					cardDataModel.SetAttachTarget(item.Value.ToString());
					break;
				case NetworkBattleDefine.NetworkParameter.highlander:
					cardDataModel.IsHighlander = ConvertToInt(item.Value) == 1;
					break;
				case NetworkBattleDefine.NetworkParameter.spellboost:
					cardDataModel.Spellboost = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.addChantCount:
					cardDataModel.AddChantCount = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.setChantCount:
					cardDataModel.SetChantCount = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.unionburst:
					cardDataModel.UnionBurstCount = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.skyboundArt:
					cardDataModel.SkyboundArtCount = ConvertToInt(item.Value);
					break;
				case NetworkBattleDefine.NetworkParameter.isInvoke:
					cardDataModel.IsInvoked = ConvertToInt(item.Value) == 1;
					break;
				case NetworkBattleDefine.NetworkParameter.skill:
				{
					string[] array = item.Value.ToString().Split('|');
					cardDataModel.skillCardIndex = int.Parse(array[0]);
					cardDataModel.publishedActiveSkillCount = int.Parse(array[1]);
					cardDataModel.skillMovementNum = int.Parse(array[2]);
					break;
				}
				case NetworkBattleDefine.NetworkParameter.is_open:
					cardDataModel.IsOpen = ConvertToInt(item.Value) == 1;
					break;
				case NetworkBattleDefine.NetworkParameter.randomTargetIdx:
				{
					List<int> list3 = ConvertToListInt(item.Value);
					if (i < list3.Count)
					{
						cardDataModel.RandomTargetIndex = list3[i];
					}
					break;
				}
				case NetworkBattleDefine.NetworkParameter.fusion:
					cardDataModel.FusionIngredientList = ConvertToListInt(item.Value);
					break;
				}
			}
			if (mgr != null)
			{
				if (dictionary.ContainsKey(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.from]))
				{
					cardDataModel.fromState = (NetworkBattleDefine.NetworkCardPlaceState)ConvertToInt(dictionary[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.from]]);
				}
				else
				{
					cardDataModel.fromState = NetworkBattleGenericTool.GetCardPlaceState(mgr.GetBattlePlayer(cardDataModel.isOpponent), cardDataModel.Index);
				}
			}
			list.Add(cardDataModel);
		}
		return list;
	}

	protected virtual int ConvertToInt(object intStr)
	{
		return Convert.ToInt32(intStr.ToString());
	}

	protected int GetSpinCount(object receivedObject)
	{
		string s = receivedObject.ToString();
		int result = 0;
		if (int.TryParse(s, out result))
		{
			return ConvertToInt(receivedObject);
		}
		if (receivedObject is Dictionary<string, object> dictionary && dictionary.Keys.Contains("vid") && dictionary.Keys.Contains("value"))
		{
			int num = int.Parse(dictionary["vid"].ToString());
			if (GameMgr.GetIns().GetNetworkUserInfoData().GetSelfViewerId() == num)
			{
				return int.Parse(dictionary["value"].ToString());
			}
		}
		return 0;
	}

	private List<int> ConvertToListInt(object listObject)
	{
		List<object> obj = listObject as List<object>;
		List<int> list = new List<int>();
		foreach (object item in obj)
		{
			list.Add(ConvertToInt(item));
		}
		return list;
	}

	public void RecordReplayInfoInRecoveryExceptUriList(NetworkBattleDefine.NetworkBattleURI uri, bool isHaveSequence, Dictionary<string, object> data, bool isPlayer)
	{
		if (uri != NetworkBattleDefine.NetworkBattleURI.ChatStamp && uri != NetworkBattleDefine.NetworkBattleURI.SelectSkill)
		{
			return;
		}
		ConvertReceiveDataToMakeData(uri, isHaveSequence, data, isPlayer);
		switch (_receiveData.dataUri)
		{
		case NetworkBattleDefine.NetworkBattleURI.ChatStamp:
		{
			if (Enum.TryParse<ClassCharaPrm.EmotionType>(isPlayer ? _receiveData.playChatStamp.ToString() : _receiveData.oppoChatStamp.ToString(), out var result) && !ClassCharaPrm.IsEvolutionEmotionType(result))
			{
				networkBattleMgr.GetBattlePlayer(isPlayer).CallOnEmotion(result);
			}
			break;
		}
		case NetworkBattleDefine.NetworkBattleURI.SelectSkill:
			if (isPlayer)
			{
				networkBattleMgr.RecordSelectSkillInRecovery(_receiveData);
			}
			break;
		}
	}

	public void CheckLatestReplayInfoInRecoveryExceptUriList()
	{
		networkBattleMgr.CheckLatestReplayInfoInRecovery();
	}
}
