diff --git a/SVSim.BattleEngine/COPIED.manifest.tsv b/SVSim.BattleEngine/COPIED.manifest.tsv index 916aabb..30d0c48 100644 --- a/SVSim.BattleEngine/COPIED.manifest.tsv +++ b/SVSim.BattleEngine/COPIED.manifest.tsv @@ -1,19 +1,29 @@ # engine-relpath source-relpath sha256 patched(0|1) +AISendIntervalTrigger.cs AISendIntervalTrigger.cs 9714dac65d9572af1caba2fccdd6426c579c68160dac461853b18216a290671d 0 +AITurnControl.cs AITurnControl.cs b243f134711fb0c93454ace4d1e0fd073159ed1f8ffb349b79ded53a8c062847 0 AchievedInfo.cs AchievedInfo.cs ea4a48fc79056999864843575ad2158855147d67f610cf0da6bce7ac2fc8ec3a 0 AchievementInfo.cs AchievementInfo.cs 822021c9dd75a53d1e85bb97871f53ee0fb8bd92924a3209d35458d381c76e7a 0 AchievementInfoDetail.cs AchievementInfoDetail.cs 9e1b20906951b38e6b0bd58aef69a2446a034aad14654b5832897def3fcfbaf5 0 AchievementWindowBase.cs AchievementWindowBase.cs ced3e84a9c3c7085d64769f68ed54edfca7e637d14934978dfe98c966c459048 0 ActiveAnimation.cs ActiveAnimation.cs 9ed4752c84da57a2d43ecf9c4f2e4f38f919ec959926046c4789abe82bba9f25 0 AddDamageInfo.cs AddDamageInfo.cs 064839ffc0cb82bdcd15d929f33cc09c9732f68e3f95e1566d4aa1db6c61b730 0 +AddHealModifierInfo.cs AddHealModifierInfo.cs 41efe6d37249c80ea0cf0588976d40349c5906f0c14cf77776616a1d8ffe5e90 0 AddTargetInfo.cs AddTargetInfo.cs 622c5cdc7421909489a00b7017670cadce81b74d0860dedbc662ab4faf6fd82a 0 AlleyField.cs AlleyField.cs 138c25529e56d11ec28a82ae570ccee4fb1df1f52a258faaff4705afbebf13dc 0 AnimationOrTween/Direction.cs AnimationOrTween/Direction.cs 7c497cb72737f19f0a3ce12c5cceb3ad7d4ba5b9fb5c43c5abab047e8fe3c59c 0 ApiType.cs ApiType.cs 36dd6f7ae87a7caa985eebb0de02f709f7276c48068b1db2f28dcfd1fdc826be 0 ApplySkillTargetFilterCollection.cs ApplySkillTargetFilterCollection.cs 286c92d6dee5ffb49b9d62e5064bdd303fa5dc523e7e29b3ef8ec03f2e185b8b 0 +AreaBGInfo.cs AreaBGInfo.cs 7d1b5307511080f36019fe6286effe9960c4cebe4a3174668dd1988b2ebbe995 0 AreaSelInfo.cs AreaSelInfo.cs ef8322fa8a622cb44b3e8ff1dc03b85f784d7397bfdf4b6018993489e5eeb35f 0 +AreaSelectBG.cs AreaSelectBG.cs 1b3df23385533e2fa487ac99b6f7663d9f3dcebf9d8ef5b59517a6c60029dd03 0 +AreaSelectChapterEffect.cs AreaSelectChapterEffect.cs 5fe6057da9763c57807cff59388f137a266436d82a9efe934c6ff4489f55e2b1 0 +AreaSelectEffectControlBase.cs AreaSelectEffectControlBase.cs 4a0507a8649c0ff5027fd798212d71ea50609c5913f15a036adf47b74e62e03c 0 +AreaSelectMapIcon.cs AreaSelectMapIcon.cs 8f53fba1e364974a1d0e2a74714fd75ad5b169a32227cd956d3178f3c0d631c5 0 +AreaSelectUI.cs AreaSelectUI.cs b60642a02eefc4fa87bcf260ec6690bf0d9c85fbbb9306df71512a6243fee584 0 ArenaColosseum.cs ArenaColosseum.cs 66b067b705e632eae13711062dad303f645fefe0eb92c7ea53faca6e11c1b3f1 0 ArenaCompetition.cs ArenaCompetition.cs b93a87591acb5ab3e3e56a477ffbd2e9fd6a22a9fc0b46e29ace3553bbf4f279 0 ArenaData.cs ArenaData.cs 03b256eb428d73a1b51df1bbea80f883256bea98e97b7c6410a79f5097bd76e0 0 +ArenaEntryBase.cs ArenaEntryBase.cs 382a1386eda2b152ff0dc698a10c1c1d87de74d44e776e4fbe16d65021249088 0 ArenaEntryDataBase.cs ArenaEntryDataBase.cs c952da76cb1ec0102c1f5b6ab3e858c59387811531043a489b5ef96b9286e01d 0 ArenaField.cs ArenaField.cs ffd6e156fa2abe44f29e9f16304290fe8544e3f08a2d273f88823efec7e50d8c 0 ArenaNextSceneSelector.cs ArenaNextSceneSelector.cs d9e4338e53fc085a892edb2cd7348764736ec35d475239d7b2a95ac67ede4e58 0 @@ -23,13 +33,17 @@ ArenaResultReporter.cs ArenaResultReporter.cs 329f0ee53824a157dd9b240582f1bfa901 ArenaTwoPickData.cs ArenaTwoPickData.cs d63a8dbd3ba6ff149bdfc5f651a23a0bcd02ee4cb03940460002cdeb22836c7f 0 ArrowControl.cs ArrowControl.cs 884ed3b803390467ba85ed67ae9edb7c6ce13e9fb46dc4221f87f086bad6ef0d 0 AspectCamera.cs AspectCamera.cs 31f9273af0f4de11118ee062d16e6fcc4cf8bf37012af1ec81b14d6d58377eb9 0 +AspectCameraPerspective.cs AspectCameraPerspective.cs 457950085a98cc3dddd6aa7157b3b7bb7c8e2acb1cb390cfdfc7ce0f88f47248 0 +AssetBundleEditorTag.cs AssetBundleEditorTag.cs 91b4c9fba5686199c94b5c41f09021675ec128d4b2c5124d749588d53ed2aba4 0 AttachedSkillInformation.cs AttachedSkillInformation.cs 4596525861f9328a006ae767cb5687d37742ca4296f04446a715859705117435 0 AttachingAbilityInfo.cs AttachingAbilityInfo.cs dc7a858f5db686f046ffb9b7d004c3d513d2f6bd87e62737db7af3dc97429ce5 0 AttackSelectControl.cs AttackSelectControl.cs 11e98f485db0cf64820b945ae46e2b1d72d85a218ca899d41e7d24289cbc7ad0 0 +AudioList.cs AudioList.cs 1833b5583de1e9d467cde1e88ffc0a2d35360e42e4a2ebc83dd7eb21ed0b7418 0 BMFont.cs BMFont.cs 1228c62e3a837d18284ce8047861a1f90cc7702df5b008fb4ce0b812f299b69a 0 BMGlyph.cs BMGlyph.cs 24ed29cc0a20d8b9bc91f2cd5607efd7f992b7f64d2dd885e58b5bf21ff5cb46 0 BMSymbol.cs BMSymbol.cs 0252903edf4666d2456e20c524783bf1647ce6ef559ac631ac287abc1ef4178d 0 BackGroundBase.cs BackGroundBase.cs b45dfcd6593e604dfc630dbd09ed09003fbc03ce5d5ca3d9c10f021331647f7f 0 +BaseCardIDComp.cs BaseCardIDComp.cs 2732088664fcd4f1d01b80755756874b6a72308dd126461ae9a76f6520cf144d 0 BattleCamera.cs BattleCamera.cs 35cd1b3cfb6d5c9932a5b9777983b01fede0c8638a4ade7637a18318048ff2d7 0 BattleCardBase.cs BattleCardBase.cs b105aec032149ab0a1730c6e06e25530699851707150ad4b72e24fe6d17fd50f 0 BattleCardIconAnimations.cs BattleCardIconAnimations.cs b92ae5d235191bf076a2997b4cd85bb9bd9a7689a388014bdac7390d271f428d 0 @@ -57,10 +71,13 @@ BattleUIContainer.cs BattleUIContainer.cs 3e6933c0efae7f1ea44f18faef01f77f187fa8 BattleUtility.cs BattleUtility.cs 2fb4d029e53be602f954503ffbc0ebfadc62c8e6615a822a8a642bd07b179642 0 BetterList.cs BetterList.cs 3fff32bb27bc6ed52ed8cebcebd1b70d0c83b8d49a008d15ad884237706e8471 0 Bgm.cs Bgm.cs 0563a3cfd7d3496978c1e8118976e8e176010f260a09a6d5021d6fb2cd7fd424 0 +BingoBall.cs BingoBall.cs 936816ad8c2bc8f09e9e568fcbc274e6960b7a877e06c733b26b4c9c3c70dd09 0 +BingoSheetBlock.cs BingoSheetBlock.cs e98181555a9b2a9d2135d136e4316db85062c92983d181eb5a6540d9f8ede66b 0 BothBattlePlayerFilter.cs BothBattlePlayerFilter.cs d9b5460d0154326c4bfd32227da8987e9410dd94fd31be079960167e4b78b9de 0 BuffCountInfo.cs BuffCountInfo.cs a8ca34862f1d83c9c99a702eb5c4bd02e799ad2b9127f4c380b940029e884214 0 BuffDetailInfoUI.cs BuffDetailInfoUI.cs bef5b52e085808e650d013187963b8a8bcfe6c6623a253cb9707d6fac740cab4 0 BuffInfo.cs BuffInfo.cs 820575948ba2de316270e52a8009838b00ed7c6a834e37883372be24f6b07fdd 0 +ByteReader.cs ByteReader.cs 7a52a7fab89ef5915fab93560518b089d2e28b4a30ae9e1bfb145209ce1400a0 0 CantPlayCardFilterInfo.cs CantPlayCardFilterInfo.cs d83ea7282348ee3cf8b391748ec6720fa8a928ddb27020f8ee0191ea242d073d 0 CardBasePrm.cs CardBasePrm.cs e34d9f9bbf52dfe2a0b30cd56d5e900e711ac1423cd26d23dde627e6066c08c4 0 CardCreatorBase.cs CardCreatorBase.cs 45a8375791df42ad905864765fe42d596e4d56614fe18f2d90df79b14e57f5c2 0 @@ -88,36 +105,53 @@ ChangeAffiliationVfx.cs ChangeAffiliationVfx.cs 24b75de653446ad964a050f8c493c012 ChantCountAddModifier.cs ChantCountAddModifier.cs 9ad3d307986ca7bdde52eacbeb6314741b1601b4d2f6c344552df1904d26186a 0 ChantCountSetModifier.cs ChantCountSetModifier.cs f800ee0b26519e2b7362af2c7aeca2120f7205a600acf1c659d2993a1783afe7 0 ChantFieldBattleCard.cs ChantFieldBattleCard.cs e4a822d3a612543f37d223dbe7a751e3a30eace2cc2d40f49159d5534c27156c 0 +ChapterExtraData.cs ChapterExtraData.cs 9b18e16ed7c0d1a312284696fdc52840db19f8653629454ea6a2e4518b01478c 0 CharIdx.cs CharIdx.cs 7ff22de9e540d981db8eae5af20c74279edcc9f6526722a4783b253d4cdf96b8 0 Charactor3dInformation.cs Charactor3dInformation.cs adf2decd42c9fbbb8d25001cb13c09daa3c5b5b966bb90c5e7e66b90685cf0b5 0 ChateauField.cs ChateauField.cs baa59d3f23b02ab28c5ad5d262e41f01f812a4a771e63c647973d0ea5f898b6f 0 Class3dPostImageEffect.cs Class3dPostImageEffect.cs f2bc26e2c6675c4be1daf97a625679aa6c89a86f5938e70c092584c8243061b7 0 Class3dScreenOverlay.cs Class3dScreenOverlay.cs 21232996507eb29bd12c7f9d7530e8b3343a06b05260697038afc48c7530f019 0 +ClassBasicCardList.cs ClassBasicCardList.cs 53080dea764a289b9d59839efe525dcbd295260c2cc2fb128ef637b97ed59f67 0 ClassBattleCardBase.cs ClassBattleCardBase.cs 3fcc1ab079f0b7d1b30873026971ef8bedb013e4f46ee49b4a9532968703b4f5 0 +ClassCardCreator.cs ClassCardCreator.cs 2d0762491a1d31a55260675f07b944a11474e48b2438e2e945ce927f0ccca688 0 ClassCharaExp.cs ClassCharaExp.cs 716ff126337cb011392a0aa189a0122c3eaf0e0bd6552ac13cd72ef040925955 0 ClassCharaPrm.cs ClassCharaPrm.cs 39f8c6b747beeb52b55996623c1ed36eee3c3bc27ea9955be9b257b845e0b2c6 0 ClassInformationUIController.cs ClassInformationUIController.cs dd8ae4d1a449c6ee5c03ebdca8e609bd3201299f2d145f87e0886bd7ba47ac39 0 +ClassSkillApplyInformation.cs ClassSkillApplyInformation.cs e477066b4d2dc2eb69c6f258341616856726addd8548c2cffd5d3ee48ef50e4a 0 ClassSkinPlate.cs ClassSkinPlate.cs 5aab70386f16f29066a8c4d03887e9d0429a016b529af259e543da425be3fa98 0 ClassSkinPurchasePage.cs ClassSkinPurchasePage.cs 74edd9b280bb306476fe89678512915dfc377a5d86369dcbbf493f03dda2645a 0 +ClipboardHelper.cs ClipboardHelper.cs 7fc9dfa2a6a7e0fbc838896af8bcfbe3989e6b60c896646543adf5ed1a1e886e 0 +ColorOverwrite.cs ColorOverwrite.cs b105af901904731252ec84a9526074355a32b3e06c70ffa44ef7c0e8121207d3 0 ColosseumBattleFinish.cs ColosseumBattleFinish.cs 18dbacfbfbe0b305d484fe97f57e75a8448e1833ce0d2f905258b3e08cc7e4da 0 ColosseumBattleFinishDetail.cs ColosseumBattleFinishDetail.cs b666569fbebdaa212c977a907ae272dddbd8b34d76435acac2e03d4a4c6092b2 0 +ColosseumCardPanel.cs ColosseumCardPanel.cs 57ac21e9aea157c32ceeedcdf448d5cf25bfb4512c225c791136881cf97190ff 0 +ColosseumDetail.cs ColosseumDetail.cs 336f55ca78aa976520347ca4d1dffd2c03c41de5eb8afab8643ffedce1645ba9 0 +ColosseumEntry.cs ColosseumEntry.cs ee5af9a600edd2308b11682c9fa523931eed8a2c208b82d2ec4e9b2563f07074 0 ColosseumResultAnimationAgent.cs ColosseumResultAnimationAgent.cs 94516a64af44aba18eb5104283aa0e41ef4bdb87423bd857742eec53fb57a916 0 ColosseumResultAnimationHandler.cs ColosseumResultAnimationHandler.cs 7a2f79975efe09d891db158be9065a9edf2068af37d20ed02529109fd01300b5 0 ColosseumResultReporter.cs ColosseumResultReporter.cs 6e9ca923733f01c6c20aeb544c5ce5c0e58284bb2d480b1b5faa65ce7f24e060 0 +CommonBackGround.cs CommonBackGround.cs df587cccb68b484f617cffa913bd3850d64f4f821abbde625b817499c25b35be 0 ConditionSkillFilterCollection.cs ConditionSkillFilterCollection.cs b8fc3d9621a1f8ae7aaffbaac618bdaba36b63b036a37b611d9a798e2e68a8aa 0 ConnectionReportTrigger.cs ConnectionReportTrigger.cs c78d2c39db8a484c95b7e47c7bbdd16d050942c012531f286a188d5df33d3ca6 0 ConnectionReporter.cs ConnectionReporter.cs 64f1c1133af6cd674763ed612d837a14bbc5ce1908afc9f3a93ff6b6cc18577f 0 +ConsistencyReportButtonAction.cs ConsistencyReportButtonAction.cs dbbc03ab138e28617e8f4d6e409f2441d50d9da8da8f53009a6b356e5e5273ec 0 ContentKeywordExt.cs ContentKeywordExt.cs 3e93b52de66c252f5225c0d8924e19c53852b3d9c9c46b5620702dc7b13e0986 0 ConventionInfo.cs ConventionInfo.cs f4199507123b62b5da1633608e877cf0d9ed4ecf26a1671d520dfa2c8ee3026a 0 ConventionList.cs ConventionList.cs d0271cd5a5029c3ccf3fff460d093070d97fc13c1871573bd980733c6a21ad9c 0 ConventionListPlate.cs ConventionListPlate.cs 367921469919006a00056b6899bad8ff06c7ffcebe0142abe71b40a206b61ac2 0 ConventionListUI.cs ConventionListUI.cs 71ef763a92802844e97010920f4fe83430f2376b0349d5ce7333c0586a48d358 0 +Convention\Offline.cs Convention\Offline.cs 23b8a13c83c914a9fce9d3065e84e78df7e21404d5f3cb3d6e27d9c02d3a143c 0 CostAddModifier.cs CostAddModifier.cs 0627378794b72cb0f38a5a0b14aa70b03a02de4335074f21836b248e16c35ea9 0 CostCurveUI.cs CostCurveUI.cs 75c41420986c2e5acbce33837dd0d475a50fb5a1bb3e3abcf0d2b813984e4f9a 0 CostHalfModifier.cs CostHalfModifier.cs 21e90484e832afa41ec4f9e6244762a32b0a162f1ab940329d7a994ecce73347 0 +CostHalfRoundDownModifier.cs CostHalfRoundDownModifier.cs d9acd090e82b61697e184e9e3481d595bb279e5827dcd95f3fb1b132b6724255 0 CostHalfRoundUpModifier.cs CostHalfRoundUpModifier.cs 92e2a80e70e590d861036e69c77beb5a48c52012885e62876240bed3a059fa70 0 CostSetModifier.cs CostSetModifier.cs f6821df3735ce643be552bb7b919ccb8c75a1c22135daf01ef28a6eed9bf7c02 0 +CreateItemList.cs CreateItemList.cs 37647f56ebad7156a219ffed1f755fbb8554656599f82b67962c1c1802bb80c7 0 +Cute.Payment\IPaymentCommonCallback.cs Cute.Payment\IPaymentCommonCallback.cs 21466450f2d87e33a5d8e8d681832bb230cc75547384d5cd69120e439235ebdf 0 Cute/EventExtension.cs Cute/EventExtension.cs abe1b8be9d01d8ad88901cdccf387563ae14282dd4e02b3fc1e1e7a872526f0c 0 +Cute\AchievementManager.cs Cute\AchievementManager.cs ef74efb238feff1a14f3bc70c612b4faab3e5546612c2b21324998ae72d37091 0 +Cute\AdjustManager.cs Cute\AdjustManager.cs 670477cb0f0b5e7d8c4940a6b826a57c037b8392a58caf242a0219160461c485 0 Cute\AssetBundleObject.cs Cute\AssetBundleObject.cs 8bb313efedc9c4ceea5ecc22768952299393dfa30e532c9d411e48f622929d2e 0 Cute\AssetErrorState.cs Cute\AssetErrorState.cs b33ad3fb7e2ef3fe360dd4bfb4fa165c6545fea387978a19954be38534aafc5f 0 Cute\AssetHandle.cs Cute\AssetHandle.cs 1d8a2e86416732f74946f33dcc83668475124040ac512495fb78581a21c6e504 0 @@ -126,6 +160,7 @@ Cute\AssetObject.cs Cute\AssetObject.cs c739b1f221168cd883e8663a2680c487ea72e09d Cute\AssetRequestContext.cs Cute\AssetRequestContext.cs 6b2494166728d2c202cb050c3ce0a06b635295895e48f03c6fd9397ea07177b5 0 Cute\AsyncJob.cs Cute\AsyncJob.cs 5e02641f0b1d264d5fc74a31652543d970ae65943d3cfd96e477a835520863a2 0 Cute\AudioManager.cs Cute\AudioManager.cs 5e0cce94bcfad63266cd298aef89bb383e541f5802aa19dc9692db02047e6529 0 +Cute\BootApp.cs Cute\BootApp.cs 1a6b3066b6155aba225b9ca4e79655e428fc7b24cb16569717b53600b1f23bb5 0 Cute\BootNetwork.cs Cute\BootNetwork.cs 99769dd6c38b2ee2ef7ad02e14530c658576e5c4a2188ed1cbcdd563f68443f6 0 Cute\BootSystem.cs Cute\BootSystem.cs 61afa7a7c8df705504031629965440d491603dec531b047a36b9294f255ee04e 0 Cute\Certification.cs Cute\Certification.cs 8c143ee5f98e99332bbd1d6ec091d7590004b3b7215f1dc234d39bb5402f8531 0 @@ -133,6 +168,7 @@ Cute\CryptAES.cs Cute\CryptAES.cs d3022b9e1be75bc07e57aef61093717a84b60383608eba Cute\Cryptographer.cs Cute\Cryptographer.cs f61bc1f4727d323004c443c9db30a4f221db3309be2cb14d6f51fc6a39590908 0 Cute\CustomPreference.cs Cute\CustomPreference.cs ddc46cc13bf2728e4fcee7db550ec093ec3acf651ea48d3dbb5f5099d5a20f89 0 Cute\CuteNetworkDefine.cs Cute\CuteNetworkDefine.cs 4d83e9f5fbd6546ff6d16568a41ff885eaf9406275cc033c015b2aeab7203074 0 +Cute\DataMigration.cs Cute\DataMigration.cs 33898de02ccfaf795788f56df87b06d99cae1e16ca8d22afbf6bf7a4b632a0bd 0 Cute\DebugManager.cs Cute\DebugManager.cs 046c827677e5060f5a78b5d095b349e6956f3fe9a6183d51e411389755b37654 0 Cute\DeviceManager.cs Cute\DeviceManager.cs 1cfdf166a10ee8c25d00d8aa8b4679d3aebf72bd98d50a1c465d55e357059734 0 Cute\GameStartCheckTask.cs Cute\GameStartCheckTask.cs 549e76d44bb9692e45701c6bd09ea441a495e8f7e7fe7acdf508583c44e2b5a5 0 @@ -141,20 +177,27 @@ Cute\HangulManager.cs Cute\HangulManager.cs 5d49693ea1bc8e9c60c356f2495fe2d10f21 Cute\IAchievementCallback.cs Cute\IAchievementCallback.cs 2da279d18d01267260283e79c2962362a72e5612eb137c7f4cb6bd7aac60d661 0 Cute\ILocalKVS.cs Cute\ILocalKVS.cs 9a335a9930a14555431a147bd25a10809dfba3d7fffea2a74354e0c36e4c356e 0 Cute\INetworkUI.cs Cute\INetworkUI.cs f9c167ca8b2919b6a9a31518e9517a032aa67f6444239aa070e884c397c3b70b 0 +Cute\LeanThreadPool.cs Cute\LeanThreadPool.cs 6ee7d493e0fe784f58b46954311c486b08c7fa509de4e4ecc60c2ef40b6d0189 0 Cute\LocalSqliteKVS.cs Cute\LocalSqliteKVS.cs 75f8091265f3795e846c9a6ad45f8e3e469f1012e0f8568bc21f7a5912357808 0 Cute\ManifestDatahashKVS.cs Cute\ManifestDatahashKVS.cs 0eae9523c5fdafac69d67396e8b4b26bdca8749abe59feaf5775c1b92148602f 0 Cute\MovieManager.cs Cute\MovieManager.cs afe69325463e327cf9875f8a310f1b3c410652a13b144a7313920229e49df112 0 Cute\MoviePlayer.cs Cute\MoviePlayer.cs 146ae8ae35cedc1f977609b0dcb271ef46ef0def022b8c5de7720968bd7ca63f 0 Cute\NetworkManager.cs Cute\NetworkManager.cs 0045133deabae1d9d7323c1496d1e373c5fe4a1b731a81ed01ecac3500826ae1 0 Cute\NetworkTask.cs Cute\NetworkTask.cs dddf8a492571b5d0ae698a7e472c86f75a746d5ca0e7b34b08184cc820459acd 0 +Cute\PCPlatform.cs Cute\PCPlatform.cs a0810fcee0d4228d7043804b71bc631414235a136d31e62090c9886e157e8186 0 +Cute\PCPlatformSTEAM.cs Cute\PCPlatformSTEAM.cs d00b9316745b628d0bcb7ffd296e5ad3ee7e1e3dd006eabc652fd725b356bf2d 0 Cute\ParallelJob.cs Cute\ParallelJob.cs a6008b18295410cefa08fc98b6b9c4010c9a424120c322d86a050c2999f1750e 0 Cute\PaymentPCFinishTask.cs Cute\PaymentPCFinishTask.cs b8ec9fe1f1741a9525cb675d0b400b218c6d6b851f2eacaa104832afb44b627d 0 +Cute\PaymentPCStartParams.cs Cute\PaymentPCStartParams.cs be95fa062f1bca344ca011a73ea9e6f9eef6fa2c559d3064c8ed9b2ca6fda902 0 +Cute\PaymentPCStartParamsSTEAM.cs Cute\PaymentPCStartParamsSTEAM.cs fcaf910e2d5ab9f51703f7a9bdf959874059d42402e70984dacdf5d0dc5da459 0 +Cute\PaymentPCStartTask.cs Cute\PaymentPCStartTask.cs bf5501c824f3d59f5f18c8bb2361243a06395c9275b2d576d172c082b8a3250e 0 Cute\PostParams.cs Cute\PostParams.cs 075f4ac38426adb7885083dd0638d902737d83d34c4b36befd8cef000ff4f2b1 0 Cute\QualityManager.cs Cute\QualityManager.cs c6bb9c24b798af63b951d77bf525604ad725c9f14eadccce016f0c91497beacf 0 Cute\ResourcesManager.cs Cute\ResourcesManager.cs 71d3f4d1e0d685fcc86ecb163a7c0509fc8455329c16cdb6d2a8a6044207f924 0 Cute\SavedataManager.cs Cute\SavedataManager.cs 5646f2abab140a3b680014dd7d642989be1b1e041292d0f60c814546a27d8130 0 Cute\SignUpTask.cs Cute\SignUpTask.cs 12bc4a5ca60ba8e2305e5a1aa786a85911d9684005f38dea5469b67f42fb69c1 0 Cute\SkipCuteCheckResultCodes.cs Cute\SkipCuteCheckResultCodes.cs 9e61d6dca2c37a5cb99be5f4657fcd1789504cea08a9f234e35cfe5bc0c9b346 0 +Cute\SocialServiceUtility.cs Cute\SocialServiceUtility.cs 98a01ef8cc4020f8fe4b1517946e9baa59f100cfa03bc0ebcc0d7561219d42e5 0 Cute\SoftwareResetBase.cs Cute\SoftwareResetBase.cs 3f12519bbe890a1cecb09928deb13e8f22ee6a4230884f63a53e7ec22d7114e0 0 Cute\SoundData.cs Cute\SoundData.cs 48133c9aece96639bb8d52c28e0aeef4b9e41fcaefee31d11a75c34ba355c96e 0 Cute\TimeData.cs Cute\TimeData.cs d1bb7dbdb7c456739a7949b2348121660df2ca5fba8f7797df275133b5691ddf 0 @@ -171,8 +214,14 @@ DamageInfo.cs DamageInfo.cs 5c8ace7ed08f5a2b17b94041d029976515795a6521c62fae4c10 DamageModifier.cs DamageModifier.cs 3e5115d7fc848170b4a12b9e83e7b29d4eea9f8ad99dd1922d8fd548ec39d547 0 DataMgr.cs DataMgr.cs e26d86f920c1c4fa975100bca4e120da223aa00fdf2c7afe55555685039de048 0 Debug.cs Debug.cs b4f865824033417f743baa3ac8f75d9a6268aaff551b10a8c975797e52b9a774 0 +DeckCreateMenuUI.cs DeckCreateMenuUI.cs 9fd67898af43926bec460f903d17c46b6276ec76fbdf5279f82a89099f14f52c 0 DeckData.cs DeckData.cs 6e55b1b948e5e0b023b2bcfda8ba3ba3349137ce7902bc954f448ea150ad8dff 0 DeckDecisionUI.cs DeckDecisionUI.cs c860e82f9d92cc1a6ca9569185947f949731136a14f6923844f0d4f869b9e4e3 0 +DeckFrame.cs DeckFrame.cs 10766591b689deda42f52312344641a216abea3bdd724cfb71b8e28861e0784e 0 +DeckIntroduction.cs DeckIntroduction.cs 072fd4f510f7fb191b20a900a3599462f1a432b0fb5a5e7fe0f41f94a0c9770e 0 +DeckIntroductionCopyDialog.cs DeckIntroductionCopyDialog.cs 3481c9bde5668f31b2cd110c38f5b1f37f23a01bc848dc97ab457e233ca7c27d 0 +DeckIntroductionItem.cs DeckIntroductionItem.cs 203e91a28d0fb94e9f56e3353f6d245b278ad6fb5437ed99ad647970d44ea4d7 0 +DeckListMenuUI.cs DeckListMenuUI.cs a3edab346b80866df72c2005c7a492f81c9a3da1bafd510fa6d6b205eedeb38f 0 DegreeInfo.cs DegreeInfo.cs 1bef2f1b36023d033923cac8f96972380ed7e20a42b7114c67b4a29515fd02a1 0 DegreeInfoDetail.cs DegreeInfoDetail.cs 41c09ccb25ccd6a1628a1d56079767434a6fa5228bad103eaee88b12a8d00659 0 DepthBlurAndBloom.cs DepthBlurAndBloom.cs fddb16fe8e4701ffa5687fa2f6e1d10e37e4713163e6c64ae2b1070b7bf7774b 0 @@ -190,16 +239,20 @@ Effect.cs Effect.cs 3a262efdcdf78cd70cebc47f2e13c37d59121b0f65cd4425576dbff5e7c3 Effect3dInformation.cs Effect3dInformation.cs cbc8e10d2755feed8707d5fcc98e14a1d152e3f21a9e519d5b3990b0a45335cb 0 EffectBattle.cs EffectBattle.cs 948c157c1c662f13946de84a8d82a9e791eedc9d0e4033e260aa960b001ddbe6 0 EffectIdx.cs EffectIdx.cs 5a1bb1179ec2ae8c4e552ab9dfb859718b54c683382bec84518f1ad437c9dfe1 0 +EffectSetUp.cs EffectSetUp.cs 7dab4041e1975ae265ceaafe160b5d4857d3518aaed277ec445a88077f590efa 0 EmblemInfo.cs EmblemInfo.cs 21fb353975ce1e929d9a88bdab9a69c32c751768cb9148293e29a8a504f9b1ee 0 EmblemInfoDetail.cs EmblemInfoDetail.cs a6f8597d09808fa9634e52ad8482f2c715e043cbda29b14d9fac2d59ec74d47c 0 EmitHandUtility.cs EmitHandUtility.cs 1912ad3e82e968b5e0fce6fe1339bf9ae17bcfa3019558b7848a9df9d656b54d 0 EnemyAICoroutine.cs EnemyAICoroutine.cs a199f7894f26de72a798cb8f66c853bb23dd761a98d70a9fdfc0c1049fc6c50e 0 EnemyClassBattleCard.cs EnemyClassBattleCard.cs 5919e0aff71c63ab89cdd942261e776abd3a3882536bc036c20f1b89159c2d70 0 +EnemyStatusPanelControl.cs EnemyStatusPanelControl.cs 20b622b34f72ca08706c732d8a1dad90055d4e1cb4e3fa054e6b560061f69bd1 0 +EpSetModifier.cs EpSetModifier.cs 67421f56915c690a3fe034745b2a400f845ef20ffb4d19e4eab2e2253cc36776 0 EventBattleResult.cs EventBattleResult.cs 4175af8625db01292947338f264c8aee51a48e9ef5785fc2c99ad19a5a546d85 0 EventDelegate.cs EventDelegate.cs 46aac74b8f69ad3bbff976d609890b06d39bdcaac8d750dbc08edb7350fe20bd 0 ExecutionInfoCreatorBase.cs ExecutionInfoCreatorBase.cs 66231c001020d1bd54233645c2462edefd3af69adb166a4230e738915687a4d3 0 FadeUtility.cs FadeUtility.cs 21735efdf8f885c091421350cfaadd1b2eddc1a3ffe4f5ddc84784260636b04d 0 FieldBattleCard.cs FieldBattleCard.cs d0cf47325d0374752ab098fd364b886e7fa9e9367d6d2c59da71d03f200cbb6d 0 +FieldCardCreator.cs FieldCardCreator.cs c8e2cd0ee4875841922ce3a6a24c0ae847c221ff525585989829124e66b469a4 0 FilterController.cs FilterController.cs 383faac09c95684862201a8ee7cb0384bd00bad97e17b967a2e2a0e4babe3969 0 FinishTaskBase.cs FinishTaskBase.cs bcce8f5f8457978804ac2b8142a5c038e8113a67c6ba081226355bb2b4aeb93c 0 FlexibleGrid.cs FlexibleGrid.cs 5ae686e596cc48092f7c71a8d4dde5963b777c406372cf8a68d4b274ad7332a6 0 @@ -221,6 +274,7 @@ GachaUI.cs GachaUI.cs 9a2717c4c7488d1ac985e3f297efc5a0d2b1f11154257f120db4716b95 GameObjectExtension.cs GameObjectExtension.cs c52b9f14cc4237846cad401e99a269de16bbaae57ceafd3aff88b4de48763032 0 GameObjectExtensions.cs GameObjectExtensions.cs e2cfe625254133493242c2f67a77a16149115ce2148f56423c9e854c8074ff56 0 GateField.cs GateField.cs 7e46608dfc593222fb0364424b87944064f061d736b93d69d2c531f1645b7d18 0 +GetDataTranslateTask.cs GetDataTranslateTask.cs 5fa1138ce9d3a7a94d1491ea21dd9d73d25f6456a851795ad5bdbec89e9f08f1 0 Global.cs Global.cs 176c8351aa9f1c5529fa0ed3ae8514fef117d4274034ec358ac1b7ee4fafb782 0 GuardInfo.cs GuardInfo.cs f90debeff49492f32e54241fe88120353c9e640c63e40e5368e37aca46cbe4d7 0 Gungnir.cs Gungnir.cs f0a18179c8b88c4faaece7f01be63ddf3fdbeb922e47ec6f0eb12af590620d22 0 @@ -248,6 +302,7 @@ IDInput.cs IDInput.cs 6366e6c23d9c954bb08d8052040e04953528b02084c380a9f600458175 IDetailPanelControl.cs IDetailPanelControl.cs f705759bfd1ee67cb2fd89727c9c5bc3fa339e1a45ecdba0f1deffa5d7464e71 0 INetworkLogger.cs INetworkLogger.cs b7c350604afeec7b31078c254297785062ecdff88e65cb530d870d6b791f4a11 0 INextSceneSelector.cs INextSceneSelector.cs 52d188563368337f2653d41f54ed6ba915911929134b6bef628f6cd72c820c95 0 +IPaymentCallback.cs IPaymentCallback.cs 49a700edd4e580c493f97fdc7328a2609630904bce2f2a6110b485d5958e7869 0 IPpModifier.cs IPpModifier.cs 95a83890b06528d37c73dea24b75a3dcd23dfd532508bcb90463e34a5811d19e 0 IResultAnimationHandler.cs IResultAnimationHandler.cs 0106c5eb9c8d912d47c5cc46336bffce1284cf5935088850fc0dc6c7ccfe3351 0 ISkillApplyInformation.cs ISkillApplyInformation.cs 1082061304ea9099b2e144ac28aef691d138e0f8e09f4bac8109c8c359277fa1 0 @@ -307,6 +362,7 @@ Load.cs Load.cs a68f95fd46d5b9961f8b40424d093ee3ab9a21e168992034c66f81adb66dcc1d LoadDetail.cs LoadDetail.cs aa01efaaaca68bd8899b41ba90ef228c3d5b7f9ccaf9e7937b476a1bc9886342 0 LoadingBase.cs LoadingBase.cs 0f63fc8676b84b1b8c36bf51f41b241c74e236abbff1e07b2612233f3f4f04d2 0 LoadingInScene.cs LoadingInScene.cs 9ae449b0ba5668e3d3d8d1d0ae340514617ac705d364c9be8993efe6afe4ddb1 0 +LocalNotificationPriority.cs LocalNotificationPriority.cs ca3265d518980b3058603bcd1151b0ac7f934866f991ff967826870f4a9cb060 0 Localization.cs Localization.cs 07d154439612a9a8e6e49ec7edd9f5fc0a7af965d231291c96c0057d991e4a48 0 MailData.cs MailData.cs 8229d3b651b4df09e52def59da26a70635224c3e8f80437d01c7a1012be8f942 0 MailDataDetail.cs MailDataDetail.cs 61caaf9762aff044c3f675a4899b47a31af0872a70f1035d822755842fd2ad3e 0 @@ -332,6 +388,7 @@ MaxLifeAddModifier.cs MaxLifeAddModifier.cs 410eb577b9e19074d555fdc89b773a0399f0 MaxLifeSetModifier.cs MaxLifeSetModifier.cs e4103f7d5abd5a91b83c08613a35d3da2b208ebc7655206c00fe2c7718fbd85a 0 MecanimSceneBase.cs MecanimSceneBase.cs 92369606696d42d4a610216fd48e13aa1592bbfc5e0f98f53afc3e5264d3fbed 0 MecanimStateBase.cs MecanimStateBase.cs 8aebc2fffebf571b953804cca24acf6a73902ffe3b35c53e8e8076691121039f 0 +Mission.cs Mission.cs 06fcb02410d114b2a2c64a0846941c62a286f44d22b7fdb92d650096a704a381 0 MissionInfo.cs MissionInfo.cs 2577e5c3f988a6acc5810ff4642988b8324415e4e361fe54a37c593b0fe7b82b 0 MissionInfoDetail.cs MissionInfoDetail.cs 4caacd77a98f00dbc81b5111933dcc5eccc86bd558a44f37485f2bd253b6bf87 0 MotionUtils.cs MotionUtils.cs 59de592e4cf7fc0b7d210b22473fbec6484d175342bb8030165fdce550b75392 0 @@ -362,6 +419,7 @@ Nat2Field.cs Nat2Field.cs e88af89f0bf45a0b124aa0b2e9450fed9619402d343a570bfaf7df Nat3Field.cs Nat3Field.cs 6b05e595b5a36ad4862461c02404c37194820d3ca96e77fc314e380fbddfdfab 0 Nat4Field.cs Nat4Field.cs 582be3b3d22bed077a105861bdbcbd5e564bb709b771377f980aaed098e6ccec 0 NateField.cs NateField.cs fea9100df495f60716a7e330e466ea94881e61789d606526c5aaadf4504b19e3 0 +NetworkAIBattleSetupCardEvent.cs NetworkAIBattleSetupCardEvent.cs 3a5294dfdd135a9f040af7bac6844a56b56faa81921199b77b809c4d4d549748 0 NetworkBattleData.cs NetworkBattleData.cs 73c823febb4d40b508b72cc946fcc47211d89e93c4906cbeca43beab971d69d3 0 NetworkBattleDefine.cs NetworkBattleDefine.cs 4d0a39b09dd5ad11786645dc4365148d945ea11e690f735d3eb541ebb7ce604a 0 NetworkBattleGenericTool.cs NetworkBattleGenericTool.cs 38d7965e7e25aa31d7e56abd5797b1b02a99bfd96426ffd87a43ffc15ce9895a 0 @@ -377,6 +435,7 @@ NetworkConsistency.cs NetworkConsistency.cs 46c2b57e8b0a5bdb71b4a7020d729e528a4f NetworkExecutionInfoCreator.cs NetworkExecutionInfoCreator.cs 89e65032a5504837b829716759802d32359100db4f5390b66a36bddc2f6010c9 0 NetworkLog.cs NetworkLog.cs a1c5fcdb35a5ce00aceda3fd90062530770d917b9fd797b62a8f28c6eaa85f53 0 NetworkMatchNextSceneSelector.cs NetworkMatchNextSceneSelector.cs 3f8708e5031523b308897c815e5ee5df12e2aefc43edb503bb94e3fbd763a7a9 0 +NetworkNullLogger.cs NetworkNullLogger.cs 98a335c7182b7bf7f815b16a5a6f5c67625aa7aef9cceeea1edf9669c049a9dc 0 NetworkOperationCollection.cs NetworkOperationCollection.cs 021cdb1734ce14912b202d51e5da4f1954e89594cca5ca46b465a6b05a6453ba 0 NetworkOperationCollectionBase.cs NetworkOperationCollectionBase.cs a360f399fb1d35b94e70b3578b446b373c1e465f9e12e05fac075c8643d7a305 0 NetworkRecoveryBattleData.cs NetworkRecoveryBattleData.cs 78b0408c9459cde1b83a8e2916f4aba7638d4359dd415ef455bcd592b3189907 0 @@ -478,12 +537,19 @@ NotConsumeEpModifierInfo.cs NotConsumeEpModifierInfo.cs 00aef49ba7e742cd19278a69 NotMulliganEndToJudgeChecker.cs NotMulliganEndToJudgeChecker.cs 80febf55e54e431a6cf8c3264baa180f1a48d57bbf4d97c020aa23d37dbaa90d 0 NotTurnEndToLoseChecker.cs NotTurnEndToLoseChecker.cs a8874bbac8694e89090b0b13eb7ddaee90ff8f1d6e873873ac1e492b18a09814 0 NotTurnStartToLoseChecker.cs NotTurnStartToLoseChecker.cs 346d048a258240b0943432ad93d305d26418debdc57e17c95ed6b2062f8eeecf 0 +NtDataTranslate.cs NtDataTranslate.cs d26fb3c7caec79b93ad840404cb531b266903c9d24958ab9a81d4f49f920e9a6 0 NtDataTranslateInfo.cs NtDataTranslateInfo.cs 70f2e47dfd6a5e7302c116f2c58898e5518c74062b4295ac9ae07419499dee1d 0 +NtDataTranslateInput.cs NtDataTranslateInput.cs b1c30143f1c44c479520901aca66b3cae8eeb5f59f9796f6c86e5282b503ca17 0 NtDataTranslateManager.cs NtDataTranslateManager.cs 4063c0681776b01e828e83f159b806804e22d0a4cef942420ad352f5891ebd5d 0 NullBattleCard.cs NullBattleCard.cs 5cd7b46b3bd1a40c5ada04e175f331f4a885e0805a3ac221eaabe832820e3c1e 0 NullBattlePlayerFilter.cs NullBattlePlayerFilter.cs 8529798e07d72f054b13bb680445d302992dde2828272066af7e46502104dd5b 0 +NullBattlePlayerVfxCreator.cs NullBattlePlayerVfxCreator.cs 11035dde02733eeb736037e86db605d1803892ca7cc75c9e59a0ca3bcb61b89f 0 +NullClassInfomationUI.cs NullClassInfomationUI.cs e28e080e8ddc10db48da58a81729699ccf05ed8b5977a2d72fdfd43d8697cdd8 0 NullDetailPanelControl.cs NullDetailPanelControl.cs 23191faed4f557714b777369da21d97219e3f71ab6fad72ef21f2558b78b067b 0 NullNextSceneSelector.cs NullNextSceneSelector.cs cd2669c1c2e3d84b2fcb31c2c670dc1beaa336ff2b460f52fa3d7e32b81bf00d 0 +NullNotMulliganEndToJudgeChecker.cs NullNotMulliganEndToJudgeChecker.cs 704879e8f79fe7dd0671829d1ab58c0ba4a231d842a709bec0bdf7925773c4dd 0 +NullNotTurnEndToLoseChecker.cs NullNotTurnEndToLoseChecker.cs 3c79113d3f1ffe5512d67c80f3233ce16b08533a5dc612ffe085c841c1cf3e37 0 +NullNotTurnStartToLoseChecker.cs NullNotTurnStartToLoseChecker.cs dc5540e6b383ac4ab52c6023c3f78afd29e3d7e8208a337f84daf070335eda15 0 NullOperationCollection.cs NullOperationCollection.cs c3886781dcb423b1d045a7aee74fb139aa16fe927ed2ff4fb96a929a22969efb 0 NullSkillApplyInformation.cs NullSkillApplyInformation.cs 22d0b0e5e341249065c4f256772d66f328da2bd390bbf89fc7a003625483dc0c 0 NullStatusPanelControl.cs NullStatusPanelControl.cs 78238e8cbf895ca2513e74d23322a2a8fefa728ddf1407a110dbb0f02a53d271 0 @@ -491,6 +557,7 @@ NullTurnPanelControl.cs NullTurnPanelControl.cs 4c65fd3cca218efa16563934404a0054 OffenseAddModifier.cs OffenseAddModifier.cs 5f3150bfdb6cc9b4f581ca0d1e82b05d649a6eb86542aa8eaa777961e40f5fc2 0 OffenseMultiplyModifier.cs OffenseMultiplyModifier.cs bbe0e1023839d6f97ce887615cada33d6c12eb9b1cd1ab09bc4ed3ff06c88317 0 OffenseSetModifier.cs OffenseSetModifier.cs 2100c8a68ca22b7d74e79d62fbd378b83a9a053332b1f10163dd8fed1b7adda2 0 +OmotePlugin.cs OmotePlugin.cs a70f953d064a1511a113f97403a03552e1db4622cf0941a41597efedfc529cd8 0 OpenURLOnClick.cs OpenURLOnClick.cs d2d823441976fdb025023fb4f5605c95a5d7bde38f1869dd1b31fa0eae8dc389 0 OperateMgr.cs OperateMgr.cs e850a929de25ffac21dc85de267235a530e4671ad5edf8652cca9c5be8418028 0 OperateReceive.cs OperateReceive.cs cd94427cdfe2b43ccd2bb815dcf7373e2a3caa3f7dc23901b0abf2c6e312f742 0 @@ -502,6 +569,13 @@ OpponentRecoveryToDispChecker.cs OpponentRecoveryToDispChecker.cs 6e8de98a40a364 PackOpen.cs PackOpen.cs 2ccd3afaff9e8a3365e56b357bf2daf3bab4df292002e0948c0981e31ea39f54 0 PackOpenDetail.cs PackOpenDetail.cs 59540a83a0f103a8113e416485c1f2fe5495f0ab5d80899da778069a6ac26743 0 PanelMgr.cs PanelMgr.cs 5b0d5fd19f49134ad0a708e7263f8d68ef636a33a0212776191602c4b9074dae 0 +Payment.cs Payment.cs cdbd5d9a0b888b5abca9fb8ec4a6ecdfcbd3e82bb7940cb7cb70cea96297c79c 0 +PaymentBase.cs PaymentBase.cs eb88ea4f0346458c49273e3291404e7f12668c76c2137ff658877924ddc1e7a6 0 +PaymentImpl.cs PaymentImpl.cs 265aebd2f63fd2e9beb9fa575950dede4db2a55f4c7b76ceec1c44752594c55c 0 +PaymentPC.cs PaymentPC.cs bc3fea7d796fc411f63c8459dcea00428a1e0e2142828ed7b026b44da1a54fc0 0 +PaymentPurchase.cs PaymentPurchase.cs e6ec297b7a424cd8a8b7afe8dd6c8ec317a69e8114a8eea4d30474de2e60cd0d 0 +PaymentSkuInfo.cs PaymentSkuInfo.cs 5150c2682bf354d4769e0c5a5f1abeca3804ded4ae30402419c70474b9567711 0 +PaymentUI.cs PaymentUI.cs 84b2c7e5e297d8f2dfd20ee865e44780217ade7193c13981f1c50d28441e5504 0 PlayHandCardReflection.cs PlayHandCardReflection.cs 934c893708573d24787ba3ad9b678ea465b749715f68cbda53ca00d427fe70e0 0 PlayQueueViewBase.cs PlayQueueViewBase.cs c6829c45500f1c4911e8fe41bb66711e61417521de911513042fe09fb55c50cd 0 PlayerClassBattleCard.cs PlayerClassBattleCard.cs 1cab6fed6be2d2bfc08d2f2ce1c2f78fa5710a3d3000972619105da408392ae7 0 @@ -524,6 +598,7 @@ Prediction.cs Prediction.cs 536228a52cfca4db3c40d419472dc575278a0785a280040a3320 PrefabMgr.cs PrefabMgr.cs 889ee1b9782467f82ef5ce88da54d55213d76bc7a044abff5837c10d562576cb 0 PriConnField.cs PriConnField.cs c410f6b85dc9d94959caf1879f9d600be46fc880e6f2a3dd6f594c4b1aee5f2b 0 PuzzleBattleManager.cs PuzzleBattleManager.cs f96e0a25d8e148a6704bf4624095cbf8453f800a73cc96f73bfc15e894536072 0 +PuzzleGenerator.cs PuzzleGenerator.cs fc55ddcf6dcfc9cef6b7d338bbbc1371971987cff7580626ce549bb6c080b307 0 QuestFinish.cs QuestFinish.cs a64f425ff026f670b995b33c462b81aecb0d956f6c6e4da98e2d4d98b5d41220 0 QuestFinishDetail.cs QuestFinishDetail.cs 488d190e160ff8dd616403fbf006ded58d40bd7e02a6d77b4df443283dfb11cb 0 QuestNextSceneSelector.cs QuestNextSceneSelector.cs 765b1a0efd54ad7c15b70be5c74eb27e3bb67cb0d3cafb49af2712965af1ae47 0 @@ -548,33 +623,43 @@ RealTimeNetworkAgent.cs RealTimeNetworkAgent.cs ac4c8a6f6c8400736edb447aa4c4463c ReceiveFriendApplyInfo.cs ReceiveFriendApplyInfo.cs ecee225b7bc644459695784dbbc20a97818f9ca7fb62bfa81577c5a2ae1d5de6 0 ReceiveFriendApplyInfoDetail.cs ReceiveFriendApplyInfoDetail.cs d9f55b1ab75c25a702a930a6a50117ac4302cb6fdad96ca4f70b21a9478f0086 0 ReceiveIntervalTrigger.cs ReceiveIntervalTrigger.cs 7a5b285c9acf441c4a97e08243228c9a55e3a81657911fe59d775db0956205a7 0 +ReceiveIntervalTriggerStandard.cs ReceiveIntervalTriggerStandard.cs 8dbab0f071139395d87ef98d990721986986c66131cde332ae57a82e4eef1ef8 0 ReceivePlayActionsReflectionBase.cs ReceivePlayActionsReflectionBase.cs 6ffcef690e2a73d946b9af88612c18a819ff02013333d940ec958144b34e445d 0 +ReceiveReward.cs ReceiveReward.cs 1723b8a0c3ef3d6cba1336177b768855586dd49ac8b29e30f33e1e04a2b4254c 0 ReceivedReward.cs ReceivedReward.cs 790befcadc8b35b0067eb88a127210a625dbf639ba1b5d5829d5e434569e9c1f 0 +RecoveryNetworkInPlayAction.cs RecoveryNetworkInPlayAction.cs 308fac616d0489cc2291325e597ec257047fc6815a925f7038481f3d070222ca 0 RecoveryOperateMgr.cs RecoveryOperateMgr.cs 4a107e2bef7889ecffbf500ed3f4b56205c611e84f25a450f0ffa4cf40809504 0 RecoveryOperateReceive.cs RecoveryOperateReceive.cs 84e33ae28bcd79e5376a0ef448881280e378a595614d3ec7038d360efb861eb9 0 RecoveryOperationCollection.cs RecoveryOperationCollection.cs 57597229de28acdbd55d40699d95d4c8a4c470f681410a9d75ed6ffe4a45d1a5 0 +RecoveryReplaceReceivedCard.cs RecoveryReplaceReceivedCard.cs f6952b5de11fdb1e0a14c7586a889bc4c4ad06bdf0bbd6b245835646c3583e07 0 RecoveryToDispChecker.cs RecoveryToDispChecker.cs e5f6b0b7a4ed72ae2fb7466083109da654797f0a53b0d956e7bcebc20de47423 0 +RedShellUnity\RedShell.cs RedShellUnity\RedShell.cs 2cb8e731beeef5be0ae839cf7155ee71b2cf4aa1cc15600035af5afffc8dd850 0 ReflectionInfo.cs ReflectionInfo.cs 6c52f52fa1003907d7f37ac9cac83be02069791e91f47ce500dc686716c2600f 0 RegisterActionBase.cs RegisterActionBase.cs 9e101ce8eeaed30cb02f8263d3b43f07bd57c40e868c291ca3dd8e5d6b9652a3 0 RegisterActionManager.cs RegisterActionManager.cs dafa07d8b8beea14456ada306ffb47898391089361a04a7e56d9c01f6736a978 0 RegisterAlter.cs RegisterAlter.cs 71f274fa4dc4a7e20aa2a7ec84259f24a8ff204e7d112d190715842c1607aed5 0 RegisterAttach.cs RegisterAttach.cs a1073c9e0beb3403421f762b56752fc138f2eaf4efe0c9ce525e691f27835b47 0 +RegisterChangeUnionBurstCount.cs RegisterChangeUnionBurstCount.cs 6673cfe121344bb35b32eaf664738c9c05390089b52371b4470f4b6907db8eb0 0 RegisterChoiceAdd.cs RegisterChoiceAdd.cs ebd7a55f46204db08be667eb3eb5716a88ea723e0515a63c5a9678513d584f81 0 RegisterCopyToken.cs RegisterCopyToken.cs 0d18db819ca168a8f1c89bf4cdbe6472221510cf7029db1279c9b2c62352b43a 0 +RegisterCostChangeCard.cs RegisterCostChangeCard.cs 5a073f72104b3e1ddf9c636f25ac85f8ccab6c0fa3bcd46a3ce3fb75a67adb7c 0 RegisterDeckOut.cs RegisterDeckOut.cs aacec98ddf2a97fec3c06f6fee3309251d17b3a3ef30ef7af5777241f110d7ef 0 RegisterEnhanceTrigger.cs RegisterEnhanceTrigger.cs 6ae80e2e9274a5961d57e86a01756dfb851edfc38a5df6c7c1ac3b3f4b992a10 0 RegisterEvolution.cs RegisterEvolution.cs 7913c5d94b10bfcfaea3eb3f3f52d2b505dd15fd6431e00307caa967c026987a 0 +RegisterExtraTurn.cs RegisterExtraTurn.cs 6f0cc3680798f417417f43879efd08fe376a31f24ac4fdb73858f1938cd3ea44 0 RegisterExtract.cs RegisterExtract.cs 0511c2e0ce3516d627ce4284c46d6c83f5dbe0a0809d8563b51525d8feafaaea 0 RegisterFilter.cs RegisterFilter.cs a4f323658602948e32a4b9ddef2e3b6a35540e1bd9f273dffa2bd06272b30bbd 0 RegisterFusion.cs RegisterFusion.cs 9fad0a9cd989a74569aaee6bb29fb03aa8a5fc60c9a843bc2d40c14677f216d1 0 RegisterLotCardBase.cs RegisterLotCardBase.cs 0eaa82c60bc5c3a4cda5f11e43b2046258be409435659981f9e28076585d4953 0 RegisterMetamorphoseData.cs RegisterMetamorphoseData.cs d2da9001d5dba0107bb0e96d5cd5802ffdac10141d5346f46692226d325ccb43 0 RegisterOpenMyCards.cs RegisterOpenMyCards.cs bbc85f37d83266f1bba8da24c4967831013a84688e5e822d1e1314aaca314665 0 +RegisterPlayCountChange.cs RegisterPlayCountChange.cs 20ab593bd14a9b3799520ba7b670a2753f1776a7d673faad7327d833f47b8261 0 RegisterPlayerParameter.cs RegisterPlayerParameter.cs 7b1862b642c09e9bc47f8ba3897fe7878af52a984f9b5448cbb0f895e746e837 0 RegisterScan.cs RegisterScan.cs 25cd0ba7c22b1c1bad9c8705346dd26e63d3fa87ec74c0005dae78f69834ad02 0 RegisterShortageDeckWin.cs RegisterShortageDeckWin.cs 30369d01c40064ffc6eb5e2ddbb674af36f5f68a349438ed6e5eb293e98bf3d2 0 RegisterSkillConditionCheck.cs RegisterSkillConditionCheck.cs 97e3189933a0a6f6cac86e228aa5629cda4fdd52a830adb2e295d8364d07f3c1 0 RegisterSpecialWin.cs RegisterSpecialWin.cs 42aaa086b7a6f0b14538fc92347a832b4e432605bea4e3861218cfccc508bc82 0 +RegisterSpellboost.cs RegisterSpellboost.cs ec502aba5a966cd0afa7e40c714efc8feddc3b7251ecba8c7d3e642a83bad6c9 0 RegisterStateChangeCard.cs RegisterStateChangeCard.cs ba906084130c2dd3b4c97c0d3aff81ec9b34002cbcfc95d7ecfe199b14f3d61a 0 RegisterTargetBase.cs RegisterTargetBase.cs 8203159714f9b6739c4fe81aa59ad7989ec5e200495253e3f6303ad06a9069ea 0 RegisterToken.cs RegisterToken.cs db7b950af0ed7b687763ac8b31df8e6ba8cd4a412a81166123a72652373b8e15 0 @@ -589,11 +674,13 @@ ReplayBattleEnemy.cs ReplayBattleEnemy.cs 0cd9edf444148dcced5f0cad667456456882a9 ReplayBattlePlayer.cs ReplayBattlePlayer.cs 09ebef15f39bb79b464433d2f046ef416a556dd2b2b59d4738e97b42cd20bcb6 0 ReplayDetailInfo.cs ReplayDetailInfo.cs 49705ba9302bd646d306eb153ae870102b6a45cf51bc989d6ce7c65e77b5b816 0 ReplayExecutionInfoCreator.cs ReplayExecutionInfoCreator.cs be484ac0171d68795e901539d17cd53168072c47e83f095959bb8eb9ac277f85 0 +ReplayInPlayAction.cs ReplayInPlayAction.cs c74e5c7e0a52217aafac9bde87f152c37b91753f83899589bb149f64886af0b9 0 ReplayMoveTurnButton.cs ReplayMoveTurnButton.cs a4eff325fcfbbdedd9b6c3bbc6416190ee72a13ccf18e33eba417c3937ad8547 0 ReplayMoveTurnItem.cs ReplayMoveTurnItem.cs 82c04d3244e3b6f46322d969ea080dc6c2ae5e82806125a3585519b961c068d5 0 ReplayMoveTurnPanel.cs ReplayMoveTurnPanel.cs 4e9ce337088992a503cad1389c20d2ef699e2cc40b5bd35e64289f8ab493a33b 0 ReplayOperateReceive.cs ReplayOperateReceive.cs 97f022471eebff107b95c1f2465fa3920761ef08601f27d7ad6a5366c16202f5 0 ReplayOperationCollection.cs ReplayOperationCollection.cs 3a4aa5d5069982ad8e320ed954182f8d12bb4523cba27897539ca53eb25dc5c5 0 +ReplayPlayCardAction.cs ReplayPlayCardAction.cs 5874f79095b88f65b141b50b6363b7e878983fa4dc420980c53270149d59bfc3 0 ResourceHandler.cs ResourceHandler.cs 4aee3875b0074af62154f817dd7042fe873830923e9b0d9a2099085641441e62 0 ResultAnimationAgent.cs ResultAnimationAgent.cs b0cd2cae790fa1427c69e96cfcf164f38d4a58aff8fcd60f08d1a9a8273a9c15 0 Reward.cs Reward.cs b5270d953033a0ecb0874e5721846dc4d797916bfcbd4973c0dea5d359b8ede7 0 @@ -602,6 +689,7 @@ RivayleBackalleyField.cs RivayleBackalleyField.cs 52ff935248c68d70ec31e67d6f2147 RivayleField.cs RivayleField.cs 9b69b1048560d224f4d3ddd17c582720b1b67fb9694ad30263575280166de234 0 RoomBattleMatching.cs RoomBattleMatching.cs c45c33d2b1a471bd59943a860664bb145130c9b2d048103e7b5dc487acc4970e 0 RoomBattleMatchingDetail.cs RoomBattleMatchingDetail.cs f3585e9c69dbb3549d7ba0c34b195fa95a92122534cab9d16d0b22a3c871f2af 0 +RoomInviteReceiveDialog.cs RoomInviteReceiveDialog.cs a199462c44acc0f178ff1d5c537de423dbe7d73b251b90f81dc534bc2e942d7f 0 RoomMatchFinish.cs RoomMatchFinish.cs 03e6a59f109b8d6ae000bc899a882ee9bb64d4361406c727198dc619a0010209 0 RoomMatchFinishDetail.cs RoomMatchFinishDetail.cs 3f80cc80214fe7f025c8d2c9378639ed5f81f9b086966fbe27bc6f5f0c74fba5 0 RoomMatchReportEndAgent.cs RoomMatchReportEndAgent.cs 71940f832ce3ddb524ecb0a2c73b4cce3ff19085dbd083ec90cce48f763e281a 0 @@ -622,7 +710,10 @@ SendCardDataMaker.cs SendCardDataMaker.cs 074a19f77a59be5859a486c9731f3f6df4e496 SendFriendApplyInfo.cs SendFriendApplyInfo.cs 28a60bd3a4421a8cfe1531ceac2ecd78eec64ebc7de20736892d65cef1836579 0 SendFriendApplyInfoDetail.cs SendFriendApplyInfoDetail.cs c6efa3a67633162dc822f528e60dd1a9aa6b4a48c0d2fd0d8fcd34b24417c2d2 0 SendIntervalTrigger.cs SendIntervalTrigger.cs ac92d11f73c9cd58a08b07f2d852028a646ee049df17439d023f05ba627878b5 0 +SendIntervalTriggerStandard.cs SendIntervalTriggerStandard.cs 81a57bf38fc4f6a89b47535a3d0b7498458ac3be9d86214b6121eb2037208ddb 0 SendKeyActionDataManager.cs SendKeyActionDataManager.cs b74f41da4e4f704e0300026d9af6e27a1374370214a6f77694db5dd01c726fd6 0 +SetDamageInfo.cs SetDamageInfo.cs c19138615d995e320a4877de90d4801127c7cd0db62ce38d794d5a214c9cd694 0 +SetHealModifierInfo.cs SetHealModifierInfo.cs ec923d2e56eac3a192da637eeef53fe587009fc60d76b27ff3cc7dc259e5d84c 0 SetShaderGlobalColorBG.cs SetShaderGlobalColorBG.cs 605e1b276a8dc8cc0bdb083470de6fd462e168a827200f932aac8d5b67245934 0 ShieldInfo.cs ShieldInfo.cs c7ca21d0fd446587d0e2ce1e80b29055ea4ef2f6c154a18eaa279543aba8eb1e 0 ShopSupplyCardPanel.cs ShopSupplyCardPanel.cs b8f62fbaaccb2d9ab0260c8e9865d919646a10c197c4daeaedcff460ff50d29e 0 @@ -1187,16 +1278,25 @@ SkyboundArtCountAddModifier.cs SkyboundArtCountAddModifier.cs 253e896f5d73dc2493 SlideObjectReceiveControl.cs SlideObjectReceiveControl.cs 25066b5bbcee488a0ae0d634e595354d194715895dd8f197c57740dc9a65d654 0 SoundMgr.cs SoundMgr.cs 6446b13929ddfef0f1e421498e7e007e5f047fb0b9af01ad4cb155f10abb98c3 0 SpecialArenaField.cs SpecialArenaField.cs 412c324799fcf5ba3b44f569fc38eb55ee839d19eac69d239f0aa36b613b9ffa 0 +SpecialCrystalDialog.cs SpecialCrystalDialog.cs 15d2f53d2787f08015c1c962ad2a71349d8e97bd57f0a15833a83819de8deaeb 0 SpecialCrystalInfo.cs SpecialCrystalInfo.cs 5f8544bfa60c28abe33c1241f998b843b3556abd78ad806e86f1d0f54207144a 0 +SpecialSkillBattleCard.cs SpecialSkillBattleCard.cs e48fbcea339fdf5bf613b12b2ff19ec67c3aa543c6bddb6b5054e1d2b92fa9bd 0 +SpecialSkillCardCreator.cs SpecialSkillCardCreator.cs e444fc5659d0dc30cf33c161dba1b9bdb8c17b8f70e6115cf5f9d01ee0f5b56e 0 SpellBattleCard.cs SpellBattleCard.cs beeb2ee38181c49eb23a3a4a34d88712ab9e775a1d6325359c497c75a1d64916 0 +SpellCardCreator.cs SpellCardCreator.cs 52caefcbf8d495918c298d3d7eea1f4f089804ba2620ee6f44edfcfa210d22a1 0 SpellSelectableCardFilter.cs SpellSelectableCardFilter.cs fe43393a84e3e8fd571b5ece0389e248f16a630c4d887b691b7005a090305cd6 0 +SpellSkillCollection.cs SpellSkillCollection.cs 0cd9860b4983c567f11749905a9746626b8192d6897d9cd1c374ed2370a9c530 0 SpringPanel.cs SpringPanel.cs a017e4bda72cd7cf6f5afd49033ac1d7bc1e1723f7c9a2c47ed03275ab680470 0 SpringPosition.cs SpringPosition.cs 95b7fe8038f93aefba651ab2ffc437bf067eda828d383ff8669768bc03fb6f7e 0 Sqlite3Plugin\DBProxy.cs Sqlite3Plugin\DBProxy.cs 5ab0876de5301af3407c3340fcf569cf9465991accb81edbec51f68b056cd761 0 +Sqlite3Plugin\DatabaseCorruptionException.cs Sqlite3Plugin\DatabaseCorruptionException.cs bc96c0e67ce004d1673b758f7d489179dd97b61df6c9d46c3b19c72ae94efb82 0 Sqlite3Plugin\PreparedQuery.cs Sqlite3Plugin\PreparedQuery.cs 9cd4ecc6dc386f9cedece748372992ac3eb56d4a6b372ab22e28ae7b24504577 0 Sqlite3Plugin\Query.cs Sqlite3Plugin\Query.cs 1ca5b79273292fc248f5097567142422dbdea8cc372ebe7c9b07a90de3aefef2 0 +Sqlite3Plugin\ResultCode.cs Sqlite3Plugin\ResultCode.cs e3457f7f8dc63bbfe0fea257c86a402b75ace3268a4d49931bd3ab4f0931c68c 0 +Sqlite3Plugin\Sqlite3LibImport.cs Sqlite3Plugin\Sqlite3LibImport.cs 183751c9a34a0176f8943457d2f0fd2fb2c6bd2d1c5e9a1d3ce0fee523d5ab5c 0 StageField.cs StageField.cs 00b4ce73ee0ecf03cd735eeaf3c92d88ff84d961545ce9a128fe276ca8a6bc20 0 StartPickMultiCardVfx.cs StartPickMultiCardVfx.cs 5319d35407eb703a1ce1e62c8010ca48bbbdab28664801e44229742709856dc2 0 +StaticTextForUILabel.cs StaticTextForUILabel.cs 9436023ca36b366ede714d43732a219acd072f187f78f79c93f52d255a8ebc9e 0 StockEmitMgr.cs StockEmitMgr.cs 652918ba621b02fc0141d1cce1e68847dbfb9d6be19cf9d2b87ee737c1fac742 0 StockReceiveMgr.cs StockReceiveMgr.cs ca15f8d8c7a532558071dd010fcecff5e05ef69891f8f364db4537ddf8f08fdc 0 StockSequenceMgr.cs StockSequenceMgr.cs ff64a78a351e6ed010b0bf9ef00e84d6540109fe578cdbf2772e17d6d66ada38 0 @@ -1212,13 +1312,17 @@ StoryReportEndAgent.cs StoryReportEndAgent.cs d2ea0cac09dc90b1fc0e163fa2e6117a45 StoryResultAnimationAgent.cs StoryResultAnimationAgent.cs 67b5f484cd593a1c03f6116ae6c8eb2debf45f38671606478af7f0d12df06b59 0 StoryResultAnimationHandler.cs StoryResultAnimationHandler.cs d5d0f28beddf0487e54c0652b3ec0af101543df4df63d8cc4847c9de0618b91a 0 StoryResultReporter.cs StoryResultReporter.cs 21c77ea3cad8a8dd32ade349e68769bf3b09af224b919f29d09b958a1ac699c8 0 +StorySection.cs StorySection.cs 90bc36e5d786c592f5d668f69f2dd6044c311cdddee93c5056de37b19674aea6 0 StorySectionData.cs StorySectionData.cs 2a9977f30e6a8c4d3dcb54696ffa9b84f30baad9435745b36bc071465c6fe5d7 0 SuperSkyboundArtCountAddModifier.cs SuperSkyboundArtCountAddModifier.cs 6672f92e8d9fad08c10c7a441d1756d2baf9fc0d47f137cf8adc0498ddbd47b1 0 +SwitchLanguage.cs SwitchLanguage.cs 9362d44e73a33a7feadca7811e0c8f71b526f9c2653947ccce80bab7aa494ede 0 TaskManager.cs TaskManager.cs d16af8956ca562f74241bd570a68e7f2dbd0d061039a22e4eb71207843b2735b 0 TempleField.cs TempleField.cs 3e3cab0f9c8630e3b275c78a226712ab34eeb17f807c484652331aa0b2b17fe7 0 TempleNightField.cs TempleNightField.cs 3d27607868382d47a14f17880cfd5e7a340112e9e23e376a91ced7269cc2912c 0 +TimeLeftUpdate.cs TimeLeftUpdate.cs 682a67e5ffaa1ab2e2f1ab05aed0caf5be8c2a228609b8325da1734a95ab3fa4 0 Timer.cs Timer.cs 0ac4b1fc273798a587d38987cc7a353d8c071a81c4b7ba293fdc59a9c2e1c804 0 TimerMgr.cs TimerMgr.cs cfe8eb9a3405153f46ae962772d23934c39daaa34336cf6b309484c511509d1e 0 +TitleUI.cs TitleUI.cs 50c94d31b173fcb949c3c29a1c89f8d5735587d4a9da87e81dc8bb5771b16538 0 TokenDrawModifier.cs TokenDrawModifier.cs ee94b1a849c7779f1c0fcaf0951c06cadcdfd0fe7c61182de4e1cc468af494cb 0 TopBar.cs TopBar.cs e3365819277393c8892627127c124e72917b3c50e15a9bf549b44cf2e2fa8350 0 TouchControl.cs TouchControl.cs 999089722cce89697ebef6b2da6cb20a4d33e10826160e6487f25282cc5713eb 0 @@ -1227,11 +1331,19 @@ TurnEndButtonUI.cs TurnEndButtonUI.cs fd5682499e7764933d3d3d24c8b75e1bf6a863fc29 TurnEndTimeController.cs TurnEndTimeController.cs 3b516431616bcaac105e1c19c199fde08a74a4414ac2eb7264ecbf7aee4dc062 0 TurnPanelControl.cs TurnPanelControl.cs d8b78ab4ec6b6b5e6ebfa8129679ef6dac38ac1e8285867c349c3e0c00881db7 0 TurnPlayerInfo.cs TurnPlayerInfo.cs 57656b4a000e98f9d9a75bcfcf13b1703c33a1c64f8f36f78afb0771f3caf43b 0 +TutorialNextSceneSelector.cs TutorialNextSceneSelector.cs 83aaf60c3f7e0a6f36356d25ae7b7c2036c124a4887e199a90ebd8f133e341ea 0 +TutorialReportEndAgent.cs TutorialReportEndAgent.cs 9905613c59c9d50fa76e2539e094101d8e9a1f94025902fcbff11cb2c2feacff 0 +TutorialResultAnimationAgent.cs TutorialResultAnimationAgent.cs 4101f22dc613cd363267f3cb3eec76cad79cdef1b9ed168ea6b03debcd117cd8 0 +TutorialResultAnimationHandler.cs TutorialResultAnimationHandler.cs bc841acb23029a83b76f7f751b61b6e763fed8d0db6990a204b7a9984212efcd 0 +TutorialResultReporter.cs TutorialResultReporter.cs cec5f150092707940105b19a0fd27739dc5f0fa02c8d18e0ded38715bb7fdba2 0 TweenAlpha.cs TweenAlpha.cs d1f530a59b492a34140f88c0fecb88406289cc37817e822d3a36cd141ec03e7e 0 TweenColor.cs TweenColor.cs 27070a2f526015c8a9b68005be21e9235d46c72a35eb646b09e3d38fdaea8cb1 0 TweenPosition.cs TweenPosition.cs 1426cfaf028ac956d7e1e286ad67189723116ca2dc4926a101ca1784c90ec22a 0 +TweenPositionX.cs TweenPositionX.cs d612a70acd8d1b45e9adbb01dc94a7649a4c05c7bfe0cea86728f8fd17e1a1de 0 +TweenPositionY.cs TweenPositionY.cs 526bfb20912ea1fe320ee386efcb268da8df01702d338800a34a5ddcd84bb418 0 TweenRotation.cs TweenRotation.cs 840297b6cb3b51034b457fc3c4ae794ec3e76f9d75b2aeb9135ea2518e3a572e 0 TweenScale.cs TweenScale.cs dd50401e8ffca06da1d2ccaa9d21cccfef2007d8f786f0690b79880d13b5007d 0 +Twitter.cs Twitter.cs 5abebbe6b3243fdd889d09fef67a248e683b1c84749789538a2a1a6d342d85b4 0 UI2DSprite.cs UI2DSprite.cs c0c50a2c03e76ab7ee5fc7b0bb6ede7462ca98cb338a3ac93d3310d6016e660c 0 UIAnchor.cs UIAnchor.cs ed46145415d1c7a0fef11d38de99b4b851e92044455ab3297d3e487c09e5f9b2 0 UIAtlas.cs UIAtlas.cs 7b4a3539816d0568b2175af231466e58b30e60596b5f0ff095e6781c37b6b6e6 0 @@ -1244,6 +1356,8 @@ UIButtonColor.cs UIButtonColor.cs 527c1e1d9db0da61cdc0348e893b3df2bef7fadd046b90 UICamera.cs UICamera.cs 500eb9bb8f8bf4e7ed1f0073de80c5ccefe85273db00fc887295153d533c6525 0 UICardList.cs UICardList.cs 0c983d56f955b25b0e0d52b4b1ce7c4a51b175093770c24c66db0ca575abc288 0 UICenterOnChild.cs UICenterOnChild.cs 474da8b0e6bab01a59538a47351a71f3a3564f9242c37a9adb29419dcaf91ee1 0 +UICenterOnClick.cs UICenterOnClick.cs f6fd08e24ca2e897bcbd22568be224eb3d7bae06f898d66fcd34f5fc20419178 0 +UICurveLabel.cs UICurveLabel.cs e7eb2389c940c26327f302d9c11863726a359d46c85a5ad5a0d5d5e44cbe5d8d 0 UIDragScrollView.cs UIDragScrollView.cs e5acfb873e2c58489438689c35fb49f9bc6a626e42b8210d99131027c5c614b4 0 UIDrawCall.cs UIDrawCall.cs 9450bbb24af68f5949415fdaf4d172e87f3666f50d04cc349a63317ba3ce16c0 0 UIEventListener.cs UIEventListener.cs 2e8420b6be9c0a4432e84df935bcd72a3d59ae68eb9cbcb7fbf7c37d22fa08d4 0 @@ -1257,6 +1371,7 @@ UIKeyNavigation.cs UIKeyNavigation.cs 07f92623077c4fe71abe087b62e8f66ff3d2542997 UILabel.cs UILabel.cs caf2353d46a4a538b696f1cc11ca0d987d99905db8789a507df4fc726a29cb47 0 UIOrthoCamera.cs UIOrthoCamera.cs 7af22756b74e80e8d79ec65a1b8dcb4a780548152af5fe354fc8d7ba437ea8a8 0 UIPanel.cs UIPanel.cs da0a82c5db60138e81e2fabbf0ed39adbe43f0d98a52ce5e7204e90c6378b8e6 0 +UIPlaySound.cs UIPlaySound.cs 6280f8f8f07a4fd699ab2abbfe08fb3ec82c43b5210b481f7ca71c04b0843f31 0 UIPopupList.cs UIPopupList.cs a92be6b849fd09c1208562e37b483dda6e17a2ef7d7dbd4f9ee4db417b719306 0 UIProgressBar.cs UIProgressBar.cs c528c65a6c4c5f0b99f16ee5d956ea45b0b2b50d5f99c82590ca11b39b1681dd 0 UIRect.cs UIRect.cs 26b0ed3873a80eccb7b3e110fa54f7ad732cfaae698aa5cbd7aec4c0f7b01d7a 0 @@ -1275,8 +1390,12 @@ UITweener.cs UITweener.cs 639742c82b7b38d98215bb9852df84c92819b28dbb9dcf43d834ed UIWidget.cs UIWidget.cs bcc292adf33c73b6e1091e74df776dee7808b10f1e8a5b6296f3efe5eee1ac03 0 UIWidgetContainer.cs UIWidgetContainer.cs 86cb92fd2fe067189987d823f21f7492355d99490a37d03d0ca4b98ef6b2d014 0 UIWrapContent.cs UIWrapContent.cs 59a7ac9b3b6a8774ff69869ccf8d0a013efc3999ac636ec43ed5d2a90cf5c301 0 +UIWrapMuchContent.cs UIWrapMuchContent.cs fc9fc8a00a5073a46cb3bcf49af1bc1836c34e0f283c8a718630f09b0370c5de 0 +UIWrapVariableContentVertical.cs UIWrapVariableContentVertical.cs 56aedb3a083cd1d98b508939e0c3153c6c50e7ae70f1a12948861add7967eb5a 0 UnionBurstCountAddModifier.cs UnionBurstCountAddModifier.cs 8beff11a43074eb1a3803dcfd0e5f9b094f5fd9967146439d6caf8c3fd468bb6 0 UnitBattleCard.cs UnitBattleCard.cs 27dc1f653b825080ccfcc072236165148c25fbecf170d2b9fb9629cd330ba878 0 +UnitCardCreator.cs UnitCardCreator.cs 1fc13c2d1f5c3b52f6fc77e2a4c7f42c8efdf15ceab3f1d712d73f45b0ca152f 0 +UnitSkillApplyInformation.cs UnitSkillApplyInformation.cs d285ae08cb916a85e0a4ed5d41a524b27ffffd1a1527758860f17107b9f214c0 0 UnityEventAgent.cs UnityEventAgent.cs 0712c1fa51f3a6ac91d26d42972c3b4c0bef81431ac7e4424ca222c18746f46c 0 User.cs User.cs d0108788bc786b1852b9d9c9bce9011d14a7fa681c8dc5b18814912029c4bb1d 0 UserAchievement.cs UserAchievement.cs 06f9a530d683c21c4c3697b0ae6b8c79e33197e504de7479d0ddfeb5b9c54014 0 @@ -1291,10 +1410,14 @@ UserMission.cs UserMission.cs 2516293322a85ea704c66c79789c5b026a41024802aa464f94 UserPromotionMatch.cs UserPromotionMatch.cs 9456ac47ac4ae1050bf35e2c32556774053f2442c6d35f4029d635faceade38a 0 UserRank.cs UserRank.cs 482eb25d49fe10180258f86c98e5d016d0b2ae97dd9a703550ab6b203d12f1c0 0 UserTutorial.cs UserTutorial.cs a9158fa4ed1954b5b0779acd6621f18d1046d1fcd196d0291ecf804c2f1733fb 0 +UtilityDrumrollItem.cs UtilityDrumrollItem.cs e312d53d716b1ec16a7a12d4fea285b42c5db7d36074cd705f3c700946584b06 0 UtilityDrumrollScroll.cs UtilityDrumrollScroll.cs 33e4e607231f08df2286af7f8240407eab36a5c20139699f24a469e96a2f870a 0 ValueWithOperator.cs ValueWithOperator.cs 8f7f0a6779b0acef60616d8b11397e9287a2fda5aabb5633931fe054d0488a95 0 VariableSkillFilterCollection.cs VariableSkillFilterCollection.cs 81a4181b82be933b517204d193716c7b76af98f9c499635a1cded597b62dad30 0 VellsarDesertField.cs VellsarDesertField.cs aa6332744db7946bc81a58cc9366b5aa12645510de417e387d952fa83fdb6723 0 +VideoHostingImplBase.cs VideoHostingImplBase.cs 5d306aeb8ed6ace236e7d47e577510b6d3bd70ab120d31a5880a650063b60672 0 +VideoHostingManager.cs VideoHostingManager.cs 4ca315a66a50eeb4780c8c41bf7b0d5bf1be464182b54ac24b68e8adb556e420 0 +VideoHostingNicoNicoNotification.cs VideoHostingNicoNicoNotification.cs be17b4acb15f849f500dfb9e892250adb64c3c7c89e72488acd756e5b773bd09 0 VideoHostingUtil.cs VideoHostingUtil.cs 70b20ef9a7e8187d33356d37bf74f0da02005bf26e2e7b33b0b60ca8feca5fb6 0 VirtualBattleEnemy.cs VirtualBattleEnemy.cs 67a44fd924c8488a7a309162835d01f4a865481f1e6544d75cbf3ee28f151e34 0 VirtualBattlePlayer.cs VirtualBattlePlayer.cs eb107ba07f87bf04337ca7958f545da20b211e0cf5c5aaa8ca5b5487ec4eef64 0 @@ -1304,16 +1427,25 @@ VoiceDictionaries.cs VoiceDictionaries.cs 845e20628eb0ef372bbfb8c7b55ae14ce6c57e VoiceDictionary.cs VoiceDictionary.cs 314e23ce11985b7f0b5e6a5753b4ba48813c4414972441cccc4c8efe15e81d21 0 VolcanoField.cs VolcanoField.cs 3dfb1318b89b7b82f8a4ea2065f471417bb6004efc2319f32a86ac9c6476528b 0 VoteData.cs VoteData.cs f91a040c073e36b7058a2fe866005c33b22f247fd61419c21c6af46669485d9e 0 +WatchInPlayAction.cs WatchInPlayAction.cs 54de3968aded18d6d6b9bb1f5e803d58294de6cf45c558aad2df902938d1fdb7 0 WatchOperateReceive.cs WatchOperateReceive.cs e77378fd91ec257eba34448e0305e9608ae2bc29f8581c65167ac4c4cd829096 0 WatchOperationCollection.cs WatchOperationCollection.cs a20deb14316a4f38ead77c4a4bf6d7d7b092dd1037bac54b3f4ebf26b01bccf9 0 +WatchPlayCardAction.cs WatchPlayCardAction.cs 9cf94b6d52239d0a5b92cdb8d8def9d0984c01204d62d9483269b572e47c30d5 0 WatchTouchControl.cs WatchTouchControl.cs 7a8426ee3f178f05650eb4ccd5952eb5dcc1718ea8ec05be81715dcfbdfda529 0 WatchTurnEndTimeController.cs WatchTurnEndTimeController.cs 50cd44122fe694f1003214c31a552ec9e899388166b4a495e5a03d5601fbfb1d 0 WatcherDisconnectChecker.cs WatcherDisconnectChecker.cs b2ec9803c3ed9e473233cfd4e2f805195df1f607936f7dde9ae1b7a7028dd847 0 WatcherLeaveChecker.cs WatcherLeaveChecker.cs 7b969aacc9670f319bd45d344528524a3001b0152cc96e99631e89fa69354466 0 +WindowResize.cs WindowResize.cs db6f56a3db9e6109bf9b44841081eb5281bb285fad9d76dc3cf2799ee2808d38 0 Wizard.AutoTest/LitJsonExtention.cs Wizard.AutoTest/LitJsonExtention.cs 2c7f0f5931516292033479e8ef92631fdd72a27907c048ba77d3e287187fc504 0 Wizard.AutoTest\AutoTestBattleMgr.cs Wizard.AutoTest\AutoTestBattleMgr.cs 42841daf11cb9b42e8d97f44f7ae24aebee089b7d9c7c6d8d39f21b32b49860d 0 Wizard.Battle.Card.InnerOptions\CardInnerOptionsBase.cs Wizard.Battle.Card.InnerOptions\CardInnerOptionsBase.cs e0c9e0e503c55e536924b17f7b2948423a79b85bafaf0ffa0d02b053667d69f2 0 +Wizard.Battle.Card.InnerOptions\PlayerCardInnerOptions.cs Wizard.Battle.Card.InnerOptions\PlayerCardInnerOptions.cs 820fb10d151a049b103b5f7b0a15f697c76365a7b2fb3a53f78d81947df55a56 0 Wizard.Battle.Card\IVirtualBattleCard.cs Wizard.Battle.Card\IVirtualBattleCard.cs 9446d58a4ab2ddd2097d3132b133c36780d7e9d36b83309a4dc12d7c8d441f40 0 +Wizard.Battle.Card\VirtualChantFieldBattleCard.cs Wizard.Battle.Card\VirtualChantFieldBattleCard.cs 1e05dff55c5c9bf722bb464b16ae763b03cd8a26ea02a41fa779461240f08982 0 +Wizard.Battle.Card\VirtualClassBattleCard.cs Wizard.Battle.Card\VirtualClassBattleCard.cs 586494135800d6e0bd7486b2dbbc09fa683c411aff74b54bbb70f87545df04c8 0 +Wizard.Battle.Card\VirtualFieldBattleCard.cs Wizard.Battle.Card\VirtualFieldBattleCard.cs 5f6212473f5a0c6a08ff1c21b9496a86281cd4bc4ddf1cf0697234f83a5c2dba 0 +Wizard.Battle.Card\VirtualSpellBattleCard.cs Wizard.Battle.Card\VirtualSpellBattleCard.cs 7172c61bf30b7ff5ab86da9d618ce7b2fcbc6aa0c50845422fb2122cc1ab1704 0 +Wizard.Battle.Card\VirtualUnitBattleCard.cs Wizard.Battle.Card\VirtualUnitBattleCard.cs ab7aa44de0f89f6dbc380b00e3657750ef8265eaaca459aef3f8376e3c6ff8a5 0 Wizard.Battle.Mulligan\IMulliganMgr.cs Wizard.Battle.Mulligan\IMulliganMgr.cs d49640f1076af798e9114ff9058b7fdfe5d5a194ed2420a6ef95122fa10d8c0f 0 Wizard.Battle.Mulligan\MulliganCtrl.cs Wizard.Battle.Mulligan\MulliganCtrl.cs dbb991240686c69313e36a6e7773acbf2e877eefb1153a7ee985379755ca36c7 0 Wizard.Battle.Mulligan\MulliganInfoControl.cs Wizard.Battle.Mulligan\MulliganInfoControl.cs 96b05ee5e79977b06a9f8d3e2f027b350baf06cbb49dc5d569b0cd4ca8030fda 0 @@ -1321,16 +1453,25 @@ Wizard.Battle.Mulligan\MulliganMgrBase.cs Wizard.Battle.Mulligan\MulliganMgrBase Wizard.Battle.Mulligan\MulliganOperateControl.cs Wizard.Battle.Mulligan\MulliganOperateControl.cs 4cfb95ea034953cd75b801f65f634a5bb92650bc4322ee9ea2621035fc618e2a 0 Wizard.Battle.Mulligan\MulliganViewBase.cs Wizard.Battle.Mulligan\MulliganViewBase.cs 641fd480d2682454e5eee8bf149498ad23811752900dcc43de5b994c77b76b58 0 Wizard.Battle.Mulligan\NetworkMulliganMgr.cs Wizard.Battle.Mulligan\NetworkMulliganMgr.cs e9d24af08954400b4e484871273ffecfe5ae76abb16cb0350b7ce16ac89b3c7d 0 +Wizard.Battle.Mulligan\NetworkOpponentMulliganCtrl.cs Wizard.Battle.Mulligan\NetworkOpponentMulliganCtrl.cs 897a078c122c68f79cf4d673480a687d0aea7c307f8fc483da9371700f336d6e 0 +Wizard.Battle.Mulligan\NetworkPlayerMulliganCtrl.cs Wizard.Battle.Mulligan\NetworkPlayerMulliganCtrl.cs 3897678fd2cc804c84b1e1d2ce6cba1677682a9ab902a55360a43181373d2cd1 0 Wizard.Battle.Mulligan\OpponentMulliganCtrl.cs Wizard.Battle.Mulligan\OpponentMulliganCtrl.cs 68ad23dde55aaecf68521d861b4d61a5569caeb8b524058f2fafead7a79f727e 0 Wizard.Battle.Mulligan\OpponentMulliganView.cs Wizard.Battle.Mulligan\OpponentMulliganView.cs 225bcec52a9768a233bf336efb8285b40f57ccc1ebbc7d63a47823c3bd3876bc 0 Wizard.Battle.Mulligan\PlayerMulliganCardSortOutVfx.cs Wizard.Battle.Mulligan\PlayerMulliganCardSortOutVfx.cs 2592025f334540f261207c02c5a69032c4109eec8e3ad47c8037e224a29424b3 0 Wizard.Battle.Mulligan\PlayerMulliganCtrl.cs Wizard.Battle.Mulligan\PlayerMulliganCtrl.cs 19da0c8f4d906a0151537e458feba897f497e0e58e98cc073af8ca17a46e992b 0 Wizard.Battle.Mulligan\PlayerMulliganView.cs Wizard.Battle.Mulligan\PlayerMulliganView.cs 9ec7621e20fb7b26e60f532612dc2598bb6b19b8d5f6d10f9616a42ad203832a 0 Wizard.Battle.Mulligan\SingleMulliganMgr.cs Wizard.Battle.Mulligan\SingleMulliganMgr.cs f885a0a4039b2cea9889f904d0af81129ec2b700672550e0f7988c061c8883a9 0 +Wizard.Battle.Operation\AttackOperationCommand.cs Wizard.Battle.Operation\AttackOperationCommand.cs 977380b85cc0b7e2eba35421a4bb00a795d137193591f126bf60c4a1db1e43a8 0 +Wizard.Battle.Operation\ChangeAIOperationCommand.cs Wizard.Battle.Operation\ChangeAIOperationCommand.cs b9c14e2d908e2c84fc0fdbe149cc49d8e92c057575feb708a6b672bb7f53514b 0 +Wizard.Battle.Operation\EvolveOperationCommand.cs Wizard.Battle.Operation\EvolveOperationCommand.cs 893db7b4077f9e94ed98d3d58fedbed113b2c4f95abde5bd92a18f2d92edd723 0 +Wizard.Battle.Operation\FusionOperationCommand.cs Wizard.Battle.Operation\FusionOperationCommand.cs c2d98ea4cae44e22b6b1433900256cfa819fcdc6dfd85c6939f44b8e6b853766 0 Wizard.Battle.Operation\IOperationCommand.cs Wizard.Battle.Operation\IOperationCommand.cs 71d184f986afd2d5160a6f7121ef8f80e50c018b48c21d5e3b6c14086df8c494 0 Wizard.Battle.Operation\OperationSimulator.cs Wizard.Battle.Operation\OperationSimulator.cs c97c6fdf16353d9d3aa5839528bc5832d00a85e27da8d786ad8274e1bf45708c 0 +Wizard.Battle.Operation\PlayOperationCommand.cs Wizard.Battle.Operation\PlayOperationCommand.cs 4359c79e97c900f043931d02cc34057a7920fa0655bdd2e7a294e23727519cd7 0 Wizard.Battle.Operation\SimulateRandomSelectFilter.cs Wizard.Battle.Operation\SimulateRandomSelectFilter.cs 2d15e18af41ec05545d8b1d6db64f5d25240828ce3284d81fd23f775fa8c00f2 0 Wizard.Battle.Operation\SimulationSelection.cs Wizard.Battle.Operation\SimulationSelection.cs efe3abe803236d55e3594f15b65dafd9fff41a526e291a217ce63d1b89ecb475 0 +Wizard.Battle.Operation\SkillOperationCommandBase.cs Wizard.Battle.Operation\SkillOperationCommandBase.cs 6de20c71e94e1c620846cfb5decefdd8e345da027540ef66a834c715e3c40664 0 +Wizard.Battle.Operation\SkillTargetInfo.cs Wizard.Battle.Operation\SkillTargetInfo.cs e4a6b9b4e958284eeba861005523a0aabd366cdc427ca80078b180d565c6ffe0 0 Wizard.Battle.Operation\TurnEndOperationCommand.cs Wizard.Battle.Operation\TurnEndOperationCommand.cs 2d89809870675e678f07161469602becac62efd9dcef35f5e185ccdbf9b43fa6 0 Wizard.Battle.Phase\IPhase.cs Wizard.Battle.Phase\IPhase.cs dacb64f72e43ea5c900c2fba5abcae616e9243f2c80bd2129af54263636f5ad7 0 Wizard.Battle.Phase\IPhaseCreator.cs Wizard.Battle.Phase\IPhaseCreator.cs 14fceafb7bfc643cc5022d38744b03926cda07bb67d1178b36a7ea614432259e 0 @@ -1343,15 +1484,22 @@ Wizard.Battle.Phase\OpeningPhase.cs Wizard.Battle.Phase\OpeningPhase.cs c47c0336 Wizard.Battle.Phase\PhaseCreatorBase.cs Wizard.Battle.Phase\PhaseCreatorBase.cs a5641cd3ac277cb47bd0d2e2ee904bc17155ecb18f2e4c2b60a3d643be9ed06d 0 Wizard.Battle.Phase\RecoveryAfterMulliganPhase.cs Wizard.Battle.Phase\RecoveryAfterMulliganPhase.cs 8b75c76e7a0122bff7e06a1bfe0817f1ce84585dea460e0d99225fb20d5fe4f5 0 Wizard.Battle.Phase\RecoveryNetworkBeforeSubmitMulliganPhase.cs Wizard.Battle.Phase\RecoveryNetworkBeforeSubmitMulliganPhase.cs 6f16e1181f83f47de29f27017d1ecfd8aa6963f55524ee3457cc1a428778fb1e 0 +Wizard.Battle.Phase\ResultPhase.cs Wizard.Battle.Phase\ResultPhase.cs 82729c54c9b19486a199fa40f6fc43d74092ac457e4c2e3bcff73b7113adbb25 0 +Wizard.Battle.Phase\SingleMulliganPhase.cs Wizard.Battle.Phase\SingleMulliganPhase.cs 949ba3c58a0cb59f6ed337a46c3b949a60387390c0b310f545465dc09e7d6e48 0 Wizard.Battle.Player.ClassCharacter\Class3dCharacterBase.cs Wizard.Battle.Player.ClassCharacter\Class3dCharacterBase.cs e30cc0fc68c1164411d0420f753d2597c166db94670eb8959bbfca401d7088ca 0 Wizard.Battle.Player.ClassCharacter\ClassCharacterBase.cs Wizard.Battle.Player.ClassCharacter\ClassCharacterBase.cs 76c74e23c52d36176339dfb50f6885660ef587601b80cc2a882682bf0332429c 0 Wizard.Battle.Player.ClassCharacter\HighRankSpineClassCharacter.cs Wizard.Battle.Player.ClassCharacter\HighRankSpineClassCharacter.cs 17f31270da67508f21987a11ad6978745cade12c9dec53249b6a508a58a2e773 0 Wizard.Battle.Player.ClassCharacter\IClassCharacter.cs Wizard.Battle.Player.ClassCharacter\IClassCharacter.cs c1a985539e3b304260d87f4af6ec249d939dc0385e7cd902634296c4127d991f 0 +Wizard.Battle.Player.ClassCharacter\PlayerHighRankSpineClassCharacter.cs Wizard.Battle.Player.ClassCharacter\PlayerHighRankSpineClassCharacter.cs fd0ac732efff8feee43aabf86cfc089e93f874ad8e4a40e60e538cf092b4e821 0 Wizard.Battle.Player.ClassCharacter\SpineObject.cs Wizard.Battle.Player.ClassCharacter\SpineObject.cs bd325662311d523dc9948557b3ddf899ed5a72fe18430f69e307360f7fa6758f 0 Wizard.Battle.Player.Emotion\Debug722006NullVfx.cs Wizard.Battle.Player.Emotion\Debug722006NullVfx.cs 65801eb05b7c9ee4c6514faa6d67f2d632ee95a47a74836a2f34072fe19a30db 0 Wizard.Battle.Player.Emotion\EmotionBase.cs Wizard.Battle.Player.Emotion\EmotionBase.cs 8a8edb24dbf845b07acf74e70658335d8fe23f67105e1e70e814153b836d4fad 0 +Wizard.Battle.Player.Emotion\EnemyEmotionBase.cs Wizard.Battle.Player.Emotion\EnemyEmotionBase.cs 35c86dd528fcab638f076c4bf0ef4f4b96737b83bba5450d117abe5024aaec6c 0 Wizard.Battle.Player.Emotion\IEmotion.cs Wizard.Battle.Player.Emotion\IEmotion.cs 289e34823e07e0fa97f0259e3eeeeb1e0475f5c78aff8f6515f4208c7ad2f2e5 0 Wizard.Battle.Player.Emotion\IPlayerEmotion.cs Wizard.Battle.Player.Emotion\IPlayerEmotion.cs fe56394e17ad9a097aa1ef3da9df965c05e62c9850c21601b49b6eb87841d1d8 0 +Wizard.Battle.Player.Emotion\NetworkOpponentEmotion.cs Wizard.Battle.Player.Emotion\NetworkOpponentEmotion.cs 25657cf1f6415c83bc58885dc513d76ccf7985933773feb8dd39d47b3c1be6a8 0 +Wizard.Battle.Player.Emotion\NullEmotion.cs Wizard.Battle.Player.Emotion\NullEmotion.cs c1318df605e2d6091d061ae7ab2912086641339782ce7772ccdb69e6017751d6 0 +Wizard.Battle.Player.Emotion\NullPlayerEmotion.cs Wizard.Battle.Player.Emotion\NullPlayerEmotion.cs 06b4b9904bff94caec65f7ac4787c26e8a5a1d8c7bf011d71c9ee72206d3795c 0 Wizard.Battle.Player.Emotion\PlayerEmotion.cs Wizard.Battle.Player.Emotion\PlayerEmotion.cs f5c02d38012cea684c668d7db6b07cdeaecd31072a6d2bc727fc2ddbbb5689ca 0 Wizard.Battle.Recovery\BattleConditionEnemyInfo.cs Wizard.Battle.Recovery\BattleConditionEnemyInfo.cs 35f6c55a91314ee7cda4d1c93658aaafa972118ef0363c736dcd752bcaaaaaf0 0 Wizard.Battle.Recovery\BattleConditionInfo.cs Wizard.Battle.Recovery\BattleConditionInfo.cs d24a150006f866efadf537fd45c760cfed23d3373be6c7fcf39438827e00226f 0 @@ -1363,6 +1511,8 @@ Wizard.Battle.Recovery\HandCardInfo.cs Wizard.Battle.Recovery\HandCardInfo.cs b0 Wizard.Battle.Recovery\IRecoveryManager.cs Wizard.Battle.Recovery\IRecoveryManager.cs 183fafee041522a2c67f6e3c0b50751e4591e507f8f2950658fbc29ad3cbc78d 0 Wizard.Battle.Recovery\IRecoveryRecordManager.cs Wizard.Battle.Recovery\IRecoveryRecordManager.cs f8f95b3c268918fd18b849616a576e763819bf3d376dbbdb4a60393370a2d4e7 0 Wizard.Battle.Recovery\InPlayCardInfo.cs Wizard.Battle.Recovery\InPlayCardInfo.cs 63491906ad4c2e18fd2e7eadec2ee92d15eda18b8f726ec38f969da79e30155c 0 +Wizard.Battle.Recovery\NullRecoveryManager.cs Wizard.Battle.Recovery\NullRecoveryManager.cs cda3f270ddd3fd686a0c2c97fe4cf2db18c7355456edf2f8c35f60caff753f32 0 +Wizard.Battle.Recovery\NullRecoveryRecordManager.cs Wizard.Battle.Recovery\NullRecoveryRecordManager.cs d9fc4f9bbf285d820fd6e4346de1f23986428383ef791aed731adcdc8b168480 0 Wizard.Battle.Recovery\OperationRecorderBase.cs Wizard.Battle.Recovery\OperationRecorderBase.cs 1291b862fc0bccd5cc9c96af41498e36e2521a1c0f0655a81f78b4d4eef02877 0 Wizard.Battle.Recovery\RecoveryController.cs Wizard.Battle.Recovery\RecoveryController.cs b433838072979be22767455344a4529b74ec0cc4261c4606ec2100897b7e8889 0 Wizard.Battle.Recovery\RecoveryDataHandler.cs Wizard.Battle.Recovery\RecoveryDataHandler.cs 972832014b77ce9a1f5fff1df87a2222b8c62aedc2057bb931646e85bee24c08 0 @@ -1371,7 +1521,11 @@ Wizard.Battle.Recovery\RecoveryOperationInfo.cs Wizard.Battle.Recovery\RecoveryO Wizard.Battle.Recovery\RecoveryRecordManagerBase.cs Wizard.Battle.Recovery\RecoveryRecordManagerBase.cs 272f5bf53d47ca90c2ad69377eab055c2e6f47fac6421a4864c0f414383ff973 0 Wizard.Battle.Recovery\ResultConditionInfo.cs Wizard.Battle.Recovery\ResultConditionInfo.cs 52d21760da08ba7b0e6e067cb7dc7a3890638ed6949305d3ad42a1fdf04e4743 0 Wizard.Battle.Recovery\SetupConditionInfo.cs Wizard.Battle.Recovery\SetupConditionInfo.cs a5b78784312eb08496ef6db3b2c61a53957cf288c93c53714674972f5f4d2b9e 0 +Wizard.Battle.Recovery\SingleBattleRecoveryManager.cs Wizard.Battle.Recovery\SingleBattleRecoveryManager.cs 25db0435c1699768e94c47a781a343fcb610d6fff36d07d8f761e0f00e776957 0 +Wizard.Battle.Recovery\SingleBattleRecoveryRecordManager.cs Wizard.Battle.Recovery\SingleBattleRecoveryRecordManager.cs ab5cd4adaf2efa49f19cf91da2892271a730eb764a2024c0c5694aa7752c15b3 0 +Wizard.Battle.Resource\BattleResourceMgr.cs Wizard.Battle.Resource\BattleResourceMgr.cs 3b4f7a78710d82e763164ca8bdf257a4c238b9986120e4d560be27574c179e57 0 Wizard.Battle.Resource\IBattleResourceMgr.cs Wizard.Battle.Resource\IBattleResourceMgr.cs 59e39c39afa8186f237fa879f5cdb043aa2dc99e5117eb0e1204df77b563d607 0 +Wizard.Battle.Resource\NullBattleResourceMgr.cs Wizard.Battle.Resource\NullBattleResourceMgr.cs 492b03d15cadeb08296bc74eb1a1b0c887756d1d87071ca1486a49f848a29a15 0 Wizard.Battle.Sound\LeaderSoundManager.cs Wizard.Battle.Sound\LeaderSoundManager.cs 50eb5262cd65deb22c5eb5ea3b47735844e8282d3e9b2ac064f520a9e12d397f 0 Wizard.Battle.Touch/ITouchProcessor.cs Wizard.Battle.Touch/ITouchProcessor.cs 6343a8aa50461bcb5e99f9cc9a689d81bd62516266456f7821da962ab93bd369 0 Wizard.Battle.UI/IClassInfomationUI.cs Wizard.Battle.UI/IClassInfomationUI.cs 05831a370255fda7e5f0091a278fb0c35ce7dd81c504395127589505e9cce4ee 0 @@ -1385,6 +1539,8 @@ Wizard.Battle.View/IClassBattleCardView.cs Wizard.Battle.View/IClassBattleCardVi Wizard.Battle.View/IPlayerView.cs Wizard.Battle.View/IPlayerView.cs d0f937abd9dfa4130e0d0ea2892c539aef0023df1eeb0d0dbe13a4f80ee26f50 0 Wizard.Battle/ActionProcessor.cs Wizard.Battle/ActionProcessor.cs 7c8b40454a4948dd48a58c0efc240703eab9a77aea0add64e542f6b06c7323af 0 Wizard.BattleMgr\IBattleMgrContentsCreator.cs Wizard.BattleMgr\IBattleMgrContentsCreator.cs 7f1410027b146fe028bfadf5940599f1e576063dfa764e0be2754dfd7d19e30f 0 +Wizard.BattleMgr\RecoveryNetworkBattleMgrContentsCreator.cs Wizard.BattleMgr\RecoveryNetworkBattleMgrContentsCreator.cs e99bea259ffacb5780693918571ecd548b01c567b2266aa9a1ac9d17423a242a 0 +Wizard.Battle\EnemyAIInnerOptionsBuilder.cs Wizard.Battle\EnemyAIInnerOptionsBuilder.cs caaecda6f73da8c458bee8f4e67dd5ea1bfaf8cf17c2cf1636e98fff84a927b0 0 Wizard.Battle\IBattleCardUniqueID.cs Wizard.Battle\IBattleCardUniqueID.cs 0b1559e61bfd02f584b4830ad53aa6ce521665c00ff44ee89dda2953c9c3d781 0 Wizard.Battle\IInnerOptionsBuilder.cs Wizard.Battle\IInnerOptionsBuilder.cs 38160d48e9b01d686c0fd51a5743ee97afb742c97c1fda347460047a7d17b928 0 Wizard.Battle\IReadOnlyBattleCardInfo.cs Wizard.Battle\IReadOnlyBattleCardInfo.cs 1b3456595cf0664d7b1e3324268f84cf913c3e2778ecbacc63b0c0ba72ab2e8c 0 @@ -1393,6 +1549,7 @@ Wizard.Battle\NullInnerOptionsBuilder.cs Wizard.Battle\NullInnerOptionsBuilder.c Wizard.Battle\PlayerInnerOptionsBuilder.cs Wizard.Battle\PlayerInnerOptionsBuilder.cs 0ed76b5df3e18db737576bc6a4c8f06dbdaf227a67d8ca07d39cbbc10947e970 0 Wizard.Bingo\BingoDrawTask.cs Wizard.Bingo\BingoDrawTask.cs 9c235721777d20d8d0bf0eba785c92b794881142c4904ead3fbb73bd9c28d995 0 Wizard.Bingo\BingoInfoTask.cs Wizard.Bingo\BingoInfoTask.cs 3c651be0075b3dfdf781286166ddcffa16771a6a73eff7ae7d76a8a9e7a8d315 0 +Wizard.Bingo\BingoPage.cs Wizard.Bingo\BingoPage.cs 5e806667bd74fcd0ba59bdd9506d53a3395b4a76f0607518579a3c2022e01fc5 0 Wizard.DeckCardEdit\CachingCardBundle.cs Wizard.DeckCardEdit\CachingCardBundle.cs 3efcb163e9be8d023e12394684c83745081c500cf13a84b91674aab0eeace113 0 Wizard.DeckCardEdit\CardBundle.cs Wizard.DeckCardEdit\CardBundle.cs ae56efeea60e2288b595d57f6b48bc83661ff8f22b0607746a39b080714e439e 0 Wizard.DeckCardEdit\CardBundleController.cs Wizard.DeckCardEdit\CardBundleController.cs fa0cf42cf3d42e56dbcf0702ba21f15ccf4f4f38a7318472cbf8f473f7d97a61 0 @@ -1405,6 +1562,7 @@ Wizard.DeckCardEdit\CardSelectListUI_State_Edit.cs Wizard.DeckCardEdit\CardSelec Wizard.DeckCardEdit\DeckCardEditUI.cs Wizard.DeckCardEdit\DeckCardEditUI.cs ac6172c070e028adf71839ba2a607383dcd58168077e68243ae53e4dc618abac 0 Wizard.DeckCardEdit\DeckSave.cs Wizard.DeckCardEdit\DeckSave.cs 1fd5f1ef0fcb288eb9e28a0dce4796cce3afd61d7d2692e931f83111516825e1 0 Wizard.DeckCardEdit\FilteringCardBundle.cs Wizard.DeckCardEdit\FilteringCardBundle.cs 920e6cb5399277f6f2e2825e6cd5610b5d4dffb50d4c87b540a1d4b53b5d97ca 0 +Wizard.DeckSelect.FirstDisplayPageIndexGetter\DefaultFirstDisplayPageIndexGetter.cs Wizard.DeckSelect.FirstDisplayPageIndexGetter\DefaultFirstDisplayPageIndexGetter.cs e0c65bb6b43540c9021988f3517a05eb138134aa5b8fd16b74e9010eccf81f35 0 Wizard.DeckSelect.FirstDisplayPageIndexGetter\FirstDisplayPageIndexGetterBase.cs Wizard.DeckSelect.FirstDisplayPageIndexGetter\FirstDisplayPageIndexGetterBase.cs 40d49191845c1ef7511756a754e18726428eb4a14a4c3e2216cf8f04f4b0b95b 0 Wizard.DeckSelect.FirstDisplayPageIndexGetter\IFirstDisplayPageIndexGetter.cs Wizard.DeckSelect.FirstDisplayPageIndexGetter\IFirstDisplayPageIndexGetter.cs c0964e222f42a338369b5b77bfa65080dc7cf3b89cf384ae3f6068d982cd2b6c 0 Wizard.DeckSelect.FirstDisplayPageIndexGetter\QuestFirstDisplayPageIndexGetter.cs Wizard.DeckSelect.FirstDisplayPageIndexGetter\QuestFirstDisplayPageIndexGetter.cs 5e9ccf095c3d5aaa4e48b1de47ca7fc2f933e622ef4463d0861a90b5e1a7be99 0 @@ -1416,10 +1574,16 @@ Wizard.Dialog.Setting\ItemSlider.cs Wizard.Dialog.Setting\ItemSlider.cs cba121f5 Wizard.Dialog.Setting\ItemToggle.cs Wizard.Dialog.Setting\ItemToggle.cs f4e3ab638edcd310a56da40c48c578fb2d1419836f631fc51927687e9df7c4fb 0 Wizard.Dialog.Setting\SettingBase.cs Wizard.Dialog.Setting\SettingBase.cs 57bb82b20bdeca249e6991783268f707de706f2e456bfb063714be3af75c3cf6 0 Wizard.ErrorDialog\Dialog.cs Wizard.ErrorDialog\Dialog.cs 19ca6f8150bbec122121a53c1166ad4fb5634e58c7e233b5be79d3865a2c23b7 0 +Wizard.Lottery\DoubleChanceData.cs Wizard.Lottery\DoubleChanceData.cs 45ae69b003caf8018be47699ccd21d4979cd0ef83a84e46acc50e6425f247c34 0 Wizard.Lottery\LotteryApplyData.cs Wizard.Lottery\LotteryApplyData.cs a1f736b119c42db936962ef4b57821e5f0aaf4ab1458b6c2f92f25c727e4efcc 0 Wizard.Lottery\LotteryApplyDialog.cs Wizard.Lottery\LotteryApplyDialog.cs 8787f2ff7ae2f2b65a3b8c67419ccaa7bde8cef3345f5b439c5947dec470904d 0 +Wizard.Lottery\LotteryInfoTask.cs Wizard.Lottery\LotteryInfoTask.cs 9ffdf996f9d23511427a2d19f85056187ed619fcc057f2d5a5f982f2cff48f6e 0 Wizard.Lottery\LotteryLoadTaskData.cs Wizard.Lottery\LotteryLoadTaskData.cs 4c935c7750aed7c86abc7984c465c869b5f3b6535e0c62925b74e0f9dac5d5c0 0 Wizard.Lottery\LotteryMissionData.cs Wizard.Lottery\LotteryMissionData.cs 2844dfd64d868c6ee758e9a32c986cdc2ffe9c3d7cefba74f151b3248569a9a0 0 +Wizard.Lottery\LotteryPage.cs Wizard.Lottery\LotteryPage.cs a5a97a7b28946779d4ebea31cccd2b6277bbbbae945823110f3f23541ba07977 0 +Wizard.Lottery\LotteryRewardData.cs Wizard.Lottery\LotteryRewardData.cs 27fadecd62fe1cb28a699bd3c50d1524810c60f9e12bb1ffdacda4bba8f51281 0 +Wizard.Lottery\LotterySpecialRewardDialog.cs Wizard.Lottery\LotterySpecialRewardDialog.cs e0081b816349f36c61bf8f82f4a4dc461258da6dd89f9877a15bf43942677792 0 +Wizard.Lottery\LotteryTreasureBox.cs Wizard.Lottery\LotteryTreasureBox.cs 9eafd4ea6ea090d35cfa571b6e9b0f86d28a5f9515cdc5365588b32789bee88c 0 Wizard.QuestSpecialResult\QuestAssetManager.cs Wizard.QuestSpecialResult\QuestAssetManager.cs 13ae6dae3eb9d98368e13a0435e061fa70f0b8a5965c591e3bd41ff16d452947 0 Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateCard.cs Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateCard.cs b89c513435bb4d68607d6d0e5ee95a76144fd0fccb5abdb58b1a73ffed9a7309 0 Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateChaos.cs Wizard.Scripts.Network.Data.TableData.Arena.TwoPick\CandidateChaos.cs cfb1306d5d36d0221864b7302fa4f4949faa16c8cd0c4a6421b681e6326b0d96 0 @@ -1445,6 +1609,7 @@ Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase\BuildDeckSeriesPurchaseIn Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseBuyTask.cs Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseBuyTask.cs 5efb8b505dfdce8f140a7272da996a88f88f6689bce8fa1cc1a7e849ceeedca2 0 Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseData.cs Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseData.cs 0804c342fc51f32cc6960cf06b9fb48de29b7c63cfe6f97b52b6c0144c872f02 0 Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseInfo.cs Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseInfo.cs 6a7f437d68999ac72e72ee3b2770792118bc3831d0186e1848885ad863fde0f6 0 +Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseInfoTask.cs Wizard.Scripts.Network.Data.TaskData.ItemPurchase\ItemPurchaseInfoTask.cs 3a3a316f5c0c9690d79e6971397ec4733db43a5181756bdc4f470ffafe3b068c 0 Wizard.Scripts.Network.Data.TaskData.Ranking\MonthlyRanking.cs Wizard.Scripts.Network.Data.TaskData.Ranking\MonthlyRanking.cs ee7df866956e2aedc6236294098a235b1298543040bdb39edfb90d850fb15363 0 Wizard.Scripts.Network.Data.TaskData.Ranking\MyMasterPointHistories.cs Wizard.Scripts.Network.Data.TaskData.Ranking\MyMasterPointHistories.cs cbe5266fc37e82bdb0c3c094e4cd82681f187e83a6ad8adebdc88a29680deb6c 0 Wizard.Scripts.Network.Data.TaskData.Ranking\Ranking.cs Wizard.Scripts.Network.Data.TaskData.Ranking\Ranking.cs ec842ab5aac1dad72bba1e0e4722d17648d7ac568cb5795f9cd6703726853f15 0 @@ -1462,6 +1627,103 @@ Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\GachaPointExchangeTask.cs Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeInfoTask.cs Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeInfoTask.cs bec97c8be6a014ee2d01e4855dc090022b70119e51856978c8bbe15608336d7c 0 Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeTask.cs Wizard.Scripts.Network.Data.TaskData.SpotCardExchange\SpotCardExchangeTask.cs 53581da430a338cb178b66c999b918e94ad9910b1f3a817fef051cdd779aecd2 0 Wizard.Scripts.Network.Data.TaskData\ItemAcquireHistoryInfo.cs Wizard.Scripts.Network.Data.TaskData\ItemAcquireHistoryInfo.cs 4c472401abcddb81bf2cdaaddc6ed0ade73d7da1dfb9f67c3452ee5a4c969723 0 +Wizard.Scripts.Network.Task.Arena.Competition\CardChooseTask.cs Wizard.Scripts.Network.Task.Arena.Competition\CardChooseTask.cs 93ccfceafd67e9942a7b317b90451bd68c55797e495216c6b44bb1e8638938f4 0 +Wizard.Scripts.Network.Task.Arena.TwoPick\ClassCharaChooseTask.cs Wizard.Scripts.Network.Task.Arena.TwoPick\ClassCharaChooseTask.cs 8bcdf7ed2a08f985de5f275fa170b78dfb1a8e2476dfca944dd7247d6af7d8bd 0 +Wizard.Scripts.Network.Task.Arena.TwoPick\FinishTask.cs Wizard.Scripts.Network.Task.Arena.TwoPick\FinishTask.cs 681c3bdb8be55a1f506cccdfd59b3e7f0af81516678797449e868fdef781d96a 0 +Wizard.Scripts.Network.Task.Arena.TwoPick\TwoPickDoMatchingTask.cs Wizard.Scripts.Network.Task.Arena.TwoPick\TwoPickDoMatchingTask.cs 19f1b7e448c04ffd7adc9c67159fbe9267f56d69befe0de0bec64d32110bd785 0 +Wizard.Scripts.Network.Task.Arena.TwoPick\TwoPickFinishBattleTask.cs Wizard.Scripts.Network.Task.Arena.TwoPick\TwoPickFinishBattleTask.cs 53ed74a982e1b150d4529cbe599e4d78956e6c8553a9587c2eab2b740e2cdfe4 0 +Wizard.Scripts.Network.Task.Arena\ArenaEntryTaskBase.cs Wizard.Scripts.Network.Task.Arena\ArenaEntryTaskBase.cs c90dd25ddbe958f1b7dd5232fc1fb0869c633aa8f5479a254eca74e9b8caf21a 0 +Wizard.Scripts.Network.Task.Arena\ArenaRetireTaskBase.cs Wizard.Scripts.Network.Task.Arena\ArenaRetireTaskBase.cs 360c197720496476b74663417abc4fe0566aa80ec367b6b78e53873de3e9382c 0 +Wizard.Scripts.Network.Task.Arena\ArenaTopTaskBase.cs Wizard.Scripts.Network.Task.Arena\ArenaTopTaskBase.cs fbe64a62489560079041134eec8e483370391d4196c0cb405cb96d999a22a442 0 +Wizard/AIAccelerateUtility.cs Wizard/AIAccelerateUtility.cs 3cc7d0196d1b8264fa1acc64f15cd394d9278fe3432de268f7860db041ebbb9f 0 +Wizard/AIAttachTagSimulationUtility.cs Wizard/AIAttachTagSimulationUtility.cs 642ab3d7c5215294dca2b0340cde2ac4d10f2a51eb4dc08821dfdb2154e750fb 0 +Wizard/AIAttachedTagRemoveTiming.cs Wizard/AIAttachedTagRemoveTiming.cs 8e9fcb21eb1ef0d5eaa4f3e7baab1b7074b930b8cbeedf2205632c759716e381 0 +Wizard/AIAttackableCountSimulationUtility.cs Wizard/AIAttackableCountSimulationUtility.cs 52565094c93508241f9c63266ffb8f2995f5f5662ff88431922674e5726b53df 0 +Wizard/AIBanAttackSimulationUtility.cs Wizard/AIBanAttackSimulationUtility.cs 2ff8a7514a804143901f369c14bbe4dbbb19b68fb040623202ab051503e4dbd2 0 +Wizard/AIBanishSelectLogicArgument.cs Wizard/AIBanishSelectLogicArgument.cs 14f0aab679d51d6d80f0da96d42ee7ae0cc43d95fa49ac6f438ed6466c165f06 0 +Wizard/AIBanishSimulationUtility.cs Wizard/AIBanishSimulationUtility.cs f74d601995fb6bbd292dcbc2d70214756a265b21e938b3bbf7f85a1e7e0546d8 0 +Wizard/AIBarrierGlobal.cs Wizard/AIBarrierGlobal.cs 55686ebf9a77cc69d8fd3a19e2a2e4c527cd6ff0edbc5a431397d7f9124a7bdb 0 +Wizard/AIBasicTargetSelectUtility.cs Wizard/AIBasicTargetSelectUtility.cs 75525d16629b77f4f27ddfea6cee68059109c98ea618e2c8d4b161fc30e6e68b 0 +Wizard/AIBerserkUtility.cs Wizard/AIBerserkUtility.cs 94c6827ae773205374ecb80b82e47080d765696c3fd382cdec1a038a4d470254 0 +Wizard/AIBounceSelectLogicArgument.cs Wizard/AIBounceSelectLogicArgument.cs 8866f8448a80272d3ae32eb5e27656aefc86397b3d461e141f571f88cbe9fc5b 0 +Wizard/AIBounceSimulationUtility.cs Wizard/AIBounceSimulationUtility.cs 969780defa02f2240d956a12a1aa3ac0d7175dcaf6ecb232dc6bdf547a4d1b89 0 +Wizard/AIBrokenCostSumUtility.cs Wizard/AIBrokenCostSumUtility.cs 0122cdb6fea1a02733575b495b9b8c133e2dea3387b4dbe5a1d317785cae29d3 0 +Wizard/AIBuffCountUtility.cs Wizard/AIBuffCountUtility.cs e2da1d0a309dcdb701d22bdc3bb372436fef59a4b2b2914c0998059c01a9ab2d 0 +Wizard/AIBuffEvaluationUtility.cs Wizard/AIBuffEvaluationUtility.cs 923a4fe2434a48e467166bb6724b5a0deb81aaa9dcf1d8e505b979ffada9f716 0 +Wizard/AIBurialUtility.cs Wizard/AIBurialUtility.cs 74c699d1ecf996fb91e850825e5cf81ff1faea80ec9933aad85b8c4e3d854eac 0 +Wizard/AICannotPlaySimulationUtility.cs Wizard/AICannotPlaySimulationUtility.cs 34c15c417b18dc0f2cad90c0a37fc768027f4351b17500fa5f57dbe99930db0b 0 +Wizard/AIChangeClassSimulationUtility.cs Wizard/AIChangeClassSimulationUtility.cs add3d57f93089afc2a444c0d62544ae4adadc9931b9fa375f110d5294996c6ab 0 +Wizard/AIChangeCostSimulationUtility.cs Wizard/AIChangeCostSimulationUtility.cs 7c3320d4812e9a28469cbf1638e5e06c87bf49054a72154df1ded4ea622cd9d5 0 +Wizard/AIClashHeal.cs Wizard/AIClashHeal.cs 475805f471153a7dbd8a6acc2d4c845f58d592a6718d2713eff61433bbfe9837 0 +Wizard/AICopyTagSimulationUtility.cs Wizard/AICopyTagSimulationUtility.cs b8c2deaa29de4f39aaa02234e98a4f7fd340fef70719e98ca1a38ab3ea5fd047 0 +Wizard/AICountdownChangeUtility.cs Wizard/AICountdownChangeUtility.cs c2494aa8456455f3e02330fd561f57d29bad570416d726997f94fc8e318970fc 0 +Wizard/AICrystalizeUtility.cs Wizard/AICrystalizeUtility.cs f1e26520421a44f51907703feb043d473ec1efb33720eb85e60c067b5765083e 0 +Wizard/AIDamageClippingInfo.cs Wizard/AIDamageClippingInfo.cs 0dc2c03a3c31cae76198b3a978687cf0cb718dd5cfb22e9cefa0f0d71535a7ae 0 +Wizard/AIDamageCutInfo.cs Wizard/AIDamageCutInfo.cs 6b4c030a670ce5e60685ff3c9d3ef27b028217b15f795258e793bc5311f96b7e 0 +Wizard/AIDamageSelectLogicArgument.cs Wizard/AIDamageSelectLogicArgument.cs 041432b05d8068061e4795bb4e0486373c95d456e39d16576eec37eb633722b5 0 +Wizard/AIDamageSimulationUtility.cs Wizard/AIDamageSimulationUtility.cs f3b5f51924691f9e64b486277d59f37629fa44e8b076a61d09ea8e745de41c37 0 +Wizard/AIDeckSimulationUtility.cs Wizard/AIDeckSimulationUtility.cs b957947f7d0f7a37c11e0646863687820ed76bdd5d996bc571778b177ea90679 0 +Wizard/AIDefaultSelectLogicArgument.cs Wizard/AIDefaultSelectLogicArgument.cs c45df870462317321cce0a1f952b50b16e35a82c31138f286ec645c4cff736b0 0 +Wizard/AIDestroySelectLogicArgument.cs Wizard/AIDestroySelectLogicArgument.cs 4ea804180fb1966c5f7eb2dff8e94a9682d35e812cb25e8aa4692226b6bb4dfb 0 +Wizard/AIDestroySimulationUtility.cs Wizard/AIDestroySimulationUtility.cs dfaa3fae772cefecb4e5b67cfb16e3a29fdcb68efb5b917a12618833d75c01d9 0 +Wizard/AIDrawCountUtility.cs Wizard/AIDrawCountUtility.cs 5947b948544fd4af48637c0e2bf4b9b08f52f99d518b4609151895036b6e3c90 0 +Wizard/AIEmoteCtrlNull.cs Wizard/AIEmoteCtrlNull.cs 2b3f870faaa22a4c729a45ae99a60c180d2d4eadff8b36a8b620f54a7135d816 0 +Wizard/AIEnemyHandTagCollectionContainer.cs Wizard/AIEnemyHandTagCollectionContainer.cs bb8efc8abf69a65d80e007aa9b6e99f530d1da6f108ac161dd04b3c44e7f740c 0 +Wizard/AIEnhanceUtility.cs Wizard/AIEnhanceUtility.cs 7481cd0104af9faf09cf068a50137922ca661259580ddfcdaa01ab777d30db95 0 +Wizard/AIEvalAttackRemoveUtility.cs Wizard/AIEvalAttackRemoveUtility.cs dcb6b18227f53689161bf9e602653b7ad3d36d22ad6c8c42c26e344ca38ce180 0 +Wizard/AIEvalReanimateUtility.cs Wizard/AIEvalReanimateUtility.cs 0503a13ceb88e7beac859202819f480821b5cb75c7bd1469fb45d12710ac910f 0 +Wizard/AIEvaluateTagExtension.cs Wizard/AIEvaluateTagExtension.cs 7704ec34bf0e9d20d262f539203644563e068835014b5e3258646f4828192152 0 +Wizard/AIFusionCountUtility.cs Wizard/AIFusionCountUtility.cs 381e67bde5c8873fc74b20ee19d6799c1767c0a4a24ede4a55e12dfed3cb10cc 0 +Wizard/AIGenerateTagUtility.cs Wizard/AIGenerateTagUtility.cs 17fab802cc06ff63c274b8c9fac589b97564ca7cca73719508dc5a40f908983d 0 +Wizard/AIGetPreprocessInformationUtility.cs Wizard/AIGetPreprocessInformationUtility.cs e09fb1fd4c38f382c4341543ca872801e9c6ed54890b278b70fac544f45118e3 0 +Wizard/AIGetStatusUtility.cs Wizard/AIGetStatusUtility.cs 4aa4757c3b233a92e568540155fd96d6a8a9e7e655a115afd626f2b4dca2cfca 0 +Wizard/AIHandBuffSimulationUtility.cs Wizard/AIHandBuffSimulationUtility.cs 3315a797f5f349057bc2a23c7d1ad0e425362a36653634510f7fbb9b4ae5b771 0 +Wizard/AIHandCountUtility.cs Wizard/AIHandCountUtility.cs 2d94217494ab839b77d30b4927af515fa97a81ff5b27766b78fe3c4d265de114 0 +Wizard/AIHealCountUtility.cs Wizard/AIHealCountUtility.cs d08e694f0d5f2409e9fef30e37bd21922462dde5a5121c9e80ff3a932d4dafe9 0 +Wizard/AIHealSimulationUtility.cs Wizard/AIHealSimulationUtility.cs 078d7bdbecf77edcc2d8b0c8959722f27c72eb1a1410e448e49be75905c6da9d 0 +Wizard/AIIsSelectableUtility.cs Wizard/AIIsSelectableUtility.cs 38778a80c91cfe89dd56c4e66b7acc17f85cde17929cd48e176ea98fd8d906e8 0 +Wizard/AILethalTargetSelectUtility.cs Wizard/AILethalTargetSelectUtility.cs 15d744de8077c7338fccd76f2600ae4f222322eb1ce28d6dccff81139c6fa740 0 +Wizard/AILifeLowerLimitInfo.cs Wizard/AILifeLowerLimitInfo.cs 909e1157b80bb065f09d24f58bf5579d63787fd77b7904c471fb7b51781329b6 0 +Wizard/AIMaxAttackSelectLogicArgument.cs Wizard/AIMaxAttackSelectLogicArgument.cs 90fa7bf788888731608fb0cc62fea8f5330f4e9f140ed69b1be96206e3495a4c 0 +Wizard/AIMetamorphoseSelectLogicArgument.cs Wizard/AIMetamorphoseSelectLogicArgument.cs a42dfb26869b886ddc0262c8d343dea5f0fff0519cabe311c34ecbaa41e524cd 0 +Wizard/AIMetamorphoseSimulationUtility.cs Wizard/AIMetamorphoseSimulationUtility.cs 82ad59688a127f66b55336a6405725d36e5d2e6e95ad38e8f8a76d4ea0111d3d 0 +Wizard/AINetworkBattleManager.cs Wizard/AINetworkBattleManager.cs 9cc054fb2f7cb322fe977db6b07e4b2b48ae107f82b5dd1e25acd8504bf46c4b 0 +Wizard/AINotBeAttackedSimulationUtility.cs Wizard/AINotBeAttackedSimulationUtility.cs 8fc972df511b04ad92a8df0fb838d0ccd0ba64e74e8230e2bb56187100793676 0 +Wizard/AIOneMoreLastwordUtility.cs Wizard/AIOneMoreLastwordUtility.cs a314f9f0c5f88685fb4c65d832537c9310205c6a1f5c76b5b23392d1844f7a16 0 +Wizard/AIPlayBounce.cs Wizard/AIPlayBounce.cs b7deb06b21138a3d1eeedc4bff2749907b4a257f52976965bfc96f4a4a7b7f3b 0 +Wizard/AIPlayReanimate.cs Wizard/AIPlayReanimate.cs 998dba73d7dafa58d44669913fae805bdf961898daad628d1c9292e87ac350c4 0 +Wizard/AIPlayerLifeSimulationUtility.cs Wizard/AIPlayerLifeSimulationUtility.cs 5db5e8b840d670562d1fb798f600d61863a3259fadc63bd428c7bf022674b8ec 0 +Wizard/AIPlayoutAttackerCountUtility.cs Wizard/AIPlayoutAttackerCountUtility.cs feba9821435a91c6c7fc43566f17544fb21b397f1636e009a4f5f6a80a01b7a7 0 +Wizard/AIRallySimulationUtility.cs Wizard/AIRallySimulationUtility.cs f3bab3dfcb0c805391191b9c8ea649f3ef5cedb9c1448dad53221864acc1d879 0 +Wizard/AIRandomMultiDamageEvaluator.cs Wizard/AIRandomMultiDamageEvaluator.cs c052288bdf7056c8ca59c4277b30a4c5c164096e05408a31b815f313403c6d48 0 +Wizard/AIReanimateSimulationUtility.cs Wizard/AIReanimateSimulationUtility.cs 0412bb4d143b14a3d04cc4c54f7c06f6d5287b39121a67d9dc257038f4492a5c 0 +Wizard/AIRecoverAttackableCountUtility.cs Wizard/AIRecoverAttackableCountUtility.cs a38e7cbc81a836fd1049d5d6bc124506628bb9b38c80dd3e9951da0aa9c99c6f 0 +Wizard/AIRemovalEvaluationOption.cs Wizard/AIRemovalEvaluationOption.cs 326a951d66f7a7faead9258a13eab84879b8e6a2b1a06a54faab9554ba63ec2f 0 +Wizard/AIRemoveSkillSimulationUtility.cs Wizard/AIRemoveSkillSimulationUtility.cs 548c9db516d6b615ad52258e8f93c18af44b25fbc8b662e1428c249f28d1c2ed 0 +Wizard/AIReverseDiscardSelectLogicArgument.cs Wizard/AIReverseDiscardSelectLogicArgument.cs ed9abf7de3fadc653c2489a72e41c949e1cb03b0cb9a707ac202cf78ea61f283 0 +Wizard/AIReverseEvaluateValueListOrder.cs Wizard/AIReverseEvaluateValueListOrder.cs 256331e1b4a04de841f7ded6895d1dd5403b9b00c09ab3ab5e76f06b3e3ac161 0 +Wizard/AISelectLogicSimulationUtility.cs Wizard/AISelectLogicSimulationUtility.cs 6f937f9163a0c85c16e44cd700188b5fb71cb263c04c9361c4028cd9aca2ace2 0 +Wizard/AISetStatusSimulationUtility.cs Wizard/AISetStatusSimulationUtility.cs cf3be428b0b63c12d282eabfdc26d55723cd76cfacd7e2b0445295b46171b767 0 +Wizard/AIShieldInfo.cs Wizard/AIShieldInfo.cs 362ac60ea17695256734ef46d89791c6d10b8fdf6fffbb7064cb389cd0bd065f 0 +Wizard/AISimulationRemovalUtility.cs Wizard/AISimulationRemovalUtility.cs a788a2ca422b069fcdc1d7abd191537ceed966c06b00bdc2bd5b2c75ed3c4522 0 +Wizard/AISituationCurrentProcessAccessExtension.cs Wizard/AISituationCurrentProcessAccessExtension.cs b0126b9aa32c1230cdacdd5eb30cf533701ff884877d1187117b2ebb5fff7c17 0 +Wizard/AISkillActivateCountUtility.cs Wizard/AISkillActivateCountUtility.cs eb49fc2ce0c90f7129d6ca8dbdc75451be49f669e0ffec318d98c9f99e4b4faa 0 +Wizard/AISkillCountFromIdUtility.cs Wizard/AISkillCountFromIdUtility.cs 0f2fb854375d88702aeaf73857a37d5ec471491e651fe23e52af43aef0f22251 0 +Wizard/AISpellboostSimulationUtility.cs Wizard/AISpellboostSimulationUtility.cs 2cd04a1c60a16a2e95106b9ebb8c8ec87dfa5e2bdf8fc8f2eb04a201832c0ff8 0 +Wizard/AISubtractCountdownSimulationUtility.cs Wizard/AISubtractCountdownSimulationUtility.cs 547102c30d69f23e55119ae2a846f7a76a45ebb079c822ee035c71829de07379 0 +Wizard/AISummonCountUtility.cs Wizard/AISummonCountUtility.cs 4a15008906646dea908842ba9fef40ba3a6470a5fbab9d17c5af0ad983665249 0 +Wizard/AITagCountFromIdUtility.cs Wizard/AITagCountFromIdUtility.cs b4454056e099561d3c41d259bef12f3a9f03d394676912d8f8f554dd4bf1caef 0 +Wizard/AITurnEndMove.cs Wizard/AITurnEndMove.cs e36f779a7a013de24d997f73f92fee8c24d027449598dee77cc35965a7599a38 0 +Wizard/AITyrantOrderSelectLogicArgument.cs Wizard/AITyrantOrderSelectLogicArgument.cs bb6ddbbc525b90ae543a0d89f1fd2c7dfc0cd017502018953ac7f56cd50f0e98 0 +Wizard/AIUntouchableStopPreprocessOption.cs Wizard/AIUntouchableStopPreprocessOption.cs eca55f02cb7dc695f3c01b99e477b80564be1f0d6d68a2eee1784083f001fa9e 0 +Wizard/AIVirtualCardUpdateInformationExtension.cs Wizard/AIVirtualCardUpdateInformationExtension.cs 12e5491c2b53081b4f67c0386917af8efef7e5c3ee18345aaa0ef6a1b50e6758 0 +Wizard/AIVirtualFieldInitializeUtility.cs Wizard/AIVirtualFieldInitializeUtility.cs 74d9cc5bed25a8b5307e9a4cc64e82944e471870311fe1de5005a88b8b52e1d9 0 +Wizard/AIVirtualFieldTagProcessExtension.cs Wizard/AIVirtualFieldTagProcessExtension.cs f16ccaa76b951bf0d0856ffb734c6b0d551915c18ce213b50365203e9e4b16db 0 +Wizard/AIVirtualFusionSimulator.cs Wizard/AIVirtualFusionSimulator.cs 216b30526c1c20f6f68ca442a8a91f3f8b4bf6c5288c4e7d8244a2655d0e562c 0 +Wizard/AIVirtualRemovalInfo.cs Wizard/AIVirtualRemovalInfo.cs 465ad9429d71e91b8362474f8b924915fbcd7473c26ec1499d577e18083e5d4f 0 +Wizard/AIVirtualTurnStartSimulator.cs Wizard/AIVirtualTurnStartSimulator.cs 4ffeb3dc76517ba36c9fe2d026a06b9a4581f2b3b9496b9d88f27906adb3c230 0 +Wizard/AIWhiteRitualSimulationUtility.cs Wizard/AIWhiteRitualSimulationUtility.cs cb99377bc63f81d69390e6407848b54eef775827771bb0b4a56cea25908c3dbc 0 +Wizard/AIWhitefrostWhisperLogicArgument.cs Wizard/AIWhitefrostWhisperLogicArgument.cs 1174b61be1377624e74801d9d68834ad8dc0985e6c732f50dbe1da35fb3fde06 0 Wizard/Tuple.cs Wizard/Tuple.cs 2626ed192e620d909de28610153912dcb36f602c54a5a4eda943a2b12bf7fe88 0 Wizard\AIAccelerate.cs Wizard\AIAccelerate.cs b968700bf63fb47d263662e812270a805011fa53b4b026a5ad15f056d24c1d5d 0 Wizard\AIAccelerateInformation.cs Wizard\AIAccelerateInformation.cs 0b2558c3d4b87221a849f6e5a6622b517c9fad31e500f2f1f04ac1b20545fadc 0 @@ -2021,7 +2283,10 @@ Wizard\AIWhenPlayTagArgument.cs Wizard\AIWhenPlayTagArgument.cs 374f17523d8266b8 Wizard\AIWhenPlayTokenArgumentBase.cs Wizard\AIWhenPlayTokenArgumentBase.cs 0b94d1ff02bb4cc8a87ba200cc16dcdcf20146293d448f86dbf4d43dae61a22f 0 Wizard\AIWhenPlayTokenDraw.cs Wizard\AIWhenPlayTokenDraw.cs e61b4aaba2515f7e5968930f248e16dbf1e4126cf01433d12d82bc68a13708ea 0 Wizard\AI_LOGIC_LV.cs Wizard\AI_LOGIC_LV.cs e6a97a7f33f421973293eff0f046a0a8422ddc4103f3fb7b77a114c0f6b7b9d6 0 +Wizard\AbortSoloPlayRecoveryTask.cs Wizard\AbortSoloPlayRecoveryTask.cs 983b900d2b180dcbd61032ecec688b66e8ab98504e7cb58250e4069f6040ad13 0 +Wizard\AcceptAgreementTask.cs Wizard\AcceptAgreementTask.cs 0868aac7735e2826cff2db423a3de42943fe4fe2ca16d2e9f9f219f05cf7f5d3 0 Wizard\AchievementImpl.cs Wizard\AchievementImpl.cs f7e7690b1c5f5ed7e6d08e2ebb6624ac1c175a874b83806b16fd0fd89d857030 0 +Wizard\AchievementReceiveRewardTask.cs Wizard\AchievementReceiveRewardTask.cs a12a24d0b68ea814ac403cf63490fab86443321b174e434ed93c76e5e328da3b 0 Wizard\ActivateCountTagCollection.cs Wizard\ActivateCountTagCollection.cs fb0b8de915750511da274995871c184582f447c1b1d5a6569960db243bf1f482 0 Wizard\AddCardToPlayoutPlayPtnTagCollection.cs Wizard\AddCardToPlayoutPlayPtnTagCollection.cs be590b8fc0998c928f0130913b0aa923eaff662f21368401ab13ea2d763f349b 0 Wizard\AfterAttackTagCollection.cs Wizard\AfterAttackTagCollection.cs 399655aabb4fb431693df63b42794178c30765b5e3e708214bc55a7a1a6b9236 0 @@ -2032,21 +2297,33 @@ Wizard\AllyPlayBonusPolicyCollection.cs Wizard\AllyPlayBonusPolicyCollection.cs Wizard\AllyPlayBonusRatePolicyCollection.cs Wizard\AllyPlayBonusRatePolicyCollection.cs d33ddef3ce145c7b8acd943c451ba8657c25f0c98f243ee7a4f21d9f1857f32a 0 Wizard\AllyPlayBonusTagCollection.cs Wizard\AllyPlayBonusTagCollection.cs 04260820f1240296416afe9d579b64e16c953293375bd26d7b956a0f37341d16 0 Wizard\AreaSelectClearReward.cs Wizard\AreaSelectClearReward.cs 6e11173e7b2d4d16b18e4f8ce7e7c5f588e754cd013ac4e0cc58176537736f83 0 +Wizard\ArenaCommonLobby.cs Wizard\ArenaCommonLobby.cs 3c46adae1758b23226f89e84e69187905119579d21edc1aabca6abce86273750 0 +Wizard\ArenaCommonLobbyBattleInfo.cs Wizard\ArenaCommonLobbyBattleInfo.cs 2562cdbce205a7c3dc5699d086c1de69dce1d92922f8144cc45a1d9d5402dd14 0 +Wizard\ArenaCommonLobbyBattleStateObject.cs Wizard\ArenaCommonLobbyBattleStateObject.cs f29606af21c34c8fe143bb421a3d3ae9069530ec9aa36faaf606a2b91418f61d 0 +Wizard\ArenaCommonLobbyInitParam.cs Wizard\ArenaCommonLobbyInitParam.cs cb54afea02c865e2fc41f7595a4103f1318941db807f4ed15bd3789db6a7b272 0 +Wizard\ArenaCommonLobbyLoadRequest.cs Wizard\ArenaCommonLobbyLoadRequest.cs 345fecff05cede96f68f40c5e97d1d46ed3f3b0267e8fe1cbef2726c47ac4bc7 0 +Wizard\ArenaCommonLobbyTreasureBoxInfo.cs Wizard\ArenaCommonLobbyTreasureBoxInfo.cs d152019349b71fc6016f5bc9da66939fc2a5db4f81c098e3e254ee058cdf8b17 0 Wizard\ArenaConfigDialog.cs Wizard\ArenaConfigDialog.cs 95172ffd65a3e90cb63f7d9368dd662721f74fa5526f6397a82eb56a182081c0 0 +Wizard\ArenaConfigUpdateTask.cs Wizard\ArenaConfigUpdateTask.cs 0cead1a6b0865ce506094bea9a6083f6089d2dbbd02b08966bb3592253839730 0 Wizard\AttachedSkillInfoReceiveData.cs Wizard\AttachedSkillInfoReceiveData.cs 40db29bd9eeb41d3a0e15aab0a91ddee7a24709d5742d05584b8a76100522aaa 0 Wizard\AttachedSkillInfoReceiveDataCollection.cs Wizard\AttachedSkillInfoReceiveDataCollection.cs 9fccf7143e59065644b7cb96f1bb56f52ef4a5353eae76c1a161846544222c6a 0 Wizard\AttackBonusTagCollection.cs Wizard\AttackBonusTagCollection.cs ead7de323b51ab6321e12b5ce37616db9d75cb4ba1c8b5887fd929383cd16586 0 Wizard\AttackByLifeTagCollection.cs Wizard\AttackByLifeTagCollection.cs a67f23b492a670013588dee1fd854d9bcb9ae3c3a62a9b8020a57e40e2578a5c 0 Wizard\AttackTagCollection.cs Wizard\AttackTagCollection.cs dfd6643aae0b0677bdd31fd52845c995bf14d4a78b4818d272f20f39e7c6340e 0 Wizard\AttackableClassTagCollection.cs Wizard\AttackableClassTagCollection.cs 87f2a7fc4a2cca3d35ad802fbf745b621c94eb9b19e4f4414b763902064303cc 0 +Wizard\AvatarAbilityDetailDialog.cs Wizard\AvatarAbilityDetailDialog.cs bd39de010ee3169a531c9eb1c30402455e5fce5af0fa97d0cb676f786649c8e8 0 Wizard\AvatarBattleAllInfo.cs Wizard\AvatarBattleAllInfo.cs aa81432dab0e99a84a4aadceec6db2c859c5ef15d5112d0c2e8872ffcaed7745 0 Wizard\AvatarBattleInfo.cs Wizard\AvatarBattleInfo.cs d3417046e0acea3e6806fee941f30ee543f122d34956412ba61f5822e42c6a95 0 +Wizard\AvatarFormatBehavior.cs Wizard\AvatarFormatBehavior.cs f773138b62dbc5e5c4e2c11a853f4a400d02f029badc0153be4bb0cc8671116f 0 +Wizard\BGMManager.cs Wizard\BGMManager.cs ed3557a935cc6c62a205c94d46fddec5b1d4769f17855a6b3927760a28f60153 0 Wizard\BanishBonusTagCollection.cs Wizard\BanishBonusTagCollection.cs 02d6a7110fe4433971e2499430f5bb929d665c70805a9c148f4b4108324bcb9c 0 Wizard\BanishTagCollection.cs Wizard\BanishTagCollection.cs 9e9bfded276a6d2cdd2f21775da1d55d1b744b5a950d52ad369a0fac152f68b4 0 Wizard\BannerDialog.cs Wizard\BannerDialog.cs 4c2e9f967bb9166bb2891bc9f01e16be05bad5a4734da3dcac094ec9419dcc9b 0 Wizard\BarrierBonusPolicyCollection.cs Wizard\BarrierBonusPolicyCollection.cs b0c4650dd4c3aecdd39b732f72a999762c493b0e89ed5187e223093f3f6923b7 0 Wizard\BaseParam.cs Wizard\BaseParam.cs aafba52c5b868cb4b3c9736c6706113d8d521c754bdc9b955c8b9deda221c722 0 Wizard\BaseProductDetail.cs Wizard\BaseProductDetail.cs 5d15337781bcac5656c95a9e42ea8dd5c77032851255a423251308a505fb801e 0 +Wizard\BaseRoomBattleEnterRoomTask.cs Wizard\BaseRoomBattleEnterRoomTask.cs c08b379b94b6d9084e3eb73d63661d4f97bb68b3427d128685bf0d845ae022fa 0 +Wizard\BaseSelectBuyMeansDialog.cs Wizard\BaseSelectBuyMeansDialog.cs a7bda9d4d11277a7da5d4e25ec7addd5f4bd330172212a08bf6ad12f732507ff 0 Wizard\BaseSeriesData.cs Wizard\BaseSeriesData.cs b5f6431a7d175f16784a36d07707c81d6f4ad0942135a0ee636de3de5caac758 0 Wizard\BaseShopPurchasePage.cs Wizard\BaseShopPurchasePage.cs f158ce39f34b47b46ea2fe27605e7fa4a4ebc14db87b9240e47189066cbda891 0 Wizard\BaseTask.cs Wizard\BaseTask.cs f6e3ff4403c4ec32bf1d37807c1f8b51e419caa7feb6fd81887ae09c6d7e1348 0 @@ -2061,7 +2338,12 @@ Wizard\BattlePassGaugeInfo.cs Wizard\BattlePassGaugeInfo.cs b4940b7f064149a0137e Wizard\BattlePassGuage.cs Wizard\BattlePassGuage.cs fe0d550cbe5afc8acd6364b1a8966bdc08f1bcedf9467c32cc06e3d3b8c099b5 0 Wizard\BattlePassLevelInfo.cs Wizard\BattlePassLevelInfo.cs 8c2484b47fb952aeb2e32134999644dc78babcb03e2f1a482c3f340135918c8f 0 Wizard\BattlePassMonthlyMission.cs Wizard\BattlePassMonthlyMission.cs 2fe16dceba2cbaa3391d1e91821149c5eb45c64841478212dcbe59034724d8ae 0 +Wizard\BattlePassProduct.cs Wizard\BattlePassProduct.cs fce42097d88e4c4dc131d415d67cf0ff38f2ffa0bb961bbcadd387eb0a865ff5 0 +Wizard\BattlePassPurchaseDialog.cs Wizard\BattlePassPurchaseDialog.cs 5be1730794cfe0edf290708880facbf66705762f3f7ab98e81207aa1f38152bd 0 +Wizard\BattlePassPurchaseInfo.cs Wizard\BattlePassPurchaseInfo.cs 9e32041f4ef31a7e93998c17d87727417d2796eecef7eccc9ec09185fab25aac 0 +Wizard\BattlePassPurchaseProductView.cs Wizard\BattlePassPurchaseProductView.cs 44bd65c0f0a0bb1060b91200e2dfe5f7c383c1e2997b9c76c159f2dae2fb9d30 0 Wizard\BattlePassResultPanel.cs Wizard\BattlePassResultPanel.cs 332992ec3f44533c9f99f06d577f6a6834e815859c09a54d4264807d8b946eb4 0 +Wizard\BattlePassUtility.cs Wizard\BattlePassUtility.cs b3ca009f983e460691c482b98dec53341c517ad2c057366cc09c4b9665e6aeda 0 Wizard\BattlePlayerPair.cs Wizard\BattlePlayerPair.cs ff8d3eb14f7bb8386d29f2891a1c5665ea857171bdae23493033729180b21bec 0 Wizard\BattlePlayerReadOnlyInfoPair.cs Wizard\BattlePlayerReadOnlyInfoPair.cs da9aacfc922101e0b5d741b0233dc3f8597fd07d339a5366d037745b8c2a0a09 0 Wizard\BattleRecoveryInfo.cs Wizard\BattleRecoveryInfo.cs 0a148f60eb5689ef33f58d98f43ea7f437702750dce77d9fbd7dc261118d44f4 0 @@ -2070,7 +2352,12 @@ Wizard\BattleStartUserPanel.cs Wizard\BattleStartUserPanel.cs 9af3ec3df078b3f799 Wizard\BeforeTransformVirtualCard.cs Wizard\BeforeTransformVirtualCard.cs 96c43888d9a72d8bc8b4dcb86439e635fd5919f9b9499e4ba92035ca0bebd4bd 0 Wizard\BestInPlayMoveAI.cs Wizard\BestInPlayMoveAI.cs 7ca9982d80f65a598aaf66565055787d968ddb041fbe64e2a832f6079145b202 0 Wizard\BestOpenSpaceAttackAI.cs Wizard\BestOpenSpaceAttackAI.cs 6be9bd37837ee5e84d7df230ca5c7d001f8f46bcf2f852ab4015a7ed2aa7595e 0 +Wizard\BingoSelectBuyNumPopup.cs Wizard\BingoSelectBuyNumPopup.cs 76e20fa43e4589e0de46e35c8b3cfced522440538f5253bce01da314dcc6ccbc 0 Wizard\BossRushBattleData.cs Wizard\BossRushBattleData.cs 5b9afe850670e86c4721cb59e61d3bba4cf78d99e66c328ef778d183c4c06084 0 +Wizard\BossRushClearDeckListTask.cs Wizard\BossRushClearDeckListTask.cs a81b18447afe0f3fd5adc172a82968f1318cc9842e2f6989131e41c05a905bb0 0 +Wizard\BossRushFinishTask.cs Wizard\BossRushFinishTask.cs d9050b3e56a575e552b5728a9237aed8aba7a9aa54e82dad99c7abe116d03682 0 +Wizard\BossRushHiddenBattleFinishTask.cs Wizard\BossRushHiddenBattleFinishTask.cs 42b99e7d0888fec9264afb9ee7aaea63b7f79a549cdcb00bfb6b0ff0b3618329 0 +Wizard\BossRushHiddenBattleStartTask.cs Wizard\BossRushHiddenBattleStartTask.cs b4a6068cff7ac9309c8e3158acd37dccf6f67b410a91c3fde84a0e47e82ab49f 0 Wizard\BossRushInfo.cs Wizard\BossRushInfo.cs 5e0c725f4d19e75b060bc8545f857c0f91dab77e994dcf1fbdbc67b2554a627f 0 Wizard\BossRushLobbyAbilityCandidateData.cs Wizard\BossRushLobbyAbilityCandidateData.cs eeae65a4867ad4514df39f64edb586c9c3b5fe31ea9b58ac1f86e7b9baf66e7a 0 Wizard\BossRushLobbyAbilityData.cs Wizard\BossRushLobbyAbilityData.cs 3a508f41271c634e404f7e84dfcb817d670ed03d919a551af7b79da062726ef8 0 @@ -2105,14 +2392,43 @@ Wizard\CardMasterLocalFileUtility.cs Wizard\CardMasterLocalFileUtility.cs 81527d Wizard\CardParameter.cs Wizard\CardParameter.cs a7ea3ce6d2efad06697ea5e9ea2ce0b38280139b2e55a55f0c48aca2c99109fc 0 Wizard\CardPrm.cs Wizard\CardPrm.cs 41697c1ed692386772dfed98690e9a3471cbc295460b8fef2c7b5cbdfd223247 0 Wizard\CardProtectTask.cs Wizard\CardProtectTask.cs 1b700bc1a2b75cecd4b8460cd90eddcb6e5de64c8cacc5ffe009786fe345f7a9 0 +Wizard\CardSelectDialog.cs Wizard\CardSelectDialog.cs 235c9952bb1fa49974a682a05756b8c61b37196f738d61f08cc75034c62f5f1f 0 +Wizard\CardSelectDialogObject.cs Wizard\CardSelectDialogObject.cs 915c0944957d7510c1aa7940015e9b5855bfc6308bbc99a300eb720b9ec4d4e5 0 Wizard\CardSelectListConfirmPagerView.cs Wizard\CardSelectListConfirmPagerView.cs 93ed1b34d2ed8b3f868bded81f89fd6ec1a2f63b607a6b553dac15ac8ccb86a0 0 Wizard\CardSetName.cs Wizard\CardSetName.cs 943b0083d367048c7cdebcfdc2780aee27f6d9f1adfafec7cb720830bb614f6f 0 Wizard\CardSetNameMgr.cs Wizard\CardSetNameMgr.cs 146a4a804055f9c3341301c3823bda3cf3f560e8032b5df46e1b7fca87009649 0 Wizard\CardSkillHashUtility.cs Wizard\CardSkillHashUtility.cs ad5fba74351ce510165f83273391762c3cb57e96ff605e13cf3d5e544a2e6edd 0 +Wizard\CardSleeveDetailWindow.cs Wizard\CardSleeveDetailWindow.cs b74705d70564b25e3972d121591c55be39437df0dfa16cf0e14db3501761fd02 0 +Wizard\CardSleeveRewardItem.cs Wizard\CardSleeveRewardItem.cs 9cf753ca79d8e25f1aaec1af3f4d9e0f565c3e1b6827ced3479fb86cb824b5cd 0 +Wizard\CardSleeveRewardView.cs Wizard\CardSleeveRewardView.cs 239ffd404400fe94dbfc08cc48d0591bcef769a5081a389134d5409275c84180 0 Wizard\CenteringUIWidget.cs Wizard\CenteringUIWidget.cs 1ddc0ddbbfcd6638010dc6889706b3a5944ac5b122103cf24f9c0d7adde66efc 0 Wizard\ChangeInplayTagCollection.cs Wizard\ChangeInplayTagCollection.cs 0e52c7c354104e962110f89f72971455b6d1835ee41c01e07886fee28491dcd0 0 Wizard\ChaosUtil.cs Wizard\ChaosUtil.cs 152adff597f552c9e74f44fe8c2bf41708055dc1c80e85410eea6aa04f0ad82c 0 Wizard\ChapterObjectCenteringSupporter.cs Wizard\ChapterObjectCenteringSupporter.cs 43ae389f01e2a45d87767adfab44caaccb10d590e0509e4dcd54ee4d6787e7d9 0 +Wizard\ChapterSelectButton.cs Wizard\ChapterSelectButton.cs 94510cf6d704e60588b1239da078fd5ccc02cb37efa4b3e27edf429fdd9dbd1e 0 +Wizard\ChapterSelectSphere.cs Wizard\ChapterSelectSphere.cs dfad54b585ff199b6fd6def8f79a55306e4d1c5aee9a6e9c3aae6ebfc753468b 0 +Wizard\Chat.cs Wizard\Chat.cs e2376b5c58c19422a0f99ad05e74437e983847398f904dd2ce80ecb8ffaf66dc 0 +Wizard\ChatConnectController.cs Wizard\ChatConnectController.cs 014c3d0c59f4e794b9105613e290a10548ee43fdf4951fef04d981dcd74bbff6 0 +Wizard\ChatDeckView.cs Wizard\ChatDeckView.cs 91a037627c00c5a88e2f2626051c9e8a97e4ec6bca015ca3c0bb7ab21ca41605 0 +Wizard\ChatInfo.cs Wizard\ChatInfo.cs 39a9ae7e4df948fccb0f3f1024b8fbba06603c7e608af8218147074aab1b72c7 0 +Wizard\ChatLogContentBase.cs Wizard\ChatLogContentBase.cs 84d8752970bccfef5a9d0cf14196a3f1ebca41bf3883ddd8a75f832596a20a7a 0 +Wizard\ChatLogPartsNotice.cs Wizard\ChatLogPartsNotice.cs 0691379a2bb1d279ed9777dde5468880e84d9bdb2af67f37e3a1aa72f665dd31 0 +Wizard\ChatLogPlate.cs Wizard\ChatLogPlate.cs f13c0874299c45def434b3ece7594365d6939078c37504e79522ab2683f9e98f 0 +Wizard\ChatLogPlateLayoutBase.cs Wizard\ChatLogPlateLayoutBase.cs 5ba9faac23285f6b7011bb455b64e9167a96642e383c059ee15d7902361134f9 0 +Wizard\ChatLogPlateLayoutMember.cs Wizard\ChatLogPlateLayoutMember.cs 6a65a67042da7c152ca004903078c58cd52aa5c098d12e85ad2dde661d76e006 0 +Wizard\ChatLogPlateLayoutNoMember.cs Wizard\ChatLogPlateLayoutNoMember.cs 9768cc7a11665dfdc94743d882f0a2115efac8a80dea6e249d951b173b7bae2d 0 +Wizard\ChatLogUI.cs Wizard\ChatLogUI.cs 0b9af050bbf823b6367cdec09ad970423a3ab5245a86907201e30139c08883d0 0 +Wizard\ChatMessageInfo.cs Wizard\ChatMessageInfo.cs c414c78903b6045ce4d88c76381d9bc1bdf1c02ecb23cc62c9acb4d27794c7aa 0 +Wizard\ChatOpenCloseAnimation.cs Wizard\ChatOpenCloseAnimation.cs bc7683671e62091da2d54ba63ef146ad4881b74d8afdae41799f585a3a0e98bb 0 +Wizard\ChatReplayListDialog.cs Wizard\ChatReplayListDialog.cs 821eec442279d4101141b8117cb21db6779284f232eb7a943c94d442e0b5fc8b 0 +Wizard\ChatReplaySendConfirmDialog.cs Wizard\ChatReplaySendConfirmDialog.cs c94be67ae4c487eb107626d133e99b60e49bd3211d6f8cce1146004e9ac1ef4f 0 +Wizard\ChatSendDeckUI.cs Wizard\ChatSendDeckUI.cs 1da32342f2f25220f56dc054075c3477736ab00f455494621e221d365b82488e 0 +Wizard\ChatSendReplayListUI.cs Wizard\ChatSendReplayListUI.cs 94fd68696d7eb05eb569bbeabc0a360d4d824740a5875ea43018eab5e1b81915 0 +Wizard\ChatSendReplayUI.cs Wizard\ChatSendReplayUI.cs ebece60b7151f53191e0cebaaa8d0be602a581dadf3777ec342f37cdf72516c3 0 +Wizard\ChatSendStampUI.cs Wizard\ChatSendStampUI.cs 5c250e7f72ac018a0ad18f6f6458fc1f2ee8a3a1ccb0df7a32fccfc2293f5d46 0 +Wizard\ChatSendTextUI.cs Wizard\ChatSendTextUI.cs 24113a55d13772c8aad68a5374b260b8aa38cc8ee84bbe2cabe1cb5bb0a57b83 0 +Wizard\ChatShareDeckUI.cs Wizard\ChatShareDeckUI.cs bef70391826b009a453b4e250efa972e0fd7121d6e5a18e8e2b89a0ca321e925 0 +Wizard\ChatUserInfo.cs Wizard\ChatUserInfo.cs 782e1f2982c9c8dd641e2b2f320e5769541a9634fa53bb7678b520884e2ae5f4 0 Wizard\CheckSpecialTitleTask.cs Wizard\CheckSpecialTitleTask.cs 191c82c69c744c93682a3516d15a7eefe0153962e47df48b88be507ed0d26095 0 Wizard\CheckTimeSlipRotationPeriodTask.cs Wizard\CheckTimeSlipRotationPeriodTask.cs dc3007b64143e02fad056a87ef9f0c3e93f443499a851c802fb85a05a1525c65 0 Wizard\ChoiceTagCollection.cs Wizard\ChoiceTagCollection.cs ee83f8d599d0592e679c11c5c208841c1d044088b38e12604016e5f673f77cf9 0 @@ -2122,27 +2438,48 @@ Wizard\ClassCharacterMasterData.cs Wizard\ClassCharacterMasterData.cs ccf929714e Wizard\ClassInfoParts.cs Wizard\ClassInfoParts.cs 75b6923688f22d49ddc97db55ecb6daae2c8c4d444ccfaae66625d85ce35e208 0 Wizard\ClassInfomationOrder.cs Wizard\ClassInfomationOrder.cs 885f4c62c3d6f3e026f95c4f83830f634bbbcfe4c74352d763bfb992ce21e4e8 0 Wizard\ClassSelectionButton.cs Wizard\ClassSelectionButton.cs e54b6667dcf47f83bdb242337ba8d6744ddef3d8a7111201da5e83fa62475450 0 +Wizard\ClassSelectionPage.cs Wizard\ClassSelectionPage.cs 9824d4d179df52757687f5c6e9a3aa6a403997f140d036f805105742146d51e3 0 +Wizard\ClassSelectionPageParam.cs Wizard\ClassSelectionPageParam.cs 11c33bf47223789c7ab191b2d048a04ae324485be18f86a3f9aa2ce28fa4680c 0 Wizard\ClassSet.cs Wizard\ClassSet.cs 37d444f7109e8637da98bc721c35286d6f0c45c49dbcf552603e26e453908e32 0 Wizard\ClassSkinDetailWindow.cs Wizard\ClassSkinDetailWindow.cs 05f8f178d4cbec20554dcfbae3f9f62c22f55cadda61528334284c38185a0aae 0 +Wizard\ClassSkinSelectBuyMeansDialog.cs Wizard\ClassSkinSelectBuyMeansDialog.cs 769c2c46a5c7fab555acfd53982eeac368e3f0452eef8a34ecaca0402196cf0d 0 Wizard\ClassType.cs Wizard\ClassType.cs c0be0ce00bb64ad28a85f1f1edfafa0216b67a47fa8d744a1b69c19b78c786ce 0 Wizard\ClassUtil.cs Wizard\ClassUtil.cs fbfe755aff08092de955f89e8cc0494b289d74cf09eab426a239dcb2aca78a27 0 Wizard\CloneActualFlags.cs Wizard\CloneActualFlags.cs feadf48e251d85e8d9b76ce2a973f56102a2c753d788ad21055e577d1788f8dd 0 Wizard\ColorCode.cs Wizard\ColorCode.cs c009240287a148d30c3fb249cf85ead5a885b76455dd42f79aaedc43d0b3b393 0 +Wizard\ColosseumBattleFinishTask.cs Wizard\ColosseumBattleFinishTask.cs ef1c9eb75c4aea0a055af34dffff276283d7e6a4421351dc62921dbdd4acefd3 0 +Wizard\ColosseumDoMatchingTask.cs Wizard\ColosseumDoMatchingTask.cs bb9748c3e243e10959d05bb928f3fb3ebfc619d98ec1b5f584df7298c22cf7cf 0 +Wizard\ColosseumEntryInfoTask.cs Wizard\ColosseumEntryInfoTask.cs a91e9a568dd5d734b8e21200735e9d5ef3ca21f985ceddeb86c8b34671b1793f 0 +Wizard\CompetitionBattleDoMatchingTask.cs Wizard\CompetitionBattleDoMatchingTask.cs 2faadde3f3cd37235fb69e525903e01fbc5165a5958eda8f87679c9ed12c7bfc 0 Wizard\CompetitionBattleFinish.cs Wizard\CompetitionBattleFinish.cs 9c57fa74b82bb7cbb69253ebc959b03e4629cf6f600e17de6c2408ffc87664a3 0 Wizard\CompetitionBattleFinishDetail.cs Wizard\CompetitionBattleFinishDetail.cs 8fe99f2a423fd36c67a12e32f1efa60ea8c6229adaa6a19964a9b1bf6728ef3e 0 +Wizard\CompetitionBattleFinishTask.cs Wizard\CompetitionBattleFinishTask.cs c9d0952c1d0b8f41d7d165f3e398accf16139341b5c9d77bc75d1936c970abcc 0 +Wizard\CompetitionCardPanel.cs Wizard\CompetitionCardPanel.cs f7e68a3c5565a7b5379eae34148f63226cbaf5a943fcc9c675fc9b7f7e7caa39 0 +Wizard\CompetitionCheckPeriodTask.cs Wizard\CompetitionCheckPeriodTask.cs d6721f2411b1d094508177e68b0178dfee7bc57ebaef2b345f8518ffb9977c55 0 +Wizard\CompetitionEntry.cs Wizard\CompetitionEntry.cs 87cc3080389dfa9f7293b7028ec058c0161cbc8f05e341dbacfe1a12da05d0bb 0 Wizard\CompetitionResultAnimationAgent.cs Wizard\CompetitionResultAnimationAgent.cs 75b8a263a2ef3999b4abbcc79aeb8027457521e7cc84ee5de27b09d34810acf5 0 Wizard\CompetitionResultAnimationHandler.cs Wizard\CompetitionResultAnimationHandler.cs b881b9efd770b87585bf3d059976ffd97e5ea23e4cfcf9501d9ac45fe96f8994 0 Wizard\CompetitionResultReporter.cs Wizard\CompetitionResultReporter.cs c6e601412cc55d33f4136c71e11d1f92aede9f2bf4cc12e3154a8d526bbd62ed 0 +Wizard\CompetitionUtility.cs Wizard\CompetitionUtility.cs d22c4eabe3e4e8942d8ad54558ed972e8ff77ce2a4eeae9126846d9793419ce1 0 Wizard\CompleteDeckDecideDialog.cs Wizard\CompleteDeckDecideDialog.cs 13989e70a3de839fc5932bf3e87eb15edc889c6a22bad05294c232e75e192255 0 Wizard\CondChoiceTagCollection.cs Wizard\CondChoiceTagCollection.cs e2cbd37890595adbf142aebaca58885a87788ad81dc9a78c7f9d6628d2147169 0 +Wizard\ConfigUpdateFoilPreferredTask.cs Wizard\ConfigUpdateFoilPreferredTask.cs 85a43a7b27da7aef91ec1e1f21abe0985aac1cf89c695e44fdb7a55faabc3aa4 0 +Wizard\ConfigUpdatePrizePreferredTask.cs Wizard\ConfigUpdatePrizePreferredTask.cs 284c2f0cfa477d0e789b67094dc0d127fd9ea7ed28d66a7a1a036154dbf1b9bd 0 +Wizard\ConventionCrossoverFormatBehavior.cs Wizard\ConventionCrossoverFormatBehavior.cs 66e89ced56b6978e69f48d4636e98381e1db3d97557ddeda5ca431eadfb1ef77 0 Wizard\ConventionDeckList.cs Wizard\ConventionDeckList.cs 8653b2d3cfd9d69413b0483bf384e05e18e0ca3b52f6239a212c5e5f01f2aceb 0 Wizard\ConventionInfoTask.cs Wizard\ConventionInfoTask.cs 81ccf3c9eef5ee417b4e3f7e3c981f994f99933a4174219a6a884842395c5a45 0 +Wizard\ConventionMyRotationFormatBehavior.cs Wizard\ConventionMyRotationFormatBehavior.cs ab7de41e7d5f64121605db416350e56b48833080cbcc685de4f21d3da774888b 0 +Wizard\ConventionRotationFormatBehavior.cs Wizard\ConventionRotationFormatBehavior.cs ca2a9ab98335b94ae8b2f522ac626e422367ebac2766c2ff2d4baebe4cf82927 0 +Wizard\ConventionUnlimitedFormatBehavior.cs Wizard\ConventionUnlimitedFormatBehavior.cs 1de3e843ee13ad288de18976bafef1077a3964b8dc1410cbb8121719bde5aeea 0 Wizard\ConvertTime.cs Wizard\ConvertTime.cs e4b66d476871adf4e6d5a62c07335a98c8ae8edbe2acad9c50c4a348520dafaf 0 +Wizard\ConvertValue.cs Wizard\ConvertValue.cs a6a99081a91ed05900618a9a0e702891b7601d43e015832bdb170338c647b76c 0 Wizard\CostBonusTagCollection.cs Wizard\CostBonusTagCollection.cs 8c6d5e7a4b886334eecb7e70ef787bc39de32eb5c5f0c2715f4eefd209ea71a9 0 Wizard\Country.cs Wizard\Country.cs 833d76a4fa24fe50248cad54e6aa5eb6f4f20cf42afd17326638827e0380f133 0 Wizard\CrossOverClassInfomationOrder.cs Wizard\CrossOverClassInfomationOrder.cs 09161540d7eba3406e5c30ebe4c9e1debf9d40ec4d1cd3484d6d71ad357955e0 0 Wizard\Crossover.cs Wizard\Crossover.cs 20a74b69be74e89d8eef25a2b8fe5971b653566b418675a2a2b056a9500dfb7c 0 +Wizard\CrossoverFormatBehavior.cs Wizard\CrossoverFormatBehavior.cs fa6ad8d1871e7ada30582e1de1227592a53c9cc651aedcde6e1db91f7a959f6f 0 Wizard\CrossoverPortalParam.cs Wizard\CrossoverPortalParam.cs d0d751f5c901ed6c7b18cf4189c6e0ae2d3de4184cb05d8c770770d16f58f6bd 0 +Wizard\CrossoverReceiveRankRewardTask.cs Wizard\CrossoverReceiveRankRewardTask.cs a3e37dbd0112cd4e9f81f8d69dc5980ade6f13e50c342dc52ccaf2cbbc13f856 0 Wizard\CrossoverRestrictedCard.cs Wizard\CrossoverRestrictedCard.cs 663c0ac1cabef1716b979c3ec4bdafa47ced26420eaaa08bd6b97e90acf1d815 0 Wizard\CrossoverRewardInfo.cs Wizard\CrossoverRewardInfo.cs bb3763306d0e7d3feefb748b1bf461a114a363d36703edb8a8a5d2b5734128ee 0 Wizard\CsvColumns.cs Wizard\CsvColumns.cs d113f92e1f0145adb323c093deca81aab1889e8de34ed78c852b8e5a764c1c4c 0 @@ -2151,15 +2488,22 @@ Wizard\Data.cs Wizard\Data.cs 26bd39c591da328c1a30eccf773064be022145dad1f11a2958 Wizard\DeckAttributeType.cs Wizard\DeckAttributeType.cs 006bb4c04d8a60c9caf04873dde6c962366348db03ec40a8bbc0071392f656dd 0 Wizard\DeckAutoCreateTask.cs Wizard\DeckAutoCreateTask.cs e8c21d513114d2c42ad85a28da4adb48642bd36dc012f6029fbc8a8d72b78d6c 0 Wizard\DeckBuildShortageCardView.cs Wizard\DeckBuildShortageCardView.cs 34428e4efb614c4fd59136d1bb87485ce117a97b2c6668f0481fff4b510a31d3 0 +Wizard\DeckConventionUpdateTask.cs Wizard\DeckConventionUpdateTask.cs a3166a78167c695c8a109a9581e59e2aa9145cfaf9af71815256034e99a7e89e 0 Wizard\DeckCopyDialog.cs Wizard\DeckCopyDialog.cs 32d95553dc268017f7d0345914c1f83243c928376e418f78d48615b568551957 0 +Wizard\DeckDetailDialog.cs Wizard\DeckDetailDialog.cs f3af592eee584a5dab2cc31ac8668ac77f37cc97fac68bfd1f2edcba65da6848 0 Wizard\DeckGroup.cs Wizard\DeckGroup.cs c5334b68f875f193b100950fba847271ae5fe12e94c79aabd4a8220551066964 0 Wizard\DeckGroupListData.cs Wizard\DeckGroupListData.cs d107ef3fc0cae879fe755256b94e8cc7ddcaa64d3cffa1143246dfe68a185150 0 Wizard\DeckInfoTask.cs Wizard\DeckInfoTask.cs 4256d53231dfd8f243c47c9e94810d749c9542fb4c540f0ad486918dec5f3b3a 0 +Wizard\DeckIntroductionTask.cs Wizard\DeckIntroductionTask.cs 3b03a5c38563b466f72fa956252693d5fc0b35c110d3b9c9ccc3e23057865587 0 +Wizard\DeckListUI.cs Wizard\DeckListUI.cs 358bf4fcf970e714fbe1bfa67db36794271d63f0b93d9f3fff38c5ecfec2b7e1 0 +Wizard\DeckListUIParam.cs Wizard\DeckListUIParam.cs fa39362bce104dfb54eb1bdf781e9cd973157da9ad76aa33c0595f8934e1af6a 0 Wizard\DeckListUtility.cs Wizard\DeckListUtility.cs 353c79754fd9a0967d88439c3793c7759e75f6dccc99aaa506c63c263bc40ca7 0 Wizard\DeckSelectUI.cs Wizard\DeckSelectUI.cs 2988481745cf6011c71470173e750d0d53e049eae0fd0222fdd58426552e4ea5 0 Wizard\DeckSelectUIDialog.cs Wizard\DeckSelectUIDialog.cs 57d268defebb1b9e21d26eb5d83eb0e6a017dfbef062ee03279a17c81707ce57 0 Wizard\DeckSelectUIDialogTitle.cs Wizard\DeckSelectUIDialogTitle.cs a392d397f6f7b885440ceedee71ee93e8acefe1e7cfb1508bc44a311a43567a0 0 Wizard\DeckUI.cs Wizard\DeckUI.cs f99d5d852a206e73ee5c25406ae03380225bfea8c68ce24b69de8347e220af59 0 +Wizard\DeckUtil.cs Wizard\DeckUtil.cs 7a8e6c204f5312eabdb6c56cc8dfa366db3a9aa55584ede83c7cfec225b4d5a5 0 +Wizard\DeckViewHelper.cs Wizard\DeckViewHelper.cs c364b815cd91be517d658f93ddf3a7ba7428261c156ee2162a17e211f4e294c2 0 Wizard\DeckVirtualCard.cs Wizard\DeckVirtualCard.cs 00c7e8d2ebae0dac6af30eb018cd1390a3ceba87b1348c93fe0c7c99eebf275d 0 Wizard\Degree.cs Wizard\Degree.cs 0f3cf092884c7d4c5a4479ce9f887c3b93e77c2c1fd205379c785b4ec095dd22 0 Wizard\DegreeCategory.cs Wizard\DegreeCategory.cs f68c21dc08c6bf0b20af52a33792e14d680c5dab5abb1f2d78eba08e418f7806 0 @@ -2187,6 +2531,7 @@ Wizard\EmoteTagCollection.cs Wizard\EmoteTagCollection.cs ea18ac5bcf19f541d6feda Wizard\EmoteUI.cs Wizard\EmoteUI.cs c312c9110380793bd972cd6641177b21ac99b356ce3e06862f278f13f10d1586 0 Wizard\Emotion.cs Wizard\Emotion.cs 0cffcacfe1eb54bd02b66fb4ad54a3a146722e89b824ebb4c126904c87dfca8d 0 Wizard\EmptyDeckInfo.cs Wizard\EmptyDeckInfo.cs aa954d6e0b6b699500ff9a7db06408c35ae2c48314dafbf058c4d3edd5566bcd 0 +Wizard\EmptyDeckInfoTask.cs Wizard\EmptyDeckInfoTask.cs ac943ae638b0d7ff12ac839f0245ed0021ed55407d517769c0d33584cd65d3a4 0 Wizard\EncryptData.cs Wizard\EncryptData.cs e7afc82bfc5e7b796ecf5b0ec1fa0afd4be0e3c4ee9dee1d37e1c99cdddf3fad 0 Wizard\EnemyAI.cs Wizard\EnemyAI.cs d264983ee917e4b6268e30f01e49b5cfc278cd5c5d91e085f8bbeb148cbdd3af 0 Wizard\EnemyAIFusion.cs Wizard\EnemyAIFusion.cs d3dd6db16807beb214c1c42481567a3bff6f729c3b793c8017771d23c6628f98 0 @@ -2246,6 +2591,9 @@ Wizard\ForceImmediateAttackTagCollection.cs Wizard\ForceImmediateAttackTagCollec Wizard\Format.cs Wizard\Format.cs da3bc270aeb1fce63610b6bd1857ef6e07019c7840ba3a549f607170a957b3ce 0 Wizard\FormatBehaviorManager.cs Wizard\FormatBehaviorManager.cs 6605b28d99c969cc08551568ae47b3c494dfae376ffc04a60c814ce993958bf2 0 Wizard\FormatChangeUI.cs Wizard\FormatChangeUI.cs 4488f75727d57aff2b56bd18dfa5b67566189114c7120041fb4edc081f72e667 0 +Wizard\FreeAndRankMatchDeckSelectConfirmDialog.cs Wizard\FreeAndRankMatchDeckSelectConfirmDialog.cs 6583f613bc1f0853e1906a5392279f4f95c1f16b4035f29c8d1fb7d5d1fd73cb 0 +Wizard\FreeBattleDoMatchingTask.cs Wizard\FreeBattleDoMatchingTask.cs 5fff06ecb3477c0b585b72e75c7c6e6127ff870957d04b066b34a4eea596c86c 0 +Wizard\FreeBattleFinishTask.cs Wizard\FreeBattleFinishTask.cs 751980db78c6eacc00c9d7622fc92ae1df8c87c36b2dfe58424798ddf40f5c34 0 Wizard\FreeCardPackCampaignFinishTask.cs Wizard\FreeCardPackCampaignFinishTask.cs 1dd31ef77f9940b479c211692c1d8301712bc5df8cf21de3224e0dda8eed203f 0 Wizard\FullSimulationAI.cs Wizard\FullSimulationAI.cs 39e5b70761aeaab89f7d8d5423e73debab490171e72a2bb8a75a013c2dc9c8f0 0 Wizard\FusionBonusTagCollection.cs Wizard\FusionBonusTagCollection.cs 4903288da869da61c7a10520fd0815a168c5a1b1f00dc1fb011e509e88f69464 0 @@ -2265,10 +2613,28 @@ Wizard\GachaResultBuyCardPack.cs Wizard\GachaResultBuyCardPack.cs c38ca173783090 Wizard\GachaResultBuyCardPackDialog.cs Wizard\GachaResultBuyCardPackDialog.cs e0b7d915f4c8c7e1b20cf88c44dd01a6325d58afc1e7df9be45cb0fb19c75d55 0 Wizard\GachaSelectBuyNumPopup.cs Wizard\GachaSelectBuyNumPopup.cs 2aa4ee4381bd6ffda29d4c4c8ee8ce7899722d361089037ebeb8c626c4091c13 0 Wizard\GachaUIParam.cs Wizard\GachaUIParam.cs 0b3d1a8dea33c121c44ad2d11b4d3329811913ddaeff65abd0e388ebdd566a2a 0 +Wizard\GachaUtil.cs Wizard\GachaUtil.cs bcbe7800864a035b5f6ed151b417a52bdfb44f6ab75061220b1488ac19b05217 0 Wizard\GameStartAttachTagPolicyCollection.cs Wizard\GameStartAttachTagPolicyCollection.cs c4e1108a4e06f5cc00b27cfed24cd5556490e08cd912acdb504db349ec47d6c6 0 +Wizard\GatheringAutoJoinTaskInfo.cs Wizard\GatheringAutoJoinTaskInfo.cs fc170ce4677f14fc4a9c2ead3d1818726a17a01d2defd0e8a34dbfb4da89e509 0 +Wizard\GatheringChat.cs Wizard\GatheringChat.cs fde29e1f249d32a60a52c2db003f4b447c084ac27ee03f74acf1b2d093280f40 0 +Wizard\GatheringChatAutoJoinRoomMatch.cs Wizard\GatheringChatAutoJoinRoomMatch.cs 225266a9051831905157567681db05c36b3da18fabc55ea0eee7d78216c17cb4 0 +Wizard\GatheringChatDeckList.cs Wizard\GatheringChatDeckList.cs 90f6d0c84fbf91a9577fc8bcd228a3fefbd74e45e54ca1c8ad493f0938049dbc 0 +Wizard\GatheringChatInterruptOrLeave.cs Wizard\GatheringChatInterruptOrLeave.cs b8b940139f08fa99c5292bc657bc7d7aba7e5194826fe604a960fec262a65e7b 0 +Wizard\GatheringChatSendRoomMatchUI.cs Wizard\GatheringChatSendRoomMatchUI.cs d0a0ddce3d5f464a5b642b0e80bd01ef1389893e40b91ddfffd8f45a9ce1f610 0 +Wizard\GatheringChatSettings.cs Wizard\GatheringChatSettings.cs ea1d8e522d03131e4b885b4bc4943707e710e6758292ab0d9140dfc0096c4a15 0 +Wizard\GatheringCreateDialog.cs Wizard\GatheringCreateDialog.cs bfd5438b12dca19b991584ee3488d0355871f16b9a362dbbd26d56d5ae829b6a 0 +Wizard\GatheringCreateTask.cs Wizard\GatheringCreateTask.cs 83b33e80d485f4f544510d8829537b9841d8f337afdc30e495a9ea40299f2134 0 +Wizard\GatheringEntrySetting.cs Wizard\GatheringEntrySetting.cs 476bfbf70aad87c0909d546d10250b11c82b056d7460b19ba859464d764d9344 0 +Wizard\GatheringInfo.cs Wizard\GatheringInfo.cs 7614c505d5604ad78e39e70d5ed3b5ff5bc84d634312bafb10b6e9037861d6df 0 +Wizard\GatheringMatchedRoom.cs Wizard\GatheringMatchedRoom.cs 1531b714bd8ba8bc782ab35b68fa9bde01229f1705099fb9671c72d9ebc70db8 0 Wizard\GatheringMyPageInfo.cs Wizard\GatheringMyPageInfo.cs c28baddfaafc8ef7685abfdf6ac6318f822524a30006247625391fd7b6568fd2 0 +Wizard\GatheringRoomEnterTournamentRoomTask.cs Wizard\GatheringRoomEnterTournamentRoomTask.cs 167e6f58f8ab1a9b182a4ac8f5178ed4c92c6bbd9feac6ef240deff757a14d2c 0 Wizard\GatheringRule.cs Wizard\GatheringRule.cs ee446b445c77d6d0a1e6e0f64b54cbe2a8b15974376ebc7fefa65331bd42ce51 0 +Wizard\GatheringTornamentCreateTask.cs Wizard\GatheringTornamentCreateTask.cs 868e1e194981f75a91f070752033b408c400e1226fd5eb34bfa8b5d983057157 0 +Wizard\GatheringUserInfo.cs Wizard\GatheringUserInfo.cs fc67c9a20b37d66061a42e83e25b059f5342c936ab45d5d3e0c76132e8b08e04 0 +Wizard\GatheringUtility.cs Wizard\GatheringUtility.cs bf3292e3e5a29dcbd25e25fa60eac4976ca06736de83eeea7cff5beb232f7517 0 Wizard\GenerateDeckCodeTask.cs Wizard\GenerateDeckCodeTask.cs 9f32c9513ec63d8b19e36d402c1adfec123b7f5774b86369391ce5fcb3996e1b 0 +Wizard\GenerateDeckImageTask.cs Wizard\GenerateDeckImageTask.cs 0707c62e24e24b776145e4c81a1a4f4c6a2483c674333e2a40205646e541a5aa 0 Wizard\GenerateTagCollection.cs Wizard\GenerateTagCollection.cs c8a76fe65207f3e3ce6c06bfeb0317ea98796bf8f093dfa710b05547e8b8cfad 0 Wizard\GetCardMasterTask.cs Wizard\GetCardMasterTask.cs 76242fa1bce00c5820fb35ba1e7abd984841a2b12971987d7300384c23a9eb01 0 Wizard\GetOnTagCollection.cs Wizard\GetOnTagCollection.cs 53dd75747aca1d11c8dde8703971ca327b36076ac25d7a4980cf21255835148f 0 @@ -2281,11 +2647,15 @@ Wizard\HandBonusTagCollection.cs Wizard\HandBonusTagCollection.cs 254828268b50bd Wizard\HandPlusTagCollection.cs Wizard\HandPlusTagCollection.cs 6e7c69ade97cea12534f1308a8a1b47170ac1078b3efe5e0613c38a742d9eca9 0 Wizard\HealTagCollection.cs Wizard\HealTagCollection.cs 913557e82f49d9beb64a02bbae3555ace4b4ab633580411e14dd6ded61f46ef5 0 Wizard\HighRankEffectInfo.cs Wizard\HighRankEffectInfo.cs d902f77261b58377e093cc7305827c087b4af6fda9d39c0470afe75ae1e7e1f7 0 +Wizard\HofFormatBehavior.cs Wizard\HofFormatBehavior.cs a0a20f0b5c52c5b4b3c8325645fdc27de9fb370dcead8d96990694cb75d8b269 0 Wizard\IAIEmoteCtrl.cs Wizard\IAIEmoteCtrl.cs 7a10392831ba1389e0d690d49fd563b9de356e8199e9cb2c252edb5d7b2442a3 0 Wizard\IAIRemoveTagArgument.cs Wizard\IAIRemoveTagArgument.cs b1b55e01c9542773c5fda04e23e2692c9c1f2abe8d7f5e49832eecd32e1c4770 0 Wizard\IAITargetSelectTagCollection.cs Wizard\IAITargetSelectTagCollection.cs 9f5213399c3590ccf5519da98308384c07a960c6c8e79721169a854218ad3416 0 Wizard\IAITurnEndArgument.cs Wizard\IAITurnEndArgument.cs fecc0c0f390376939e0aa5993b4ef7efe2c68457b3b7a76b8c7203b53b4853af 0 Wizard\IBattleSimulationAI.cs Wizard\IBattleSimulationAI.cs 4ae9b2993be434a5b76d822de8d56977d7c15d0108e7446a19dcabc785976470 0 +Wizard\IChatActionUI.cs Wizard\IChatActionUI.cs 5cc278a75d5c0525e8cac93ad131dcad9cc35cf6bb62668d6212fcb5b9dd21b9 0 +Wizard\IChatApiSettings.cs Wizard\IChatApiSettings.cs 0d99b1ef99ec1035e7bd1d30f2f1545e12851df6b06b0cf604b0a340e77c8a77 0 +Wizard\IChatSettings.cs Wizard\IChatSettings.cs 26b5ef8dd132ab5cacce7c0e2b682f1ddede64f5e2e7311b8231d357bf6b34ff 0 Wizard\IEnemyAI.cs Wizard\IEnemyAI.cs e4fc8be7e4dfb93145e0dda9a6c8935813b54ca7f46b156a784e1c24e0b07c41 0 Wizard\IEnemyAIBattleInfoRecieveDataAccessor.cs Wizard\IEnemyAIBattleInfoRecieveDataAccessor.cs 0f24830f9f5c99068d1eaded636815b8010c1056883b3ce7fc2fac1867e66574 0 Wizard\IFormatBehavior.cs Wizard\IFormatBehavior.cs b11e696685f19dcd75be555aaab5121b54b2c70fe1af72caa468ec5e80c6947e 0 @@ -2294,19 +2664,24 @@ Wizard\IgnoreFanfareBonusTagCollection.cs Wizard\IgnoreFanfareBonusTagCollection Wizard\IgnoreTargetTagCollection.cs Wizard\IgnoreTargetTagCollection.cs 792b1c640a8978a7f69d9d295480780e18c250ea874a655ab55dc1c99d535542 0 Wizard\InCompleteDeckDecideDialog.cs Wizard\InCompleteDeckDecideDialog.cs 81c448ba1d0e0d9614c0c7b6941a396e03ed0bc460b4419c79d2e88155835eb5 0 Wizard\InplayMovePatternFilter.cs Wizard\InplayMovePatternFilter.cs 99b4635adc0978eacd30a4eab54eedf0185b23b29f2824b7a66071566ff34737 0 +Wizard\InviteConfigUpdateTask.cs Wizard\InviteConfigUpdateTask.cs 61a0624c5a9fda20507973901d5218d7bedafe21ed4eb355af8601dd64b8621f 0 +Wizard\InviteGetListTask.cs Wizard\InviteGetListTask.cs e977b97383bd14e766ffe3997242099a9f0f619d47aaefac8f5cf0dc18139499 0 Wizard\Item.cs Wizard\Item.cs 1f08b86cf607be02d6083243247d28fb89bfae5ba9595f1cf74562680caa9025 0 Wizard\ItemPurchase.cs Wizard\ItemPurchase.cs 6f7d4c77170059b5418fb2aeb0749abc735bd141a116e5e612b028455964159a 0 Wizard\ItemPurchasePlate.cs Wizard\ItemPurchasePlate.cs 7ad6b0abd541371ba4184602105b3de849ac547452f5ab594de2f75dcea69e13 0 Wizard\LabelDefine.cs Wizard\LabelDefine.cs 073931ece990c5defc6b745f739221ae742552579055257c5c1fc179b1b07807 0 Wizard\LastwordTagCollection.cs Wizard\LastwordTagCollection.cs 35a8bf05a748f8cc1811bf419a5e19cbe8058bc76e3f54d9f2160c584436a59f 0 Wizard\LeaderSkinSeries.cs Wizard\LeaderSkinSeries.cs 8273cd6831408f1e74e7e2f7b3db3074d41b102e557941ee3c1f0afecaed71e5 0 +Wizard\LeaderSkinUpdateTask.cs Wizard\LeaderSkinUpdateTask.cs cfd0aef8a3674e3332ff9c0bd243d828dd5f31307cfc62ec39498076318bc9e7 0 Wizard\LeaveBonusTagCollection.cs Wizard\LeaveBonusTagCollection.cs 30e0c56bbe6b1418a166762a88660ce41b13facd173f1b00e500066e84e699fd 0 Wizard\LeaveTagCollection.cs Wizard\LeaveTagCollection.cs 11d8c7a49a83ae6032f77183b7e2e32d38ac4a9def2413cf64558a00fe53750e 0 Wizard\LifeRecord.cs Wizard\LifeRecord.cs dbb7e7c6532bf24174d3d958147309b1eb87faac12c57754e7282cf8ac5d8b50 0 +Wizard\LoadQueue.cs Wizard\LoadQueue.cs a3bd987174d57f1e63dc59f67a02235addb16bd515d9d4fc995054949f4c898d 0 Wizard\LocalLog.cs Wizard\LocalLog.cs 991b50f5e128fd3b2368770fe7a7b7691ce4090bdaca5ae744d1f464572caab0 0 Wizard\LocalizeJson.cs Wizard\LocalizeJson.cs 4adf1a47af054dc08971d7e8d1574e8b8d7692c027182ff6c3d167164240f4ea 0 Wizard\LootBoxDialogUtility.cs Wizard\LootBoxDialogUtility.cs 8277f2e7dfbe98bc4e8790630c338d50a0e635f7566e9d1ee1cd22cd6b199237 0 Wizard\Master.cs Wizard\Master.cs dc58e2aacb78cd813aa7c7e8db2ba18268b3ca62188e0ef36d9f8445a58486ce 0 +Wizard\MasterResetMonthTask.cs Wizard\MasterResetMonthTask.cs 0e7830760327c23b708bfce1ec62a27e9484aac191b54c1b594f43d20ecc9d1d 0 Wizard\Mastershop.cs Wizard\Mastershop.cs ed5828427f2fe31272830b4ab3dfe0c70d1caae570cf7145f96e9cb402eb90f5 0 Wizard\Matching_Competition.cs Wizard\Matching_Competition.cs 5a28b9f3ed26f46c28b9b41ea26557cb56a13a424f8279a3e6e7ecccf47cd1e5 0 Wizard\Matching_Sealed.cs Wizard\Matching_Sealed.cs fe051fbc6117cc48b6ba9d48226d5735bde55b220e558cdbbf7d13dbe3f888e6 0 @@ -2315,23 +2690,35 @@ Wizard\MemberBattleBonusRateTagCollection.cs Wizard\MemberBattleBonusRateTagColl Wizard\MemberBattleBonusTagCollection.cs Wizard\MemberBattleBonusTagCollection.cs 7d5c866fa706411b0eef538feb6b10551066b0e552d757a081c9a2b1bf5a5107 0 Wizard\MemberEvoBonusTagCollection.cs Wizard\MemberEvoBonusTagCollection.cs 94fa4f95290b222605bc4c01b68d38d8f3bd64568887f0764034bd1a1ab429e5 0 Wizard\MissionInfoTask.cs Wizard\MissionInfoTask.cs 68c13aa4f0b37a1e1f29c30ba2b2b3e9809be3a69b40fa7990c577521ebe082a 0 +Wizard\MissionRetireTask.cs Wizard\MissionRetireTask.cs 4277fd692632db4c7d396bb9b2474e6a68ed738817e1d698c9cfc0fb7e4d6c06 0 Wizard\ModUnitRatePolicyCollection.cs Wizard\ModUnitRatePolicyCollection.cs 51ee8a8ca31e3fb5eef773271b95e463c8fe376f9b16e9f537aaf8ab1b03e4c7 0 Wizard\ModifyHealTagCollection.cs Wizard\ModifyHealTagCollection.cs b8451ec819776ddfec09c4027fad85ee2d2e9d7c77970aef414949841b8a034d 0 Wizard\MoveFirstBonusPolicyCollection.cs Wizard\MoveFirstBonusPolicyCollection.cs fc3fa7944f42245732f94eb03228bf5b88fa886fb290f58edf4b2c6f6e7735aa 0 Wizard\MovieSubtitles.cs Wizard\MovieSubtitles.cs 6704fb258932c439dd0c56b3fe2e4fd4bde4331bc214b94d9e4511e2e523deaf 0 +Wizard\MultiDeckSelectDialog.cs Wizard\MultiDeckSelectDialog.cs 9a9b3b0532ab9ac8654b027254d8b4bd85e9801ec462e1f5d86659c5fefa153e 0 Wizard\MyPage.cs Wizard\MyPage.cs 75afa5c09e9866a0f5a59ffd85f4cb7977975700b88d318238b675440cb7c1e2 0 +Wizard\MyPageBGCustomDialog.cs Wizard\MyPageBGCustomDialog.cs 38a7ac3519303533e1d3df0c06e22fec9d12bb9c20bf2f5801bf0785f3a43d6a 0 Wizard\MyPageBGInfo.cs Wizard\MyPageBGInfo.cs 2a4a4b373afc76709bc4fe338c9cda07e9a9928403e14544aa866ba1b20cfd33 0 +Wizard\MyPageCodeInputTask.cs Wizard\MyPageCodeInputTask.cs 08caac8e962f404c909fc35af58e4ce074af84fee4ceb00c537466f9ed0a24ca 0 Wizard\MyPageCustomBGControl.cs Wizard\MyPageCustomBGControl.cs 6dcda3459b2867c5cecfed12306c6546d704104d72050625c5445fe3dcc4f996 0 Wizard\MyPageCustomBGMasterData.cs Wizard\MyPageCustomBGMasterData.cs f804b67196ba049ab2bca36abbcb98246d603c7e9035901c75b40a3eda954326 0 Wizard\MyPageDetail.cs Wizard\MyPageDetail.cs a34a11602c1741e48c51da86e5376c92e2c51e711ff32818cc328f4c046bed41 0 +Wizard\MyPageFinishBattleTask.cs Wizard\MyPageFinishBattleTask.cs 2b6a054c8cfa51d5d390e9642e0441b579dee6b982259f5d618f70b3a1e11835 0 +Wizard\MyPageHomeDialog.cs Wizard\MyPageHomeDialog.cs 07a1744a7e94b1e5656868608968a1e70e7b5293d098dee5a6d61cd1fca2135d 0 Wizard\MyPageHomeDialogData.cs Wizard\MyPageHomeDialogData.cs 8a340ba114a70c5546bba0d727cb9a9257efea3ae656417566882f3101a3578f 0 Wizard\MyPageMaintenanceNotification.cs Wizard\MyPageMaintenanceNotification.cs 64149488be27c560203a11731d10539772adaab7c7e342991027b71af1af47f6 0 Wizard\MyPageMyPageNotificationDetail.cs Wizard\MyPageMyPageNotificationDetail.cs 4e8495da3fda6ebd51be3d0f16582659a5c1084113c8ccc53d36a951053238b5 0 Wizard\MyPageNotifications.cs Wizard\MyPageNotifications.cs 25336aac677f52bf5e9d5be2963cba52b1889ebe288fdce4c7ddd21b41b6b84b 0 +Wizard\MyPageOtherButtons.cs Wizard\MyPageOtherButtons.cs 494a2042ca360483e7d4f42a5e9f32c1624e0f7e1a1fc2ff665d21f15d605618 0 +Wizard\MyPageRefreshTask.cs Wizard\MyPageRefreshTask.cs f5e55531a94b6055f1dda47ef44c3f00de3c2bad9d86754e4604df0c8686c2d0 0 +Wizard\MyPageRewardDialogBoxCount.cs Wizard\MyPageRewardDialogBoxCount.cs c7dc2f5080d1aff9a61c393316886f8985d9ba795433ddb8ee3bb61c3cd794a9 0 +Wizard\MyPageSpecialWinRewardDialog.cs Wizard\MyPageSpecialWinRewardDialog.cs 71c3c9eea55e30d345a15e82b1bd271285b1401adb6b58c28dcbbfed62671bfa 0 Wizard\MyRotationAbilityGroup.cs Wizard\MyRotationAbilityGroup.cs 221427bd0628660a209d850d6e01274d00ceadba7c5a951a3dd98e87d1c30653 0 Wizard\MyRotationAllInfo.cs Wizard\MyRotationAllInfo.cs 88ae58ae0352d620d94bfc461b28f50a3c6f9cc1cb015954748a32c8db3efde7 0 +Wizard\MyRotationFormatBehavior.cs Wizard\MyRotationFormatBehavior.cs d99bf365ea3083a5f67df25071e655e6aedd2f11bd70f08c1242a558f3024e33 0 Wizard\MyRotationInfo.cs Wizard\MyRotationInfo.cs 4d9090e0e4b81cbd5c0e2ad5542da9577a5dade1a6a5211ebeb9dfd1ce91961b 0 Wizard\MyRotationParts.cs Wizard\MyRotationParts.cs 2469f8b192fe03cec39e4519002031872790662048e61305a63802a48f1cd6df 0 +Wizard\MyRotationPeriodSelectDialog.cs Wizard\MyRotationPeriodSelectDialog.cs bb995629efd4da2dd3059154f131275623f6004d6328e40b22cdce0c2f032227 0 Wizard\MyRotationRePrintInfo.cs Wizard\MyRotationRePrintInfo.cs 2bb1fdfcc60af40afcf6fdd11b36edeca0ced9c4765b226c6f62cca1ed5f0da1 0 Wizard\MypageReceiveSpecialTreasureTask.cs Wizard\MypageReceiveSpecialTreasureTask.cs 5d5f018ada4f5139b2521adfef9930dabef7937602d7854d5599341792eb814e 0 Wizard\MypageTreasureBoxCpOpenTask.cs Wizard\MypageTreasureBoxCpOpenTask.cs 25b6a4ae001a6f38a505a1e1d291fcdbad8172e0ea0680b2fb78a9d9565a5e92 0 @@ -2342,7 +2729,9 @@ Wizard\NoInstantAttackTagCollection.cs Wizard\NoInstantAttackTagCollection.cs db Wizard\NoNormalEvoTagCollection.cs Wizard\NoNormalEvoTagCollection.cs 92c16f64f48fc8d643dcc29addd4c77adbc8a92bd9ccee830560190344e789ef 0 Wizard\NoSkipAttackTagCollection.cs Wizard\NoSkipAttackTagCollection.cs 107152d8cb5b57a6c8e2682d6ba73cb90662fbbd7ac749def7e841101b5462e8 0 Wizard\NonReferableVirtualCardBuildParameterCollection.cs Wizard\NonReferableVirtualCardBuildParameterCollection.cs 23251af778a55d3bd995d72adf74616b1d9679a6178c35e19e0466f748fb3210 0 +Wizard\NoneFormatBehavior.cs Wizard\NoneFormatBehavior.cs 885cfa3a6bc7896ecb67ca7ca95ddd5e7e4dfba4877d3c0441c09db327bc1887 0 Wizard\NotificatonAnimation.cs Wizard\NotificatonAnimation.cs 86079fa67434ccd594837728872c521648a01111dc6917ecc9b100b892556c99 0 +Wizard\NullReceiveTurnEndToJudgeResult.cs Wizard\NullReceiveTurnEndToJudgeResult.cs 6d6ef2f3f0e2e43c47b58fcbc3f0aea7b139cc156df84fa6a93d14349534aa6c 0 Wizard\OneMoreLastwordTagCollection.cs Wizard\OneMoreLastwordTagCollection.cs 43ded6b3ecf0cea6d0880bb9e6a0294fecf17eacca1f27bdfdbf4073a9f36661 0 Wizard\OptionSettingWindow.cs Wizard\OptionSettingWindow.cs ddca8fc3a8fa399d2a19e143de82647c9a7dc3e849ae4538b9f42c5e4987f79a 0 Wizard\OtherAttackTagCollection.cs Wizard\OtherAttackTagCollection.cs 01abdfb334ad2c7a75244ce40aa76963123120b1311b55d9f72b30eb602dcf45 0 @@ -2356,6 +2745,7 @@ Wizard\OtherLeaveTagCollection.cs Wizard\OtherLeaveTagCollection.cs 42cfe082336b Wizard\OtherPlayTagCollection.cs Wizard\OtherPlayTagCollection.cs 48e0ada3fca7ac1e7ab4fa3fc253649df81c3d5599d63805883d6168b123044a 0 Wizard\OtherPlayoutBonusTagCollection.cs Wizard\OtherPlayoutBonusTagCollection.cs 8e7dab4a4a8d31ddea357e269f0e25f43f7bb52f094d2c3db1ee98a0d5c990de 0 Wizard\OtherSummonTagCollection.cs Wizard\OtherSummonTagCollection.cs 08bd5692d0fce51fe7087136fb302c1b0ce17c7b6b18ab25b90fee52e2dbef05 0 +Wizard\OutOfService.cs Wizard\OutOfService.cs 9951148c3174914d5c780eb058cbf4643a5b0bf5046de5466fa6898465405903 0 Wizard\PackBannerData.cs Wizard\PackBannerData.cs 19a49488cc25566d51d172cdaaf5ea6194a0c6121ab2c78eaea5f6b2ca71de09 0 Wizard\PackCategory.cs Wizard\PackCategory.cs 9335bf51da46cc25f51040bd04c543bad6686858802d3ded1c9ab857bef69995 0 Wizard\PackChildGachaInfo.cs Wizard\PackChildGachaInfo.cs 40d10fdd911009cd6dfb780e2111a16cb7914cb7f1e8680130f9ab255a5a0801 0 @@ -2363,6 +2753,8 @@ Wizard\PackConfig.cs Wizard\PackConfig.cs 01a5fcd6c5d39e3c08d6b820f8a062f16d6510 Wizard\PackInfo.cs Wizard\PackInfo.cs 2bc15a5a218249074b306483866f20441ecb88d3ade2e2d363c19fb5633da0b7 0 Wizard\PackInfoTask.cs Wizard\PackInfoTask.cs 361bde0ab56dfe307c887d472f2187971583a7bc9f706e70c9557fd8cd1b8039 0 Wizard\PackOpenTask.cs Wizard\PackOpenTask.cs f640c02451e49da979f8d11388ae35549961a1076fb7faf277f267fcc4d4b9f8 0 +Wizard\PackSetRotationStarterClassTask.cs Wizard\PackSetRotationStarterClassTask.cs 98aa07a50d8f9291c3b8ebd61847b1c054c8a945837a494198ed41f89e49ae61 0 +Wizard\PaginationDots.cs Wizard\PaginationDots.cs 3a110b30e3a00834795f601512868899d167fe9ae6c579b98c92d75470a9dff0 0 Wizard\ParameterOverwriterBase.cs Wizard\ParameterOverwriterBase.cs 0966e18f7e514ddaff7567c3d845b6cc98d10d7ee49f6130156ed46eace56cf0 0 Wizard\PlagueCityTagCollection.cs Wizard\PlagueCityTagCollection.cs 3213ddc7ae26058dc28be578bd19b4342914324bdf761ebbc5f74e640e5155d6 0 Wizard\PlayBonusRateTagCollection.cs Wizard\PlayBonusRateTagCollection.cs 32b5ae7c6fe5998aa1dfac3fac64bc08c36cc127408b983667e85d98bcca76af 0 @@ -2380,6 +2772,7 @@ Wizard\PlaySkipInformation.cs Wizard\PlaySkipInformation.cs 991da0ec87aeb9d1d428 Wizard\PlaySkipTagCollection.cs Wizard\PlaySkipTagCollection.cs b5a8ef396806b07493e98d47000f4519868355ff37432aa94d59ecec87306cb8 0 Wizard\PlaySkipWithActionIfEvoInformation.cs Wizard\PlaySkipWithActionIfEvoInformation.cs 161af11f1248d88fb5b0eac67b043c8e6df9668a1008632660b4fed0c506720d 0 Wizard\PlaySkipWithActionInformation.cs Wizard\PlaySkipWithActionInformation.cs 444852c31fc756f4e09231c2993261bc2feb600deb6f1eca2f687bfd25c45939 0 +Wizard\PlaySkipWithEvoInformation.cs Wizard\PlaySkipWithEvoInformation.cs ab1f8c1e0a656b97fb240e2094d7189958d278aafd48cc1aa50b09769e9cdecb 0 Wizard\PlayTagCollection.cs Wizard\PlayTagCollection.cs 68c84ed4598bdef107d093b7662ddd4a51cfcdeecc73c72cb40db08fd6d01fa3 0 Wizard\PlayedCardInfo.cs Wizard\PlayedCardInfo.cs 4f5236fb71867c8607bc4f3aacee3e5355080a4d5a4a79bc6521f564b7994e6e 0 Wizard\PlayedTogetherHistory.cs Wizard\PlayedTogetherHistory.cs 4539c3f65d8eeec93a128d35d03162aa0920584fd6c0572819926d650f1bf1d4 0 @@ -2387,6 +2780,7 @@ Wizard\PlayedTogetherInfo.cs Wizard\PlayedTogetherInfo.cs 2ad8297287d54111f23f6e Wizard\PlayerEmoOnLeaderDamagedPolicyCollection.cs Wizard\PlayerEmoOnLeaderDamagedPolicyCollection.cs c184b3bcdee48da727b852c93144b682dd012190bb9a6a2cdf15a71d78c305c2 0 Wizard\PlayerEmoOnTurnEndPolicyCollection.cs Wizard\PlayerEmoOnTurnEndPolicyCollection.cs 8bcdde120838b245bdae2c8b2f0f980ea5e6ae9f6cb82f408ee2818f6889d874 0 Wizard\PlayerEmoOnTurnStartPolicyCollection.cs Wizard\PlayerEmoOnTurnStartPolicyCollection.cs 1820ab12d06d0480f691e6e27c845fe7d714dc89520bd49c07d298d5217964bc 0 +Wizard\PlayerPrefsCache.cs Wizard\PlayerPrefsCache.cs 2b8c03328e4c85f7900af6d163b6e51253c58ab04c0c44fe3860affcb310b831 0 Wizard\PlayerPrefsWrapper.cs Wizard\PlayerPrefsWrapper.cs 55326eeae1bd6269244e81c561851a486cedf959b981caea8f4de3bb80f01b67 0 Wizard\PlayerStaticData.cs Wizard\PlayerStaticData.cs 7928b47254bacd87b53525bc22a5401e4471860e6d62d12b3c1fcfb420625a54 0 Wizard\PlayoutBonusTagCollection.cs Wizard\PlayoutBonusTagCollection.cs e09f770ddfeb7644d0d836a9d9747944a76a1ca464e4301b7469c52433d69051 0 @@ -2401,8 +2795,16 @@ Wizard\PracticeAISettingData.cs Wizard\PracticeAISettingData.cs 59f4b1180f859de7 Wizard\PracticeAISettingDataSet.cs Wizard\PracticeAISettingDataSet.cs d718d5d948ff6fb0a57614b84d7f11a04c99bfcf099c6f3916e56522017f22fc 0 Wizard\PracticeData.cs Wizard\PracticeData.cs 46f8546a0b0ad4fa7e383db8ebae71f94f8e7489336e2cc49150984086ea02a1 0 Wizard\PracticeDataMgr.cs Wizard\PracticeDataMgr.cs 8807b1c5f3579893c86becdab6748170b0f0d421645b3786291a70eccf7651ba 0 +Wizard\PracticeDeckInfoTask.cs Wizard\PracticeDeckInfoTask.cs 38fa87c840d197ad9aa94bd147f129c4a3f5799b1187d51b39ed770971b6433c 0 +Wizard\PracticeDeckSelectConfirmDialog.cs Wizard\PracticeDeckSelectConfirmDialog.cs 13f8bbdef277832992bdeb7600f8d0bfa2dee1e4d60e3585b182b72c35fa725c 0 Wizard\PracticeFinishTask.cs Wizard\PracticeFinishTask.cs d10192570f5b7a64781d5e092dc30b83c6959fea2af08b630521977ae9c6b197 0 +Wizard\PracticePuzzleBattleFinish.cs Wizard\PracticePuzzleBattleFinish.cs ed2e79308d9c0bf875285fae6dd3e7c0008d348f70b8b9b4515823bb30f7a046 0 +Wizard\PracticePuzzleBattleStartTask.cs Wizard\PracticePuzzleBattleStartTask.cs bdcbb6d0b03d007e52ef3119fbee18375348aa9d3a1d45437d700978c63eaa35 0 +Wizard\PracticePuzzleData.cs Wizard\PracticePuzzleData.cs dd1450b0ad2e2fe40e000e13a683e2a16e6a1e16e7713918dc609916c841e526 0 +Wizard\PracticePuzzleListTask.cs Wizard\PracticePuzzleListTask.cs bef9de12e7f2e7d682dc8d5cfe6e53b47b2244c28672d69ad9c0fa34775b8797 0 Wizard\PracticePuzzleMissionData.cs Wizard\PracticePuzzleMissionData.cs 47003f300e5cf92034b000af42ec55b6d8797551ff78779f988cf4fb444b3969 0 +Wizard\PracticePuzzleUI.cs Wizard\PracticePuzzleUI.cs aeadd06a59ad34917b6d49b08b7e588d6418b60c480854b398f83f1ab089a1bf 0 +Wizard\PreRotationFormatBehavior.cs Wizard\PreRotationFormatBehavior.cs da6d17ff9cab5d432f8c421d9a52ebb059ceae41c37920f366b2262e5a1e9592 0 Wizard\PremiumCardConversionDialogParts.cs Wizard\PremiumCardConversionDialogParts.cs ef813540d655bcf33bcdf994acfdae8185dc8dcf85976520da2f394c6125733a 0 Wizard\PremiumCardConversionTask.cs Wizard\PremiumCardConversionTask.cs bd38fcf046c19a6950f9dd0857065a55e01e6defd496a53413bc0aa2aa8d2142 0 Wizard\PreprocessTagCollection.cs Wizard\PreprocessTagCollection.cs 2f22016f344bf7a05815f0d60d7721a9ecaa1094dced3c3007c77b4372cb2368 0 @@ -2415,19 +2817,26 @@ Wizard\PuppetAttackTagCollection.cs Wizard\PuppetAttackTagCollection.cs e284ebde Wizard\PurchaseConfirm.cs Wizard\PurchaseConfirm.cs 91ab7d0a239b6ddf305b5395e8cb058c5714a0b6a5d4e1534990e912ec2af0d2 0 Wizard\PurchaseRewardDialog.cs Wizard\PurchaseRewardDialog.cs 66c1260e844322ac7c786ebc6ef10dcd3390fea3724c38abd2898aa4961917cb 0 Wizard\PurchaseRewardInfo.cs Wizard\PurchaseRewardInfo.cs 68266e03484b149bbe1ec5d0d26ca99f5377e33cf6194af6c332ae021d96c925 0 +Wizard\PurchaseRewardItem.cs Wizard\PurchaseRewardItem.cs dd7e30d290725cf9a7f1daca7a5228c09c0191f32a9078f224a33564f651b2e5 0 Wizard\PuzzleAnimation.cs Wizard\PuzzleAnimation.cs d39d28b1116f056e57c19e9e18249f9989c6907b6e6413451d343e2127fe1746 0 Wizard\PuzzleBattleMasterData.cs Wizard\PuzzleBattleMasterData.cs d1724a7755e6ffd48ced04db5853dbfec787b6190c235471eb96b8ababf766c0 0 +Wizard\PuzzleHintDialog.cs Wizard\PuzzleHintDialog.cs 0366b1c5e455351352c856dbd371920d954ed4d6a922560bbebef0eabefcecb5 0 Wizard\PuzzleQuestData.cs Wizard\PuzzleQuestData.cs da6724883671e227cfd3b5b8eb64af071bed3ffec7ecb95e84710b18db96b901 0 Wizard\PuzzleQuestInfo.cs Wizard\PuzzleQuestInfo.cs 17e215c00ac4d2ec648d5a3c7a70393fea406889685c88434b6d526571811f7b 0 Wizard\PuzzleQuestSelectDialog.cs Wizard\PuzzleQuestSelectDialog.cs 2f297d0ea4730615c2657a05777994e224732fe8003c9e231b307d5eb8b500ba 0 Wizard\PuzzleQuestSelectGroup.cs Wizard\PuzzleQuestSelectGroup.cs 825f716ed1886765d08cdc9d43e623e98fc1db4a092f0b27c418e2af744fba6f 0 +Wizard\PuzzleQuestSelectItem.cs Wizard\PuzzleQuestSelectItem.cs c0b5b5b27d90e719673e39c46ff500c503e0516c439c0bfe088804d511bb7687 0 Wizard\PuzzleQuestStatus.cs Wizard\PuzzleQuestStatus.cs 080f93e95b6fb21f06ca4e7874ef9050bd4bcb62338f5c0e12b05de722cecca9 0 Wizard\PuzzleUtil.cs Wizard\PuzzleUtil.cs bafb6cdbfa6a9e1878ac22eecbe6c6fab77c4998dba4f4a7893813cfbb39e5a7 0 +Wizard\PuzzleWinConditionDisplay.cs Wizard\PuzzleWinConditionDisplay.cs 7239697f83889fdb99f607e6ebdf7236178cf02a6c0f07b4d038e95b7f35a546 0 +Wizard\QRCodeUtility.cs Wizard\QRCodeUtility.cs c8af515564303b95a73435f9cc6e227eab7869005b298fde2a9792aca85efbc4 0 Wizard\QuestAllConfirmDialog.cs Wizard\QuestAllConfirmDialog.cs 797160bab5654b592f9bd5e9390e42008336c0ba9e0aeea1aabdab7a0e435bed 0 Wizard\QuestBattleData.cs Wizard\QuestBattleData.cs 2c7b710d636f9f2112f6216b78f6516f17e573803db9277c03e2d04200b2e23a 0 Wizard\QuestBossData.cs Wizard\QuestBossData.cs 54bea11a04848ecbba06458cc3fb23ee38eb80ffe096871a490c3c3e10730f7a 0 Wizard\QuestCampaignDialog.cs Wizard\QuestCampaignDialog.cs ac77934edc832b5b3d82459ea80b834bcbb2448c26882d1c8bcf2510c4a881aa 0 Wizard\QuestDeckListTask.cs Wizard\QuestDeckListTask.cs 7c35ec8edc89aaefdab8f908cdf6ec9067a7635d9d89fd135783e8226d348f1c 0 +Wizard\QuestDeckSelectConfirmDialog.cs Wizard\QuestDeckSelectConfirmDialog.cs 34de87600a1350e054bb2a695fc14cfe75babbf8c368ec4f722a261199ff3891 0 +Wizard\QuestFinishTask.cs Wizard\QuestFinishTask.cs df06faf4d119a9aaccbefe6a28b34215e975e134cb59a8a5e22da5505e21e1ed 0 Wizard\QuestGaugeItem.cs Wizard\QuestGaugeItem.cs dd1dc88a5b96dcf53a47bfead6786c42c20b7b422547f9946b5213d534309b7f 0 Wizard\QuestInfoTask.cs Wizard\QuestInfoTask.cs b6da4bc6326ab5b8a11367cd77cc00a563847486bd62528ec1badcd71451e271 0 Wizard\QuestItem.cs Wizard\QuestItem.cs 6f873d6290ba0122b8c6789fb23e5ba9ec1a602bbe11e8fe50dad5eff8b712cd 0 @@ -2446,17 +2855,25 @@ Wizard\QuestPointInfoTask.cs Wizard\QuestPointInfoTask.cs d536b67d78c30f75ac3727 Wizard\QuestPuzzleSelectionButton.cs Wizard\QuestPuzzleSelectionButton.cs 856cba9ac3c534d254d3d3f444cc0c6c489e6146984a12b7fb870a6d98a881e7 0 Wizard\QuestRewardInfo.cs Wizard\QuestRewardInfo.cs c0d8c01dd78824d62c5f145bea4141a576db63d39ca2230e35eb41fe48342e97 0 Wizard\QuestRewardReceiveAllTask.cs Wizard\QuestRewardReceiveAllTask.cs 8a176374c8b8e0de2c80c6baf26cb7a13435dc036c82ad4f3afd528126478d75 0 +Wizard\QuestRewardReceiveTask.cs Wizard\QuestRewardReceiveTask.cs f3e8b6c06cf492740d439122e2fbb137c1e3a98d046d1f8ad57badabd4e86046 0 Wizard\QuestSelectionButtonBase.cs Wizard\QuestSelectionButtonBase.cs a6376f737ad9c5e89199eb572562d3e85f8537bf4b0e349df1d95462cb8f2230 0 Wizard\QuestSelectionButtonData.cs Wizard\QuestSelectionButtonData.cs 63f83ab58371f7a90664d831e88932b1c6ef39b5e93b99308aecd0d87fe381ab 0 Wizard\QuestSelectionPage.cs Wizard\QuestSelectionPage.cs 4a4a0e23ca749a3e634e45fd0edab5c1a4902651f56b982a057136a705940685 0 +Wizard\QuestStartTask.cs Wizard\QuestStartTask.cs 9bf4ab93c0616d945f16995bd3c0426b1b21766091e7e459f2cccf488b645b53 0 +Wizard\QuestTweetTask.cs Wizard\QuestTweetTask.cs 19335e16a89c3ab8033ff682a36210c12772a6de1b14b56139e69842d22897fa 0 Wizard\RallyCountPlusTagCollection.cs Wizard\RallyCountPlusTagCollection.cs 4925407e467310dbb38e525aa9a90f4dede317572f982adf5d8fc273bb6ade51 0 Wizard\Rank.cs Wizard\Rank.cs 1bbdd3efaf38a8a9e587ae8094b0db792cb81d1df7cf63252f739347b1803cba 0 +Wizard\RankBattleDoMatchingTask.cs Wizard\RankBattleDoMatchingTask.cs b111a9e8df73fc71fe09e65e120ff482075f9591e7bdb500e632cbc021dc3ddd 0 +Wizard\RankBattleFinishTask.cs Wizard\RankBattleFinishTask.cs 4a7bb61041265a910d2324bde0435b0def1b3acbea47570b25b019c1ddc34e99 0 Wizard\RankMatchAISettingData.cs Wizard\RankMatchAISettingData.cs 210b88babcc6daff656bdc2fe24edcd0a9556351f2b147d5f04a37f52a770f42 0 Wizard\RankMatchAISettingDataSet.cs Wizard\RankMatchAISettingDataSet.cs a0dd289c49ede4aac584291fdeeb060cc0c9b70c4e1a123cad6cab216ea2de55 0 +Wizard\RankMatchEnemyAI.cs Wizard\RankMatchEnemyAI.cs 6f70b2ad24fb6f304d55db4791ce68fc2ea4359648eba2c0d609075d4fd7b7d4 0 Wizard\RankWinnerReward.cs Wizard\RankWinnerReward.cs eaca300be07defdbf22c9792d9697997fbbf9b0f162a3fabc535498f7c28e0da 0 Wizard\ReanimateBonusTagCollection.cs Wizard\ReanimateBonusTagCollection.cs 6ac7d8043c9a315e74aa1533f36f00468f432fb4043367c6c7f6881ca06b9e34 0 Wizard\ReanimateEvoTagCollection.cs Wizard\ReanimateEvoTagCollection.cs a266712e3ded29167a94fd881ee344b35eaf3eaad8f1359736d2c76ee0e02881 0 Wizard\ReceiveTurnEndToJudgeResult.cs Wizard\ReceiveTurnEndToJudgeResult.cs ef2f76201ccef6b81ce3b2ff37016bc839e7126f5772524f74d114d3d826e6b9 0 +Wizard\RedEtherCampaignMissionLabel.cs Wizard\RedEtherCampaignMissionLabel.cs c6d10bcb57880225ae980b403b360e6bd58afd27be12395617fd07191d0b5c0e 0 +Wizard\RedEtherCampaignPanel.cs Wizard\RedEtherCampaignPanel.cs 0e5e7c126acad45c93499b9b2279a684b556f0157179d563c051cb2c3cabcc88 0 Wizard\RedEtherCampaignResultData.cs Wizard\RedEtherCampaignResultData.cs 83dcda42b623e04deaad677b7a127eb8fc5a3b762d8969ed3d32e2bd4ec92a90 0 Wizard\RedEtherCampaignRewardData.cs Wizard\RedEtherCampaignRewardData.cs ee29767b469b128fd64232d415baf1a34b315478dd268f4fa59a9774b5789d3b 0 Wizard\ReferableVirtualCardBuildParameterCollection.cs Wizard\ReferableVirtualCardBuildParameterCollection.cs b04760995eddf63a9f8f7dcc1ca3064092bc880a67eb1ba7f808e77dfd7cf829 0 @@ -2464,6 +2881,7 @@ Wizard\ReincarnationSimulationTagCollection.cs Wizard\ReincarnationSimulationTag Wizard\RemainTime.cs Wizard\RemainTime.cs cad4a6d7241987deccf91cab20b07146a393262888f556743b959d015c58c7cb 0 Wizard\RemoveByDestroyTagCollection.cs Wizard\RemoveByDestroyTagCollection.cs 6bb0f29c81a74b7bab7c062244773c4a7c366ea76836db7ca5abe860d097c38b 0 Wizard\RemoveSkillTagCollection.cs Wizard\RemoveSkillTagCollection.cs 4b31000c33a964929a361f964499aeddd2e884862600c4488c86d49e8a21120f 0 +Wizard\ReplayContentView.cs Wizard\ReplayContentView.cs 60ca9b5671ddd42e7fc6845b9504d09b415ebae5bbb4e35a5c833bc1b4941a8d 0 Wizard\ReplayInfo.cs Wizard\ReplayInfo.cs c1a4ac59b3c2867dee7d40b8756492ddb6418bb5895a96e663eb0ec73b36bea4 0 Wizard\ReplayInfoItem.cs Wizard\ReplayInfoItem.cs f33d8625be78c3ff5edad57e4a9350f2721677352b1e637dde6f604c37db2471 0 Wizard\ReplaySkipAnimation.cs Wizard\ReplaySkipAnimation.cs 028d4fbc5d2ac366f5a90c86245482b36f37990c22eedd1f9b1109b5e673d346 0 @@ -2472,15 +2890,41 @@ Wizard\RewardBase.cs Wizard\RewardBase.cs ea35849169b3987c450abbaece54578234821d Wizard\RewardConfirmDialog.cs Wizard\RewardConfirmDialog.cs 021ab951cdc0d5415fa633e3ae3baa4d455d7f58effe7cc50ab607cd366cc111 0 Wizard\RewardConfirmView.cs Wizard\RewardConfirmView.cs 10b0861af3584726436dbc8f2d1881984455c98878e9fe32731e5d73e2966e8b 0 Wizard\RewardConfirmViewItem.cs Wizard\RewardConfirmViewItem.cs a610a6e1717c0e451e02d3aa855904d94cf7402180f65380e09ff8ef9119b623 0 +Wizard\RoomBattle2PickDoMatchingTask.cs Wizard\RoomBattle2PickDoMatchingTask.cs 97c2eeaa9c42d136a24fb6a1887aa61231a8ee16698e9c90bf98090d0b0dab36 0 +Wizard\RoomBattle2PickFinishTask.cs Wizard\RoomBattle2PickFinishTask.cs 916d9096fe82c2e9b7c50bcddb74713a1812a98c0a9b7c5972f04c67dbc8f8ba 0 +Wizard\RoomBattleDoMatchingTask.cs Wizard\RoomBattleDoMatchingTask.cs 9fb411d45b8c8e4f9858cc7ec9903fccc06f87ddbee0b923cbaf4730c3240bf0 0 +Wizard\RoomBattleDoMatchingTaskAvatar.cs Wizard\RoomBattleDoMatchingTaskAvatar.cs 0dff84a1eff96c8b810cb853bcb02fabb9f979471792e711510cd68686e49132 0 +Wizard\RoomBattleDoMatchingTaskHOF.cs Wizard\RoomBattleDoMatchingTaskHOF.cs 7686d29846b7c8da4b4ebc4915761081f4f712a7583e2b06d221bc88a66b64d1 0 +Wizard\RoomBattleDoMatchingTaskWindFall.cs Wizard\RoomBattleDoMatchingTaskWindFall.cs 1da0a8d237decf92e5c9a678b805391aea8684978e7e15b0992b239db2b2e5a3 0 +Wizard\RoomBattleFinishTask.cs Wizard\RoomBattleFinishTask.cs c4fc3101dbb2ded83ca554ceeea63a14c04812bb71cc3ce04b19fde32fb623c4 0 +Wizard\RoomBattleFinishTaskAvatar.cs Wizard\RoomBattleFinishTaskAvatar.cs 6ba849d2b1e50fca155fa795774bab8674a3036922ce4d8b4669b376ef1c0ab2 0 +Wizard\RoomBattleFinishTaskHOF.cs Wizard\RoomBattleFinishTaskHOF.cs e023260976a1856c0387cd9a55d025c557e7df4a833220095708885c672e6ec6 0 +Wizard\RoomBattleFinishTaskWindFall.cs Wizard\RoomBattleFinishTaskWindFall.cs 76b15e866a28db1664f4116da0ddb459071e11146b99f89b292bae34b2a7618d 0 Wizard\RoomNonPossessionCardCampaign.cs Wizard\RoomNonPossessionCardCampaign.cs c2a0ac27c8f58890764c6733cac8d4c73ecb67b27ebf4a4d18db2022980b0de4 0 Wizard\RoomRuleInfo.cs Wizard\RoomRuleInfo.cs 6ba79e521eaeba627b6ef48ac714180b870049479ed8690533f780c27c07cfcf 0 Wizard\RoomTwoPickMultiDeckInfo.cs Wizard\RoomTwoPickMultiDeckInfo.cs 162e9f436a85bbde551fe7b19f140aa0e2535c62a92a1736ba4aa5b7e6d502a5 0 +Wizard\RotationFormatBehavior.cs Wizard\RotationFormatBehavior.cs b844d354970ff3f6967aca80a4dcb835831592dcecf7ea309081d373f5310eb9 0 Wizard\RubyText.cs Wizard\RubyText.cs 603c0127a9a30f36afd18e894bd0f14eb47c07dcbf2dc70795aee7febc873466 0 +Wizard\ScenarioPart.cs Wizard\ScenarioPart.cs db5f86ccf89a525b0b23a19f5e23f7d3b924d56c185ddb5dffba30ea6da18e67 0 +Wizard\ScenarioSummary.cs Wizard\ScenarioSummary.cs fc6d5aeac36bf313b09f4c52bdf0e288286f9abc641f5598bf27b7813b212302 0 Wizard\SceneTransition.cs Wizard\SceneTransition.cs 3858aa170b79fe0d46824439ee34bd85865732bc0c96dfa9bc8b37f5a28a0670 0 +Wizard\SealedBattleDoMatchingTask.cs Wizard\SealedBattleDoMatchingTask.cs 7d146127c5d37576d6ec7a85b8012305b29cb72fcbf409b06e547bec75b5de11 0 +Wizard\SealedBattleFinishTask.cs Wizard\SealedBattleFinishTask.cs 16482a698b71345f8077e131c9896377cab92856a2c31f8b4e584a5c4ab25ac3 0 Wizard\SealedCardInfo.cs Wizard\SealedCardInfo.cs cce1286ee19cba2f723c2ccc551dd0d86ce57e4cfe48dc17364166cb94f84cd7 0 Wizard\SealedClassInfo.cs Wizard\SealedClassInfo.cs b767bc9d34b118b82729ce158dc1f52ab666abde3c80336bad1c6d4268ab1f22 0 +Wizard\SealedClassSelect.cs Wizard\SealedClassSelect.cs 9c654ebff2da9191e3b32d8f5df4ad9db3d74d9ea08e05d5a7e57c6e116711a5 0 +Wizard\SealedClassSelectConfirmDialog.cs Wizard\SealedClassSelectConfirmDialog.cs 4732bca48b8de65649356eebca0e62782dcb816fc428bb8d3c7855677a8b8a18 0 +Wizard\SealedClassSelectLoadRequest.cs Wizard\SealedClassSelectLoadRequest.cs 20442e8e544239342ab6b250e1dc6b6c67eef312198539c34e76a4ec0e748476 0 +Wizard\SealedClassSelectObject.cs Wizard\SealedClassSelectObject.cs bf7c8699e094f8ada96dc42dbee4fa0f0adc9aff3c97f57fb96475028cd342ab 0 +Wizard\SealedClassSelectObjectInitParam.cs Wizard\SealedClassSelectObjectInitParam.cs c9c1822be5a6c449365af24c723993ff07b9a03f061200be3f696997c1b9ebc7 0 +Wizard\SealedController.cs Wizard\SealedController.cs 36eecb63551f28a57b21ba01b38cf385d241af0d89c9ea4d6bd2cde359cdfc8d 0 Wizard\SealedData.cs Wizard\SealedData.cs 64eef0afbb678d29b18696e41cf2ea13b2950eb9392154f9123ac1d6a554ec70 0 +Wizard\SealedEntryData.cs Wizard\SealedEntryData.cs c8bbd9d82b200f0d2ce15fbc40fb52f4a369ebbdcab415fee9a2f33b4334dfc5 0 +Wizard\SealedFormatBehavior.cs Wizard\SealedFormatBehavior.cs 22997985fd859e05aac4f25a208fdfcfda552e144ad99477c1217ec042d1c62c 0 +Wizard\SealedLobby.cs Wizard\SealedLobby.cs 79a79c33dfb0c600d1b06b52a91a643de97d0db5491963c34fb89d04b093d41f 0 Wizard\SealedMyPageResponseData.cs Wizard\SealedMyPageResponseData.cs e4532941557173ee81bd1262fd7883720e7170ec80d739943d719c11c9ec0ff5 0 +Wizard\SealedStepFuncs.cs Wizard\SealedStepFuncs.cs 681c73c79ee719bccbbe71160299bfdafa2ba531d8b73f6bf2efb1a37d2a87d3 0 +Wizard\SecretBossDeckConfirmDialog.cs Wizard\SecretBossDeckConfirmDialog.cs 278f242c93552a8308d4f2e7d3c87fa7fbaa35d4e99e7a079462cbc6a8791fec 0 Wizard\SecretBossInfo.cs Wizard\SecretBossInfo.cs 5ee84152be88797d9d5147965973aad8011e7ad23e07bf2c2a4df512012f99b9 0 Wizard\SelectBuyNumPopupBase.cs Wizard\SelectBuyNumPopupBase.cs ecea78a81f059d7e3d7bf18e05ef61bfa39a85e0b72b0f53991e8edbf498c90e 0 Wizard\SelectCardPurchaseConfirmDialog.cs Wizard\SelectCardPurchaseConfirmDialog.cs d903d5c304091a75730d89c2762f51c1c1f9bc8d4b6de53405e6a037a08c7e40 0 @@ -2488,6 +2932,7 @@ Wizard\SelectSkinCardDialog.cs Wizard\SelectSkinCardDialog.cs b4843278a392d9b14c Wizard\SelectSkinCardInfo.cs Wizard\SelectSkinCardInfo.cs 6011046eb19f8a1d354683c144f769a09f56ff42f43a4d4245aeb1beaac72fa2 0 Wizard\SelectSkinCardPlate.cs Wizard\SelectSkinCardPlate.cs b2f7078b56691bb3b8f2829af9d48e52c4ecd077fef2f705a63d27412749a125 0 Wizard\SelfAndOtherEvoTagCollection.cs Wizard\SelfAndOtherEvoTagCollection.cs dcd522c9567e370f36d467501d30d5f7e8f0e570f6ba60272c95b014705198de 0 +Wizard\SendTraceLogTask.cs Wizard\SendTraceLogTask.cs 60f0d6ff3011c0a5248d1e1b189584ba4c285d9d4d789ebc527c317c241dbe74 0 Wizard\SetAITribeTagCollection.cs Wizard\SetAITribeTagCollection.cs 69b942da626b35c3f41096f752dc2456adf3315ed15777644baea2fe80f87f7a 0 Wizard\SetReferenceIdPolicyCollection.cs Wizard\SetReferenceIdPolicyCollection.cs 8cf3171c99f0bfea8fb69de902e587a5ea113a49c935b269be49f001c7f4c288 0 Wizard\SetReferenceTribePolicyCollection.cs Wizard\SetReferenceTribePolicyCollection.cs 38b4892c251736b3b2aa706a8d6d96d6584b25f83a5764345ff57f4399a1cff3 0 @@ -2505,12 +2950,15 @@ Wizard\SimulationAdditionalActionInfoSet.cs Wizard\SimulationAdditionalActionInf Wizard\SimulationResult.cs Wizard\SimulationResult.cs e7664bfdf29cce647808d1fa5989de992affa051e552a2fbe4c627ccc37c55f4 0 Wizard\SimulationSetting.cs Wizard\SimulationSetting.cs 77cdc42ebe248d32c80459d163910035dd3b2a20383025b8fbd4099697926f45 0 Wizard\SkinProductDetail.cs Wizard\SkinProductDetail.cs 62ba878fd680385058defd2b206b2a194f21f2eeebbebf21bef478afb0d9aef5 0 +Wizard\SkinPurchaseInfoTask.cs Wizard\SkinPurchaseInfoTask.cs 3454d2cf87c68b916cb0f31f007cc06b3a06c3548eee7899c177d90c36e357d3 0 Wizard\Sleeve.cs Wizard\Sleeve.cs 7f871310a61810e786bb5daeb65e994c5deb2f1c2f6269065892a4d325553e80 0 Wizard\SleeveBuyTask.cs Wizard\SleeveBuyTask.cs 0d00a58104bd404cfb18e3a8354186f94adc71158f214b52c388b08e808d4470 0 Wizard\SleeveCategory.cs Wizard\SleeveCategory.cs d636241391f0421028aec23fa83b44af32beb01a3af5bc14469fe076b8016a38 0 Wizard\SleeveMgr.cs Wizard\SleeveMgr.cs 65624ba278a3238a02189445cf03fdf423d1e8985338d938a389c002e5bbf497 0 Wizard\SleeveSeries.cs Wizard\SleeveSeries.cs 9a3658f9b77625a36c9ce51c8797c3fec4f8a9d48b541e828a372b71490b45ba 0 Wizard\SoftwareReset.cs Wizard\SoftwareReset.cs 34b932e97699b44f002a33ef3d500a42d2c91473bc726c7a5e1baed65a44d2af 0 +Wizard\SoloBattleEnemyAI.cs Wizard\SoloBattleEnemyAI.cs c6816cba54b636abfb717276a9dc7b11a020e032552e8d81e724d377e87459f9 0 +Wizard\SpecialTitleAssetBundle.cs Wizard\SpecialTitleAssetBundle.cs e66f46da8066697b5f1ad0ae64808ca6bbbdbd93d0a17cabd5bebebe7c635c13 0 Wizard\SpecialTreasureInfo.cs Wizard\SpecialTreasureInfo.cs 7a11bde523e27e58b1ed032703c755e76da0a85e0b1919f7cdff673f440731d1 0 Wizard\SpeedChallengeInfo.cs Wizard\SpeedChallengeInfo.cs 9fd6697d1c55746b451fa07809d610d6ba1251ad6b723ece688a3b04fc996876 0 Wizard\SpineDisplay.cs Wizard\SpineDisplay.cs ea318e1a3fc12d23581101ef989a9d32d7dadcbb33a1104526b2cd7c9b8008b6 0 @@ -2518,12 +2966,16 @@ Wizard\SpotCardData.cs Wizard\SpotCardData.cs ac20fd44447242b9ecc761f3b4acf3bb40 Wizard\SpotCardExchange.cs Wizard\SpotCardExchange.cs 40ab6e8cfa601cac24d61ee262c4715f40fdecb81f3b705b9458db57540c9592 0 Wizard\SpotCardExchangeDialog.cs Wizard\SpotCardExchangeDialog.cs bb9eb3bed731bb46701d97f1951f7a10bfe8af3ce51cf88a87b1728b285bcc51 0 Wizard\SpotCardExchangeInfo.cs Wizard\SpotCardExchangeInfo.cs f8441842f1c264887158a5e5fa5305830a11308af593bd4049893b9a9f54d17a 0 +Wizard\SpotCardExchangePlate.cs Wizard\SpotCardExchangePlate.cs 943fac1cde750532368f107b98903c6eeb5b6dfed972d2ac3b35692ee2111c1b 0 Wizard\StarterClassSelectDialog.cs Wizard\StarterClassSelectDialog.cs 3522461bbc4d0f73d1beb639b37213f68a9691ea3a344df56e34ff7ba75b2e4b 0 +Wizard\StarterPurchaseConfirmationDialog.cs Wizard\StarterPurchaseConfirmationDialog.cs b71ac292410e536bbdf302395b6b8584d500a40746167ad1ab885229cbfe2ecc 0 Wizard\StoryAISettingData.cs Wizard\StoryAISettingData.cs 14402dc36fa4ae13f154c8110141087145efb387c94292f7a5102dd3b671151d 0 Wizard\StoryAISettingDataSet.cs Wizard\StoryAISettingDataSet.cs 76693a53b4022593dd67cd8d08b41c2ab7647d8b3663176b13909ca0e6c11900 0 Wizard\StoryFinishTask.cs Wizard\StoryFinishTask.cs dbf0508b3638ac87b55872f060f672960b38de3c2cabcf6d8bdd3499047d4643 0 Wizard\StoryNotification.cs Wizard\StoryNotification.cs 2031e97ce2caa711e695a8ca6b372e9c43c4957e890d274a857887d387eb2808 0 Wizard\StorySectionBtn.cs Wizard\StorySectionBtn.cs 4c5017f7a46c2aadf025f170455524a7fbcdaf230357f103411171a21d2e67b9 0 +Wizard\StorySectionSummaryDialog.cs Wizard\StorySectionSummaryDialog.cs 2592e979478669a865bccc1f2dcfd8943d38248f4f93e842c58cac1fc2125455 0 +Wizard\StorySectionTask.cs Wizard\StorySectionTask.cs f0bb589fd600a447d375f42b1653ccc12c6225016bc00a53e6977520ee648653 0 Wizard\StorySelectPage.cs Wizard\StorySelectPage.cs 9f24b2f8f98fd01b416272fbd6653d2a4394e94276813dbe4392144e459c831e 0 Wizard\SubClassSelectDialog.cs Wizard\SubClassSelectDialog.cs ce9eed6444e38ddd10eb305755b400808395d861621442d60553e91e46b6351f 0 Wizard\SummonTagCollection.cs Wizard\SummonTagCollection.cs 584ee636f3d8826973893728e77f5a72cc4c4b608357b6bccb993f17abf46976 0 @@ -2533,6 +2985,7 @@ Wizard\SupplyLabelPlateListUI.cs Wizard\SupplyLabelPlateListUI.cs 9c49cffa2ff008 Wizard\SystemText.cs Wizard\SystemText.cs 1450cdaf4d2f61346fb8743ca0be089647c64f328b825d2e1f9d9ce667655dc3 0 Wizard\TagCollection.cs Wizard\TagCollection.cs 16016406df9b7e9287ba64d32b57297059ee1a1fe2f3b57845ec7ad4588630ea 0 Wizard\TagCollectionType.cs Wizard\TagCollectionType.cs 6723cd1be89e3669a02e640d2b4528d8908b0322f25fef413e8b147e3aea3101 0 +Wizard\TagCollectionWithMultipleTypes.cs Wizard\TagCollectionWithMultipleTypes.cs cbaa5e18e5c01e87510d40f27ca88332bb11ee17313a4503e68dfe877c0fb6e7 0 Wizard\TagCollectionWithSingleType.cs Wizard\TagCollectionWithSingleType.cs 13828b771705d65b2626fda575be6d2de1057d1b91b26917d20c96e9b3179371 0 Wizard\TagCollectionWithTypeBase.cs Wizard\TagCollectionWithTypeBase.cs 9ba0688d57518d19a3ed80819ae1501bd59c911e7749388aff097dfae8f46aee 0 Wizard\TagCollectionWithTypeCreator.cs Wizard\TagCollectionWithTypeCreator.cs ba793e436b0c9b4f4ec2e4d0b8cdb6d0572c1285556baf0068fb6d330d0d7cbc 0 @@ -2542,20 +2995,30 @@ Wizard\TextLineCreater.cs Wizard\TextLineCreater.cs fdb7f0a918c2f5b92268954b3980 Wizard\TokenPlayPattern.cs Wizard\TokenPlayPattern.cs c14d846afb81b876291013c077cbd503bebd27b651b5b78708e93d68758e2e7b 0 Wizard\ToolboxGame.cs Wizard\ToolboxGame.cs f0a39a9ec7a06d08cc2594cc93f010c602946492ed93c002775c41000f30ef75 0 Wizard\TransformBackup.cs Wizard\TransformBackup.cs 590cfc9e5b00c6896b9bff2e1086827dd53d821b99cc83a76bc76f94ea053135 0 +Wizard\TransitionDeleteTask.cs Wizard\TransitionDeleteTask.cs 8add5ad5b354244a204f363738e421430bf935f915e08b8d3c05a259902ccb98 0 +Wizard\TransitionDialog.cs Wizard\TransitionDialog.cs 902558332dfac4b76963ac9021eb5c723ebb15dd15d3f4fd1c6fbbef30b2e37e 0 +Wizard\TransitionInfoTask.cs Wizard\TransitionInfoTask.cs ab19b5d418517b6201f68a372a316f1c95d705b75a9e39d94e8642af5b472e8e 0 +Wizard\TransitionPublishDialog.cs Wizard\TransitionPublishDialog.cs d8c56ceee7cc8bfdc84ad8962798e816fb3b5c8a989a00ff05fcb2a5af3b4714 0 +Wizard\TransitionPublishTask.cs Wizard\TransitionPublishTask.cs ab1e0e766b8239b0acf1e99bd4fce171ed56dc7d329287686aac0b5759fdefce 0 Wizard\TreasureBoxCp.cs Wizard\TreasureBoxCp.cs e78c9c95de87adcce86167b4f99afc69960072254fbff0226dbb27aa2253c10f 0 +Wizard\TreasureBoxCpDialog.cs Wizard\TreasureBoxCpDialog.cs 0cf1c94147a7432b0d154d5d5cdf950a05d3db6a6a8c769c95ab86ad7e94a1c0 0 Wizard\TreasureBoxCpResultInfo.cs Wizard\TreasureBoxCpResultInfo.cs 77141091f1b85fdfa04005a5551b5d9ae29322c1446c70411e410daec2fe4bc5 0 Wizard\TreasureCpBoxTextPanel.cs Wizard\TreasureCpBoxTextPanel.cs 22be14af133def36515b86ba125a329778b6d3f19997ecc70e7e68bd05167a51 0 Wizard\TurnEndTagCollection.cs Wizard\TurnEndTagCollection.cs 176accc9ed7bbafa5b36a25cbd85caa6bad54acabdbe1f786160ba11737cbdf2 0 Wizard\TurnStartTagCollection.cs Wizard\TurnStartTagCollection.cs a6190321dd648393cb52de200be2bdd7dadeca06f602fd13c9803fd3d84e2849 0 Wizard\TutorialAreaSelect.cs Wizard\TutorialAreaSelect.cs fd8c11bbe4a98a5407fc1bdae75f3fae5fab2a996cde2a54a7fcbd5a73115352 0 Wizard\TutorialData.cs Wizard\TutorialData.cs 2fc9577f9c08b7803e3673d18eee530d3a61d95d0d8b8d5c166e97ab4dc557ed 0 +Wizard\TweenAnimation.cs Wizard\TweenAnimation.cs fcd6dd622114eb97f11737e4db6a7af924eb209a8a6a44ad4aade9d8a1e1ee4d 0 +Wizard\TweenAnimationGroup.cs Wizard\TweenAnimationGroup.cs 5b6eeb31bb7d1cb9cdaae48da61d0b07ba6b5a72145c5b3e1e7a84a54f599c5e 0 Wizard\TwoPickFormat.cs Wizard\TwoPickFormat.cs 7f09731756f955d49fd610f3383ad697786e37c4d09d78bf577b03767bd40177 0 Wizard\TypeFilterDialog.cs Wizard\TypeFilterDialog.cs 4c764fe4b79a18bc267d0775575b85f7bedb28a645935f2474dfebc292ba3cf8 0 Wizard\TypeFilterSingle.cs Wizard\TypeFilterSingle.cs d59034d2a145657e5d06d6db841d13f3ea71a00ddb586f5e8994d8e14ad9de2b 0 Wizard\UIAtlasManager.cs Wizard\UIAtlasManager.cs 5c75b17b39bb1e5e6c14eed56ebbf00a21bc88427227a971897b7d41eae9a173 0 +Wizard\UIDestroyUtility.cs Wizard\UIDestroyUtility.cs ba51f00bdab3124c314a2d7e2e1384f756e9519f4531f04952d2748ce7993eb6 0 Wizard\UIGauge.cs Wizard\UIGauge.cs 0118ff5fbb35e3386abbda434cac738fc420ecbac5dcba1e532483f4ac9b0d40 0 Wizard\UILabelEffectOverwriter.cs Wizard\UILabelEffectOverwriter.cs d91ad280e420b0b04a1e1fda0b58c993d0523b2dce9f58e40bf2fd98aaf9943b 0 Wizard\UILabelGradientOverwriter.cs Wizard\UILabelGradientOverwriter.cs 61d81c1710dbdcfdd5f2ecc07bfaf1aea701f80c45b46c4556705782c43a4eec 0 +Wizard\UIMarquee.cs Wizard\UIMarquee.cs 6cbce7ed5b35b808cb61011c426f87a4d84ea4c96a901de098d13978dc9a95d0 0 Wizard\UIPageIndicator.cs Wizard\UIPageIndicator.cs d4e6665f6992a99dac634794580ed7810242639f10b9a4f4875fc4df0b87db11 0 Wizard\UIParticleEffectGroup.cs Wizard\UIParticleEffectGroup.cs dcc425e476a98214ce77ae6c41500e8a082e3c4ecdea1b06455ffc80da4f85ff 0 Wizard\UIParticleEffectManager.cs Wizard\UIParticleEffectManager.cs 6de2774b868bed1f996dfccce58de26dca47b89b42e03a7929eb95ea97dafcbd 0 @@ -2563,17 +3026,25 @@ Wizard\UIShaderSprite.cs Wizard\UIShaderSprite.cs 26f4dc6be5c3fa99f59e54582797b0 Wizard\UISpriteAtlasOverwriter.cs Wizard\UISpriteAtlasOverwriter.cs 0f3455b58b740cab260d97bf28d1b8e73ba0ba6938f62d4b81021b3329e07bd7 0 Wizard\UIUtil.cs Wizard\UIUtil.cs 6a019191da0f9c4a0605f3ccec9e85f028115bcf1c292b8f0512a20b54654be7 0 Wizard\UnitBonusPolicyCollection.cs Wizard\UnitBonusPolicyCollection.cs b8e5522040191498c5871a91b7330774d4710b2f65ee2af451706ff9cb228baf 0 +Wizard\UnlimitedFormatBehavior.cs Wizard\UnlimitedFormatBehavior.cs a9c6cda132c872841d05088bbe187914479e2b555876b4b45f5be6a7b7bb0948 0 Wizard\UnlimitedRestrictedCard.cs Wizard\UnlimitedRestrictedCard.cs 295618ea53573f498923f63bfabd0b3543552761811830b83e2a18980edfc311 0 Wizard\UserGoods.cs Wizard\UserGoods.cs c21dd8bc5521e705da0994f68771149a54d461f49d00fbd54f9d8673bb047eb3 0 +Wizard\UserInfoBase.cs Wizard\UserInfoBase.cs ad812a1d63e876c52e813a7a70bb468fd85a8814f1adeff8686f49763d4d3b2e 0 +Wizard\UtilityDrumrollItemCustomize.cs Wizard\UtilityDrumrollItemCustomize.cs 4d708a6f05b32993026e2a719bd67a44446e41de59baa8f62878604f2653dda9 0 +Wizard\VoteDataTask.cs Wizard\VoteDataTask.cs 970031c62f0a7056fae5f88a0033f4bdd6c92cf10b46a228608f19cbf50f8882 0 +Wizard\VoteTask.cs Wizard\VoteTask.cs 6997ab7504f80977a4fe1db297832eb7a6b5cc9399a3cf6354e12c0d4be177bc 0 Wizard\WebViewHelper.cs Wizard\WebViewHelper.cs 6de04c4f2ed591d28abd463e1ecf8392e75ac345520c2632365aef575d87bc53 0 Wizard\WebViewScreen.cs Wizard\WebViewScreen.cs db0acaf319d8dc5ee28c441a4c32d88b59f49632efcb5707de85ed1ae47ecf7e 0 Wizard\WhenGetOffTagCollection.cs Wizard\WhenGetOffTagCollection.cs 56009d6b9acb7df9d376670526228b9b51d19fadd14325cc60166a0a0d82d7d1 0 Wizard\WhenNecromanceTagCollection.cs Wizard\WhenNecromanceTagCollection.cs 2576488749e9fa264bac47d56edcca8f30e7b0eaa08459f85ea0286f39453925 0 Wizard\WhenPlayTagCollection.cs Wizard\WhenPlayTagCollection.cs 4b4ee7e60d9fc7d6ac23ce8b3cec928d542ea6bb55d3637ad66093f0cba30141 0 +Wizard\WizardFirebase.cs Wizard\WizardFirebase.cs 2f1fe52b52dcc184ba1630ed0df7713c3a49f83a8700d459cee2e0c40b03dffc 0 Wizard\WizardUIButton.cs Wizard\WizardUIButton.cs e078cf8215ad02ac1c0fd4a7fe66ab7151dcf704fc230c199a12caab67719d5b 0 Wizard\_3dCardFrameManager.cs Wizard\_3dCardFrameManager.cs d23f7bd3cc2ddbb86f9a40d1dea6941796cf7562f9dd0f804b6acccd9a345396 0 Wizard\eColorCodeId.cs Wizard\eColorCodeId.cs 4c853d61f36776bc6a652c11a6eabdb4dbde7ff8ff5fbc410fb4b878a17edcb1 0 WrapContentsScrollBarSize.cs WrapContentsScrollBarSize.cs 90b8b14191d5016037bc1b907ef9408f9aecc63e8a2562cd58db8991345a538e 0 +WrapContentsScrollBarSizeByDirection.cs WrapContentsScrollBarSizeByDirection.cs 61585719e6ffc0839f025ebbfa59cf4949d16685ea71addd2a5533395ff6aff5 0 +WrapVariableContentsScrollBarSize.cs WrapVariableContentsScrollBarSize.cs 05c94e8b843c29e056c2f9f3a7303febe0638d3cf83aa1c46e30df93d36f768c 0 YuwanField.cs YuwanField.cs 1368d0b2755edbae36ce4dcabd69d8d2f6ce854765ea46621199ef20d407d13a 0 iTween.cs iTween.cs 8da77cd885d8fb1e8727e91681ab5ac00a889d0fcc9b973a4162f15a0b642a54 0 llField.cs llField.cs a0e0eaed3f22a8c4ce47f82fa80346e3b99e3ac0a6765e1ad4ade3a87c1b0189 0 diff --git a/SVSim.BattleEngine/Engine/AISendIntervalTrigger.cs b/SVSim.BattleEngine/Engine/AISendIntervalTrigger.cs new file mode 100644 index 0000000..416b944 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AISendIntervalTrigger.cs @@ -0,0 +1,6 @@ +public class AISendIntervalTrigger : SendIntervalTrigger +{ + public override void SendDataCheck(NetworkBattleManagerBase networkBattleManager, NetworkBattleDefine.NetworkBattleURI sendUri) + { + } +} diff --git a/SVSim.BattleEngine/Engine/AITurnControl.cs b/SVSim.BattleEngine/Engine/AITurnControl.cs new file mode 100644 index 0000000..2f27d85 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AITurnControl.cs @@ -0,0 +1,58 @@ +using System; +using Cute; +using Wizard; + +public class AITurnControl +{ + private DateTime _startTime; + + private bool _isStartTimer; + + public AITurnControl() + { + _isStartTimer = false; + } + + public void StartTurnTimer() + { + _isStartTimer = true; + _startTime = TimeUtil.GetAbsoluteTime(); + } + + public void SetAndStartTurnTimer(DateTime time) + { + _isStartTimer = true; + _startTime = time; + } + + public void Update(IEnemyAI ai) + { + if (ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive && !ai.IsConnectNetwork) + { + ai.Reconnect(); + } + if (!_isStartTimer || !ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive) + { + if (_isStartTimer && ai.IsConnectNetwork) + { + ai.Disconnect(); + } + } + else if ((float)NetworkUtility.GetTimeSpanSecond(_startTime.Ticks) >= 90f) + { + if (ai.IsStackAction) + { + ai.CleanupStackedAction(); + } + if (!ai.IsStackAction) + { + ai.TurnEnd(); + } + } + } + + public void StopTurnTimer() + { + _isStartTimer = false; + } +} diff --git a/SVSim.BattleEngine/Engine/AddHealModifierInfo.cs b/SVSim.BattleEngine/Engine/AddHealModifierInfo.cs new file mode 100644 index 0000000..e594ecf --- /dev/null +++ b/SVSim.BattleEngine/Engine/AddHealModifierInfo.cs @@ -0,0 +1,20 @@ +public class AddHealModifierInfo : HealModifier +{ + public int AddHealAmount { get; private set; } + + public AddHealModifierInfo(int addHealAmount, int order, BattleCardBase owner) + { + AddHealAmount = addHealAmount; + base.OrderCount = order; + _owner = owner; + } + + public override int Calc(int healAmount, BattleCardBase healOwner, BattleCardBase target) + { + if (healOwner.IsPlayer != _owner.IsPlayer) + { + return healAmount; + } + return healAmount + AddHealAmount; + } +} diff --git a/SVSim.BattleEngine/Engine/AreaBGInfo.cs b/SVSim.BattleEngine/Engine/AreaBGInfo.cs new file mode 100644 index 0000000..91272c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AreaBGInfo.cs @@ -0,0 +1,95 @@ +using System.Collections.Generic; +using UnityEngine; + +public class AreaBGInfo : MonoBehaviour +{ + private readonly List _chapterExtraDatas = new List + { + new ChapterExtraData + { + SectionId = 2, + ExtraTextureChapter = 10, + BGExtraEffectPath = "scn_map_change_1", + SeType = Se.TYPE.SE_MAP_TREE_EFFECT + }, + new ChapterExtraData + { + SectionId = 2, + ExtraTextureChapter = 11, + ExtraTextureIndex = { 1, 2 }, + BGSuffix = "b" + }, + new ChapterExtraData + { + SectionId = 2, + ExtraTextureChapter = 12, + ExtraTextureIndex = { 1, 2 }, + BGSuffix = "b" + }, + new ChapterExtraData + { + SectionId = 1, + ExtraTextureChapter = 4, + BGExtraEffectPath = "scn_map_change_1", + SeType = Se.TYPE.SE_MAP_TREE_EFFECT, + ClanType = CardBasePrm.ClanType.NEMESIS + }, + new ChapterExtraData + { + SectionId = 1, + ExtraTextureChapter = 5, + ExtraTextureIndex = { 1, 2 }, + BGSuffix = "b", + ClanType = CardBasePrm.ClanType.NEMESIS + }, + new ChapterExtraData + { + SectionId = 1, + ExtraTextureChapter = 6, + ExtraTextureIndex = { 1, 2 }, + BGSuffix = "b", + ClanType = CardBasePrm.ClanType.NEMESIS + }, + new ChapterExtraData + { + SectionId = 9, + ExtraTextureChapter = 1, + BGSectionId = 4, + BGExtraEffectPath = "scn_map_change_4", + BGFirstClearEffectPath = "scn_map_change_2", + FirstClearSeType = Se.TYPE.SE_MAP_SECTION9_CHAPTER1, + SeType = Se.TYPE.SE_MAP_SECTION9_CHANGE_CHAPTER, + ChapterMoveTime = 0f, + FirstClearEffectDelayTime = 1.2f, + FirstClearMoveOutDelayTime = 0.5f + }, + new ChapterExtraData + { + SectionId = 9, + ExtraTextureChapter = 2, + BGSectionId = 7, + BGExtraEffectPath = "scn_map_change_4", + BGFirstClearEffectPath = "scn_map_change_3", + FirstClearSeType = Se.TYPE.SE_MAP_SECTION9_CHAPTER2, + SeType = Se.TYPE.SE_MAP_SECTION9_CHANGE_CHAPTER, + FirstClearEffectDelayTime = 1.2f, + FirstClearMoveDelayTime = 1f + }, + new ChapterExtraData + { + SectionId = 9003, + ExtraTextureIndex = { 1, 2 }, + BGSuffix = "c" + } + }; + + public List GetExtraChapters(int sectionId, int? selectStoryClassId) + { + List list = _chapterExtraDatas.FindAll((ChapterExtraData item) => item.SectionId == sectionId); + if (sectionId == 20) + { + list.AddRange(AreaBGInfoSection20.GetChapterExtraDatas()); + } + return list.FindAll((ChapterExtraData item) => (CardBasePrm.ClanType?)item.ClanType == (CardBasePrm.ClanType?)selectStoryClassId || item.ClanType == CardBasePrm.ClanType.NONE); + } +} diff --git a/SVSim.BattleEngine/Engine/AreaSelectBG.cs b/SVSim.BattleEngine/Engine/AreaSelectBG.cs new file mode 100644 index 0000000..dd45e19 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AreaSelectBG.cs @@ -0,0 +1,489 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +[Serializable] +public class AreaSelectBG +{ + private const float BGTEXTURE_WIDTH = 1024f; + + private const float BGTEXTURE_HEIGHT = 1024f; + + private const int BGTEXTURE_NUM_X = 4; + + private const int BGTEXTURE_NUM_Y = 3; + + private const float BGTEXTURE_WIDTH_HALF_LEFT = 2048f; + + private const float BGTEXTURE_WIDTH_HALF_RIGHT = 2560f; + + private const float BGTEXTURE_HEIGHT_HALF_UP = 1536f; + + private const float BGTEXTURE_HEIGHT_HALF_BOTTOM = 1536f; + + private const float BGTEXTURE_DRAG_MARGIN = 5f; + + private const float BGTEXTURE_DRAG_DECELERATION = 0.875f; + + private const float BGTEXTURE_DRAGARROW_ANIM_SPEED = 1f; + + private const float BGDRAG_SEC_MAXSPEED = 0.25f; + + private const float BGDRAG_SEC_RESETUPTOTIME_MAX = 0.5f; + + private AreaSelectUI _areaSelectUI; + + [SerializeField] + private GameObject _BGRoot; + + [SerializeField] + private UITexture[] _BGTexture; + + [SerializeField] + private AreaBGInfo _areaBGInfo; + + private ParticleSystem _bgEffect; + + private AreaSelectEffectControlBase _bgEffectControl; + + [SerializeField] + private GameObject _BGDragCollision; + + private Vector2 _BGDragDelta = Vector2.zero; + + private bool _isBGDragEnable; + + private float _BGDragSec; + + private float _BGDragSecResetUpToTime; + + private List _loadedResources = new List(); + + private bool _isLoadEndBGTexture = true; + + private bool _isLoadEndParticle = true; + + private StorySectionData _sectionData; + + private int? _sectionClassId; + + private List _extraChapters = new List(); + + private bool _isNormalBgSet = true; + + private bool _changeChapterFirstCall = true; + + private float _currentAspectRatio; + + private Vector3 _currentBGScale = Vector3.one; + + private Vector3 _currentParentPos = Vector3.zero; + + private Vector2 _minMovablePos = Vector3.one; + + private Vector2 _maxMovablePos = Vector3.one; + + public ChapterExtraData ChapterExtraData { get; private set; } + + public ChapterExtraData TransitionChapterExtraData { get; private set; } + + public int BeforeChapterId { get; private set; } + + public GameObject GetBGRoot() + { + return _BGRoot; + } + + public bool GetLoadEnd() + { + if (_isLoadEndBGTexture) + { + return _isLoadEndParticle; + } + return false; + } + + public void SetActiveBGEffect(bool isActive) + { + _bgEffect.gameObject.SetActive(isActive); + if (_bgEffectControl != null) + { + _bgEffectControl.SetActiveBGEffect(isActive); + } + } + + public bool IsBGDragEnable() + { + return _isBGDragEnable; + } + + public void Init(AreaSelectUI areaSelectUI) + { + _areaSelectUI = areaSelectUI; + UIEventListener component = _BGDragCollision.GetComponent(); + if (null != component) + { + component.onDrag = OnDragBG; + } + SetBGDragEnable(enable: false); + } + + public void Term() + { + int i = 0; + for (int num = _BGTexture.Length; i < num; i++) + { + _BGTexture[i].mainTexture = null; + } + } + + private string GetBackGroundPath(int backGroundId, int index, bool isFetch = false) + { + return Toolbox.ResourcesManager.GetAssetTypePath("bg_story_" + backGroundId.ToString("00") + "_" + (index + 1).ToString("00"), ResourcesManager.AssetLoadPathType.Background, isFetch); + } + + private string GetExtraBackGroundPath(StorySectionData sectionData, int index, string suffix, bool isFetch = false) + { + return Toolbox.ResourcesManager.GetAssetTypePath("bg_story_" + sectionData.BackGroundId.ToString("00") + "_" + (index + 1).ToString("00") + suffix, ResourcesManager.AssetLoadPathType.Background, isFetch); + } + + private string GetExtraBackGroundPath(int backgroundId, int index, string suffix, bool isFetch = false) + { + return Toolbox.ResourcesManager.GetAssetTypePath("bg_story_" + backgroundId.ToString("00") + "_" + (index + 1).ToString("00") + suffix, ResourcesManager.AssetLoadPathType.Background, isFetch); + } + + private string GetMapEffectPath(int backGroundId, bool isFetch = false) + { + return Toolbox.ResourcesManager.GetAssetTypePath("scn_map_world_" + backGroundId, ResourcesManager.AssetLoadPathType.Effect2D, isFetch); + } + + private string GetTreeEffectPath(int backGroundId, bool isFetch = false) + { + return Toolbox.ResourcesManager.GetAssetTypePath("scn_map_world_tree_" + backGroundId, ResourcesManager.AssetLoadPathType.Effect2D, isFetch); + } + + public void LoadBG(StorySectionData sectionData, int? sectionClassId) + { + _sectionData = sectionData; + _sectionClassId = sectionClassId; + _extraChapters = _areaBGInfo.GetExtraChapters(_sectionData.Id, sectionClassId); + _loadedResources.Add(GetMapEffectPath(sectionData.BackGroundId)); + _isLoadEndBGTexture = false; + for (int i = 0; i < _BGTexture.Length; i++) + { + _loadedResources.Add(GetBackGroundPath(sectionData.BackGroundId, i)); + } + foreach (ChapterExtraData extraChapter in _extraChapters) + { + int num = sectionData.BackGroundId; + if (extraChapter.IsUseOtherSectionBG()) + { + num = extraChapter.BGSectionId; + for (int j = 0; j < _BGTexture.Length; j++) + { + _loadedResources.Add(GetBackGroundPath(num, j)); + } + _loadedResources.Add(GetMapEffectPath(num)); + if (extraChapter.AddTreeEffect) + { + _loadedResources.Add(GetTreeEffectPath(num)); + } + } + foreach (int item in extraChapter.ExtraTextureIndex) + { + _loadedResources.Add(GetExtraBackGroundPath(num, item, extraChapter.BGSuffix)); + } + if (!string.IsNullOrEmpty(extraChapter.BGExtraEffectPath)) + { + _loadedResources.Add(Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGExtraEffectPath, ResourcesManager.AssetLoadPathType.Effect2D)); + } + if (!string.IsNullOrEmpty(extraChapter.BGFirstClearEffectPath)) + { + _loadedResources.Add(Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGFirstClearEffectPath, ResourcesManager.AssetLoadPathType.Effect2D)); + } + } + _areaSelectUI.StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadedResources, _OnLoadEndBG)); + _isLoadEndParticle = false; + } + + public void UnLoadBG() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResources); + _loadedResources.Clear(); + _sectionData = null; + _sectionClassId = null; + } + + private void _OnLoadEndBG() + { + List list = new List(); + _bgEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetMapEffectPath(_sectionData.BackGroundId, isFetch: true)) as GameObject).GetComponent(); + Vector3 localScale = _bgEffect.transform.localScale; + _bgEffect.transform.parent = _BGRoot.transform; + _bgEffect.transform.localScale = localScale; + _bgEffect.transform.localPosition = Vector3.zero; + _bgEffectControl = _bgEffect.gameObject.GetComponent(); + list.Add(_bgEffect.gameObject); + if (_bgEffectControl != null) + { + _bgEffectControl._backGroundEffects.Add(_bgEffectControl.BASE_EFFECT_INDEX, _bgEffect); + _bgEffectControl._backGroundEffects.Add(_sectionData.BackGroundId, _bgEffect); + } + for (int i = 0; i < _BGTexture.Length; i++) + { + _BGTexture[i].mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(_sectionData.BackGroundId, i, isFetch: true)) as Texture; + } + foreach (ChapterExtraData extraChapter in _extraChapters) + { + Dictionary bGTexture = extraChapter.BGTexture; + int num = _sectionData.BackGroundId; + if (extraChapter.IsUseOtherSectionBG()) + { + num = extraChapter.BGSectionId; + for (int j = 0; j < _BGTexture.Length; j++) + { + bGTexture.Add(j, Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(num, j, isFetch: true)) as Texture); + } + if (num != _sectionData.BackGroundId && !_bgEffectControl._backGroundEffects.ContainsKey(num)) + { + ParticleSystem particleSystem = InitParticle(num, extraChapter.AddTreeEffect); + _bgEffectControl._backGroundEffects.Add(num, particleSystem); + list.Add(particleSystem.gameObject); + } + } + foreach (int item in extraChapter.ExtraTextureIndex) + { + if (!bGTexture.ContainsKey(item)) + { + bGTexture.Add(item, Toolbox.ResourcesManager.LoadObject(GetExtraBackGroundPath(num, item, extraChapter.BGSuffix, isFetch: true)) as Texture); + } + } + if (!string.IsNullOrEmpty(extraChapter.BGExtraEffectPath)) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGExtraEffectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true); + extraChapter.ExtraEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(assetTypePath) as GameObject); + if (extraChapter.AttachExtraEffectToBgRoot) + { + extraChapter.ExtraEffect.transform.parent = _BGRoot.transform; + extraChapter.ExtraEffect.transform.localPosition = Vector3.zero; + } + else + { + extraChapter.ExtraEffect.transform.parent = _areaSelectUI.transform; + } + extraChapter.ExtraEffect.SetActive(value: false); + List collection = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(extraChapter.ExtraEffect, null); + _loadedResources.AddRange(collection); + } + if (!string.IsNullOrEmpty(extraChapter.BGFirstClearEffectPath)) + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(extraChapter.BGFirstClearEffectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true); + extraChapter.FirstClearEffect = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(assetTypePath2) as GameObject); + extraChapter.FirstClearEffect.transform.parent = _areaSelectUI.transform; + extraChapter.FirstClearEffect.SetActive(value: false); + List collection2 = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(extraChapter.FirstClearEffect, null); + _loadedResources.AddRange(collection2); + } + } + List collection3 = GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list, delegate + { + _isLoadEndParticle = true; + }); + _loadedResources.AddRange(collection3); + _isLoadEndBGTexture = true; + } + + private ParticleSystem InitParticle(int bgId, bool addTreeEffect = false) + { + Vector3 vector = default(Vector3); + ParticleSystem component = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetMapEffectPath(bgId, isFetch: true)) as GameObject).GetComponent(); + vector = component.transform.localScale; + component.transform.parent = _BGRoot.transform; + component.transform.localScale = vector; + component.transform.localPosition = Vector3.zero; + if (addTreeEffect) + { + GameObject gameObject = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(GetTreeEffectPath(bgId, isFetch: true)) as GameObject); + gameObject.transform.parent = component.transform; + gameObject.transform.localScale = Vector3.one; + gameObject.transform.localPosition = Vector3.zero; + } + return component; + } + + public void OnChangeSelectChapter(StoryChapterData chapterData, bool isFirstClear) + { + TransitionChapterExtraData = null; + if (_extraChapters.Count > 0) + { + int intChapterId = int.Parse(chapterData.ChapterId); + ChapterExtraData = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == intChapterId); + } + if (_bgEffectControl != null) + { + _bgEffectControl.OnChangeSelectChapter(this, _sectionData, _sectionClassId, chapterData, isFirstClear); + } + } + + public void SetExtraTexture(int chapterId) + { + if (_extraChapters.Count == 0) + { + return; + } + ChapterExtraData chapterExtraData = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == chapterId || n.SectionId == 9003); + if (chapterExtraData != null && chapterExtraData.IsChangeBG()) + { + int num = _sectionData.BackGroundId; + if (chapterExtraData.IsUseOtherSectionBG()) + { + num = chapterExtraData.BGSectionId; + for (int num2 = 0; num2 < _BGTexture.Length; num2++) + { + _BGTexture[num2].mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(num, num2, isFetch: true)) as Texture; + } + } + foreach (int item in chapterExtraData.ExtraTextureIndex) + { + _BGTexture[item].mainTexture = Toolbox.ResourcesManager.LoadObject(GetExtraBackGroundPath(num, item, chapterExtraData.BGSuffix, isFetch: true)) as Texture; + } + _isNormalBgSet = false; + } + else if (!_isNormalBgSet) + { + for (int num3 = 0; num3 < _BGTexture.Length; num3++) + { + _BGTexture[num3].mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundPath(_sectionData.BackGroundId, num3, isFetch: true)) as Texture; + } + _isNormalBgSet = true; + } + } + + public List GetChaptersWithDifferentBackgroundFrom(int chapterId) + { + ChapterExtraData chapterExtra = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == chapterId); + IEnumerable source = ((chapterExtra == null || !chapterExtra.IsUseOtherSectionBG()) ? _extraChapters.Where((ChapterExtraData c) => c.IsUseOtherSectionBG() && c.BGSectionId != _sectionData.BackGroundId) : _extraChapters.Where((ChapterExtraData c) => c.BGSectionId != chapterExtra.BGSectionId)); + return source.Select((ChapterExtraData s) => s.ExtraTextureChapter).ToList(); + } + + public void SetExtraEffect(int chapterId, bool isFirstClear = false) + { + if (_extraChapters.Count == 0) + { + return; + } + List list = new List(); + list = ((BeforeChapterId >= chapterId) ? _extraChapters.FindAll((ChapterExtraData n) => n.ExtraTextureChapter != 0 && BeforeChapterId > n.ExtraTextureChapter && n.ExtraTextureChapter >= chapterId) : _extraChapters.FindAll((ChapterExtraData n) => n.ExtraTextureChapter != 0 && BeforeChapterId <= n.ExtraTextureChapter && n.ExtraTextureChapter < chapterId)); + BeforeChapterId = chapterId; + TransitionChapterExtraData = list.FirstOrDefault((ChapterExtraData n) => n.ExtraEffect != null); + if (isFirstClear) + { + return; + } + if (list.Count() == 0 || TransitionChapterExtraData == null) + { + _changeChapterFirstCall = false; + return; + } + TransitionChapterExtraData = list.FirstOrDefault((ChapterExtraData n) => n.ExtraEffect != null); + if (!_changeChapterFirstCall && TransitionChapterExtraData != null && TransitionChapterExtraData.ExtraEffect != null) + { + TransitionChapterExtraData.ExtraEffect.SetActive(value: false); + TransitionChapterExtraData.ExtraEffect.SetActive(value: true); + GameMgr.GetIns().GetSoundMgr().PlaySe(TransitionChapterExtraData.SeType); + } + _changeChapterFirstCall = false; + } + + public IEnumerator SetClearEffect() + { + ChapterExtraData clearChapterExtraData = _extraChapters.FirstOrDefault((ChapterExtraData n) => n.ExtraTextureChapter == BeforeChapterId); + if (clearChapterExtraData != null && clearChapterExtraData.FirstClearEffect != null) + { + yield return new WaitForSeconds(clearChapterExtraData.FirstClearEffectDelayTime); + clearChapterExtraData.FirstClearEffect.SetActive(value: false); + clearChapterExtraData.FirstClearEffect.SetActive(value: true); + GameMgr.GetIns().GetSoundMgr().PlaySe(clearChapterExtraData.FirstClearSeType); + } + } + + public void SetupEnd() + { + if (_bgEffectControl != null) + { + _bgEffectControl.SetupEnd(); + } + } + + public void OnDragBG(GameObject obj, Vector2 delta) + { + _BGDragSecResetUpToTime = 0.5f; + _BGDragSec += Time.deltaTime; + _BGDragSec = Mathf.Min(_BGDragSec, 0.25f); + float t = Mathf.Clamp(_BGDragSec / 0.25f, 0f, 1f); + _BGDragDelta = Vector2.Lerp(Vector2.zero, delta, t); + } + + public void UpdateBGDrag() + { + if (_BGDragSecResetUpToTime > 0f) + { + _BGDragSecResetUpToTime -= Time.deltaTime; + if (_BGDragSecResetUpToTime < 0f) + { + _BGDragSecResetUpToTime = 0f; + _BGDragSec = 0f; + } + } + if (!Mathf.Approximately(_BGDragDelta.x, 0f) || !Mathf.Approximately(_BGDragDelta.y, 0f)) + { + _BGDragDelta.x *= 0.875f; + _BGDragDelta.y *= 0.875f; + Vector3 localPosition = _BGRoot.transform.localPosition; + localPosition.x += _BGDragDelta.x; + localPosition.y += _BGDragDelta.y; + UpdateMovableRange(); + localPosition.x = Mathf.Clamp(localPosition.x, _minMovablePos.x, _maxMovablePos.x); + localPosition.y = Mathf.Clamp(localPosition.y, _minMovablePos.y, _maxMovablePos.y); + _BGRoot.transform.localPosition = localPosition; + } + } + + public void SetBGDragEnable(bool enable) + { + _isBGDragEnable = enable; + _BGDragCollision.SetActive(enable); + _BGDragDelta = Vector2.zero; + } + + private void UpdateMovableRange() + { + float num = (float)Screen.width / (float)Screen.height; + Vector3 localScale = _BGRoot.transform.localScale; + Vector3 localPosition = _BGRoot.transform.parent.transform.localPosition; + if (!(localScale == _currentBGScale) || num != _currentAspectRatio || !(localPosition == _currentParentPos)) + { + float num2 = UIManager.GetInstance().UIManagerRoot.manualHeight; + if (1.7777778f > num) + { + num2 *= 1.7777778f / num; + } + float num3 = num2 * num * 0.5f; + float num4 = num2 * 0.5f; + float num5 = 2048f * localScale.x; + float num6 = 2560f * localScale.x; + float num7 = 1536f * localScale.y; + float num8 = 1536f * localScale.y; + _minMovablePos.x = 0f - num6 + num3 + 5f - localPosition.x; + _maxMovablePos.x = num5 - num3 - 5f - localPosition.x; + _minMovablePos.y = 0f - num7 + num4 + 5f - localPosition.y; + _maxMovablePos.y = num8 - num4 - 5f - localPosition.y; + _currentAspectRatio = num; + _currentBGScale = localScale; + _currentParentPos = localPosition; + } + } +} diff --git a/SVSim.BattleEngine/Engine/AreaSelectChapterEffect.cs b/SVSim.BattleEngine/Engine/AreaSelectChapterEffect.cs new file mode 100644 index 0000000..ac2f545 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AreaSelectChapterEffect.cs @@ -0,0 +1,136 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; + +public class AreaSelectChapterEffect +{ + private static readonly Vector3 EFFECT_SCALE = new Vector3(320f, 320f, 320f); + + private AreaSelectUI _areaSelectUI; + + private List _loadedResources = new List(); + + private bool _isLoadEnd = true; + + private Transform _effectParent; + + private Dictionary _effectList = new Dictionary(); + + private string _playingEffect = ""; + + public bool GetLoadEnd() + { + return _isLoadEnd; + } + + public void Init(AreaSelectUI areaselectUI, Transform effectParent) + { + _areaSelectUI = areaselectUI; + _effectParent = effectParent; + _playingEffect = ""; + } + + public void Term() + { + foreach (KeyValuePair effect in _effectList) + { + ParticleSystem value = effect.Value; + if (!(null == value)) + { + Object.Destroy(value.gameObject); + } + } + _effectList.Clear(); + _playingEffect = ""; + } + + public void LoadEffect(List chapterDataList) + { + _isLoadEnd = false; + string path = ""; + int i = 0; + for (int count = chapterDataList.Count; i < count; i++) + { + path = chapterDataList[i].ChapterEffectPath; + if (!string.IsNullOrEmpty(path) && !_effectList.ContainsKey(path)) + { + _effectList.Add(path, null); + _loadedResources.Add(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.Effect2D)); + } + } + _areaSelectUI.StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadedResources, delegate + { + List list = new List(_effectList.Count); + int j = 0; + for (int count2 = chapterDataList.Count; j < count2; j++) + { + path = chapterDataList[j].ChapterEffectPath; + if (!string.IsNullOrEmpty(path) && !(null != _effectList[path])) + { + GameObject gameObject = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject; + if (!(null == gameObject)) + { + _effectList[path] = Object.Instantiate(gameObject).GetComponent(); + _effectList[path].transform.parent = _effectParent; + _effectList[path].transform.localPosition = Vector3.zero; + _effectList[path].transform.localScale = EFFECT_SCALE; + _effectList[path].gameObject.SetActive(value: false); + list.Add(_effectList[path].gameObject); + } + } + } + _loadedResources.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list, delegate + { + _isLoadEnd = true; + })); + })); + } + + public void UnLoadEffect() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResources); + _loadedResources.Clear(); + } + + public void PlayEffect(string path, Vector3 pos) + { + if (!string.IsNullOrEmpty(path) && !(_playingEffect == path) && _effectList.ContainsKey(path) && !(null == _effectList[path])) + { + _effectList[path].gameObject.SetActive(value: true); + _effectList[path].Play(); + _effectList[path].transform.localPosition = pos; + _playingEffect = path; + SetParticleSystemsSpeed(1f); + } + } + + public void StopEffect(float? simulationSpeedAfterStop) + { + if (_effectList.ContainsKey(_playingEffect) && !(null == _effectList[_playingEffect])) + { + if (simulationSpeedAfterStop.HasValue) + { + SetParticleSystemsSpeed(simulationSpeedAfterStop.Value); + } + _effectList[_playingEffect].Stop(); + _playingEffect = ""; + } + } + + public string GetPlayingEffect() + { + return _playingEffect; + } + + private void SetParticleSystemsSpeed(float speed) + { + ParticleSystem.MainModule main = _effectList[_playingEffect].main; + main.simulationSpeed = speed; + ParticleSystem[] componentsInChildren = _effectList[_playingEffect].GetComponentsInChildren(); + for (int i = 0; i < componentsInChildren.Length; i++) + { + ParticleSystem.MainModule main2 = componentsInChildren[i].main; + main2.simulationSpeed = speed; + } + } +} diff --git a/SVSim.BattleEngine/Engine/AreaSelectEffectControlBase.cs b/SVSim.BattleEngine/Engine/AreaSelectEffectControlBase.cs new file mode 100644 index 0000000..198a7ac --- /dev/null +++ b/SVSim.BattleEngine/Engine/AreaSelectEffectControlBase.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +public class AreaSelectEffectControlBase : MonoBehaviour +{ + [NonSerialized] + public Dictionary _backGroundEffects = new Dictionary(); + + [NonSerialized] + public readonly int BASE_EFFECT_INDEX = -1; + + protected bool IsSetupEnd { get; private set; } + + public virtual void SetupEnd() + { + IsSetupEnd = true; + } + + public virtual void OnChangeSelectChapter(AreaSelectBG areaSelectBG, StorySectionData sectionData, int? sectionClassId, StoryChapterData chapterData, bool isFirstClear) + { + } + + public virtual void SetActiveBGEffect(bool effect) + { + } +} diff --git a/SVSim.BattleEngine/Engine/AreaSelectMapIcon.cs b/SVSim.BattleEngine/Engine/AreaSelectMapIcon.cs new file mode 100644 index 0000000..e648ae4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AreaSelectMapIcon.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +[Serializable] +public class AreaSelectMapIcon +{ + public const int MAPICONLIST_CAPACITY_DEFAULT = 8; + + private readonly string MAP_ICON_EFFECT_NAME_CIRCLE4 = "ef_circle4_add_nor_1"; + + private readonly string MAP_ICON_EFFECT_NAME_TWINKLE1 = "ef_twinkle1_add_nor_1"; + + private readonly Color32 MAP_ICON_EFFECT_COLOR_CLEARED = new Color32(byte.MaxValue, 192, 64, byte.MaxValue); + + private readonly Color32 MAP_ICON_EFFECT_COLOR_ALREADY_READ_CIRCLE4 = new Color32(78, 95, 125, byte.MaxValue); + + private readonly Color32 MAP_ICON_EFFECT_COLOR_ALREADY_READ_TWINKLE1 = new Color32(190, 218, 242, byte.MaxValue); + + [SerializeField] + private GameObject MapIconRoot; + + [SerializeField] + private UISprite MapIconOriginal; + + private List MapIconList; + + private GameObject MapIconEffect; + + public void Init() + { + } + + public void Term() + { + MapIconEffect = null; + GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED); + GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_NOTCLEARED); + } + + public void SetupMapIcon(List chapterDataList) + { + if (MapIconList != null) + { + int i = 0; + for (int count = MapIconList.Count; i < count; i++) + { + UnityEngine.Object.Destroy(MapIconList[i].gameObject); + } + } + MapIconList = new List(8); + UISprite uISprite = null; + for (int j = 0; j < chapterDataList.Count; j++) + { + if (chapterDataList[j].IsReleased) + { + uISprite = UnityEngine.Object.Instantiate(MapIconOriginal); + if (!(null == uISprite)) + { + uISprite.transform.parent = MapIconRoot.transform; + uISprite.transform.localPosition = new Vector3(chapterDataList[j].MapIconPos.x, chapterDataList[j].MapIconPos.y); + uISprite.transform.localScale = Vector3.one; + uISprite.name = "mapicon_" + j; + uISprite.gameObject.SetActive(chapterDataList[j].IsDisplayMapIcon); + MapIconList.Add(uISprite); + } + } + } + MapIconOriginal.gameObject.SetActive(value: false); + } + + public Vector3 GetMapIconPos(int chapterIndex, bool isLocal) + { + if (MapIconList == null) + { + return Vector3.zero; + } + if (chapterIndex < 0 || chapterIndex >= MapIconList.Count) + { + return Vector3.zero; + } + if (!isLocal) + { + return MapIconList[chapterIndex].transform.position; + } + return MapIconList[chapterIndex].transform.localPosition; + } + + public void SetActiveMapIcon(int chapterIndex, bool isActive) + { + if (chapterIndex >= 0 && chapterIndex < MapIconList.Count) + { + MapIconList[chapterIndex].gameObject.SetActive(isActive); + } + } + + public void StartMapIconEffect(StoryChapterData.ChapterClearStatus clearState, int chapterIndex) + { + Effect effect = null; + switch (clearState) + { + case StoryChapterData.ChapterClearStatus.Cleared: + effect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED); + effect.ChangeParticleColor(MAP_ICON_EFFECT_COLOR_CLEARED); + break; + case StoryChapterData.ChapterClearStatus.AlreadyRead: + effect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED); + MotionUtils.ChangeParticleSystemColor(effect.transform.Find(MAP_ICON_EFFECT_NAME_CIRCLE4).gameObject, MAP_ICON_EFFECT_COLOR_ALREADY_READ_CIRCLE4); + MotionUtils.ChangeParticleSystemColor(effect.transform.Find(MAP_ICON_EFFECT_NAME_TWINKLE1).gameObject, MAP_ICON_EFFECT_COLOR_ALREADY_READ_TWINKLE1); + break; + default: + effect = GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MAP_MAPICON_NOTCLEARED); + break; + } + MapIconEffect = effect.GetGameObjIns(); + UpdateMapIconEffectPos(chapterIndex); + } + + public void StopMapIconEffect() + { + GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_CLEARED); + GameMgr.GetIns().GetEffectMgr().Stop(EffectMgr.EffectType.CMN_MAP_MAPICON_NOTCLEARED); + } + + public void UpdateMapIconEffectPos(int chapterIndex) + { + if (MapIconList != null && chapterIndex >= 0 && chapterIndex < MapIconList.Count && !(null == MapIconEffect)) + { + Vector3 position = MapIconList[chapterIndex].transform.position; + MapIconEffect.transform.position = position; + } + } + + public GameObject GetMapIconObject(int chapterIndex) + { + return MapIconList[chapterIndex].gameObject; + } +} diff --git a/SVSim.BattleEngine/Engine/AreaSelectUI.cs b/SVSim.BattleEngine/Engine/AreaSelectUI.cs new file mode 100644 index 0000000..ea6bc67 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AreaSelectUI.cs @@ -0,0 +1,1406 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Battle.Recovery; +using Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase; +using Wizard.Story; +using Wizard.Story.ChapterSelection; +using Wizard.Story.ChapterSelection.SelectionProcessing.Main; + +public class AreaSelectUI : UIBase +{ + private enum CHAPTERUNLOCK_STATE + { + STATE_NULL, + STATE_EFFECT_CLEARLABEL, + STATE_FOCUS_NEWCHAPTER, + STATE_DISP_MAPICON + } + + private enum LoadStatusTutorialEffect + { + NotLoad, + Loading, + Loaded + } + + private const float CLEAR_EFFECT_WAIT_SEC = 1.1f; + + private const float CLEAR_LABEL_DELAY_SEC = 0.4f; + + private const float NEWCHAPTER_FOCUS_SEC = 1f; + + private const float NEWCHAPTER_FOCUS_MAPICON_ENABLE_THRESHOLD = 0.55f; + + private const float MAPICON_EFFECTWAIT_SEC = 0.05f; + + private CHAPTERUNLOCK_STATE StateChapterUnlock; + + private float NewAreaTimer; + + private ChapterSelectButton _clearEffectPlayingChapter; + + private bool IsClearLabelDisplayed; + + private bool IsNewMapIconOpened; + + private bool IsNewMapIconFocused; + + private int nowAreaAllNum; + + private bool IsPlayingUnlockChapter; + + private GameObject _clearEffect; + + private GameObject _alreadyReadEffect; + + private List _loadEffectResources = new List(); + + public static readonly string CUESHEETNAME_MAP = "se_st_map"; + + public const int CHAPTERLIST_CAPACITY_DEFAULT = 8; + + private const int SORTINGORDER_EFFECT_OVER = 1; + + private const float PLAYERICON_Y = -320f; + + private const float TITLEPANEL_X_IN = 0f; + + private const float TITLEPANEL_X_OUT = 949f; + + private const float CHAPTERLIST_X_IN = -200f; + + private const float CHAPTERLIST_X_OUT = 400f; + + private const int CHAPTERLISTICON_MAX = 5; + + public const float CHAPTERLISTICON_OFFSET_Y = 80f; + + public const int CHAPTERLISTICON_MARGIN = 50; + + public const float CHAPTERLIST_SCROLL_RADIUS = 200f; + + public const float CHAPTERLIST_SWITCH_SEC = 0.5f; + + private static readonly Vector2 CHAPTERLIST_PANEL_CLIPOFFSET = new Vector2(0f, -420f); + + private static readonly Vector2 CHAPTERLIST_PANEL_CLIPPOS = new Vector2(0f, 0f); + + private static readonly Vector2 CHAPTERLIST_PANEL_CLIPSIZE = new Vector2(1200f, 80f); + + private static readonly string ANOTHER_ENDING_APPEARANCE_EFFECT_NAME = "scn_map_world_another_bright_1"; + + private string _beforeNextChapterId; + + private int? _beforeReleasedChapterNum; + + private int? _beforeReplayChapterIndex; + + [SerializeField] + private GameObject PlayerIcon; + + [SerializeField] + private GameObject _chapterRewardPanelRoot; + + private AreaSelInfo _chapterRewardPanel; + + [SerializeField] + private GameObject _titlePanelRoot; + + private TitlePanelBase _titlePanel; + + [SerializeField] + private GameObject RightPartsRoot; + + [SerializeField] + private ChapterSelectButton _chapterSelectButtonOriginal; + + [SerializeField] + private GameObject ChapterListRoot; + + [SerializeField] + private UIScrollView ChapterListScrollView; + + [SerializeField] + private SpringPanel ChapterListSpringPanel; + + private List _chapterSelectButtonList; + + private float ChapterListScrollYPrev; + + private GameObject ChapterListTapEffectLocator; + + private Effect ChapterListTapEffect; + + [SerializeField] + private ChapterSelectSphere _chapterSelectSphere; + + private bool IsChapterSelectEnable = true; + + [SerializeField] + private GameObject _chapterListScrollCollision; + + [SerializeField] + private AreaSelectBG _BG = new AreaSelectBG(); + + [SerializeField] + private AreaSelectMapIcon _mapIcon = new AreaSelectMapIcon(); + + private AreaSelectChapterEffect _chapterEffect = new AreaSelectChapterEffect(); + + [SerializeField] + private GameObject _chapterEffectLocator; + + [SerializeField] + private CommonPrefabContainer _commonPrefabContainer; + + [SerializeField] + private float _chapterEffectSimulationSpeedAfterStop = 1f; + + private ScenarioSummary _scenarioSummary; + + private List _resourcePathList = new List(); + + private int _selectChapterIndex; + + private StoryChapterData _selectChapterData; + + private LoadStatusTutorialEffect _loadStatusTutorialEffect; + + private bool IsLoadEnd = true; + + private bool IsFadeInEnd; + + private bool IsSetupEnd; + + private TopBar _topBar; + + private bool IsUseChapterListScroll; + + private bool IsUseChapterListTapEffect; + + private bool IsUseChapterListSwitch; + + private bool _usedScrollWheel; + + private bool _isBackTransitionStarted; + + private IProcessing _firstSelectionProcessing; + + private StoryChapterData _anotherEndingAppearanceAnimationChapterData; + + private GameObject _anotherEndingAppearanceEffect; + + private bool _unlockAfterZoom; + + public static readonly Vector3 BG_SCALE_ZOOMOUT = new Vector3(0.28f, 0.28f, 0.28f); + + public static readonly Vector3 BG_POS_ZOOMOUT = new Vector3(-70f, -430f, 0f); + + public static readonly Vector3 BG_SCALE_ZOOMIN = new Vector3(0.6f, 0.6f, 0.6f); + + public const float BG_POS_ZOOMIN_OFFSET_Y = -400f; + + private const float CHAPTERLISTROOT_X_OUT = 800f; + + private const float CHAPTERLISTROOT_X_IN = -25f; + + private const float MAPMOVE_TIMER_IDLE = 1f; + + private const float MAPMOVE_TIMER_ZOOMIN = 1f; + + private const float MAPMOVE_TIMER_TOEND = 1f; + + private const float ANOTHER_ENDING_APPEARANCE_ANIMATION_TIME = 1.5f; + + [SerializeField] + private iTween.EaseType BG_ZOOMIN_EASETYPE = iTween.EaseType.easeInOutCubic; + + private bool _isPlayingBGStartMove; + + private SelectedStoryInfo SelectedStoryInfo => Data.SelectedStoryInfo; + + private StorySectionData SectionData => SelectedStoryInfo.SectionData; + + private int SectionId => SectionData.Id; + + private int? SectionClassId => SelectedStoryInfo.SectionClassId; + + private List _chapterDataList => Data.StoryInfo.ChapterDataList; + + public bool IsUseChapterListClearedMask { get; private set; } + + private bool HasAnotherEndingAppearanceAnimation => _anotherEndingAppearanceAnimationChapterData != null; + + private void InitUnlockChapter() + { + ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE.STATE_NULL); + NewAreaTimer = 0f; + SetPlayerIconVisible(isvisible: false); + IsPlayingUnlockChapter = false; + } + + private void LoadUnlockChapterResources(Action onFinish) + { + _loadEffectResources.Clear(); + _loadEffectResources.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_ui_clear_1", ResourcesManager.AssetLoadPathType.Effect2D)); + _loadEffectResources.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_ui_clear_2", ResourcesManager.AssetLoadPathType.Effect2D)); + Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupAsync(_loadEffectResources, delegate + { + StartCoroutine(CreateEffect(onFinish)); + }); + } + + private IEnumerator CreateEffect(Action onFinish) + { + bool isLoadClearEffect = false; + _clearEffect = EffectUtility.CreateEffect2D(new Effect2dCreateParam + { + Parent = base.gameObject, + EffectName = "cmn_ui_clear_1", + UnloadAssetList = _loadEffectResources, + MaterialSetEndCallback = delegate + { + isLoadClearEffect = true; + } + }); + bool isLoadAlreadyReadEffect = false; + _alreadyReadEffect = EffectUtility.CreateEffect2D(new Effect2dCreateParam + { + Parent = base.gameObject, + EffectName = "cmn_ui_clear_2", + UnloadAssetList = _loadEffectResources, + MaterialSetEndCallback = delegate + { + isLoadAlreadyReadEffect = true; + } + }); + while (!isLoadClearEffect || !isLoadAlreadyReadEffect) + { + yield return null; + } + onFinish.Call(); + } + + private void UnloadUnlockChapterResources() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadEffectResources); + _loadEffectResources.Clear(); + } + + private void UpdateUnlockChapter() + { + switch (StateChapterUnlock) + { + case CHAPTERUNLOCK_STATE.STATE_EFFECT_CLEARLABEL: + StateUnlockChapter_EffectClearLabel_Update(); + break; + case CHAPTERUNLOCK_STATE.STATE_FOCUS_NEWCHAPTER: + StateUnlockChapter_FocusNewChapter_Update(); + break; + case CHAPTERUNLOCK_STATE.STATE_DISP_MAPICON: + StateUnlockChapter_DispMapIcon_Update(); + break; + } + } + + private bool CheckUnlockChapter() + { + if (SectionData.IsTutorialCategory) + { + return false; + } + if (!_beforeReleasedChapterNum.HasValue || _beforeNextChapterId == null) + { + return false; + } + StoryChapterData storyChapterData = Data.StoryInfo.FindChapterData(_beforeNextChapterId); + if (storyChapterData != null && storyChapterData.IsPlayedChapter) + { + return false; + } + int value = _beforeReleasedChapterNum.Value; + return nowAreaAllNum > value; + } + + private int? CheckSection20UnlockChapter() + { + if (SectionId == 20) + { + int num = nowAreaAllNum; + bool flag = false; + if (num == 10 && !PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SECTION20_WERUSA_ANIMATION_PLAYED)) + { + flag = true; + } + if (num == 26 && !PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_SECTION20_NATERA_ANIMATION_PLAYED)) + { + flag = true; + } + if (flag) + { + return num - 2; + } + } + return null; + } + + private void SetupUnlockChapter() + { + SelectChapter(_beforeReleasedChapterNum.Value - 1, isplayse: false, iscalcscroll: true, ismapiconeffectenable: false); + MoveToScreenChapterList(isIn: true, isImmediate: true); + UpdateChapterList(isinterpscale: false); + MoveToScreenTitlePanel(isIn: true, isImmediate: true); + _chapterRewardPanel.MoveToScreen(isIn: true, isImmediate: true); + _BG.GetBGRoot().transform.localScale = BG_SCALE_ZOOMIN; + mapMoveTarget(0f); + SetPlayerIconVisible(isvisible: false); + _chapterSelectButtonList[_selectChapterIndex].SetClearVisible(visible: false); + _topBar.SetBackButtonEnable(enable: false); + _mapIcon.SetActiveMapIcon(nowAreaAllNum - 1, isActive: false); + } + + private void StartUnlockChapter() + { + ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE.STATE_EFFECT_CLEARLABEL); + SetChapterScrollEnable(isEnable: false); + IsPlayingUnlockChapter = true; + } + + private void StartUnlockChapterWithoutClear() + { + ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE.STATE_FOCUS_NEWCHAPTER); + SetChapterScrollEnable(isEnable: false); + IsPlayingUnlockChapter = true; + } + + private void OnUnlockChapterEnd() + { + SetPlayerIconVisible(_selectChapterData.IsDisplayMapIcon); + SetChapterScrollEnable(isEnable: true); + CheckPreBuildDeckConfirmDialog(); + _topBar.SetBackButtonEnable(enable: true); + IsPlayingUnlockChapter = false; + } + + private void ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE newstate) + { + if (StateChapterUnlock != newstate) + { + switch (StateChapterUnlock) + { + case CHAPTERUNLOCK_STATE.STATE_EFFECT_CLEARLABEL: + StateUnlockChapter_EffectClearLabel_Exit(); + break; + case CHAPTERUNLOCK_STATE.STATE_FOCUS_NEWCHAPTER: + StateUnlockChapter_FocusNewChapter_Exit(); + break; + case CHAPTERUNLOCK_STATE.STATE_DISP_MAPICON: + StateUnlockChapter_DispMapIcon_Exit(); + break; + } + switch (newstate) + { + case CHAPTERUNLOCK_STATE.STATE_EFFECT_CLEARLABEL: + StateUnlockChapter_EffectClearLabel_Enter(); + break; + case CHAPTERUNLOCK_STATE.STATE_FOCUS_NEWCHAPTER: + StateUnlockChapter_FocusNewChapter_Enter(); + break; + case CHAPTERUNLOCK_STATE.STATE_DISP_MAPICON: + StateUnlockChapter_DispMapIcon_Enter(); + break; + } + StateChapterUnlock = newstate; + } + } + + private void StateUnlockChapter_EffectClearLabel_Update() + { + NewAreaTimer -= Time.deltaTime; + float num = ((_BG.ChapterExtraData == null) ? 1.1f : (1.1f + _BG.ChapterExtraData.FirstClearEffectDelayTime)); + if (!IsClearLabelDisplayed && NewAreaTimer < num - 0.4f) + { + _clearEffectPlayingChapter.OnFinishClearEffect(); + IsClearLabelDisplayed = true; + } + if (NewAreaTimer < 0f && !IsNewMapIconFocused) + { + IsNewMapIconFocused = true; + if (_BG.ChapterExtraData != null && _BG.ChapterExtraData.FirstClearMoveDelayTime > 0f) + { + _BG.SetExtraTexture(_BG.BeforeChapterId + 1); + StartCoroutine(MoveDelay()); + } + else + { + ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE.STATE_FOCUS_NEWCHAPTER); + } + } + } + + private IEnumerator MoveDelay() + { + yield return new WaitForSeconds((_BG.ChapterExtraData == null) ? 0f : _BG.ChapterExtraData.FirstClearMoveDelayTime); + ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE.STATE_FOCUS_NEWCHAPTER); + } + + private void StateUnlockChapter_EffectClearLabel_Enter() + { + StartCoroutine(_BG.SetClearEffect()); + if (_selectChapterIndex >= 0 && _selectChapterIndex < _chapterSelectButtonList.Count) + { + _clearEffectPlayingChapter = _chapterSelectButtonList[_selectChapterIndex]; + _chapterSelectButtonList[_selectChapterIndex].UpdateClearState(_selectChapterData.ClearStatus); + } + if (!(null == _clearEffectPlayingChapter)) + { + _chapterSelectButtonList[_selectChapterIndex].OnStartClearEffect(); + IsClearLabelDisplayed = false; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_MAP_CLEAR); + GameObject obj = ((_selectChapterData.ClearStatus == StoryChapterData.ChapterClearStatus.Cleared) ? _clearEffect : _alreadyReadEffect); + obj.transform.parent = _clearEffectPlayingChapter.ClearLabelTransform; + obj.transform.localPosition = Vector3.zero; + obj.gameObject.SetActive(value: true); + float newAreaTimer = ((_BG.ChapterExtraData == null) ? 1.1f : (1.1f + _BG.ChapterExtraData.FirstClearEffectDelayTime)); + NewAreaTimer = newAreaTimer; + } + } + + private void StateUnlockChapter_EffectClearLabel_Exit() + { + _clearEffectPlayingChapter = null; + } + + private void StateUnlockChapter_FocusNewChapter_Update() + { + mapMoveTarget((_BG.TransitionChapterExtraData == null) ? 1f : _BG.TransitionChapterExtraData.ChapterMoveTime); + if (!IsNewMapIconOpened && NewAreaTimer < 0.55f) + { + if (!_selectChapterData.IsDisplayMapIcon) + { + _mapIcon.SetActiveMapIcon(_selectChapterIndex, isActive: false); + } + else + { + _mapIcon.SetActiveMapIcon(_selectChapterIndex, isActive: true); + Vector3 mapIconPos = _mapIcon.GetMapIconPos(_selectChapterIndex, isLocal: false); + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_MAP_CHAPTER_1, mapIconPos.x, mapIconPos.y); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_MAP_NEW_AREA_RELEASE); + } + IsNewMapIconOpened = true; + } + NewAreaTimer -= Time.deltaTime; + if (NewAreaTimer < 0f) + { + ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE.STATE_DISP_MAPICON); + } + } + + private void StateUnlockChapter_FocusNewChapter_Enter() + { + SelectChapter(nowAreaAllNum - 1, isplayse: false, iscalcscroll: true, ismapiconeffectenable: false, isFirstClear: true); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_MAP_CAMERA_MOVE); + NewAreaTimer = ((_BG.TransitionChapterExtraData == null) ? 1f : (1f + _BG.TransitionChapterExtraData.FirstClearMoveOutDelayTime)); + IsNewMapIconOpened = false; + } + + private void StateUnlockChapter_FocusNewChapter_Exit() + { + } + + private void StateUnlockChapter_DispMapIcon_Update() + { + NewAreaTimer -= Time.deltaTime; + if (NewAreaTimer < 0f) + { + if (_selectChapterData.IsDisplayMapIcon) + { + _mapIcon.StartMapIconEffect(StoryChapterData.ChapterClearStatus.NotCleared, _selectChapterIndex); + } + ChangeStateUnlockChapter(CHAPTERUNLOCK_STATE.STATE_NULL); + } + } + + private void StateUnlockChapter_DispMapIcon_Enter() + { + NewAreaTimer = 0.05f; + } + + private void StateUnlockChapter_DispMapIcon_Exit() + { + OnUnlockChapterEnd(); + } + + public static void SetRecoveryData(SetupConditionInfo setupInfo) + { + Data.StoryInfo.IsPreBuildDeck = setupInfo.ScenarioDeckIsPreBuild; + Data.StoryInfo.IsTrialDeck = setupInfo.ScenarioDeckIsTrial; + Data.StoryInfo.IsStoryBattleDone = true; + StoryNextSceneSelector.ResetHistoryOfUsingPreBuildDeck(); + } + + public override void onFirstStart() + { + _chapterSelectButtonOriginal.gameObject.SetActive(value: false); + bool flag = false; + if (SectionData.IsTutorial) + { + IsUseChapterListScroll = false; + IsUseChapterListClearedMask = true; + IsUseChapterListTapEffect = true; + IsUseChapterListSwitch = false; + flag = false; + } + else if (SectionData.IsTutorialReplay) + { + IsUseChapterListScroll = true; + IsUseChapterListClearedMask = false; + IsUseChapterListTapEffect = false; + IsUseChapterListSwitch = true; + flag = true; + } + else + { + IsUseChapterListScroll = true; + IsUseChapterListClearedMask = false; + IsUseChapterListTapEffect = false; + IsUseChapterListSwitch = true; + flag = true; + } + UIManager.GetInstance().createInSceneLoading(); + if (flag) + { + _topBar = StoryChapterSelectionUtility.CreateTopBar(base.gameObject, SelectedStoryInfo, new UIManager.ChangeViewSceneParam + { + OnChange = delegate + { + _isBackTransitionStarted = true; + } + }, 1); + } + _titlePanel = CreateTitlePanel(); + _chapterRewardPanel = CreateChapterRewardPanel(); + if (IsUseChapterListSwitch) + { + _chapterSelectSphere.OnClick = delegate + { + OnSwitchChapterSelect(); + }; + } + StoryNextSceneSelector.ResetHistoryOfUsingPreBuildDeck(); + Data.StoryInfo.IsStoryBattleDone = false; + base.onFirstStart(); + } + + protected override void onClose() + { + GameMgr.GetIns().GetEffectMgr().StopBuff(EffectMgr.EffectType.CMN_MAP_PLAYERICON, PlayerIcon); + _mapIcon.Term(); + _chapterEffect.UnLoadEffect(); + _chapterEffect.Term(); + StopEffectTap(); + if (LoadStatusTutorialEffect.Loaded == _loadStatusTutorialEffect) + { + GameMgr.GetIns().GetEffectMgr().DisposeLatestMadeEffects(); + _loadStatusTutorialEffect = LoadStatusTutorialEffect.NotLoad; + } + Toolbox.ResourcesManager.RemoveAssetGroup(_resourcePathList); + _resourcePathList.Clear(); + GameMgr.GetIns().GetSoundMgr().UnloadSe(CUESHEETNAME_MAP); + UnloadUnlockChapterResources(); + _BG.UnLoadBG(); + _BG.Term(); + if (_scenarioSummary != null) + { + _scenarioSummary.Dispose(); + } + _chapterRewardPanel.ReleaseClearPresent(); + Toolbox.ResourcesManager.RemoveAssetGroup(Toolbox.ResourcesManager.CardListAssetPathList); + Toolbox.ResourcesManager.CardListAssetPathList.Clear(); + InitBGStartMove(); + InitUnlockChapter(); + base.onClose(); + } + + private void OnTouchChapterListTutorial(int chapterindex) + { + if (chapterindex == _selectChapterIndex) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + StopEffectTap(); + ExecuteSelectionProcessings(); + } + else if (SectionData.IsTutorialReplay) + { + SelectChapter(chapterindex, isplayse: true, iscalcscroll: true); + } + } + + private void SetChapterScrollEnable(bool isEnable) + { + if (null != ChapterListScrollView && ChapterListScrollView.enabled != isEnable) + { + ChapterListScrollView.enabled = isEnable; + } + if (_chapterSelectButtonList == null) + { + return; + } + foreach (ChapterSelectButton chapterSelectButton in _chapterSelectButtonList) + { + if (chapterSelectButton != null) + { + chapterSelectButton.SetScrollEnable(isEnable); + } + } + } + + private void OnTouchChapterList(int chapterindex) + { + if (!IsPlayingUnlockChapter && !_unlockAfterZoom) + { + if (chapterindex == _selectChapterIndex) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ExecuteSelectionProcessings(); + } + else + { + SelectChapter(chapterindex, isplayse: true, iscalcscroll: true); + } + } + } + + private void OnCancelScenarioSummary() + { + if (IsUseChapterListTapEffect) + { + StartEffectTap(); + } + } + + private void StartEffectTap() + { + if (IsUseChapterListTapEffect && !(null != ChapterListTapEffect)) + { + ChapterListTapEffectLocator = _chapterSelectButtonList[_chapterSelectButtonList.Count - 1].TapEffectLocator; + ChapterListTapEffect = GameMgr.GetIns().GetEffectMgr().StartBuff(EffectMgr.EffectType.CMN_TUTORIAL_TAP_1, ChapterListTapEffectLocator); + } + } + + private void StopEffectTap() + { + if (!(null == ChapterListTapEffectLocator)) + { + GameMgr.GetIns().GetEffectMgr().StopBuff(EffectMgr.EffectType.CMN_TUTORIAL_TAP_1, ChapterListTapEffectLocator); + ChapterListTapEffectLocator = null; + ChapterListTapEffect = null; + } + } + + private void LimitAreaScroll() + { + int count = _chapterSelectButtonList.Count; + UIPanel component = ChapterListScrollView.transform.GetComponent(); + component.clipOffset = CHAPTERLIST_PANEL_CLIPOFFSET; + component.baseClipRegion = new Vector4(CHAPTERLIST_PANEL_CLIPPOS.x, CHAPTERLIST_PANEL_CLIPPOS.y, CHAPTERLIST_PANEL_CLIPSIZE.x, CHAPTERLIST_PANEL_CLIPSIZE.y + (float)(count * 2) * 80f); + } + + private void OnSwitchChapterSelect() + { + if (!IsPlayingUnlockChapter && !_isPlayingBGStartMove) + { + IsChapterSelectEnable = !IsChapterSelectEnable; + SetChapterSelectEnable(IsChapterSelectEnable, isplayse: true); + SetChapterScrollEnable(IsChapterSelectEnable); + SetPlayerIconVisible(IsChapterSelectEnable && _selectChapterData.IsDisplayMapIcon); + _BG.SetBGDragEnable(!IsChapterSelectEnable && _selectChapterData.IsEnableDragMapBG); + if (IsChapterSelectEnable && _selectChapterData.IsDisplayMapIcon) + { + _mapIcon.StartMapIconEffect(_selectChapterData.ClearStatus, _selectChapterIndex); + } + else + { + _mapIcon.StopMapIconEffect(); + } + } + } + + private void MoveToScreenObj(GameObject target, float localPosX, float time, Action onComplete = null) + { + if (Mathf.Approximately(time, 0f)) + { + Vector3 localPosition = target.transform.localPosition; + localPosition.x = localPosX; + target.transform.localPosition = localPosition; + onComplete.Call(); + return; + } + iTween.MoveTo(target, iTween.Hash("islocal", true, "x", localPosX, "time", time)); + StartCoroutine(DelayedCall(time, onComplete.Call)); + } + + private IEnumerator DelayedCall(float time, Action callback) + { + yield return new WaitForSeconds(time); + if (!_isBackTransitionStarted) + { + callback.Call(); + } + } + + private void MoveToScreenRightPartsRoot(bool isIn, bool isImmediate) + { + float time = (isImmediate ? 0f : 0.5f); + if (isIn) + { + SetChapterListMarqueeDisable(); + } + MoveToScreenObj(RightPartsRoot, isIn ? (-25f) : 800f, time, delegate + { + if (isIn) + { + SetSelectedChapterMarqueeEnable(); + } + }); + if (isIn && !_unlockAfterZoom) + { + if (isImmediate) + { + SetChapterScrollEnable(IsUseChapterListScroll); + } + else + { + StartCoroutine(MoveToScreenRightCallBack(time)); + } + } + } + + private IEnumerator MoveToScreenRightCallBack(float time) + { + yield return new WaitForSeconds(time); + SetChapterScrollEnable(IsUseChapterListScroll); + } + + private void MoveToScreenChapterList(bool isIn, bool isImmediate) + { + if (isIn) + { + SetChapterListMarqueeDisable(); + } + MoveToScreenObj(ChapterListRoot, isIn ? (-200f) : 400f, isImmediate ? 0f : 0.5f, delegate + { + if (isIn) + { + SetSelectedChapterMarqueeEnable(); + } + }); + } + + private void MoveToScreenTitlePanel(bool isIn, bool isImmediate) + { + MoveToScreenObj(_titlePanel.gameObject, isIn ? 0f : 949f, isImmediate ? 0f : 0.5f); + } + + private void SetChapterSelectEnable(bool enable, bool isplayse) + { + IsChapterSelectEnable = enable; + _chapterSelectSphere.UpdateChapterSelectStatus(IsChapterSelectEnable, IsUseChapterListSwitch); + MoveToScreenChapterList(enable, isImmediate: false); + MoveToScreenTitlePanel(enable, isImmediate: false); + _chapterRewardPanel.MoveToScreen(enable, isImmediate: false); + _chapterListScrollCollision.SetActive(enable); + _BG.SetBGDragEnable(!enable); + if (isplayse) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(enable ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + } + } + + private void SetChapterListMarqueeDisable() + { + if (_chapterSelectButtonList == null) + { + return; + } + foreach (ChapterSelectButton chapterSelectButton in _chapterSelectButtonList) + { + chapterSelectButton.SetMarqueeEnable(enable: false); + } + } + + private void SetSelectedChapterMarqueeEnable() + { + if (_chapterSelectButtonList != null) + { + _chapterSelectButtonList[_selectChapterIndex].SetMarqueeEnable(enable: true); + } + } + + protected override void onOpen() + { + base.onOpen(); + UIManager.GetInstance().OpenNotTouch(); + ResetSelectedStoryInfo(); + InitBGStartMove(); + InitUnlockChapter(); + SetChapterSelectEnable(enable: true, isplayse: false); + SetChapterScrollEnable(isEnable: false); + _mapIcon.Init(); + _BG.Init(this); + _chapterEffect.Init(this, base.transform); + SetPlayerIconVisible(isvisible: false); + PlayerIcon.transform.localPosition = new Vector3(0f, -320f, 0f); + _firstSelectionProcessing = CreateSelectionProcessings(SectionData.IsTutorialCategory); + StartCoroutine(Setup()); + } + + private IEnumerator Setup() + { + IsSetupEnd = false; + if (SectionData.IsTutorialCategory) + { + SetupChapterDataListTutorial(); + } + else + { + yield return StoryChapterSelectionUtility.StoryInfoTaskCoroutine(SelectedStoryInfo); + yield return StoryChapterSelectionUtility.LoadAiMasterCoroutine(_chapterDataList); + StoryChapterSelectionUtility.RegisterMaintenanceChapters(_chapterDataList); + _anotherEndingAppearanceAnimationChapterData = ((_beforeNextChapterId == null) ? _chapterDataList.FirstOrDefault((StoryChapterData x) => x.IsPlayAnotherEndingAppearanceAnimation && x.IsReleased) : null); + } + StartCoroutine(assetSetting()); + IsLoadEnd = false; + StartCoroutine(LoadAndSetupResourcesAsync()); + _BG.LoadBG(SectionData, SectionClassId); + _chapterEffect.LoadEffect(_chapterDataList); + _chapterRewardPanel.LoadClearPresent(_chapterDataList); + while (!IsLoadEnd || !_chapterRewardPanel.GetLoadEnd() || !_BG.GetLoadEnd() || !_chapterEffect.GetLoadEnd()) + { + yield return null; + } + SetupChapterList(); + _mapIcon.SetupMapIcon(_chapterDataList); + if (CheckUnlockChapter()) + { + SetupUnlockChapter(); + } + else + { + int? focus = CheckSection20UnlockChapter(); + if (focus.HasValue) + { + _unlockAfterZoom = true; + } + SetupBGStartMove(focus); + } + _chapterRewardPanel.SetClearPresent(_selectChapterData); + _BG.SetActiveBGEffect(isActive: true); + IsFadeInEnd = false; + UIManager.GetInstance().OnReadyViewScene(isFadein: true, null, OnFadeInEnd); + _BG.SetupEnd(); + IsSetupEnd = true; + } + + private IEnumerator LoadAndSetupResourcesAsync() + { + _resourcePathList.Clear(); + foreach (StoryChapterData chapterData in _chapterDataList) + { + _resourcePathList.Add(ChapterSelectButton.GetHeaderPath(chapterData, isFetch: false)); + } + if (IsUseChapterListTapEffect) + { + _loadStatusTutorialEffect = LoadStatusTutorialEffect.Loading; + GameMgr.GetIns().GetEffectMgr().InitCommonEffect("Json/EffectTutorialData", isBattle: false, isField: false, isBattleEffect: false, delegate + { + _loadStatusTutorialEffect = LoadStatusTutorialEffect.Loaded; + }); + } + GameMgr.GetIns().GetSoundMgr().LoadSe(CUESHEETNAME_MAP); + _scenarioSummary = new ScenarioSummary(SectionId, SectionClassId); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_resourcePathList, null)); + bool isLoadedClearEffect = false; + LoadUnlockChapterResources(delegate + { + isLoadedClearEffect = true; + }); + while (!_scenarioSummary.IsValid || LoadStatusTutorialEffect.Loading == _loadStatusTutorialEffect || !isLoadedClearEffect || !_titlePanel.IsFinishInit) + { + yield return null; + } + if (HasAnotherEndingAppearanceAnimation) + { + yield return EffectMgr.LoadAndInstantiate2dEffectCoroutine(ANOTHER_ENDING_APPEARANCE_EFFECT_NAME, delegate(GameObject createdEffect, List loadedAssets) + { + _anotherEndingAppearanceEffect = createdEffect; + createdEffect.transform.parent = base.transform; + _resourcePathList.AddRange(loadedAssets); + }); + } + IsLoadEnd = true; + } + + public override void onMove() + { + if (!IsSetupEnd || !IsFadeInEnd) + { + SetChapterListMarqueeDisable(); + return; + } + if (IsPlayingUnlockChapter) + { + UpdateUnlockChapter(); + UpdateChapterList(); + return; + } + UpdateChapterList(); + if (_isPlayingBGStartMove) + { + return; + } + if (_unlockAfterZoom) + { + _unlockAfterZoom = false; + StartUnlockChapterWithoutClear(); + return; + } + UpdateTamaArrow(); + if (_BG.IsBGDragEnable()) + { + _BG.UpdateBGDrag(); + } + else + { + mapMoveTarget((_BG.TransitionChapterExtraData == null) ? 1.5f : _BG.TransitionChapterExtraData.ChapterMoveTime); + } + _mapIcon.UpdateMapIconEffectPos(_selectChapterIndex); + float y = ChapterListScrollView.transform.localPosition.y; + int num = (450 - (int)y) / 80; + if (num < 0) + { + num = 0; + } + else if (num >= _chapterSelectButtonList.Count) + { + num = _chapterSelectButtonList.Count - 1; + } + if (num != _selectChapterIndex) + { + SelectChapter(num, isplayse: true); + } + base.onMove(); + } + + private void SelectChapter(int newIndex, bool isplayse = false, bool iscalcscroll = false, bool ismapiconeffectenable = true, bool isFirstClear = false) + { + int selectChapterIndex = _selectChapterIndex; + _selectChapterIndex = newIndex; + if (_selectChapterIndex < 0 || _selectChapterIndex >= _chapterDataList.Count) + { + _selectChapterIndex = 0; + } + if (SectionId == 20) + { + if (_selectChapterIndex == 9) + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SECTION20_WERUSA_ANIMATION_PLAYED, flag: true); + } + else if (_selectChapterIndex == 25) + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.IS_SECTION20_NATERA_ANIMATION_PLAYED, flag: true); + } + } + string chapterId = (newIndex + 1).ToString(); + _selectChapterData = _chapterDataList.Single((StoryChapterData x) => x.ChapterId == chapterId); + _BG.OnChangeSelectChapter(_selectChapterData, isFirstClear); + if (SectionId == 20) + { + int chapterId2 = int.Parse(_selectChapterData.ChapterId); + List chaptersWithDifferentBackgroundFrom = _BG.GetChaptersWithDifferentBackgroundFrom(chapterId2); + for (int num = 0; num < _chapterSelectButtonList.Count; num++) + { + bool isActive = !chaptersWithDifferentBackgroundFrom.Contains(num + 1); + _mapIcon.SetActiveMapIcon(num, isActive); + } + } + _mapIcon.StopMapIconEffect(); + if (ismapiconeffectenable && _selectChapterData.IsDisplayMapIcon) + { + _mapIcon.StartMapIconEffect(_selectChapterData.ClearStatus, _selectChapterIndex); + } + SetPlayerIconVisible(_selectChapterData.IsDisplayMapIcon); + SwitchChapterEffectVisible(selectChapterIndex); + _chapterRewardPanel.SetClearPresent(_selectChapterData); + if (isplayse) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SCROLL); + } + if (iscalcscroll) + { + float num2 = 400f - (float)_selectChapterIndex * 80f; + Vector3 position = ChapterListScrollView.transform.position; + position.y = num2; + ChapterListScrollView.transform.localPosition = position; + ChapterListScrollView.GetComponent().clipOffset = new Vector2(0f, 0f - num2); + if (null == ChapterListSpringPanel) + { + ChapterListSpringPanel = ChapterListScrollView.GetComponent(); + } + if (null != ChapterListSpringPanel) + { + ChapterListSpringPanel.target = Vector3.zero; + ChapterListSpringPanel.strength = 0f; + ChapterListSpringPanel.onFinished = null; + ChapterListSpringPanel.enabled = false; + } + } + _chapterSelectSphere.IsScrollUpEnable = IsUseChapterListScroll && _chapterSelectButtonList.Count > 1 && _selectChapterIndex < _chapterSelectButtonList.Count - 1; + _chapterSelectSphere.IsScrollDownEnable = IsUseChapterListScroll && _chapterSelectButtonList.Count > 1 && _selectChapterIndex > 0; + _chapterSelectSphere.OnSelectChapter(IsChapterSelectEnable); + } + + private void UpdateTamaArrow() + { + if (IsChapterSelectEnable) + { + _chapterSelectSphere.UpdateArrowAlpha(); + } + } + + private void UpdateChapterList(bool isinterpscale = true) + { + for (int i = 0; i < _chapterSelectButtonList.Count; i++) + { + ChapterSelectButton chapterSelectButton = _chapterSelectButtonList[i]; + if (chapterSelectButton != null) + { + chapterSelectButton.UpdateSelectStatus(_selectChapterIndex, i, this, isinterpscale, ChapterListScrollView); + } + } + if (_isPlayingBGStartMove) + { + return; + } + bool flag = false; + float y = ChapterListScrollView.transform.localPosition.y; + if (ChapterListScrollYPrev != y) + { + ChapterListScrollYPrev = y; + y = 450 - (int)y; + flag = !Input.GetMouseButton(0) && Input.mouseScrollDelta.y < 0f; + if (Input.GetMouseButton(0) || flag) + { + _chapterSelectSphere.UpdateRotationOnScroll(y, _chapterSelectButtonList.Count); + } + } + if (Input.GetMouseButtonUp(0) || (!flag && _usedScrollWheel)) + { + _chapterSelectSphere.ResetRotationOnScroll(); + } + _usedScrollWheel = flag; + } + + private void OnFadeInEnd() + { + UIManager.GetInstance().offNotTouch(); + if (CheckUnlockChapter()) + { + StartUnlockChapter(); + } + else + { + StartBGStartMove(); + CheckPreBuildDeckConfirmDialog(); + } + IsFadeInEnd = true; + } + + public static void CheckPreBuildDeckConfirmDialog() + { + } + + private static void ShowBuildDeckBuyConfirmDialog(int currentCount, int maxCount) + { + int productId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_ID); + if (currentCount < maxCount) + { + SystemText systemText = Data.SystemText; + string message = systemText.Get("Story_0057"); + if (currentCount > 0) + { + message = systemText.Get("Story_0058"); + } + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(message); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(systemText.Get("Story_0056")); + dialogBase.SetButtonText(systemText.Get("Shop_0095"), systemText.Get("Common_0005")); + dialogBase.onPushButton1 = delegate + { + BuildDeckPurchasePage.BuildDeckConfirmDialogShow(productId); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BuildDeckPurchasePage); + UIManager.GetInstance()._Footer.UpdateCurrentIndex(5); + }; + } + } + + private void SetupChapterDataListTutorial() + { + Data.StoryInfo.ChapterDataList = Data.Master.TutorialAreaSelectList.Select((TutorialAreaSelect x) => new StoryChapterData(x)).ToList(); + } + + private void SetupChapterList() + { + if (_chapterDataList == null) + { + return; + } + if (_chapterSelectButtonList != null) + { + for (int i = 0; i < _chapterSelectButtonList.Count; i++) + { + UnityEngine.Object.Destroy(_chapterSelectButtonList[i].gameObject); + } + } + _chapterSelectButtonList = new List(8); + nowAreaAllNum = 0; + for (int j = 0; j < _chapterDataList.Count; j++) + { + if (!_chapterDataList[j].IsReleased) + { + continue; + } + ChapterSelectButton chapterSelectButton = UnityEngine.Object.Instantiate(_chapterSelectButtonOriginal); + chapterSelectButton.gameObject.SetActive(value: true); + chapterSelectButton.transform.parent = ChapterListScrollView.transform; + chapterSelectButton.transform.localPosition = new Vector3(0f, -400f + (float)j * 80f, 0f); + chapterSelectButton.transform.localScale = Vector3.one; + chapterSelectButton.name = "chapterlist_" + j.ToString("00"); + chapterSelectButton.SetChapterData(_chapterDataList[j], this, ChapterListScrollView); + int index = j; + chapterSelectButton.OnClick = delegate + { + if (SectionData.IsTutorialCategory) + { + OnTouchChapterListTutorial(index); + } + else + { + OnTouchChapterList(index); + } + }; + _chapterSelectButtonList.Add(chapterSelectButton); + nowAreaAllNum++; + } + LimitAreaScroll(); + ChapterListScrollView.ResetPosition(); + } + + private void mapMoveTarget(float time) + { + Vector3 mapIconPos = _mapIcon.GetMapIconPos(_selectChapterIndex, isLocal: true); + iTween.MoveUpdate(_BG.GetBGRoot(), iTween.Hash("islocal", true, "x", BG_SCALE_ZOOMIN.x * (mapIconPos.x * -1f), "y", BG_SCALE_ZOOMIN.y * (mapIconPos.y * -1f) + -400f, "time", time, "easetype", iTween.EaseType.easeOutExpo)); + } + + private void SetPlayerIconVisible(bool isvisible) + { + if (isvisible) + { + GameMgr.GetIns().GetEffectMgr().StartBuff(EffectMgr.EffectType.CMN_MAP_PLAYERICON, PlayerIcon); + } + else + { + GameMgr.GetIns().GetEffectMgr().StopBuff(EffectMgr.EffectType.CMN_MAP_PLAYERICON, PlayerIcon); + } + } + + private void SwitchChapterEffectVisible(int previousChapter) + { + if (!(_chapterEffect.GetPlayingEffect() == _selectChapterData.ChapterEffectPath)) + { + float? simulationSpeedAfterStop = null; + if (SectionId == 20 && AreaBGInfoSection20.IsSpeedUpParticleTransition(previousChapter, _selectChapterIndex)) + { + simulationSpeedAfterStop = _chapterEffectSimulationSpeedAfterStop; + } + _chapterEffect.StopEffect(simulationSpeedAfterStop); + _chapterEffect.PlayEffect(_selectChapterData.ChapterEffectPath, _chapterEffectLocator.transform.localPosition); + } + } + + public string GetChapterTitleStory(string chapterID) + { + if (_scenarioSummary == null) + { + return ""; + } + return _scenarioSummary.GetData(chapterID).Title; + } + + private TitlePanelBase CreateTitlePanel() + { + return StoryChapterSelectionUtility.CreateTitlePanel(_titlePanelRoot, _commonPrefabContainer.CharaInfoPanelPrefab, _commonPrefabContainer.SectionInfoPanelPrefab, SelectedStoryInfo); + } + + private AreaSelInfo CreateChapterRewardPanel() + { + return StoryChapterSelectionUtility.CreateChapterRewardPanel(_chapterRewardPanelRoot, _commonPrefabContainer.ChapterRewardPanelPrefab); + } + + private void ResetSelectedStoryInfo() + { + _beforeNextChapterId = SelectedStoryInfo.NextChapterId; + _beforeReleasedChapterNum = SelectedStoryInfo.ReleasedChapterNum; + _beforeReplayChapterIndex = SelectedStoryInfo.ReplayChapterIndex; + SelectedStoryInfo.ClearInfoForChapterSelectionScene(); + } + + private static IProcessing CreateSelectionProcessings(bool isTutorialCategory) + { + IProcessing[] array = ((!isTutorialCategory) ? new IProcessing[8] + { + new SubChapterSelectionDialogDisplay(), + new SummaryDialogDisplay(), + new DeckSelectionDialogDisplay(), + new ChapterCharaDecider(), + new DownloadInfoGetter(), + new DownloadConfirmDialogDisplay(), + new DeckSelectionConfirmDialogDisplay(), + new StoryStarter() + } : new IProcessing[3] + { + new SummaryDialogDisplay(), + new ChapterCharaDecider(), + new TutorialStoryStarter() + }); + for (int i = 0; i < array.Length - 1; i++) + { + array[i].NextProcessing = array[i + 1]; + } + return array.FirstOrDefault(); + } + + private void ExecuteSelectionProcessings() + { + if (_firstSelectionProcessing != null) + { + Parameter param = CreateSelectionProcessingParameter(); + _firstSelectionProcessing.Execute(param); + } + } + + private Parameter CreateSelectionProcessingParameter() + { + return new Parameter(this, _commonPrefabContainer, _scenarioSummary, SelectedStoryInfo, _selectChapterData, nowAreaAllNum, null, _selectChapterData.IsPlayedChapter ? new int?(_selectChapterIndex) : ((int?)null)); + } + + private void InitBGStartMove() + { + iTween.Stop(_BG.GetBGRoot()); + } + + private void SetupBGStartMove(int? focus) + { + int newIndex = (focus.HasValue ? focus.Value : GetStartFocusChapterIndex()); + SelectChapter(newIndex, isplayse: false, iscalcscroll: true, ismapiconeffectenable: false); + MoveToScreenRightPartsRoot(isIn: false, isImmediate: true); + _chapterRewardPanel.MoveToScreen(isIn: false, isImmediate: true); + if (AspectCamera.SafeAreaRate < 1f) + { + float num = (float)Screen.width / (float)Screen.height / 1.7777778f; + _BG.GetBGRoot().transform.localScale = BG_SCALE_ZOOMOUT * num; + } + else + { + _BG.GetBGRoot().transform.localScale = BG_SCALE_ZOOMOUT; + } + _BG.GetBGRoot().transform.localPosition = BG_POS_ZOOMOUT; + SetPlayerIconVisible(isvisible: false); + InitAnotherEndingAppearanceEffect(); + } + + private void StartBGStartMove() + { + StartCoroutine(PlayAnimationCoroutine()); + } + + private IEnumerator PlayAnimationCoroutine() + { + _isPlayingBGStartMove = true; + yield return new WaitForSeconds(1f); + yield return ZoomInCoroutine(); + if (HasAnotherEndingAppearanceAnimation) + { + yield return PlayAnotherEndingAppearanceAnimationCoroutine(); + } + yield return PlayUiEntranceAnimationCoroutine(); + _isPlayingBGStartMove = false; + } + + private IEnumerator ZoomInCoroutine() + { + iTween.ScaleTo(_BG.GetBGRoot(), iTween.Hash("scale", BG_SCALE_ZOOMIN, "islocal", true, "time", 1f, "easetype", BG_ZOOMIN_EASETYPE)); + Vector3 mapIconPos = _mapIcon.GetMapIconPos(_selectChapterIndex, isLocal: true); + iTween.MoveTo(_BG.GetBGRoot(), iTween.Hash("islocal", true, "x", BG_SCALE_ZOOMIN.x * (mapIconPos.x * -1f), "y", BG_SCALE_ZOOMIN.y * (mapIconPos.y * -1f) + -400f, "time", 1f, "easetype", BG_ZOOMIN_EASETYPE)); + yield return new WaitForSeconds(1f); + } + + private IEnumerator PlayAnotherEndingAppearanceAnimationCoroutine() + { + _anotherEndingAppearanceEffect.SetActive(value: true); + yield return new WaitForSeconds(1.5f); + } + + private IEnumerator PlayUiEntranceAnimationCoroutine() + { + SetPlayerIconVisible(_selectChapterData.IsDisplayMapIcon); + if (_selectChapterData.IsDisplayMapIcon) + { + _mapIcon.StartMapIconEffect(_selectChapterData.ClearStatus, _selectChapterIndex); + } + StartCoroutine(assetSetting()); + MoveToScreenRightPartsRoot(isIn: true, isImmediate: false); + MoveToScreenTitlePanel(isIn: true, isImmediate: false); + _chapterRewardPanel.MoveToScreen(isIn: true, isImmediate: false); + yield return new WaitForSeconds(1f); + StartEffectTap(); + } + + private int GetStartFocusChapterIndex() + { + if (HasAnotherEndingAppearanceAnimation) + { + return int.Parse(_anotherEndingAppearanceAnimationChapterData.ChapterId) - 1; + } + if (_beforeReplayChapterIndex.HasValue && _beforeReplayChapterIndex.Value < nowAreaAllNum - 1) + { + return _beforeReplayChapterIndex.Value + 1; + } + return nowAreaAllNum - 1; + } + + private void InitAnotherEndingAppearanceEffect() + { + if (HasAnotherEndingAppearanceAnimation) + { + int chapterIndex = int.Parse(_anotherEndingAppearanceAnimationChapterData.ChapterId) - 1; + InitEffect(_anotherEndingAppearanceEffect, _mapIcon.GetMapIconObject(chapterIndex)); + } + } + + private static void InitEffect(GameObject effect, GameObject parent) + { + Transform transform = effect.transform; + Vector3 localScale = UIManager.GetInstance().UIManagerRoot.transform.localScale; + transform.parent = parent.transform; + transform.localPosition = Vector3.zero; + transform.localRotation = Quaternion.identity; + transform.localScale = new Vector3(1f / localScale.x, 1f / localScale.y, 1f / localScale.z); + UIManager.GetInstance().SetLayerRecursive(transform, parent.layer); + } +} diff --git a/SVSim.BattleEngine/Engine/ArenaEntryBase.cs b/SVSim.BattleEngine/Engine/ArenaEntryBase.cs new file mode 100644 index 0000000..1800a49 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ArenaEntryBase.cs @@ -0,0 +1,158 @@ +using System; +using System.Collections; +using UnityEngine; +using Wizard; + +public abstract class ArenaEntryBase : MonoBehaviour +{ + [SerializeField] + protected GameObject ArenaEntryDialog; + + [SerializeField] + protected GameObject CompetitionEntryDialog; + + [SerializeField] + protected UIButton ButtonEntry; + + [SerializeField] + protected UIButton ButtonResume; + + [SerializeField] + protected GameObject HeadLineObject; + + private UIWidget[] _headlineWidgetArray; + + private Color[] _headlineWidgetDefaultColorArray; + + private Coroutine _initCoroutine; + + protected bool _isFreeEntry; + + protected bool _isCompetition; + + protected string[] _labelsText; + + protected string _entryDialogTitleText; + + protected Action _initFunc; + + protected Action _resumeFunc; + + protected Func _isJoinFunc; + + protected Action _freeEntryFunc; + + protected Action _freeBattleFunc; + + protected Func _isFreeBattleCompetition; + + protected Action _entryFunc; + + private const float GLAY_SCALE = 0.33f; + + protected abstract void EntryDialogCreate(GameObject inDialog); + + protected virtual void EntryBaseInit(GameObject costRootObject) + { + _headlineWidgetArray = costRootObject.transform.GetComponentsInChildren(); + _headlineWidgetDefaultColorArray = new Color[_headlineWidgetArray.Length]; + for (int i = 0; i < _headlineWidgetArray.Length; i++) + { + _headlineWidgetDefaultColorArray[i] = _headlineWidgetArray[i].color; + } + } + + private void OnEnable() + { + UpdateMenu(); + } + + private void OnDestroy() + { + if (_initCoroutine != null) + { + StopCoroutine(_initCoroutine); + } + } + + public void UpdateMenu() + { + _initCoroutine = UIManager.GetInstance().StartCoroutine(_InitCoroutine()); + } + + protected virtual IEnumerator _InitCoroutine() + { + while (!MyPageMenu.IsMyPageRequestEnd) + { + yield return null; + } + if (_initFunc != null) + { + _initFunc(); + } + ButtonEntry.onClick.Clear(); + ButtonEntry.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (_entryFunc != null) + { + _entryFunc(); + } + else if (_isFreeEntry) + { + _freeEntryFunc(); + } + else + { + DialogBase.Size size = ((Data.ArenaData.CompetitionData.CostType != ArenaCompetition.EntryCostType.EntryWithCost) ? DialogBase.Size.M : DialogBase.Size.XL); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(size); + dialogBase.SetTitleLabel(_entryDialogTitleText); + GameObject gameObject = UnityEngine.Object.Instantiate(_isCompetition ? CompetitionEntryDialog : ArenaEntryDialog); + EntryDialogCreate(gameObject); + if (_isCompetition && Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithCost) + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID, Data.ArenaData.CompetitionData.CompetitionId); + Data.MyPageNotifications.data.IsCompetitionBadge = false; + UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon(); + UpdateCompetitionEntryBadge(); + } + gameObject.GetComponent().ParentDialog = dialogBase; + dialogBase.SetObj(gameObject.gameObject); + DialogBase.ButtonLayout buttonLayout = DialogBase.ButtonLayout.CloseBtn; + dialogBase.SetButtonLayout(buttonLayout); + } + })); + ButtonResume.onClick.Clear(); + ButtonResume.onClick.Add(new EventDelegate(delegate + { + _resumeFunc(); + })); + UpdateEntryResumeButton(); + } + + protected virtual void UpdateCompetitionEntryBadge() + { + } + + protected virtual void UpdateEntryResumeButton() + { + bool flag = _isJoinFunc(); + ButtonEntry.gameObject.SetActive(!flag); + ButtonResume.gameObject.SetActive(flag); + if (flag) + { + for (int i = 0; i < _headlineWidgetArray.Length; i++) + { + _headlineWidgetArray[i].color = new Color(_headlineWidgetDefaultColorArray[i].r * 0.33f, _headlineWidgetDefaultColorArray[i].g * 0.33f, _headlineWidgetDefaultColorArray[i].b * 0.33f, 255f); + } + } + else + { + for (int j = 0; j < _headlineWidgetArray.Length; j++) + { + _headlineWidgetArray[j].color = _headlineWidgetDefaultColorArray[j]; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/AspectCameraPerspective.cs b/SVSim.BattleEngine/Engine/AspectCameraPerspective.cs new file mode 100644 index 0000000..4fe8b8a --- /dev/null +++ b/SVSim.BattleEngine/Engine/AspectCameraPerspective.cs @@ -0,0 +1,44 @@ +using UnityEngine; + +public class AspectCameraPerspective : MonoBehaviour +{ + private Camera m_camera; + + private bool m_isSetFOV; + + public void UpdateFov() + { + m_isSetFOV = false; + } + + private void Start() + { + m_camera = GetComponent(); + } + + private void Update() + { + if (!m_isSetFOV && GameMgr.GetIns() != null && m_camera != null) + { + float num = 0f; + float num2 = 0f; + if (Screen.width > Screen.height) + { + num = Screen.width; + num2 = Screen.height; + } + else + { + num = Screen.height; + num2 = Screen.width; + } + float num3 = num / num2; + if (num3 > 1.7777778f) + { + num3 = 1.7777778f; + } + m_camera.fieldOfView = Mathf.Atan2(1f, num3) * 57.29578f * 2f; + m_isSetFOV = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/AssetBundleEditorTag.cs b/SVSim.BattleEngine/Engine/AssetBundleEditorTag.cs new file mode 100644 index 0000000..6789971 --- /dev/null +++ b/SVSim.BattleEngine/Engine/AssetBundleEditorTag.cs @@ -0,0 +1,54 @@ +public class AssetBundleEditorTag +{ + public enum BUNDLE_CATEGORY + { + BG, + CARD, + EFFECT, + MASTER, + STORY, + UI, + UIDOWNLOAD, + TUTORIAL, + PACKBOX, + UILANG, + STORYLANG, + FONT, + SLEEVE, + MAX + } + + public enum CardStatType + { + CARD_STAT_NORMAL, + CARD_STAT_FOIL, + CARD_STAT_PROMOTION + } + + public struct categoryProps + { + public string name; + + public categoryProps(string in_name) + { + name = in_name; + } + } + + public static categoryProps[] categoryNameList = new categoryProps[13] + { + new categoryProps("bg"), + new categoryProps("card"), + new categoryProps("effect"), + new categoryProps("master"), + new categoryProps("story"), + new categoryProps("ui"), + new categoryProps("uidownload"), + new categoryProps("tutorial"), + new categoryProps("packbox"), + new categoryProps("uilang"), + new categoryProps("storylang"), + new categoryProps("font"), + new categoryProps("sleeve") + }; +} diff --git a/SVSim.BattleEngine/Engine/AudioList.cs b/SVSim.BattleEngine/Engine/AudioList.cs new file mode 100644 index 0000000..924ca3d --- /dev/null +++ b/SVSim.BattleEngine/Engine/AudioList.cs @@ -0,0 +1,7 @@ +using UnityEngine; + +public class AudioList : MonoBehaviour +{ + [SerializeField] + public string[] GimicAudioList; +} diff --git a/SVSim.BattleEngine/Engine/BaseCardIDComp.cs b/SVSim.BattleEngine/Engine/BaseCardIDComp.cs new file mode 100644 index 0000000..4d3cd4a --- /dev/null +++ b/SVSim.BattleEngine/Engine/BaseCardIDComp.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using Wizard.Battle; + +internal class BaseCardIDComp : EqualityComparer +{ + public override bool Equals(IReadOnlyBattleCardInfo x, IReadOnlyBattleCardInfo y) + { + if (x == y) + { + return true; + } + if (x.BaseParameter.BaseCardId == y.BaseParameter.BaseCardId) + { + return true; + } + return false; + } + + public override int GetHashCode(IReadOnlyBattleCardInfo obj) + { + return obj.BaseParameter.BaseCardId; + } +} diff --git a/SVSim.BattleEngine/Engine/BingoBall.cs b/SVSim.BattleEngine/Engine/BingoBall.cs new file mode 100644 index 0000000..f2f9c25 --- /dev/null +++ b/SVSim.BattleEngine/Engine/BingoBall.cs @@ -0,0 +1,163 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +public class BingoBall : MonoBehaviour +{ + public const string NUM_SPRITE_NAME_HEAD = "bingo_ball_"; + + public const string TEXTURE_BINGOBALL_BACK = "bingo_ball_back"; + + public const string TEXTURE_BINGOBALL_FRONT = "bingo_ball_front"; + + public const float NUM_SPACE = 11f; + + [SerializeField] + private UISprite _numSpriteLeft; + + [SerializeField] + private UISprite _numSpriteRight; + + [SerializeField] + private UISprite _ballSprite; + + [SerializeField] + private Transform _bottomPos; + + [SerializeField] + private TweenPositionX _tweenPositionX; + + [SerializeField] + private TweenPositionY _tweenPositionY; + + [SerializeField] + private Vector2 _ballMovement; + + private GameObject _effectObject; + + private GameObject _dustEffect1; + + private GameObject _dustEffect2; + + private int _ballNum; + + private List _inProcessCoroutines = new List(); + + private void Start() + { + _numSpriteLeft.gameObject.SetActive(value: false); + _numSpriteRight.gameObject.SetActive(value: false); + } + + public void SetBallNum(int num) + { + _ballNum = num; + } + + public void SetNumSprite() + { + if (_ballNum >= 0 && _ballNum <= 9) + { + _numSpriteRight.gameObject.SetActive(value: false); + _numSpriteLeft.gameObject.SetActive(value: true); + _numSpriteLeft.transform.localPosition = Vector3.zero; + _numSpriteLeft.spriteName = "bingo_ball_" + _ballNum; + } + else if (_ballNum >= 10) + { + _numSpriteRight.gameObject.SetActive(value: true); + _numSpriteLeft.gameObject.SetActive(value: true); + _numSpriteLeft.spriteName = "bingo_ball_" + _ballNum / 10; + _numSpriteRight.spriteName = "bingo_ball_" + _ballNum % 10; + } + } + + public void SetBallSprite(bool isFront) + { + _ballSprite.spriteName = (isFront ? "bingo_ball_front" : "bingo_ball_back"); + } + + public List PlayEffect(string effectName, bool isOnBottom) + { + List list = new List(); + if (_effectObject != null) + { + Object.Destroy(_effectObject); + } + _effectObject = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + _effectObject.transform.parent = base.gameObject.transform; + list.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_effectObject, null)); + _effectObject.transform.localPosition = (isOnBottom ? _bottomPos.transform.localPosition : Vector3.zero); + _effectObject.SetActive(value: true); + return list; + } + + public List PlayDustEffect(string effectName, GameObject dustEffectContainer, float fallTime, float endWorldPosY, float delayTime) + { + List list = new List(); + _dustEffect1 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + _dustEffect2 = Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + list.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_dustEffect1, null)); + list.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_dustEffect2, null)); + _dustEffect1.transform.parent = dustEffectContainer.transform; + _dustEffect2.transform.parent = dustEffectContainer.transform; + _dustEffect1.SetActive(value: false); + _dustEffect2.SetActive(value: false); + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayDustEffect(fallTime, endWorldPosY, delayTime))); + return list; + } + + private IEnumerator PlayDustEffect(float fallTime, float endWorldPosY, float delayTime) + { + yield return new WaitForSeconds(delayTime + fallTime * 0.164f); + Vector3 position = base.gameObject.transform.position; + position.y = endWorldPosY - (base.gameObject.transform.position.y - _bottomPos.transform.position.y) * 0.95f; + _dustEffect1.transform.position = position; + _dustEffect1.SetActive(value: true); + yield return new WaitForSeconds(fallTime * 0.323f); + position = base.gameObject.transform.position; + position.y = endWorldPosY - (base.gameObject.transform.position.y - _bottomPos.transform.position.y) * 0.98f; + _dustEffect2.transform.position = position; + _dustEffect2.SetActive(value: true); + yield return new WaitForSeconds(0.4f); + Object.Destroy(_dustEffect1); + Object.Destroy(_dustEffect2); + } + + public void StopCoroutine() + { + if (_inProcessCoroutines.Count <= 0) + { + return; + } + foreach (Coroutine inProcessCoroutine in _inProcessCoroutines) + { + if (inProcessCoroutine != null) + { + UIManager.GetInstance().StopCoroutine(inProcessCoroutine); + } + } + } + + public void PlayTweenAnimation(Vector3 from, float delay) + { + _tweenPositionX.from = from.x; + _tweenPositionX.to = from.x + _ballMovement.x; + _tweenPositionY.from = from.y; + _tweenPositionY.to = from.y + _ballMovement.y; + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayBallFallAnimation(delay))); + } + + private IEnumerator PlayBallFallAnimation(float delay) + { + yield return new WaitForSeconds(delay); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_bng_ballfall_01", "se_sys_bng_ballfall_01", 0f, 0L); + base.gameObject.SetActive(value: true); + } + + public Vector2 GetBallMovement() + { + return _ballMovement; + } +} diff --git a/SVSim.BattleEngine/Engine/BingoSheetBlock.cs b/SVSim.BattleEngine/Engine/BingoSheetBlock.cs new file mode 100644 index 0000000..65227fa --- /dev/null +++ b/SVSim.BattleEngine/Engine/BingoSheetBlock.cs @@ -0,0 +1,152 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class BingoSheetBlock : MonoBehaviour +{ + [SerializeField] + private UISprite _numSpriteLeft; + + [SerializeField] + private UISprite _numSpriteRight; + + [SerializeField] + private UISprite _blockSprite; + + [SerializeField] + private UISprite _treasureBoxSprite; + + [SerializeField] + private UITexture _stampTexutre; + + [SerializeField] + private UISprite _lightSprite; + + [SerializeField] + private TweenAlpha _lightTextureAlpha; + + private List _inProcessCoroutines = new List(); + + private const string NUM_SPRITE_NAME_HEAD = "bingo_square_"; + + private const float LINES_NUM_SPRITE_SPACE = 16.65f; + + public void SetNumLabel(int num, int maxPerLine) + { + if (num >= 0 && num <= 9) + { + _numSpriteRight.gameObject.SetActive(value: false); + _numSpriteLeft.gameObject.SetActive(value: true); + _numSpriteLeft.transform.localPosition = Vector3.zero; + _numSpriteLeft.spriteName = "bingo_square_" + num; + } + else if (num >= 10) + { + _numSpriteRight.gameObject.SetActive(value: true); + _numSpriteLeft.gameObject.SetActive(value: true); + _numSpriteLeft.spriteName = "bingo_square_" + num / 10; + _numSpriteRight.spriteName = "bingo_square_" + num % 10; + Vector3 zero = Vector3.zero; + zero.x = -16.65f; + _numSpriteLeft.transform.localPosition = zero; + zero.x = 16.65f; + _numSpriteRight.transform.localPosition = zero; + } + } + + public void SetBlockScale(float blockScale) + { + base.transform.localScale *= blockScale; + } + + public void SetPartsVisible(bool blockVisible, int treasureBoxGrade, bool isOpen) + { + _blockSprite.gameObject.SetActive(blockVisible); + SetTreasureBoxSprite(treasureBoxGrade, isOpen); + SetStampVisible(isOpen); + } + + public void SetStampTexture(Texture texture) + { + _stampTexutre.mainTexture = texture; + } + + public void SetTreasureBoxSprite(int treasureBoxGrade, bool isOpen) + { + if (!isOpen) + { + _treasureBoxSprite.spriteName = string.Format("box_2pick_0{0}{1}", (treasureBoxGrade - 1).ToString(), "_close"); + _treasureBoxSprite.gameObject.SetActive(treasureBoxGrade > 0); + } + else + { + _treasureBoxSprite.gameObject.SetActive(value: false); + } + } + + public void SetStampVisible(bool visible) + { + _stampTexutre.gameObject.SetActive(visible); + } + + public void StampDown(float delay) + { + iTween.ScaleTo(_stampTexutre.gameObject, iTween.Hash("scale", Vector3.one * 1f, "delay", delay, "time", 0.15f, "islocal", true, "easetype", iTween.EaseType.easeOutCubic)); + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(ChangeAlpha(_stampTexutre.gameObject, delay))); + } + + public void LightOn(float delay) + { + _lightTextureAlpha.SetOnFinished(delegate + { + _lightSprite.alpha = 0f; + _lightTextureAlpha.ResetToBeginning(); + _lightTextureAlpha.from = 0f; + }); + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(LightOn(_lightTextureAlpha, delay))); + } + + public void PlaySe(int lineNum, float delay) + { + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlaySeCoroutine(lineNum, delay))); + } + + private IEnumerator PlaySeCoroutine(int lineNum, float delay) + { + yield return new WaitForSeconds(delay); + string text = string.Format("se_sys_bng_line_{0}", Mathf.Clamp(lineNum + 1, 1, 12).ToString("00")); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(text, text, 0f, 0L); + } + + private IEnumerator ChangeAlpha(GameObject obj, float delay) + { + yield return new WaitForSeconds(delay); + TweenAlpha.Begin(obj, 0.15f, 1f); + } + + private IEnumerator LightOn(TweenAlpha tweenAlpha, float delay) + { + _lightTextureAlpha.ResetToBeginning(); + yield return new WaitForSeconds(delay); + tweenAlpha.PlayForward(); + } + + public void CancelAnimations() + { + _lightSprite.alpha = 0f; + if (_inProcessCoroutines.Count <= 0) + { + return; + } + foreach (Coroutine inProcessCoroutine in _inProcessCoroutines) + { + UIManager.GetInstance().StopCoroutine(inProcessCoroutine); + } + } + + public void ResetStampTexture() + { + _stampTexutre.gameObject.transform.localScale = Vector3.one * 1.5f; + _stampTexutre.alpha = 0f; + } +} diff --git a/SVSim.BattleEngine/Engine/ByteReader.cs b/SVSim.BattleEngine/Engine/ByteReader.cs new file mode 100644 index 0000000..36b9c1a --- /dev/null +++ b/SVSim.BattleEngine/Engine/ByteReader.cs @@ -0,0 +1,203 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using UnityEngine; + +public class ByteReader +{ + private byte[] mBuffer; + + private int mOffset; + + private static BetterList mTemp = new BetterList(); + + public bool canRead + { + get + { + if (mBuffer != null) + { + return mOffset < mBuffer.Length; + } + return false; + } + } + + public ByteReader(byte[] bytes) + { + mBuffer = bytes; + } + + public ByteReader(TextAsset asset) + { + mBuffer = asset.bytes; + } + + public static ByteReader Open(string path) + { + FileStream fileStream = File.OpenRead(path); + if (fileStream != null) + { + fileStream.Seek(0L, SeekOrigin.End); + byte[] array = new byte[fileStream.Position]; + fileStream.Seek(0L, SeekOrigin.Begin); + fileStream.Read(array, 0, array.Length); + fileStream.Close(); + return new ByteReader(array); + } + return null; + } + + private static string ReadLine(byte[] buffer, int start, int count) + { + return Encoding.UTF8.GetString(buffer, start, count); + } + + public string ReadLine() + { + return ReadLine(skipEmptyLines: true); + } + + public string ReadLine(bool skipEmptyLines) + { + int num = mBuffer.Length; + if (skipEmptyLines) + { + while (mOffset < num && mBuffer[mOffset] < 32) + { + mOffset++; + } + } + int num2 = mOffset; + if (num2 < num) + { + int num3; + do + { + if (num2 < num) + { + num3 = mBuffer[num2++]; + continue; + } + num2++; + break; + } + while (num3 != 10 && num3 != 13); + string result = ReadLine(mBuffer, mOffset, num2 - mOffset - 1); + mOffset = num2; + return result; + } + mOffset = num; + return null; + } + + public Dictionary ReadDictionary() + { + Dictionary dictionary = new Dictionary(); + char[] separator = new char[1] { '=' }; + while (canRead) + { + string text = ReadLine(); + if (text == null) + { + break; + } + if (!text.StartsWith("//")) + { + string[] array = text.Split(separator, 2, StringSplitOptions.RemoveEmptyEntries); + if (array.Length == 2) + { + string key = array[0].Trim(); + string value = array[1].Trim().Replace("\\n", "\n"); + dictionary[key] = value; + } + } + } + return dictionary; + } + + public BetterList ReadCSV() + { + mTemp.Clear(); + string text = ""; + bool flag = false; + int num = 0; + while (canRead) + { + if (flag) + { + string text2 = ReadLine(skipEmptyLines: false); + if (text2 == null) + { + return null; + } + text2 = text2.Replace("\\n", "\n"); + text = text + "\n" + text2; + } + else + { + text = ReadLine(skipEmptyLines: true); + if (text == null) + { + return null; + } + text = text.Replace("\\n", "\n"); + num = 0; + } + int i = num; + for (int length = text.Length; i < length; i++) + { + switch (text[i]) + { + case ',': + if (!flag) + { + mTemp.Add(text.Substring(num, i - num)); + num = i + 1; + } + break; + case '"': + if (flag) + { + if (i + 1 >= length) + { + mTemp.Add(text.Substring(num, i - num).Replace("\"\"", "\"")); + return mTemp; + } + if (text[i + 1] != '"') + { + mTemp.Add(text.Substring(num, i - num).Replace("\"\"", "\"")); + flag = false; + if (text[i + 1] == ',') + { + i++; + num = i + 1; + } + } + else + { + i++; + } + } + else + { + num = i + 1; + flag = true; + } + break; + } + } + if (num < text.Length) + { + if (flag) + { + continue; + } + mTemp.Add(text.Substring(num, text.Length - num)); + } + return mTemp; + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/ChapterExtraData.cs b/SVSim.BattleEngine/Engine/ChapterExtraData.cs new file mode 100644 index 0000000..e3b6e7d --- /dev/null +++ b/SVSim.BattleEngine/Engine/ChapterExtraData.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using UnityEngine; + +public class ChapterExtraData +{ + public int SectionId { get; set; } + + public int ExtraTextureChapter { get; set; } + + public CardBasePrm.ClanType ClanType { get; set; } = CardBasePrm.ClanType.NONE; + + public string BGSuffix { get; set; } = string.Empty; + + public List ExtraTextureIndex { get; set; } = new List(); + + public int BGSectionId { get; set; } = -1; + + public Dictionary BGTexture { get; set; } = new Dictionary(); + + public string BGExtraEffectPath { get; set; } = string.Empty; + + public bool AttachExtraEffectToBgRoot { get; set; } + + public GameObject ExtraEffect { get; set; } + + public Se.TYPE SeType { get; set; } + + public float ChapterMoveTime { get; set; } = 1.5f; + + public string BGFirstClearEffectPath { get; set; } = string.Empty; + + public GameObject FirstClearEffect { get; set; } + + public Se.TYPE FirstClearSeType { get; set; } + + public float FirstClearEffectDelayTime { get; set; } + + public float FirstClearMoveDelayTime { get; set; } + + public float FirstClearMoveOutDelayTime { get; set; } + + public bool AddTreeEffect { get; set; } + + public bool IsUseOtherSectionBG() + { + return BGSectionId != -1; + } + + public bool IsChangeBG() + { + if (!IsUseOtherSectionBG()) + { + return ExtraTextureIndex.Count > 0; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/ClassBasicCardList.cs b/SVSim.BattleEngine/Engine/ClassBasicCardList.cs new file mode 100644 index 0000000..b2624fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClassBasicCardList.cs @@ -0,0 +1,68 @@ +public class ClassBasicCardList +{ + private static int[] AllBasicCardList = new int[8] { 100011010, 100011020, 100011030, 100011040, 100011050, 100012010, 100031010, 100031020 }; + + private static int[] ElfBasicCardList = new int[11] + { + 100111010, 100111020, 100111030, 100111040, 100111050, 100111060, 100111070, 100114010, 100121010, 100121020, + 100121030 + }; + + private static int[] RoyalBasicCardList = new int[11] + { + 100211010, 100211020, 100211030, 100211040, 100211050, 100211060, 100214010, 100214020, 100221010, 100221020, + 100222010 + }; + + private static int[] WitchBasicCardList = new int[11] + { + 100311010, 100314010, 100314020, 100314030, 100314040, 100314050, 100314060, 100314070, 100321010, 100321020, + 100321030 + }; + + private static int[] DragonBasicCardList = new int[11] + { + 100411010, 100411020, 100411030, 100411040, 100411050, 100414010, 100414020, 100414030, 100421010, 100421020, + 100424010 + }; + + private static int[] NecroBasicCardList = new int[11] + { + 100511010, 100511020, 100511030, 100511040, 100511050, 100511060, 100514010, 100514020, 100521010, 100521020, + 100521030 + }; + + private static int[] VampireBasicCardList = new int[11] + { + 100611010, 100611020, 100611030, 100611040, 100611050, 100614010, 100614020, 100614030, 100621010, 100621020, + 100624010 + }; + + private static int[] BishopBasicCardList = new int[11] + { + 100711010, 100711020, 100713010, 100713020, 100713030, 100714010, 100714020, 100714030, 100721010, 100721020, + 100723010 + }; + + private static int[] NemesisBasicCardList = new int[11] + { + 100811010, 100811020, 100811030, 100811040, 100811050, 100811060, 100811070, 100814010, 100821010, 100821020, + 100824010 + }; + + public static int[] GetRandomBasicCardId(CardBasePrm.ClanType classType) + { + return classType switch + { + CardBasePrm.ClanType.MIN => ElfBasicCardList, + CardBasePrm.ClanType.ROYAL => RoyalBasicCardList, + CardBasePrm.ClanType.WITCH => WitchBasicCardList, + CardBasePrm.ClanType.DRAGON => DragonBasicCardList, + CardBasePrm.ClanType.NECRO => NecroBasicCardList, + CardBasePrm.ClanType.VAMPIRE => VampireBasicCardList, + CardBasePrm.ClanType.BISHOP => BishopBasicCardList, + CardBasePrm.ClanType.NEMESIS => NemesisBasicCardList, + _ => AllBasicCardList, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/ClassCardCreator.cs b/SVSim.BattleEngine/Engine/ClassCardCreator.cs new file mode 100644 index 0000000..811e24b --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClassCardCreator.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +public class ClassCardCreator : CardCreatorBase +{ + public ClassCardCreator(GameObject rootObject) + : base(rootObject) + { + } +} diff --git a/SVSim.BattleEngine/Engine/ClassSkillApplyInformation.cs b/SVSim.BattleEngine/Engine/ClassSkillApplyInformation.cs new file mode 100644 index 0000000..e7fb030 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClassSkillApplyInformation.cs @@ -0,0 +1,478 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class ClassSkillApplyInformation : SkillApplyInformation +{ + public class LifeInfomation + { + public int Life { get; private set; } + + public int MaxLife { get; private set; } + + public int BeforeLife { get; private set; } + + public int BeforeMaxLife { get; private set; } + + public LifeInfomation(int life, int maxLife, int beforeLife, int beforeMaxLife) + { + Life = life; + MaxLife = maxLife; + BeforeLife = beforeLife; + BeforeMaxLife = beforeMaxLife; + } + } + + public class PpModifyInformation + { + public int AddPpValue { get; private set; } + + public PpModifyInformation(int addPpValue) + { + AddPpValue = addPpValue; + } + } + + public event Action OnLifeChange; + + public event Action OnPpChange; + + public ClassSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator) + : base(card, vfxCreator) + { + } + + public override void DamageLife(int damage, int turn, bool isSelfTurn) + { + int life = _card.Life; + int maxLife = _card.MaxLife; + base.DamageLife(damage, turn, isSelfTurn); + if (this.OnLifeChange != null) + { + this.OnLifeChange(RegisterActionBase.ActionBaseParameter.damage, new LifeInfomation(_card.Life, _card.MaxLife, life, maxLife)); + } + } + + public override void HealLife(int healAmount, int turn, bool isSelfTurn) + { + int life = _card.Life; + int maxLife = _card.MaxLife; + base.HealLife(healAmount, turn, isSelfTurn); + if (this.OnLifeChange != null) + { + this.OnLifeChange(RegisterActionBase.ActionBaseParameter.heal, new LifeInfomation(_card.Life, _card.MaxLife, life, maxLife)); + } + } + + public override void AddPp(int addPp, int currentTurn, bool isSelfTurn) + { + base.AddPp(addPp, currentTurn, isSelfTurn); + if (this.OnPpChange != null) + { + this.OnPpChange(RegisterActionBase.ActionBaseParameter.addPP, new PpModifyInformation(addPp)); + } + } + + public override VfxBase GiveForceBerserk(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + VfxBase vfx = SetForceBerserkCount(base.ForceBerserkCount + 1, skillProcessor); + sequentialVfxPlayer.Register(((ClassBattleCardBase)_card).GetOnBerserkCheck(base.ForceBerserkCount == 1 && _card.Life > 10)); + sequentialVfxPlayer.Register(vfx); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return sequentialVfxPlayer; + } + + public override VfxBase DepriveForceBerserk(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(SetForceBerserkCount(base.ForceBerserkCount - 1, skillProcessor)); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnBerserkCheck(flg: false), NullVfx.GetInstance(), InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return sequentialVfxPlayer; + } + + public override VfxBase ForceDepriveForceBerserk(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(SetForceBerserkCount(0, skillProcessor)); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnBerserkCheck(flg: false), NullVfx.GetInstance(), InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return sequentialVfxPlayer; + } + + private VfxBase SetForceBerserkCount(int count, SkillProcessor skillProcessor) + { + base.ForceBerserkCount = count; + base.IsForceBerserk = base.ForceBerserkCount > 0; + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (skillProcessor != null) + { + sequentialVfxPlayer.Register(base.Player.StartSkillWhenChangeClassLife(skillProcessor)); + } + ((ClassBattleCardBase)_card).CallOnForceBerserkChange(base.ForceBerserkCount); + return sequentialVfxPlayer; + } + + public override VfxBase GiveForceAvarice(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + SetForceAvariceCount(base.ForceAvariceCount + 1); + sequentialVfxPlayer.Register(((ClassBattleCardBase)_card).GetOnAvariceCheck(base.ForceAvariceCount == 1 && base.Player.TurnDrawCards.Count() > 2)); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return sequentialVfxPlayer; + } + + public override VfxBase DepriveForceAvarice() + { + SequentialVfxPlayer result = SequentialVfxPlayer.Create(); + SetForceAvariceCount(base.ForceAvariceCount - 1); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnAvariceCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return result; + } + + public override VfxBase ForceDepriveForceAvarice() + { + SequentialVfxPlayer result = SequentialVfxPlayer.Create(); + SetForceAvariceCount(0); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnAvariceCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return result; + } + + private void SetForceAvariceCount(int count) + { + base.ForceAvariceCount = count; + base.IsForceAvarice = base.ForceAvariceCount > 0; + ((ClassBattleCardBase)_card).CallOnForceAvariceChange(base.ForceAvariceCount); + } + + public override VfxBase GiveForceWrath(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + SetForceWrathCount(base.ForceWrathCount + 1); + sequentialVfxPlayer.Register(((ClassBattleCardBase)_card).GetOnWrathCheck(base.ForceWrathCount == 1 && base.Player.SkillInfoClass.DamagedCounter.GetDamageCount(selfTurn: true) > 7)); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return sequentialVfxPlayer; + } + + public override VfxBase DepriveForceWrath() + { + SequentialVfxPlayer result = SequentialVfxPlayer.Create(); + SetForceWrathCount(base.ForceWrathCount - 1); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnWrathCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return result; + } + + public override VfxBase ForceDepriveForceWrath() + { + SequentialVfxPlayer result = SequentialVfxPlayer.Create(); + SetForceWrathCount(0); + base.Player.BattleMgr.VfxMgr.RegisterImmediateVfx(SequentialVfxPlayer.Create(((ClassBattleCardBase)_card).GetOnWrathCheck(flag: false), NullVfx.GetInstance(), InstantVfx.Create(delegate + { + base.Player.UpdateHandCardsPlayability(); + }))); + return result; + } + + private void SetForceWrathCount(int count) + { + base.ForceWrathCount = count; + base.IsForceWrath = base.ForceWrathCount > 0; + ((ClassBattleCardBase)_card).CallOnForceWrathChange(base.ForceWrathCount); + } + + public override VfxBase GiveCantActivateFanfare(string type) + { + if (type == "unit") + { + base.CantActivateFanfareUnitCount++; + } + else if (type == "field") + { + base.CantActivateFanfareFieldCount++; + } + else + { + base.CantActivateFanfareUnitCount++; + base.CantActivateFanfareFieldCount++; + } + base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0; + base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0; + return NullVfx.GetInstance(); + } + + public override VfxBase SetCantActivateFanfareCount(int count) + { + base.CantActivateFanfareUnitCount = count; + base.CantActivateFanfareFieldCount = count; + base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0; + base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0; + return NullVfx.GetInstance(); + } + + public override VfxBase DepriveCantActivateFanfare(string type) + { + if (type == "unit") + { + base.CantActivateFanfareUnitCount--; + } + else if (type == "field") + { + base.CantActivateFanfareFieldCount--; + } + else + { + base.CantActivateFanfareUnitCount--; + base.CantActivateFanfareFieldCount--; + } + base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0; + base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0; + return NullVfx.GetInstance(); + } + + public override VfxBase ForceDepriveCantActivateFanfare(string type) + { + if (type == "unit") + { + base.CantActivateFanfareUnitCount = 0; + } + else if (type == "field") + { + base.CantActivateFanfareFieldCount = 0; + } + else + { + base.CantActivateFanfareUnitCount = 0; + base.CantActivateFanfareFieldCount = 0; + } + base.IsCantActivateFanfareUnit = base.CantActivateFanfareUnitCount > 0; + base.IsCantActivateFanfareField = base.CantActivateFanfareFieldCount > 0; + return NullVfx.GetInstance(); + } + + public override VfxBase GiveCantActivateShortageDeckWin() + { + base.CantActivateShortageDeckWinCount++; + base.IsCantActivateShortageDeckWin = base.CantActivateShortageDeckWinCount > 0; + return NullVfx.GetInstance(); + } + + public override VfxBase DepriveCantActivateShortageDeckWin() + { + base.CantActivateShortageDeckWinCount--; + base.IsCantActivateShortageDeckWin = base.CantActivateShortageDeckWinCount > 0; + return NullVfx.GetInstance(); + } + + public override VfxBase ForceDepriveCantActivateShortageDeckWin() + { + base.CantActivateShortageDeckWinCount = 0; + base.IsCantActivateShortageDeckWin = false; + return NullVfx.GetInstance(); + } + + public override VfxBase GiveRepeatSkill(string repeatTiming, string repeatTarget, SkillBase skill) + { + base.RepeatSkillTimingList.Add(new RepeatSkillInfo(repeatTiming, repeatTarget, skill)); + return NullVfx.GetInstance(); + } + + public override VfxBase DepriveRepeatSkill(string repeatTiming, string repeatTarget, bool reservation, bool isProcess, SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + List list = new List(); + for (int i = 0; i < base.RepeatSkillTimingList.Count; i++) + { + if (base.RepeatSkillTimingList[i].Timing == repeatTiming && base.RepeatSkillTimingList[i].Target == repeatTarget) + { + if (reservation) + { + base.RepeatSkillTimingList[i].IsRemoveReservation = true; + } + else if (isProcess || !base.RepeatSkillTimingList.Any((RepeatSkillInfo s) => s.IsRemoveReservation && s.Timing == repeatTiming && s.Target == repeatTarget)) + { + sequentialVfxPlayer.Register(base.RepeatSkillTimingList[i].Skill.Stop(skillProcessor)); + list.Add(base.RepeatSkillTimingList[i]); + } + } + } + if (list.Count != 0 && !reservation) + { + for (int num = 0; num < list.Count; num++) + { + base.RepeatSkillTimingList.Remove(list[num]); + } + } + return sequentialVfxPlayer; + } + + public override VfxBase ReservationAllDepriveRepeatSkill() + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + List list = new List(); + for (int i = 0; i < base.RepeatSkillTimingList.Count; i++) + { + if (base.RepeatSkillTimingList[i].IsRemoveReservation) + { + sequentialVfxPlayer.Register(base.RepeatSkillTimingList[i].Skill.Stop(null)); + list.Add(base.RepeatSkillTimingList[i]); + } + } + if (list.Count != 0) + { + for (int j = 0; j < list.Count; j++) + { + base.RepeatSkillTimingList.Remove(list[j]); + } + } + return sequentialVfxPlayer; + } + + public override VfxBase ForceDepriveRepeatSkill() + { + base.RepeatSkillTimingList.Clear(); + return NullVfx.GetInstance(); + } + + public override VfxBase GiveCantPlay(CantPlayCardFilterInfo cantPlayCardFilter) + { + base.CantPlayFilterList.Add(cantPlayCardFilter); + return InstantVfx.Create(delegate + { + foreach (BattleCardBase handCard in _card.SelfBattlePlayer.HandCardList) + { + handCard.BattleCardView.UpdateMovability(); + } + }); + } + + public override VfxBase DepriveCantPlay(CantPlayCardFilterInfo cantPlayCardFilter) + { + base.CantPlayFilterList.Remove(cantPlayCardFilter); + return InstantVfx.Create(delegate + { + foreach (BattleCardBase handCard in _card.SelfBattlePlayer.HandCardList) + { + handCard.BattleCardView.UpdateMovability(); + } + }); + } + + public override VfxBase ForceDepriveCantPlay() + { + base.CantPlayFilterList.Clear(); + return InstantVfx.Create(delegate + { + foreach (BattleCardBase handCard in _card.SelfBattlePlayer.HandCardList) + { + handCard.BattleCardView.UpdateMovability(); + } + }); + } + + public override VfxBase GiveAddTarget(AddTargetInfo info) + { + base.AddTargetList.Add(info); + return NullVfx.GetInstance(); + } + + public override VfxBase DepriveAddTarget(AddTargetInfo info) + { + base.AddTargetList.Remove(info); + return NullVfx.GetInstance(); + } + + public override VfxBase ForceDepriveAddTarget() + { + base.AddTargetList.Clear(); + return NullVfx.GetInstance(); + } + + public override VfxBase GiveDecreaseTurnStartPP(int value) + { + base.DecreaseTurnStartPPList.Add(value); + return NullVfx.GetInstance(); + } + + public override VfxBase DepriveDecreaseTurnStartPP(int value) + { + base.DecreaseTurnStartPPList.Remove(value); + return NullVfx.GetInstance(); + } + + public override VfxBase ForceDepriveDecreaseTurnStartPP() + { + base.DecreaseTurnStartPPList.Clear(); + return NullVfx.GetInstance(); + } + + public override VfxBase GiveCombatValueModifier(ICardOffenseModifier offenseModifier, ICardLifeModifier lifeModifier, SkillProcessor skillProcessor) + { + int life = _card.Life; + int maxLife = _card.MaxLife; + VfxBase vfxBase = base.GiveCombatValueModifier(offenseModifier, lifeModifier, skillProcessor); + VfxBase vfxBase2 = _card.SelfBattlePlayer.StartSkillWhenChangeClassLife(skillProcessor); + if (this.OnLifeChange != null) + { + this.OnLifeChange(RegisterActionBase.ActionBaseParameter.set, new LifeInfomation(_card.Life, _card.MaxLife, life, maxLife)); + } + return SequentialVfxPlayer.Create(vfxBase, vfxBase2); + } + + public override VfxBase DepriveCombatValueModifire(ICardOffenseModifier offenseModifier, ICardLifeModifier lifeModifier) + { + VfxBase vfxBase = base.DepriveCombatValueModifire(offenseModifier, lifeModifier); + return SequentialVfxPlayer.Create(vfxBase); + } + + public override VfxBase ForceDepriveCombatValueModifire() + { + VfxBase vfxBase = base.ForceDepriveCombatValueModifire(); + return SequentialVfxPlayer.Create(vfxBase); + } + + protected override VfxBase CombatModifierChangeCalc(bool isOldAtkBuff, bool isNowAtkBuff, bool isOldMaxLifeBuff, bool isNowMaxLifeBuff, bool isOldAtkDebuff, bool isNowAtkDebuff, bool isOldMaxLifeDebuff, bool isNowMaxLifeDebuff, bool isSkillPowerDown = false, bool isNoBuff = false, bool skipWait = false) + { + return _vfxCreator.CreateParameterChange(_card.CreateParameterChangeInfo()); + } + + public override void AddTokenDrawModifier(TokenDrawModifier modifier) + { + base.TokenDrawModifiers.Add(modifier); + } + + public override void RemoveTokenDrawModifier(TokenDrawModifier modifier) + { + foreach (TokenDrawModifier tokenDrawModifier in base.TokenDrawModifiers) + { + if (tokenDrawModifier.Equals(modifier)) + { + base.TokenDrawModifiers.Remove(tokenDrawModifier); + break; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/ClipboardHelper.cs b/SVSim.BattleEngine/Engine/ClipboardHelper.cs new file mode 100644 index 0000000..20dd236 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ClipboardHelper.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +public class ClipboardHelper +{ + public static string Clipboard + { + get + { + return GUIUtility.systemCopyBuffer; + } + set + { + GUIUtility.systemCopyBuffer = value; + } + } +} diff --git a/SVSim.BattleEngine/Engine/ColorOverwrite.cs b/SVSim.BattleEngine/Engine/ColorOverwrite.cs new file mode 100644 index 0000000..bc828ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColorOverwrite.cs @@ -0,0 +1,27 @@ +using UnityEngine; + +public class ColorOverwrite : MonoBehaviour +{ + public enum Change + { + No, + Yes, + UseDeckColorSet, + UseBingoButtonSet + } + + [SerializeField] + private Change _change; + + [SerializeField] + private bool _dontChangeEffectDistance; + + [SerializeField] + private bool _dontChangeEffectStyle; + + public Change ColorChange => _change; + + public bool DontChangeEffectDistance => _dontChangeEffectDistance; + + public bool DontChangeEffectStyle => _dontChangeEffectStyle; +} diff --git a/SVSim.BattleEngine/Engine/ColosseumCardPanel.cs b/SVSim.BattleEngine/Engine/ColosseumCardPanel.cs new file mode 100644 index 0000000..7e84702 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumCardPanel.cs @@ -0,0 +1,190 @@ +using Cute; +using UnityEngine; +using Wizard; + +internal class ColosseumCardPanel : MyPageCardPanel +{ + private const string DEFAULT_GRAND_PRIX_ID = "0"; + + [SerializeField] + private GameObject _infoRoot; + + [SerializeField] + private UILabel _infoTitleLabel; + + [SerializeField] + private UILabel _infoNextRoundLabel; + + [SerializeField] + private UILabel _infoTimeLabel; + + [SerializeField] + private UILabel _nameLabel; + + [SerializeField] + private GameObject _freeEntryIcon; + + [SerializeField] + private UISprite _panelLineSprite; + + private const int SECONDS_PER_MINUTE = 60; + + private const float SECONDS_TASK_END_NEXT_INTERVAL = 0.5f; + + private float _updateTimer; + + private bool _isFreeEntryIconDisplayPermission; + + public GameObject MyPageFreeEntryIcon { private get; set; } + + public override void CheckMaintenanceType() + { + base.CheckMaintenanceType(); + if (Data.MaintenanceCodeList.Contains(maintenanceType)) + { + _infoRoot.SetActive(value: false); + } + else + { + _infoRoot.SetActive(value: true); + } + } + + public void SetIconDisplayPermission(bool isPermission) + { + _isFreeEntryIconDisplayPermission = isPermission; + NowUpdate(); + } + + public override string GetResourcePath(bool isfetch) + { + if (Data.ArenaData.ColosseumData.ColorCodeId == "0") + { + return base.GetResourcePath(isfetch); + } + return Toolbox.ResourcesManager.GetAssetTypePath("menu_arena_colosseum_gp_" + Data.ArenaData.ColosseumData.ColorCodeId, ResourcesManager.AssetLoadPathType.CardMenu, isfetch); + } + + public void NowUpdate() + { + _updateTimer = 0f; + } + + private void OnEnable() + { + NowUpdate(); + } + + private void OnApplicationPause(bool pause) + { + if (!pause) + { + NowUpdate(); + } + } + + private void Update() + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + if (colosseumData.IsColosseumPeriod) + { + _updateTimer -= Time.deltaTime; + if (_updateTimer < 0f) + { + SystemText systemText = Data.SystemText; + double num = colosseumData.RemainingServerUnixTime + (double)Time.realtimeSinceStartup - (double)colosseumData.RemainingSinceTime; + _updateTimer = (float)(60.0 - num % 60.0); + _nameLabel.text = colosseumData.Name; + string id; + string id2; + string id3; + if (colosseumData.IsRoundPeriod) + { + id = "Colosseum_0044"; + id2 = "Colosseum_0057"; + id3 = "Colosseum_0058"; + } + else + { + id = "Colosseum_0059"; + id2 = "Colosseum_0060"; + id3 = "Colosseum_0061"; + } + string text; + if (num > colosseumData.RemainingUnixTime) + { + text = systemText.Get(id3, "0"); + if (colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage || (!colosseumData.IsRoundPeriod && colosseumData.IsColosseumPeriod)) + { + ColosseumEntryInfoTask task = new ColosseumEntryInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, ColosseumEntryInfoTaskSuccess)); + } + } + else + { + double num2 = colosseumData.RemainingUnixTime - num; + text = ((num2 < 3600.0) ? systemText.Get(id3, ((int)(num2 / 60.0) + 1).ToString()) : ((!(num2 < 86400.0)) ? systemText.Get(id, ((int)(num2 / 86400.0)).ToString()) : systemText.Get(id2, ((int)(num2 / 3600.0)).ToString()))); + } + if (colosseumData.IsRoundPeriod) + { + string text2 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage) ? systemText.Get("Colosseum_0062", systemText.Get("Colosseum_0007", ((int)colosseumData.StageNo).ToString())) : systemText.Get("Colosseum_0062", systemText.Get("Colosseum_0008"))); + _infoTitleLabel.text = text2; + _infoNextRoundLabel.text = systemText.Get("Colosseum_0043"); + _infoTimeLabel.text = text; + if (_isFreeEntryIconDisplayPermission) + { + _freeEntryIcon.SetActive(colosseumData.IsFreeEntry); + } + else + { + _freeEntryIcon.SetActive(value: false); + } + UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon(); + MyPageFreeEntryIcon.SetActive(colosseumData.IsFreeEntry); + } + else + { + string text3 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.Stage1) ? systemText.Get("Colosseum_0045") : systemText.Get("Colosseum_0041")); + string text4 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage) ? systemText.Get("Colosseum_0042", systemText.Get("Colosseum_0007", ((int)colosseumData.StageNo).ToString())) : systemText.Get("Colosseum_0042", systemText.Get("Colosseum_0008"))); + _infoTitleLabel.text = text3; + _infoNextRoundLabel.text = text4; + _infoTimeLabel.text = text; + _freeEntryIcon.SetActive(value: false); + UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon(); + MyPageFreeEntryIcon.SetActive(value: false); + } + } + } + SetUILabelParam(); + } + + private void ColosseumEntryInfoTaskSuccess(NetworkTask.ResultCode inResult) + { + _updateTimer = 0.5f; + } + + private void SetUILabelParam() + { + string colorCodeId = Data.ArenaData.ColosseumData.ColorCodeId; + if (colorCodeId == "0") + { + _panelLineSprite.color = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_LINE_SPRITE_COLOR); + base.TitleLabel.applyGradient = true; + base.TitleLabel.gradientTop = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_TITLE_GRAD_TOP); + base.TitleLabel.gradientBottom = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_TITLE_GRAD_BOTTOM); + base.TitleLabel.effectStyle = UILabel.Effect.Outline8; + base.TitleLabel.effectColor = ColorCode.Get(eColorCodeId.CARD_PANEL_GP_TITLE_OUTLINE); + _infoTitleLabel.effectStyle = UILabel.Effect.None; + } + else + { + _panelLineSprite.color = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_LINE_SPRITE_COLOR"); + base.TitleLabel.gradientTop = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_TITLE_GRAD_TOP"); + base.TitleLabel.gradientBottom = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_TITLE_GRAD_BOTTOM"); + base.TitleLabel.effectStyle = UILabel.Effect.Outline8; + base.TitleLabel.effectColor = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_TITLE_OUTLINE"); + _infoTitleLabel.effectStyle = UILabel.Effect.Outline8; + _infoTitleLabel.effectColor = ColorCode.GetWithString("GP" + colorCodeId + "_CARD_PANEL_ROUND_INFO_OUTLINE"); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ColosseumDetail.cs b/SVSim.BattleEngine/Engine/ColosseumDetail.cs new file mode 100644 index 0000000..db4f1bf --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumDetail.cs @@ -0,0 +1,270 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard; +using Wizard.ErrorDialog; + +public class ColosseumDetail : MonoBehaviour +{ + private enum eTitleLabel + { + StageName, + TimeStart, + TimeEnd, + Max + } + + private enum eGroupLabel + { + Group, + BattleNum, + BreakThrough, + Retry + } + + [SerializeField] + private UILabel _formatLabel; + + [SerializeField] + private UILabel _timeLabel; + + [SerializeField] + private UILabel _ownStatusLabel; + + [SerializeField] + private UILabel[] _round1TitleLabels; + + [SerializeField] + private UILabel[] _round2TitleLabels; + + [SerializeField] + private UILabel[] _round3TitleLabels; + + [SerializeField] + private UILabel[] _round1GroupLabels; + + [SerializeField] + private UILabel[] _round2GroupALabels; + + [SerializeField] + private UILabel[] _round2GroupBLabels; + + [SerializeField] + private UILabel[] _round3GroupALabels; + + [SerializeField] + private UILabel[] _round3GroupBLabels; + + public void Init(DialogBase inDialog) + { + SystemText systemText = Wizard.Data.SystemText; + ArenaColosseum colosseumData = Wizard.Data.ArenaData.ColosseumData; + inDialog.SetSize(DialogBase.Size.M); + inDialog.SetTitleLabel(systemText.Get("Common_0022")); + inDialog.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn_GrayBtn); + inDialog.SetButtonText(systemText.Get("Colosseum_0023"), systemText.Get("Colosseum_0025")); + inDialog.onPushButton1 = delegate + { + if (!string.IsNullOrEmpty(Wizard.Data.ArenaData.ColosseumData.AnnounceNo)) + { + UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(Wizard.Data.ArenaData.ColosseumData.AnnounceNo); + } + else + { + Dialog.Create(4416); + } + }; + inDialog.onPushButton2 = delegate + { + if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.Avatar) + { + UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.HeroesGrandPrix); + } + else if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.WindFall) + { + UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.ColosseumWindFall); + } + else if (Wizard.Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) + { + UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.Colosseum2PickChaos, null, 0, Wizard.Data.ArenaData.ColosseumData.ChaoseTipsId); + } + else + { + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.ColosseumInfo); + } + }; + inDialog.isNotCloseWindowButton1 = true; + inDialog.isNotCloseWindowButton2 = true; + string text = colosseumData.Rule switch + { + ArenaColosseum.eRule.TwoPick => (colosseumData.IsNormalTwoPick ? systemText.Get("Arena_0002") : systemText.Get("Colosseum_0105")) + " " + systemText.Get("Colosseum_0093"), + ArenaColosseum.eRule.TwoPickChaos => systemText.Get("Chaos_FormatName"), + ArenaColosseum.eRule.HOF => systemText.Get("Colosseum_0108"), + ArenaColosseum.eRule.WindFall => systemText.Get("Colosseum_0115"), + ArenaColosseum.eRule.Crossover => systemText.Get("Common_0166"), + ArenaColosseum.eRule.MyRotation => systemText.Get("Common_0178"), + ArenaColosseum.eRule.Avatar => systemText.Get("HeroesBattle_0001"), + _ => ((colosseumData.DeckFormat == Format.Rotation) ? systemText.Get("Common_0154") : systemText.Get("Common_0155")) + systemText.Get("Colosseum_0093"), + }; + _formatLabel.text = systemText.Get("Colosseum_0054", text); + _timeLabel.text = systemText.Get("Colosseum_0084", colosseumData.ColosseumTimeText); + OwnStatusLabelUpdate(); + List list = new List(); + list.Add(_round1TitleLabels); + list.Add(_round2TitleLabels); + list.Add(_round3TitleLabels); + for (int num = 1; num < 4; num++) + { + UILabel[] array = list[num - 1]; + ArenaColosseum.eRound eRound = (ArenaColosseum.eStageNo)num switch + { + ArenaColosseum.eStageNo.Stage1 => ArenaColosseum.eRound.Round1, + ArenaColosseum.eStageNo.Stage2 => ArenaColosseum.eRound.Round2A, + _ => ArenaColosseum.eRound.FinalA, + }; + UILabel uILabel = array[0]; + if (num == 3) + { + uILabel.text = systemText.Get("Colosseum_0008"); + } + else + { + uILabel.text = systemText.Get("Colosseum_0007", num.ToString()); + } + UILabel uILabel2 = array[1]; + uILabel2.text = colosseumData.DetailData[(int)(eRound - 1)].RoundTimeStartText; + UILabel uILabel3 = array[2]; + uILabel3.text = colosseumData.DetailData[(int)(eRound - 1)].RoundTimeEndText; + if (num == (int)colosseumData.FocusStageNo) + { + uILabel.text = AddColorCode(uILabel.text); + uILabel2.text = AddColorCode(uILabel2.text); + uILabel3.text = AddColorCode(uILabel3.text); + } + } + List list2 = new List(); + list2.Add(_round1GroupLabels); + list2.Add(_round2GroupBLabels); + list2.Add(_round2GroupALabels); + list2.Add(_round3GroupBLabels); + list2.Add(_round3GroupALabels); + for (int num2 = 1; num2 < 6; num2++) + { + UILabel[] array = list2[num2 - 1]; + array[0].text = colosseumData.DetailData[num2 - 1].GroupName; + array[1].text = systemText.Get("Colosseum_0075", colosseumData.DetailData[num2 - 1].MaxBattleNum.ToString()); + if (num2 >= 4) + { + array[3].text = systemText.Get("Colosseum_0088", colosseumData.DetailData[num2 - 1].MaxEntryNum.ToString()); + } + else + { + array[3].text = systemText.Get("Colosseum_0078", colosseumData.DetailData[num2 - 1].MaxEntryNum.ToString()); + } + UILabel uILabel4 = array[2]; + if (num2 == 1) + { + string text2 = systemText.Get("Colosseum_0076", colosseumData.DetailData[num2 - 1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0020")); + string text3 = systemText.Get("Colosseum_0080", (colosseumData.DetailData[num2 - 1].BreakThroughNum - 1).ToString(), systemText.Get("Colosseum_0021")); + uILabel4.text = text2 + "\n" + text3; + } + else if (num2 >= 4) + { + uILabel4.text = systemText.Get("Colosseum_0104", colosseumData.FinalRoundEliminateCount.ToString()); + } + else + { + switch (num2) + { + case 3: + { + string text4 = systemText.Get("Colosseum_0076_Group", colosseumData.DetailData[num2 - 1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0020")); + string text5 = systemText.Get("Colosseum_0076_Group", colosseumData.DetailData[1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0021")); + uILabel4.text = text4 + "\n" + text5; + break; + } + case 2: + uILabel4.text = systemText.Get("Colosseum_0076_Group", colosseumData.DetailData[num2 - 1].BreakThroughNum.ToString(), systemText.Get("Colosseum_0021")); + break; + } + } + if (colosseumData.GetStageNoFromRoundId((ArenaColosseum.eRound)num2) == colosseumData.FocusStageNo) + { + for (int num3 = 0; num3 < array.Length; num3++) + { + array[num3].text = AddColorCode(array[num3].text); + } + } + } + } + + private void OwnStatusLabelUpdate() + { + SystemText systemText = Wizard.Data.SystemText; + ArenaColosseum colosseumData = Wizard.Data.ArenaData.ColosseumData; + _ownStatusLabel.text = string.Empty; + if (colosseumData.IsClear) + { + _ownStatusLabel.text = systemText.Get("Colosseum_0038", colosseumData.Name); + } + else if (colosseumData.IsFinalRound()) + { + _ownStatusLabel.text = string.Empty; + } + else if (!colosseumData.IsRoundPeriod && colosseumData.StageNo == ArenaColosseum.eStageNo.Stage1) + { + _ownStatusLabel.text = string.Empty; + } + else if (!colosseumData.IsRoundPeriod) + { + if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2) + { + if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B) + { + _ownStatusLabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound)); + } + } + else if (colosseumData.StageNo == ArenaColosseum.eStageNo.FinalStage) + { + if (colosseumData.NextRound == ArenaColosseum.eRound.Undecided || colosseumData.NextRound == ArenaColosseum.eRound.Lose) + { + _ownStatusLabel.text = systemText.Get("Colosseum_0052"); + } + else if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB) + { + _ownStatusLabel.text = systemText.Get("Colosseum_0037_Group", colosseumData.GetGroupText(colosseumData.NextRound)); + } + } + } + else if (colosseumData.Round == ArenaColosseum.eRound.Round1) + { + if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B) + { + _ownStatusLabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound)); + } + } + else if ((colosseumData.Round == ArenaColosseum.eRound.Round2A || colosseumData.Round == ArenaColosseum.eRound.Round2B) && colosseumData.NextRound != ArenaColosseum.eRound.Lose) + { + if (colosseumData.NextRound == ArenaColosseum.eRound.Undecided) + { + _ownStatusLabel.text = systemText.Get("Colosseum_0052"); + } + else if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB) + { + _ownStatusLabel.text = systemText.Get("Colosseum_0037_Group", colosseumData.GetGroupText(colosseumData.NextRound)); + } + } + else + { + _ownStatusLabel.text = string.Empty; + } + if (_ownStatusLabel.text != string.Empty) + { + _ownStatusLabel.text = AddColorCode(_ownStatusLabel.text); + } + } + + private string AddColorCode(string inOriginalText) + { + return "[fcd24a]" + inOriginalText + "[-]"; + } +} diff --git a/SVSim.BattleEngine/Engine/ColosseumEntry.cs b/SVSim.BattleEngine/Engine/ColosseumEntry.cs new file mode 100644 index 0000000..fb088e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ColosseumEntry.cs @@ -0,0 +1,580 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class ColosseumEntry : ArenaEntryBase +{ + [SerializeField] + private GameObject _detailPrefab; + + [SerializeField] + private MyPageItemArena _myPageItemArena; + + [SerializeField] + private GameObject _costRoot; + + [SerializeField] + private GameObject _entryStatusRoot; + + [SerializeField] + private UILabel _entryStatusLabel; + + [SerializeField] + private UIButton _entryButton; + + [SerializeField] + private GameObject _infoBase; + + [SerializeField] + private UILabel _formatLabel; + + [SerializeField] + private UILabel _periodLabel; + + [SerializeField] + private UILabel _ownStatusLabel; + + [SerializeField] + private GameObject _twoPickRound1InfoBase; + + [SerializeField] + private UILabel _twoPickFormatLabel; + + [SerializeField] + private UILabel _twoPickPoolLabel; + + [SerializeField] + private UILabel _twoPickPeriodLabel; + + [SerializeField] + private UILabel _twoPickStatusLabel; + + [SerializeField] + private GameObject _twoPickRound2InfoBase; + + [SerializeField] + private UILabel _twoPickRound2FormatLabel; + + [SerializeField] + private UILabel _twoPickRound2PoolLabel; + + [SerializeField] + private UILabel _twoPickRound2PeriodLabel; + + [SerializeField] + private UILabel _twoPickRound2StatusLabel; + + [SerializeField] + private UILabel _retryNumberLabel; + + [SerializeField] + public GameObject _freeEntryIcon; + + private const string ORANGE_COLOR_CODE = "[fcd24a]"; + + private const int FORMAT_LABEL_UP_Y = 49; + + private const int FORMAT_LABEL_CENTER_Y = 14; + + private const int FORMAT_LABEL_UP_Y_FIVE_LINES = 56; + + private const int FORMAT_LABEL_CENTER_FIVE_LINES = 30; + + private const string DECK_DECISION_COLOSSEUM_PATH = "UI/DeckList/DeckDecisionColosseum"; + + private const string DECK_DECISION_COLOSSEUM_FINAL_PATH = "UI/DeckList/DeckDecisionColosseumFinal"; + + private void Awake() + { + EntryBaseInit(_costRoot); + } + + protected override void EntryBaseInit(GameObject costRootObject) + { + base.EntryBaseInit(costRootObject); + SystemText systemText = Data.SystemText; + _entryDialogTitleText = systemText.Get("Colosseum_0003"); + _resumeFunc = Resume; + _isJoinFunc = IsJoin; + _initFunc = Init; + } + + private void Init() + { + if (Data.ArenaData.ColosseumData.IsFreeEntry) + { + _isFreeEntry = true; + _freeEntryFunc = FreeEntry; + } + else + { + _isFreeEntry = false; + } + EntryStatusLabelInit(); + UIManager.SetObjectToGrey(_entryButton.gameObject, !isEntryPossible()); + UILabel componentInChildren = _entryButton.GetComponentInChildren(); + if (isEntryPossible() && _isFreeEntry) + { + componentInChildren.text = Data.SystemText.Get("Colosseum_0103"); + } + else + { + componentInChildren.text = Data.SystemText.Get("Arena_0034"); + } + } + + protected override void EntryDialogCreate(GameObject inDialogObject) + { + inDialogObject.AddComponent().ColosseumEntryClass = this; + } + + private void Resume() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + if (Data.ArenaData.ColosseumData.IsDeckEntry) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Colosseum); + } + else + { + EntryTaskSuccess(NetworkTask.ResultCode.Success); + } + } + + private bool IsJoin() + { + return Data.ArenaData.ColosseumData.isJoin; + } + + public void OnClickDetailButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OpenDetail(); + } + + private void FreeEntry() + { + ColosseumEntryTask colosseumEntryTask = new ColosseumEntryTask(); + colosseumEntryTask.SetParameter(ArenaData.eARENA_PAY.Free); + StartCoroutine(Toolbox.NetworkManager.Connect(colosseumEntryTask, FreeEntryTaskSuccess)); + } + + private void FreeEntryTaskSuccess(NetworkTask.ResultCode inResult) + { + EntryTaskSuccess(inResult); + Data.ArenaData.ColosseumData.IsFreeEntry = false; + _myPageItemArena._colosseumCardPanel.GetComponent().NowUpdate(); + } + + public void EntryTaskSuccess(NetworkTask.ResultCode inResult) + { + Data.ArenaData.ColosseumData.isJoin = true; + if (Data.ArenaData.ColosseumData.IsTwoPickRule || Data.ArenaData.ColosseumData.DeckFormat == Format.Avatar) + { + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumTwoPick; + Data.CurrentFormat = Format.Max; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Colosseum); + } + else + { + UpdateEntryResumeButton(); + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumNormal; + Data.CurrentFormat = Data.ArenaData.ColosseumData.DeckFormat; + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Data.ArenaData.ColosseumData.DeckFormat); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + if (!RunSpecialDeckSelectEntry()) + { + DeckSelectUI.InitOptions initOptions = new DeckSelectUI.InitOptions + { + CanUseNonPossessionCard = Data.ArenaData.ColosseumData.CanUseNonPossessionCard + }; + DeckSelectUIDialog.Create(Data.SystemText.Get("Battle_0488"), task.DeckGroupListData, Data.ArenaData.ColosseumData.DeckFormat, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: true, CreateDeckSelectConfirmDialog, initOptions); + } + })); + } + HeadLineObject.GetComponent().UpdateHeadLine(); + } + + private bool RunSpecialDeckSelectEntry() + { + if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.HOF) + { + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumHof; + ColosseumHOFDeckInfoTask task = new ColosseumHOFDeckInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + List deckGroupList = new List + { + new DeckGroup(task.DeckList, Format.Max, DeckAttributeType.CustomDeck) + }; + DeckSelectUIDialog.Create(Data.SystemText.Get("Colosseum_0109"), new DeckGroupListData(deckGroupList), Format.Max, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: false, CreateDeckSelectConfirmDialog); + })); + return true; + } + if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.WindFall) + { + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.ColosseumWindFall; + ColosseumWindFallDeckInfoTask task2 = new ColosseumWindFallDeckInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task2, delegate + { + List deckGroupList = new List + { + new DeckGroup(task2.DeckList, Format.Max, DeckAttributeType.CustomDeck) + }; + DeckSelectUIDialog.Create(Data.SystemText.Get("Colosseum_0117"), new DeckGroupListData(deckGroupList), Format.Max, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: false, CreateDeckSelectConfirmDialog); + })); + return true; + } + return false; + } + + private void CreateDeckSelectConfirmDialog(DialogBase dialogDeckList, DeckData deck) + { + if (!deck.IsUsable(Data.ArenaData.ColosseumData.CanUseNonPossessionCard)) + { + InCompleteDeckDecideDialog.Create(dialogDeckList, deck); + return; + } + CompleteDeckDecideDialog completeDeckDecideDialog = CompleteDeckDecideDialog.CreateForSingleDeck(dialogDeckList, deck, showSimpleStageOption: true, delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckSetAndMoveColosseum(deck); + }); + completeDeckDecideDialog.DecisionUI.CardDetailCustomize = delegate(CardDetailUI detailUI) + { + detailUI.IsShowFlavorTextButton = false; + detailUI.IsShowVoiceButton = false; + detailUI.IsShowEvolutionButton = false; + }; + completeDeckDecideDialog.DecisionUI.CardListCustomize = delegate(UICardList cardList) + { + if (Data.ArenaData.ColosseumData.IsSpecialDeckSelectRule) + { + cardList.SetShareButtonUse(isUse: false); + } + if (Data.ArenaData.ColosseumData.IsDeckMaxNumberChange) + { + cardList.SetMaxCardNum(Data.ArenaData.ColosseumData.DeckMaxNumber); + } + }; + if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.HOF) + { + completeDeckDecideDialog.DecisionUI.IsCanShowQRCode = false; + } + if (GameMgr.GetIns().GetDataMgr().m_BattleType == DataMgr.BattleType.ColosseumNormal) + { + completeDeckDecideDialog.DecisionUI.gameObject.GetComponent().alpha = 0f; + DeckDecisionColosseum deckDecisionColosseum = Object.Instantiate(Toolbox.ResourcesManager.LoadObject("UI/DeckList/DeckDecisionColosseum", isServerResources: false)); + completeDeckDecideDialog.Dialog.SetObj(deckDecisionColosseum.gameObject); + deckDecisionColosseum.Init(deck); + completeDeckDecideDialog.DecisionUI.transform.SetParent(deckDecisionColosseum.transform.parent.transform); + } + } + + private void DeckSetAndMoveColosseum(DeckData inDeckData) + { + Data.ArenaData.ColosseumData.DeckList.Clear(); + Data.ArenaData.ColosseumData.DeckList.Add(inDeckData); + if (!Data.ArenaData.ColosseumData.IsSpecialDeckSelectRule) + { + DeckListUtility.SaveLastSelectDeck(inDeckData.GetDeckID(), isDefaultDeck: false, isTrialDeck: false, Data.ArenaData.ColosseumData.DeckFormat); + } + BaseTask baseTask = null; + if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.HOF) + { + ((ColosseumDeckEntryHOFTask)(baseTask = new ColosseumDeckEntryHOFTask())).SetParameter(Data.ArenaData.ColosseumData.DeckList); + } + else if (Data.ArenaData.ColosseumData.Rule == ArenaColosseum.eRule.WindFall) + { + ((ColosseumWindFallDeckEntry)(baseTask = new ColosseumWindFallDeckEntry())).SetParameter(Data.ArenaData.ColosseumData.DeckList); + } + else if (Data.ArenaData.ColosseumData.DeckFormat == Format.Avatar) + { + ((ColosseumDeckEntryAvatarTask)(baseTask = new ColosseumDeckEntryAvatarTask())).SetParameter(Data.ArenaData.ColosseumData.DeckList); + } + else + { + ((ColosseumDeckEntryTask)(baseTask = new ColosseumDeckEntryTask())).SetParameter(Data.ArenaData.ColosseumData.DeckList, isPublished: false); + } + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(baseTask, delegate + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Colosseum); + })); + } + + public void OpenDetail() + { + ColosseumDetailTask task = new ColosseumDetailTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, DetailTaskSuccess)); + } + + private void DetailTaskSuccess(NetworkTask.ResultCode inResultCode) + { + Data.ArenaData.ColosseumData.CreateDetailDialog(_detailPrefab); + } + + private bool isEntryPossible() + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + if ((!colosseumData.IsRetry || colosseumData.IsClear || colosseumData.IsFinalRoundTry) && !colosseumData.isJoin) + { + return false; + } + return true; + } + + protected void EntryStatusLabelInit() + { + InfoTextUpdate(); + EntryTextUpdate(); + } + + private void ColosseumDeckDeletedDialogMessageReceiver() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + if (Data.ArenaData.ColosseumData.IsTwoPickRule) + { + dialogBase.SetText(Data.SystemText.Get("Colosseum_0102")); + } + else + { + dialogBase.SetText(Data.SystemText.Get("Error_4403")); + } + dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + Data.ArenaData.ColosseumData.IsDeckDeleted = false; + } + + private void InfoTextUpdate() + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + SystemText systemText = Data.SystemText; + UILabel uILabel = null; + string text = colosseumData.Rule switch + { + ArenaColosseum.eRule.TwoPick => (colosseumData.IsNormalTwoPick ? systemText.Get("Arena_0002") : systemText.Get("Colosseum_0105")) + " " + systemText.Get("Colosseum_0093"), + ArenaColosseum.eRule.TwoPickChaos => systemText.Get("Chaos_FormatName") + " " + systemText.Get("Colosseum_0093"), + ArenaColosseum.eRule.HOF => systemText.Get("Colosseum_0108"), + ArenaColosseum.eRule.WindFall => systemText.Get("Colosseum_0116"), + _ => UIUtil.GetFormatName(colosseumData.DeckFormat) + systemText.Get("Colosseum_0093"), + }; + UILabel uILabel2; + UILabel uILabel3; + UILabel uILabel4; + if (colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) + { + if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2) + { + _infoBase.SetActive(value: false); + _twoPickRound1InfoBase.SetActive(value: false); + _twoPickRound2InfoBase.SetActive(value: true); + uILabel2 = _twoPickRound2FormatLabel; + uILabel3 = _twoPickRound2PoolLabel; + uILabel4 = _twoPickRound2PeriodLabel; + uILabel = _twoPickRound2StatusLabel; + } + else + { + _infoBase.SetActive(value: false); + _twoPickRound1InfoBase.SetActive(value: true); + _twoPickRound2InfoBase.SetActive(value: false); + uILabel2 = _twoPickFormatLabel; + uILabel3 = _twoPickPoolLabel; + uILabel4 = _twoPickPeriodLabel; + uILabel = _twoPickStatusLabel; + } + } + else + { + _infoBase.SetActive(value: true); + _twoPickRound1InfoBase.SetActive(value: false); + _twoPickRound2InfoBase.SetActive(value: false); + uILabel2 = _formatLabel; + uILabel3 = null; + uILabel4 = _periodLabel; + uILabel = _ownStatusLabel; + } + uILabel2.text = systemText.Get("Colosseum_0054", text); + if (colosseumData.IsRoundPeriod) + { + uILabel4.text = colosseumData.NowRoundTimeText; + } + else + { + string text2 = ((colosseumData.StageNo != ArenaColosseum.eStageNo.FinalStage) ? systemText.Get("Colosseum_0007", ((int)colosseumData.StageNo).ToString()) : systemText.Get("Colosseum_0008")); + uILabel4.text = text2 + systemText.Get("Colosseum_0101") + colosseumData.NowRoundTimeText; + } + if (colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) + { + uILabel3.text = systemText.Get("Arena_0142", colosseumData.CardPool); + } + _ownStatusLabel.text = string.Empty; + _twoPickStatusLabel.text = string.Empty; + _twoPickRound2StatusLabel.text = string.Empty; + if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage1) + { + if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B) + { + uILabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound)); + } + } + else if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2) + { + string text3 = string.Empty; + string text4 = string.Empty; + if (colosseumData.IsRoundPeriod) + { + if (colosseumData.Round == ArenaColosseum.eRound.Round2A || colosseumData.Round == ArenaColosseum.eRound.Round2B) + { + text3 = systemText.Get("Colosseum_0100", colosseumData.GetGroupText(colosseumData.Round)); + } + if (colosseumData.NextRound == ArenaColosseum.eRound.Undecided) + { + text4 = systemText.Get("Colosseum_0052"); + } + else if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB) + { + text4 = systemText.Get("Colosseum_0037_Group", colosseumData.GetGroupText(colosseumData.NextRound)); + } + uILabel.text = text3 + "\n" + text4; + } + else if (colosseumData.NextRound == ArenaColosseum.eRound.Round2A || colosseumData.NextRound == ArenaColosseum.eRound.Round2B) + { + uILabel.text = systemText.Get("Colosseum_0048", colosseumData.GetGroupText(colosseumData.NextRound)); + } + } + else if (colosseumData.StageNo == ArenaColosseum.eStageNo.FinalStage && colosseumData.Round != ArenaColosseum.eRound.Lose) + { + if (colosseumData.IsClear) + { + uILabel.text = systemText.Get("Colosseum_0038", colosseumData.Name); + } + else if (!colosseumData.IsFinalRoundTry) + { + string text5 = string.Empty; + if (colosseumData.IsRoundPeriod) + { + if (colosseumData.Round == ArenaColosseum.eRound.FinalA || colosseumData.Round == ArenaColosseum.eRound.FinalB) + { + text5 = systemText.Get("Colosseum_0100", colosseumData.GetGroupText(colosseumData.Round)); + } + uILabel.text = text5; + } + else if (colosseumData.NextRound == ArenaColosseum.eRound.Lose) + { + uILabel.text = string.Empty; + } + else + { + if (colosseumData.NextRound == ArenaColosseum.eRound.FinalA || colosseumData.NextRound == ArenaColosseum.eRound.FinalB) + { + text5 = systemText.Get("Colosseum_0100", colosseumData.GetGroupText(colosseumData.NextRound)); + } + uILabel.text = text5 + "\n" + systemText.Get("Colosseum_0037"); + } + } + } + if (uILabel.text == string.Empty) + { + if ((colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) && colosseumData.StageNo == ArenaColosseum.eStageNo.FinalStage) + { + uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 30f); + } + else + { + uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 14f); + } + return; + } + if ((colosseumData.Rule == ArenaColosseum.eRule.TwoPick || colosseumData.Rule == ArenaColosseum.eRule.TwoPickChaos) && colosseumData.StageNo == ArenaColosseum.eStageNo.Stage2) + { + uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 56f); + } + else + { + uILabel2.transform.localPosition = new Vector3(uILabel2.transform.localPosition.x, 49f); + } + uILabel.text = "[fcd24a]" + uILabel.text + "[-]"; + } + + private void EntryTextUpdate() + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + SystemText systemText = Data.SystemText; + if (!isEntryPossible()) + { + _costRoot.SetActive(value: false); + _entryStatusRoot.SetActive(value: true); + _entryStatusLabel.text = string.Empty; + if (colosseumData.IsClear || colosseumData.IsFinalRoundTry) + { + _entryStatusLabel.text = systemText.Get("Colosseum_0086"); + } + else if (colosseumData.Round == ArenaColosseum.eRound.Lose) + { + _entryStatusLabel.text = systemText.Get("Colosseum_0022"); + } + else if (!colosseumData.IsRoundPeriod) + { + if (colosseumData.StageNo == ArenaColosseum.eStageNo.Stage1) + { + _entryStatusLabel.text = systemText.Get("Colosseum_0064"); + } + else if (colosseumData.NextRound == ArenaColosseum.eRound.Lose) + { + _entryStatusLabel.text = systemText.Get("Colosseum_0022"); + } + else + { + _entryStatusLabel.text = systemText.Get("Colosseum_0056"); + } + } + else if (!colosseumData.IsRetry) + { + if (colosseumData.IsLastDay) + { + _entryStatusLabel.text = systemText.Get("Colosseum_0068"); + } + else + { + _entryStatusLabel.text = systemText.Get("Colosseum_0067"); + } + } + } + else if (colosseumData.IsFreeEntry || colosseumData.IsFinalRound()) + { + _costRoot.SetActive(value: false); + _entryStatusRoot.SetActive(value: true); + if (!colosseumData.IsFinalRound()) + { + string id = "Colosseum_0047"; + if (colosseumData.IsLastDay) + { + id = "Colosseum_0050"; + } + _entryStatusLabel.text = "[fcd24a]" + systemText.Get(id, colosseumData.RetryRemainingNum.ToString()) + "[-]\n\n" + systemText.Get("Colosseum_0026"); + } + else + { + _entryStatusLabel.text = systemText.Get("Colosseum_0092"); + } + } + else + { + _costRoot.SetActive(value: true); + _entryStatusRoot.SetActive(value: false); + } + if (colosseumData.IsLastDay) + { + _retryNumberLabel.text = systemText.Get("Colosseum_0050", colosseumData.RetryRemainingNum.ToString()); + } + else + { + _retryNumberLabel.text = systemText.Get("Colosseum_0047", colosseumData.RetryRemainingNum.ToString()); + } + } +} diff --git a/SVSim.BattleEngine/Engine/CommonBackGround.cs b/SVSim.BattleEngine/Engine/CommonBackGround.cs new file mode 100644 index 0000000..6f22246 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CommonBackGround.cs @@ -0,0 +1,166 @@ +using System; +using Cute; +using UnityEngine; + +public class CommonBackGround : UIBase +{ + public enum eBGType + { + NONE, + MORNING, + DAYTIME, + NIGHTTIME + } + + private const string LAYER_NAME_FRONT = "FrontUI"; + + private const int MorningStartTime = 4; + + private const int DayStartTime = 10; + + private const int NightStartTime = 18; + + private const string MorningTimeBGStr = "bg_mypage_morning"; + + private const string DayTimeBGStr = "bg_mypage_day"; + + private const string NightTimeBGStr = "bg_mypage_night"; + + private static CommonBackGround _instance; + + [SerializeField] + private UITexture MypageBG; + + [SerializeField] + private GameObject MagicCircle; + + [SerializeField] + public ParticleSystem[] BgEffects; + + [SerializeField] + private GameObject _effectRoot; + + private eBGType _BGType; + + private bool _bgFinishLoad; + + private string _bgPath; + + private EffectSetUp _currentEffectSetup; + + public static CommonBackGround Instance => _instance; + + public eBGType BGType => _BGType; + + public bool IsFinishLod => _bgFinishLoad; + + public bool EffectVisible + { + set + { + _effectRoot.SetActive(value); + } + } + + private void Awake() + { + _instance = this; + } + + protected override void onOpen() + { + base.onOpen(); + ChangeMyPageBG(); + } + + protected override void OnDestroy() + { + base.OnDestroy(); + _instance = null; + ReleaseMyPageBG(); + _BGType = eBGType.NONE; + MagicCircle.GetComponent().mainTexture = null; + } + + private void ReleaseMyPageBG() + { + MypageBG.mainTexture = null; + Toolbox.ResourcesManager.RemoveAsset(_bgPath); + _bgPath = ""; + } + + public void ChangeMyPageBG() + { + int hour = DateTime.Now.Hour; + eBGType eBGType; + string newBgStr; + if (hour >= 4 && hour < 10) + { + eBGType = eBGType.MORNING; + newBgStr = "bg_mypage_morning"; + } + else if (hour >= 10 && hour < 18) + { + eBGType = eBGType.DAYTIME; + newBgStr = "bg_mypage_day"; + } + else + { + eBGType = eBGType.NIGHTTIME; + newBgStr = "bg_mypage_night"; + } + if (_BGType == eBGType) + { + return; + } + _bgFinishLoad = false; + _BGType = eBGType; + ResourcesManager resMgr = Toolbox.ResourcesManager; + string newBgPath = resMgr.GetAssetTypePath(newBgStr, ResourcesManager.AssetLoadPathType.Background); + resMgr.StartCoroutine_LoadAssetGroupAsync(newBgPath, delegate + { + _bgFinishLoad = true; + MypageBG.mainTexture = resMgr.LoadObject(resMgr.GetAssetTypePath(newBgStr, ResourcesManager.AssetLoadPathType.Background, isfetch: true)) as Texture; + if (_bgPath != null) + { + resMgr.RemoveAsset(_bgPath); + } + _bgPath = newBgPath; + ChangeBgEffect(); + }); + } + + private void ChangeBgEffect() + { + BgEffects[0].gameObject.SetActive(value: false); + BgEffects[1].gameObject.SetActive(value: false); + BgEffects[2].gameObject.SetActive(value: false); + ParticleSystem bgEffectNow = GetBgEffectNow(_BGType); + bgEffectNow.gameObject.SetActive(value: true); + _currentEffectSetup = bgEffectNow.GetComponent(); + } + + public ParticleSystem GetBgEffectNow(eBGType myPageBgType) + { + return myPageBgType switch + { + eBGType.MORNING => BgEffects[2], + eBGType.DAYTIME => BgEffects[0], + _ => BgEffects[1], + }; + } + + public void SetMagicCircle(bool isVisible) + { + MagicCircle.SetActive(isVisible); + } + + public bool IsFinishEffectLoading() + { + if (_currentEffectSetup != null) + { + return _currentEffectSetup.isFinished; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/ConsistencyReportButtonAction.cs b/SVSim.BattleEngine/Engine/ConsistencyReportButtonAction.cs new file mode 100644 index 0000000..6e668fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/ConsistencyReportButtonAction.cs @@ -0,0 +1,10 @@ +using Wizard; +using Wizard.UI.ReportToManagement; + +public static class ConsistencyReportButtonAction +{ + public static void CreateReportConfirmWindow() + { + DialogReportToManagement.Create(ToolboxGame.RealTimeNetworkAgent.GetBattleId()); + } +} diff --git a/SVSim.BattleEngine/Engine/Convention/Offline.cs b/SVSim.BattleEngine/Engine/Convention/Offline.cs new file mode 100644 index 0000000..ae4c9e3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Convention/Offline.cs @@ -0,0 +1,13 @@ +namespace Convention; + +public class Offline +{ + public const int CARD_NUMBER_OF_POSSESSION = 3; + + public static bool IsConventionMode { get; set; } + + public static void OnSoftwareReset() + { + IsConventionMode = false; + } +} diff --git a/SVSim.BattleEngine/Engine/CostHalfRoundDownModifier.cs b/SVSim.BattleEngine/Engine/CostHalfRoundDownModifier.cs new file mode 100644 index 0000000..a06a296 --- /dev/null +++ b/SVSim.BattleEngine/Engine/CostHalfRoundDownModifier.cs @@ -0,0 +1,19 @@ +using System; + +public class CostHalfRoundDownModifier : CostHalfModifier +{ + public CostHalfRoundDownModifier(bool isResidentModifier) + : base(isResidentModifier) + { + } + + public override int CalcCost(int cost) + { + return (int)Math.Floor((float)cost / 2f); + } + + public override ICardCostModifier Clone() + { + return new CostHalfRoundDownModifier(base.IsResidentModifier); + } +} diff --git a/SVSim.BattleEngine/Engine/CreateItemList.cs b/SVSim.BattleEngine/Engine/CreateItemList.cs new file mode 100644 index 0000000..8d9287c --- /dev/null +++ b/SVSim.BattleEngine/Engine/CreateItemList.cs @@ -0,0 +1,564 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Cute; +using UnityEngine; +using Wizard; + +public class CreateItemList : MonoBehaviour +{ + private static CreateItemList main; + + [SerializeField] + private GameObject ItemListObj; + + [SerializeField] + private GameObject BirthInputObj; + + [SerializeField] + private NguiObjs BuyButtons; + + [SerializeField] + private UIScrollView CrystalScrollView; + + [SerializeField] + private UIScrollBar ScrollBar; + + [SerializeField] + private GameObject ButtonBase; + + [SerializeField] + private GameObject OneButtonBase; + + [SerializeField] + private UILabel BtnInfo0Label; + + [SerializeField] + private UILabel BtnInfo1Label; + + [SerializeField] + private UILabel OneButtonLabel; + + [SerializeField] + private TweenAlpha ItemListWindowAlpha; + + [SerializeField] + private TweenAlpha BirthWindowAlpha; + + [SerializeField] + private UILabel MyCrystalNumLabel; + + [SerializeField] + private GameObject BtnFundSettlementObj; + + [SerializeField] + private GameObject BtnLegalObj; + + [SerializeField] + private UILabel BirthLabel1; + + [SerializeField] + private UILabel BirthLabel2; + + [SerializeField] + private UILabel BirthAgeLabel; + + [SerializeField] + private UILabel BirthLimitLabel; + + [SerializeField] + private UILabel BirthPriceLabel; + + [SerializeField] + private UILabel BirthWarnLabel; + + [SerializeField] + private UILabel InputExampleLabel; + + [SerializeField] + private UIInput UIInputObject; + + [SerializeField] + private GameObject _noInputCollider; + + public static int BirthDayUpdateServerTime; + + public static float BirthDayUpdateRealTime; + + private string productId = ""; + + private int ProductIndex; + + private string DateOfBirth = ""; + + private NetworkManager networkManager; + + private DateTime NowTime; + + private List _itemObjectList; + + private List _notDispItemList = new List(); + + [HideInInspector] + public DialogBase ParentDialogBase; + + private const int BIRTH_DAY_NUMBER_DIGITS = 6; + + private const int CHILD_YEAR = 18; + + private const int CRYSTAL_LIMIT_UNDER = 2500; + + private const int CRYSTAL_LIMIT_TOP = 5000; + + private const int EN_LIMIT_UNDER = 5000; + + private const int EN_LIMIT_TOP = 10000; + + private const int ERROR_WINDOW_DEPTH = 50; + + private const string DEFAULT_BIRTH_DAY = "0"; + + private const string FORMAT_CONVERT_DATE_BIRTH = "{0}/{1}/15"; + + private const int NGUI_SEPARATOR = 0; + + private const int NGUI_ITEM_SPRITE = 0; + + public string ScrollToProductId; + + private Vector3 _lastScrollPosition; + + private const float SCROLL_OFFSET = 10f; + + private const float SCROLL_DELAY = 0f; + + private const float SCROLL_DELAY_LONG = 0f; + + private const float SCROLL_TIME = 0f; + + public bool IsOnlyInputBirthday { get; set; } + + public Action OnFinishUpdateBirthday { get; set; } + + public static CreateItemList GetInstance() + { + return main; + } + + private void Start() + { + main = this; + if (networkManager == null) + { + networkManager = Toolbox.NetworkManager; + } + SystemText systemText = Data.SystemText; + PaymentPC instance = PaymentPC.GetInstance(); + instance.ConsumePurchaseSucceeded += PaymentSuccessed; + BirthLabel1.text = systemText.Get("Shop_0029"); + BirthLabel2.text = systemText.Get("Shop_0030"); + BirthAgeLabel.text = systemText.Get("Shop_0035") + "\n" + systemText.Get("Shop_0036") + "\n" + systemText.Get("Shop_0037"); + BirthLimitLabel.text = systemText.Get("Shop_0038") + "\n" + systemText.Get("Shop_0038") + "\n" + systemText.Get("Shop_0040"); + string text; + string text2; + if (Data.SystemText.RegionCode == Global.LANG_TYPE.Ger.ToString()) + { + CultureInfo cultureInfo = new CultureInfo("de-de"); + text = 2500.ToString("N0", cultureInfo); + text2 = 5000.ToString("N0", cultureInfo); + } + else + { + text = $"{2500:N0}"; + text2 = $"{5000:N0}"; + } + BirthPriceLabel.text = systemText.Get("Shop_0039", text) + "\n" + systemText.Get("Shop_0039", text2); + BirthWarnLabel.text = systemText.Get("Shop_0031"); + InputExampleLabel.text = systemText.Get("Shop_0068"); + InputExampleLabel.gameObject.SetActive(value: true); + ParentDialogBase.SetButtonDisable(isEnableOK: true); + Dictionary productPurchaseLimitList = instance.ProductPurchaseLimitList; + Dictionary productPurchaseNumberList = instance.ProductPurchaseNumberList; + Dictionary productCsvIdList = instance.ProductCsvIdList; + _notDispItemList.Clear(); + if (productPurchaseNumberList.Count != 0) + { + foreach (KeyValuePair item in productCsvIdList) + { + if (productPurchaseNumberList.ContainsKey(item.Value) && int.Parse(productPurchaseLimitList[item.Value]) <= int.Parse(productPurchaseNumberList[item.Value])) + { + _notDispItemList.Add(item.Value); + } + } + } + InitScrollView(_notDispItemList); + UpdateCrystalCount(); + if (IsBirthdayNotInput()) + { + BirthInputObj.SetActive(value: true); + BirthWindowAlpha.PlayForward(); + return; + } + ItemListObj.SetActive(value: true); + ItemListWindowAlpha.PlayForward(); + ParentDialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + ParentDialogBase.SetButtonDisable(isEnableOK: false); + ParentDialogBase.onPushButton1 = delegate + { + ParentDialogBase.Close(); + }; + UIManager.GetInstance().closeInSceneCenterLoading(); + CrystalScrollView.ResetPosition(); + ScrollBar.value = 0f; + } + + public static bool IsBirthdayNotInput() + { + return PlayerStaticData.UserBirthDay == "0"; + } + + private void Update() + { + CheckScrollToItem(0f); + if (PlayerStaticData.UserBirthDay.Length != 6) + { + if (UIInputObject.isSelected) + { + InputExampleLabel.gameObject.SetActive(value: false); + } + else if (UIInputObject.value.Length == 0) + { + InputExampleLabel.gameObject.SetActive(value: true); + } + } + } + + protected void InitScrollView(List inDeleteIdList = null) + { + PaymentPC instance = PaymentPC.GetInstance(); + List productIdList = instance.ProductIdList; + Dictionary productCsvIdList = instance.ProductCsvIdList; + Dictionary productNameList = instance.ProductNameList; + Dictionary formatProductPriceList = instance.FormatProductPriceList; + Dictionary productImageNameList = instance.ProductImageNameList; + Dictionary productIsSpecialShop = instance.ProductIsSpecialShop; + SystemText systemText = Data.SystemText; + float num = 0f; + float num2 = 0f; + int num3 = 0; + _itemObjectList = new List(productIdList.Count); + for (int i = 0; i < productIdList.Count; i++) + { + string key = productIdList[i]; + if ((inDeleteIdList == null || !inDeleteIdList.Contains(productCsvIdList[key])) && !productIsSpecialShop[key] && productNameList.ContainsKey(key) && formatProductPriceList.ContainsKey(key)) + { + NguiObjs component = NGUITools.AddChild(CrystalScrollView.gameObject, BuyButtons.gameObject).GetComponent(); + _itemObjectList.Add(component); + component.gameObject.SetActive(value: true); + component.labels[0].text = productNameList[key]; + component.labels[1].text = systemText.Get("Shop_0083") + "$" + formatProductPriceList[key]; + component.labels[2].text = systemText.Get("Shop_0041"); + component.buttons[0].gameObject.name = i.ToString(); + UIEventListener uIEventListener = UIEventListener.Get(component.buttons[0].gameObject); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, new UIEventListener.VoidDelegate(BuyCrystalButtonClickCallBack)); + num2 = component.GetComponent().height; + num = (float)num3 * num2; + component.transform.localPosition = new Vector3(0f, 0f - num, 0f); + component.sprites[0].spriteName = productImageNameList[key]; + if (i == productIdList.Count - 1) + { + component.objs[0].SetActive(value: false); + } + else + { + component.objs[0].SetActive(value: true); + } + num3++; + } + } + OneButtonBase.SetActive(value: false); + ButtonBase.SetActive(value: false); + if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Kor.ToString()) + { + OneButtonBase.SetActive(value: true); + OneButtonBase.transform.localPosition = new Vector3(0f, 0f - (num + num2 / 2f), 0f); + OneButtonLabel.text = systemText.Get("Shop_0125"); + } + CrystalScrollView.ResetPosition(); + ScrollBar.value = 0f; + } + + private void _PaymentListErrorDialog() + { + if (BattleManagerBase.GetIns() == null) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0094")); + dialogBase.SetText(Data.SystemText.Get("Shop_0093")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(100); + } + } + + public void BirthUpdateButtonClickCallBack() + { + DateOfBirth = UIInputObject.value; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetReturnMsg(base.gameObject, "BirthUpdateTask"); + dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0070")); + if (DateTime.TryParse($"{DateOfBirth.Substring(0, 4)}/{DateOfBirth.Substring(4, 2)}/15", out var result)) + { + result = TimeZoneInfo.ConvertTimeToUtc(result); + string text = ConvertTime.ToLocal(result, ConvertTime.FORMAT.YEAR_MONTH); + dialogBase.SetText(Data.SystemText.Get("Shop_0071", text)); + } + else + { + dialogBase.SetText(Data.SystemText.Get("Shop_0071", DateOfBirth)); + } + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Dia_BuyCrystal_002_Button")); + dialogBase.SetPanelDepth(100); + } + + private void BirthUpdateTask() + { + UpdateBirthTask updateBirthTask = new UpdateBirthTask(); + updateBirthTask.SetParameter(DateOfBirth); + StartCoroutine(networkManager.Connect(updateBirthTask, OnUpdateBirthFinished)); + } + + private void OnUpdateBirthFinished(NetworkTask.ResultCode code) + { + PlayerStaticData.UserBirthDay = UIInputObject.value; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuyCrystal_003_Title")); + dialogBase.SetText(Data.SystemText.Get("Shop_0069")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(100); + if (!IsOnlyInputBirthday) + { + dialogBase.OnClose = BirthCloseAndItemOpen; + return; + } + dialogBase.OnClose = delegate + { + OnFinishUpdateBirthday.Call(); + }; + } + + protected void BirthCloseAndItemOpen() + { + BirthWindowAlpha.PlayReverse(); + if (IsChildCheckDialog()) + { + ChildWarningDialog(); + } + else + { + ActivateItemList(); + } + } + + private void ActivateItemList() + { + ItemListObj.SetActive(value: true); + ParentDialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + ParentDialogBase.SetButtonDisable(isEnableOK: false); + ParentDialogBase.onPushButton1 = delegate + { + ParentDialogBase.Close(); + }; + ItemListWindowAlpha.PlayForward(); + CheckScrollToItem(0f); + } + + public void BirthCancelButtonClickCallBack() + { + ParentDialogBase.CloseWithoutSelect(); + } + + public void BirthInputOnChange() + { + if (UIInputObject.value.Length == 6) + { + ParentDialogBase.SetButtonDisable(isEnableOK: false); + } + else + { + ParentDialogBase.SetButtonDisable(isEnableOK: true); + } + } + + private void ChildWarningDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Shop_0078")); + dialogBase.SetText(Data.SystemText.Get("Shop_0079")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(100); + dialogBase.OnClose = ActivateItemList; + } + + private void BuyCrystalButtonClickCallBack(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ProductIndex = int.Parse(g.name); + StartPaymentDialog(); + } + + private void StartPaymentDialog() + { + productId = PaymentPC.GetInstance().ProductIdList[ProductIndex]; + Dictionary productNameList = PaymentPC.GetInstance().ProductNameList; + if (PlayerStaticData.IsPurchaseNotificationOfLootBox()) + { + LootBoxDialogUtility.CreatePurchaseNotificationLootBoxDialog(Data.SystemText.Get("Dia_BuyCrystal_004_Title"), productNameList[productId], StartPayment, CancelPayment); + return; + } + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Dia_BuyCrystal_004_Title")); + dialogBase.SetText(Data.SystemText.Get("Shop_0017", productNameList[productId])); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Dia_BuyCrystal_004_Button")); + dialogBase.SetReturnMsg(base.gameObject, "StartPayment", "CancelPayment"); + dialogBase.SetPanelDepth(100); + } + + private void CancelPayment() + { + UIManager.GetInstance().WebViewHelper.DestroyWebView(); + } + + private void StartPayment() + { + PaymentPC.GetInstance().purchaceStart(productId); + } + + private void PaymentSuccessed() + { + try + { + Dictionary productPurchaseLimitList = PaymentPC.GetInstance().ProductPurchaseLimitList; + string lastPaymentId = Data.Load.data._userCrystalCount._lastPaymentId; + int lastPaymentItemBuyNumber = Data.Load.data._userCrystalCount._lastPaymentItemBuyNumber; + if (lastPaymentId != null && int.Parse(productPurchaseLimitList[lastPaymentId]) <= lastPaymentItemBuyNumber) + { + if (!_notDispItemList.Contains(lastPaymentId)) + { + _notDispItemList.Add(lastPaymentId); + } + for (int i = 0; i < _itemObjectList.Count; i++) + { + UnityEngine.Object.Destroy(_itemObjectList[i].gameObject); + } + _itemObjectList.Clear(); + InitScrollView(_notDispItemList); + } + } + catch (Exception ex) + { + LocalLog.AccumulateTraceLog("Payment suceeded but exception is captured :" + ex); + } + } + + public void UpdateCrystalCount() + { + MyCrystalNumLabel.text = PlayerStaticData.UserCrystalCount.ToString(); + } + + public void FundSettlementButtonClickCallBack() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.FUND_SETTLEMENT); + } + + public void LegalButtonClickCallBack() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.LEGALTEXT); + } + + public void OneButtonClickCallBack() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Kor.ToString()) + { + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.KOREA_CRYSTAL_PAGE); + } + } + + public bool IsChildCheckDialog() + { + if (BirthDayUpdateServerTime != 0) + { + int year = int.Parse(PlayerStaticData.UserBirthDay.Substring(0, 4)); + int month = int.Parse(PlayerStaticData.UserBirthDay.Substring(4, 2)); + DateTime dateTime = new DateTime(year, month, 1); + DateTime dateTime2 = UnixTimeToDateTime(BirthDayUpdateServerTime + (int)(Time.realtimeSinceStartup - BirthDayUpdateRealTime)); + DateTime dateTime3 = new DateTime(1, 1, 1); + TimeSpan timeSpan = dateTime2 - dateTime; + int num = (dateTime3 + timeSpan).Year - 1; + int num2 = (dateTime3 + timeSpan).Month - 1; + if (num < 18 || (num == 18 && num2 == 0)) + { + return true; + } + return false; + } + return false; + } + + protected DateTime UnixTimeToDateTime(int unixTime) + { + return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(unixTime); + } + + private void StartScrollToIndex(int index, float delay) + { + Vector3 localPosition = CrystalScrollView.transform.localPosition; + Vector3 vector = localPosition - _itemObjectList[index].transform.localPosition; + vector.y += 10f; + _lastScrollPosition = localPosition; + _noInputCollider.SetActive(value: true); + iTween.ValueTo(base.gameObject, iTween.Hash("from", localPosition, "to", vector, "delay", delay, "time", 0f, "easetype", iTween.EaseType.easeInOutQuad, "onupdate", "ScrollViewUpdate", "oncomplete", "DeactivateCollider")); + } + + private void ScrollViewUpdate(Vector3 v) + { + CrystalScrollView.MoveRelative(v - _lastScrollPosition); + CrystalScrollView.RestrictWithinBounds(instant: true); + _lastScrollPosition = v; + } + + private void DeactivateCollider() + { + _noInputCollider.SetActive(value: false); + } + + private int GetIndexFromProductId(string id) + { + List idList = PaymentPC.GetInstance().IdList; + if (_notDispItemList != null) + { + for (int i = 0; i < _notDispItemList.Count; i++) + { + idList.Remove(_notDispItemList[i]); + } + } + return idList.FindIndex((string x) => x == id); + } + + private void CheckScrollToItem(float delay) + { + if (CrystalScrollView.isActiveAndEnabled && !string.IsNullOrEmpty(ScrollToProductId)) + { + int indexFromProductId = GetIndexFromProductId(ScrollToProductId); + if (indexFromProductId > 0) + { + StartScrollToIndex(indexFromProductId, delay); + } + ScrollToProductId = null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute.Payment/IPaymentCommonCallback.cs b/SVSim.BattleEngine/Engine/Cute.Payment/IPaymentCommonCallback.cs new file mode 100644 index 0000000..ce17611 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute.Payment/IPaymentCommonCallback.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Cute.Payment; + +public interface IPaymentCommonCallback +{ + void OnInitializeSucceeded(); + + void OnInitializeFailed(int errorCode, string errorMessage); + + void OnPurchaseFailed(string error); + + void OnPurchaseFailed(int errorCode, string message); + + void OnPurchaseCancelled(string productId, string price, string currencyCode); + + void OnGetProductListSucceeded(List productInfo, bool waitUnfinishedTransaction); + + void OnGetProductListFailed(int errorCode, string errorMessage); + + void OnConsumePurchaseSucceeded(); + + void OnConsumePurchaseFailed(int errorCode, string errorMessage); +} diff --git a/SVSim.BattleEngine/Engine/Cute/AchievementManager.cs b/SVSim.BattleEngine/Engine/Cute/AchievementManager.cs new file mode 100644 index 0000000..cf9734d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/AchievementManager.cs @@ -0,0 +1,61 @@ +using System; +using UnityEngine; + +namespace Cute; + +public static class AchievementManager +{ + private static IAchievementCallback mCallback; + + public static void Initialize(IAchievementCallback callback) + { + mCallback = callback; + } + + public static void ShowAchievementsUI() + { + Social.ShowAchievementsUI(); + } + + public static void ReleaseAchievement(string id) + { + Social.ReportProgress(id, 100.0, delegate(bool success) + { + if (mCallback != null) + { + mCallback.OnReleaseAchievement(success); + } + }); + } + + public static void ProceedAchievement(string id, float value) + { + Social.ReportProgress(id, value, delegate(bool success) + { + if (mCallback != null) + { + mCallback.OnProceedAchievement(success); + } + }); + } + + public static void ResetAchievements(Action callback) + { + } + + public static void LoadAchievements() + { + if (mCallback != null) + { + Social.LoadAchievements(mCallback.OnLoadAchievements); + } + } + + public static void LoadAchievementDescriptions() + { + if (mCallback != null) + { + Social.LoadAchievementDescriptions(mCallback.OnLoadAchievementDescriptions); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/AdjustManager.cs b/SVSim.BattleEngine/Engine/Cute/AdjustManager.cs new file mode 100644 index 0000000..e2c4332 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/AdjustManager.cs @@ -0,0 +1,22 @@ +namespace Cute; + +public static class AdjustManager +{ + private const string _viewerIDEventToken = "qxq65x"; + + private const string _tutorialEventToken = "wlojkf"; + + private const string _paymentEventToken = "sgqjsc"; + + public static void ViewerIDEvent() + { + } + + public static void TutorialCompleteEvent() + { + } + + public static void PaymentEvent(double price, string currencycode, string transactionId, string itemTitle, string productId) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/BootApp.cs b/SVSim.BattleEngine/Engine/Cute/BootApp.cs new file mode 100644 index 0000000..be8f444 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/BootApp.cs @@ -0,0 +1,75 @@ +using System.Collections; +using System.Globalization; +using System.Threading; +using UnityEngine; +using Wizard; + +namespace Cute; + +public class BootApp : MonoBehaviour +{ + public static string BootScene; + + private Coroutine _logCoroutine; + + private string _logMsg = ""; + + private IEnumerator Start() + { + _logCoroutine = StartCoroutine(WaitToAccumulateTraceLog()); + _logMsg += "start"; + createMutex(); + restrainOSXProcess(); + startSteamClient(); + while (Toolbox.BootSystem == null) + { + yield return 0; + } + _logMsg += "start2"; + CultureInfo.DefaultThreadCurrentUICulture = (CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("ja-JP", useUserOverride: false)); + Toolbox.AssetManager.createSavePath(); + yield return StartCoroutine(FontChanger.FontTryChangePersistant(null)); + _logMsg += "start3"; + _logMsg += "start4"; + StopCoroutine(_logCoroutine); + changeScene(); + } + + private IEnumerator WaitToAccumulateTraceLog() + { + yield return new WaitForSeconds(5f); + LocalLog.AccumulateTraceInquiryLog("BootApp " + _logMsg); + } + + private void createMutex() + { + Toolbox.mute = new Mutex(initiallyOwned: false, "Global\\ShadowversePcPlatformGlobalThread"); + if (Toolbox.mute != null && !Toolbox.mute.WaitOne(0, exitContext: false)) + { + Toolbox.mute.Close(); + Toolbox.mute = null; + Application.Quit(); + } + } + + private void startSteamClient() + { + _ = SteamManager.Initialized; + } + + private void restrainOSXProcess() + { + } + + private void changeScene() + { + if (BootScene != null) + { + Toolbox.SceneManager.ChangeScene(BootScene); + } + else + { + Toolbox.SceneManager.ChangeScene(SceneType._Splash); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/DataMigration.cs b/SVSim.BattleEngine/Engine/Cute/DataMigration.cs new file mode 100644 index 0000000..b3e93ef --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/DataMigration.cs @@ -0,0 +1,74 @@ +using Wizard; + +namespace Cute; + +public class DataMigration +{ + public enum status + { + NONE, + OVER, + FAIL + } + + private static bool inProgress; + + public static bool canCombine() + { + if (Certification.ViewerId != 0) + { + return true; + } + return false; + } + + public static void CombineStart(string url) + { + BrowserURL.Open(url); + inProgress = true; + } + + public static bool isCombineSucceed() + { + if (Toolbox.SavedataManager.GetInt("COMBINED") != 1) + { + return false; + } + return true; + } + + public static bool isProgressing() + { + return inProgress; + } + + public static void ProgressOver() + { + inProgress = false; + URLScheme.Clear(); + } + + public static void CombineSucceed() + { + Toolbox.SavedataManager.SetInt("COMBINED", 1); + } + + public static void CombineFailed() + { + } + + public static void MigrationStart(string url) + { + BrowserURL.Open(url); + inProgress = true; + } + + public static void MigrationSucceed() + { + CombineSucceed(); + } + + public static void MigrationFailed() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/LeanThreadPool.cs b/SVSim.BattleEngine/Engine/Cute/LeanThreadPool.cs new file mode 100644 index 0000000..ec5cb98 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/LeanThreadPool.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using UnityEngine; + +namespace Cute; + +public class LeanThreadPool +{ + private static LeanThreadPool _instance; + + private Thread[] _threads; + + private Semaphore _semaphore; + + private object _jobsLock; + + private object _convergeLock; + + private List _jobs; + + private bool _quit; + + private int _convergeCount; + + public static LeanThreadPool Instance + { + get + { + if (_instance == null) + { + _instance = new LeanThreadPool(); + } + return _instance; + } + } + + public int ThreadsCount => _threads.Length; + + private LeanThreadPool() + { + int processorCount = SystemInfo.processorCount; + _jobs = new List(); + _jobsLock = new object(); + _convergeLock = new object(); + _semaphore = new Semaphore(0, int.MaxValue); + _threads = new Thread[processorCount]; + for (int i = 0; i < _threads.Length; i++) + { + _threads[i] = new Thread(ThreadFunction); + _threads[i].Start(); + } + } + + private void ThreadFunction() + { + ParallelJob parallelJob = null; + while (!_quit) + { + _semaphore.WaitOne(); + lock (_jobsLock) + { + if (_jobs.Count > 0) + { + parallelJob = _jobs[0]; + _jobs.Remove(parallelJob); + } + } + if (parallelJob != null) + { + parallelJob.Run(); + parallelJob = null; + } + } + lock (_convergeLock) + { + _convergeCount++; + } + } + + public IEnumerator KillAll(Action callback = null) + { + _quit = true; + _convergeCount = 0; + lock (_jobsLock) + { + _jobs.Clear(); + } + _semaphore.Release(_threads.Length); + while (_convergeCount < _threads.Length) + { + yield return 0; + } + callback.Call(); + } + + public void AddJob(ParallelJob job) + { + lock (_jobsLock) + { + _jobs.Add(job); + } + _semaphore.Release(); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/PCPlatform.cs b/SVSim.BattleEngine/Engine/Cute/PCPlatform.cs new file mode 100644 index 0000000..9809268 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/PCPlatform.cs @@ -0,0 +1,10 @@ +using LitJson; + +namespace Cute; + +public abstract class PCPlatform +{ + public abstract void Parse(JsonData response); + + public abstract PaymentPCStartParams SetParameter(string productId, bool isAlertAgree, bool isAlertActive); +} diff --git a/SVSim.BattleEngine/Engine/Cute/PCPlatformSTEAM.cs b/SVSim.BattleEngine/Engine/Cute/PCPlatformSTEAM.cs new file mode 100644 index 0000000..23363da --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/PCPlatformSTEAM.cs @@ -0,0 +1,34 @@ +using LitJson; + +namespace Cute; + +public class PCPlatformSTEAM : PCPlatform +{ + protected PaymentPCStartParamsSTEAM _postParams = new PaymentPCStartParamsSTEAM(); + + public static string State { get; private set; } + + public static string Country { get; private set; } + + public static string Currency { get; private set; } + + public static string Status { get; private set; } + + public override PaymentPCStartParams SetParameter(string productId, bool isAlertAgree, bool isAlertActive) + { + _postParams.product_id = productId; + _postParams.price = PaymentPC.GetInstance().ProductPriceList[productId]; + _postParams.ip_address = Toolbox.DeviceManager.GetIpAddress(); + _postParams.isalertagree = (isAlertAgree ? 1 : 0); + _postParams.isalertactive = (isAlertActive ? 1 : 0); + return _postParams; + } + + public override void Parse(JsonData response) + { + State = response["steam_user_info"]["state"].ToString(); + Country = response["steam_user_info"]["country"].ToString(); + Currency = response["steam_user_info"]["currency"].ToString(); + Status = response["steam_user_info"]["status"].ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/PaymentPCStartParams.cs b/SVSim.BattleEngine/Engine/Cute/PaymentPCStartParams.cs new file mode 100644 index 0000000..7eee27f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/PaymentPCStartParams.cs @@ -0,0 +1,12 @@ +namespace Cute; + +public class PaymentPCStartParams : PostParams +{ + public string product_id = ""; + + public string price = ""; + + public int isalertagree; + + public int isalertactive; +} diff --git a/SVSim.BattleEngine/Engine/Cute/PaymentPCStartParamsSTEAM.cs b/SVSim.BattleEngine/Engine/Cute/PaymentPCStartParamsSTEAM.cs new file mode 100644 index 0000000..d8792de --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/PaymentPCStartParamsSTEAM.cs @@ -0,0 +1,6 @@ +namespace Cute; + +public class PaymentPCStartParamsSTEAM : PaymentPCStartParams +{ + public string ip_address = ""; +} diff --git a/SVSim.BattleEngine/Engine/Cute/PaymentPCStartTask.cs b/SVSim.BattleEngine/Engine/Cute/PaymentPCStartTask.cs new file mode 100644 index 0000000..921443e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/PaymentPCStartTask.cs @@ -0,0 +1,42 @@ +namespace Cute; + +public class PaymentPCStartTask : NetworkTask +{ + protected PCPlatform _platform; + + protected CuteNetworkDefine.ApiType _apiType = CuteNetworkDefine.ApiType.PaymentPCStart; + + public PaymentBase.RefundWarningType NeedRefundWarningType { get; private set; } + + public override string Url => $"{CustomPreference.GetApplicationServerURL()}{CuteNetworkDefine.ApiUrlList[_apiType]}"; + + public PaymentPCStartTask() + { + _platform = new PCPlatformSTEAM(); + } + + public void SetParameter(string ProductId, bool isAlertAgree, bool isAlertActive) + { + base.Params = _platform.SetParameter(ProductId, isAlertAgree, isAlertActive); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + if (base.ResponseData["data"].Count > 0) + { + _platform.Parse(base.ResponseData["data"]); + NeedRefundWarningType = (PaymentBase.RefundWarningType)base.ResponseData["data"]["refund_penalty_type"].ToInt(); + } + return num; + } + + public PCPlatform getPCPlatform() + { + return _platform; + } +} diff --git a/SVSim.BattleEngine/Engine/Cute/SocialServiceUtility.cs b/SVSim.BattleEngine/Engine/Cute/SocialServiceUtility.cs new file mode 100644 index 0000000..db27649 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Cute/SocialServiceUtility.cs @@ -0,0 +1,210 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Facebook.Unity; +using UnityEngine; + +namespace Cute; + +public class SocialServiceUtility : MonoBehaviour +{ + private bool isLogin_; + + private bool isCountTime; + + private float timer; + + public bool IsRunning { get; protected set; } + + public bool IsLoggedIn + { + get + { + return isLogin_; + } + protected set + { + isLogin_ = value; + } + } + + public string SocialServiceUserId { get; private set; } + + public string FirebaseIdToken { get; private set; } + + public string FaceBookAccountId { get; private set; } + + public string FaceBookAuthenticationToken { get; private set; } + + public bool FaceBookIsLoggedIn => FB.IsLoggedIn; + + public static SocialServiceUtility Instance { get; private set; } + + public static SocialServiceUtility CreateInstance() + { + if (null == Instance) + { + Instance = new GameObject(typeof(SocialServiceUtility).Name).AddComponent(); + UnityEngine.Object.DontDestroyOnLoad(Instance); + } + return Instance; + } + + private void Update() + { + if (isCountTime) + { + checkTimeOut(); + } + } + + private void Awake() + { + } + + private void AndroidInit() + { + } + + private void FbInit() + { + } + + public void FbSignIn(string nonce, Action onetimeCallback) + { + if (IsRunning) + { + return; + } + if (FaceBookIsLoggedIn && FaceBookAccountId != null) + { + if (onetimeCallback != null) + { + onetimeCallback(FaceBookIsLoggedIn); + } + return; + } + IsRunning = true; + INetworkUI networkUI = Toolbox.NetworkManager.NetworkUI; + networkUI.StartLoading(); + FB.LogInWithReadPermissions(new List { "public_profile" }, delegate(ILoginResult result) + { + IsRunning = false; + networkUI.StopLoading(); + if (result == null) + { + onetimeCallback(obj: false); + } + else if (!string.IsNullOrEmpty(result.Error)) + { + onetimeCallback(obj: false); + } + else if (result.Cancelled) + { + onetimeCallback(obj: false); + } + else if (!string.IsNullOrEmpty(result.RawResult)) + { + FaceBookAccountId = AccessToken.CurrentAccessToken.TokenString; + FaceBookAuthenticationToken = ""; + onetimeCallback(obj: true); + } + }); + } + + public IEnumerator SignIn(Action onetimeCallback) + { + if (IsRunning) + { + yield break; + } + if (IsLoggedIn && SocialServiceUserId != null) + { + onetimeCallback?.Invoke(IsLoggedIn); + yield break; + } + IsRunning = true; + INetworkUI networkUI = Toolbox.NetworkManager.NetworkUI; + networkUI.StartLoading(); + StartTimeCount(); + UnitySocialPlatformSingIn(networkUI); + while (IsRunning) + { + yield return null; + } + onetimeCallback(IsLoggedIn); + } + + public void UnitySocialPlatformSingIn(INetworkUI networkUI) + { + Social.localUser.Authenticate(delegate(bool result) + { + if (IsRunning && !result) + { + IsLoggedIn = false; + IsRunning = false; + StopTimeCount(); + networkUI.StopLoading(); + } + }); + } + + private void getFirebaseIdToken(INetworkUI networkUI) + { + } + + public void FbSignOut() + { + if (FaceBookIsLoggedIn) + { + FB.LogOut(); + FaceBookAccountId = null; + } + } + + public void SignOut(Action onetimeCallback = null) + { + if (IsLoggedIn && !IsRunning) + { + IsRunning = true; + IsRunning = false; + IsLoggedIn = false; + onetimeCallback?.Invoke(); + } + } + + public static string GetSocialServiceName() + { + return ""; + } + + public static int GetSocialServiceType() + { + return 0; + } + + public void StartTimeCount() + { + isCountTime = true; + } + + public void StopTimeCount() + { + isCountTime = false; + timer = 0f; + } + + private void checkTimeOut() + { + timer += Time.deltaTime; + if (timer >= 30f) + { + timer = 0f; + INetworkUI networkUI = Toolbox.NetworkManager.NetworkUI; + networkUI.StopLoading(); + StopTimeCount(); + networkUI.OpenSocialServiceNoResponseErrorPopup(); + IsRunning = false; + } + } +} diff --git a/SVSim.BattleEngine/Engine/DeckCreateMenuUI.cs b/SVSim.BattleEngine/Engine/DeckCreateMenuUI.cs new file mode 100644 index 0000000..303cbba --- /dev/null +++ b/SVSim.BattleEngine/Engine/DeckCreateMenuUI.cs @@ -0,0 +1,638 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.DeckCardEdit; +using Wizard.Dialog.Setting; + +public class DeckCreateMenuUI : MonoBehaviour +{ + private enum DeckCopyCodeType + { + QRCode, + DeckCode + } + + public const int DECK_CODE_LENGTH_MIN = 4; + + [SerializeField] + private UIButton m_btnCreateNew; + + [SerializeField] + private UIButton m_btnCopy; + + [SerializeField] + private UIButton m_btnDeckCode; + + [SerializeField] + private UIButton m_btnAutoDeck; + + [SerializeField] + private UIButton _btnCamera; + + [SerializeField] + private UIButton _btnLibrary; + + [SerializeField] + private DeckCopyDialog _deckCopyDialogPrefab; + + [SerializeField] + private DeckCopyDialog _useSubClassDeckCopyDialogPrefab; + + [SerializeField] + private SubClassSelectDialog _subClassSelectDialogPrefab; + + [SerializeField] + private ItemToggle _foilPreferred; + + [SerializeField] + private ItemToggle _isPrizePreferred; + + [SerializeField] + private UISprite _centerSeparatorLine; + + private DialogBase _parentDialog; + + private Format _format; + + private ConventionDeckList _conventionDeckList; + + private IFormatBehavior _formatBehavior; + + private Action _onStartChangeViewScene; + + private const float CENTER_SEPARATOR_LINE_OFFSET = -70f; + + private static readonly Version ENABLE_USE_CAMERA_LIBRARY_IOS_VERSION = new Version("11.0"); + + public static void ShowDeckCreateMenu(DeckData deck, ConventionDeckList conventionDeckList, Action onStartChangeViewScene = null) + { + Format format = deck.Format; + DeckCardEditUI.SetDeckEditParameter(deck, conventionDeckList); + DeckCreateMenuUI menu = UnityEngine.Object.Instantiate(UIManager.GetInstance()._deckCreateMenuOriginal); + UnityEngine.Object.Destroy(menu._btnCamera.gameObject); + menu._btnLibrary.gameObject.transform.SetSiblingIndex(0); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0108")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetPanelDepth(10); + if (conventionDeckList == null) + { + menu._foilPreferred.gameObject.SetActive(value: true); + menu._foilPreferred.SetTitleLabel("プレミアムカード優先"); + menu._foilPreferred.SetValue(Data.Load.data._userConfig.IsFoilPreferred); + menu._foilPreferred.SetActive_SeparatorLine(isActive: true); + menu._foilPreferred.AddChangeCallback(delegate + { + DeckCardEditUI.SendConfigUpdateFoilPreferred(menu._foilPreferred.GetValue()); + }); + menu._isPrizePreferred.gameObject.SetActive(value: true); + menu._isPrizePreferred.SetTitleLabel("絵違いカード優先"); + menu._isPrizePreferred.SetValue(Data.Load.data._userConfig.IsPrizePreferred); + menu._isPrizePreferred.SetActive_SeparatorLine(isActive: true); + menu._isPrizePreferred.AddChangeCallback(delegate + { + DeckCardEditUI.SendConfigUpdatePrizePreferred(menu._isPrizePreferred.GetValue()); + }); + } + dialogBase.SetObj(menu.gameObject); + if (conventionDeckList != null) + { + Vector3 localPosition = menu.transform.localPosition; + localPosition.y = -70f; + menu.transform.localPosition = localPosition; + menu._centerSeparatorLine.gameObject.SetActive(value: false); + } + DeckCreateMenuUI component = menu.GetComponent(); + component.SetParentDialog(dialogBase); + component._format = format; + component._conventionDeckList = conventionDeckList; + component._formatBehavior = FormatBehaviorManager.Create(format, conventionDeckList); + component._onStartChangeViewScene = onStartChangeViewScene; + } + + private void OnSelectFinally() + { + DeckCardEditUI.CurrentDeckName = null; + if (_parentDialog != null) + { + _parentDialog.CloseWithoutSelect(); + _parentDialog = null; + } + } + + private void Start() + { + UIEventListener.Get(m_btnCreateNew.gameObject).onClick = OnClickCreateNew; + UIEventListener.Get(m_btnCopy.gameObject).onClick = OnClickCopy; + UIEventListener.Get(m_btnDeckCode.gameObject).onClick = OnClickDeckCode; + UIEventListener.Get(m_btnAutoDeck.gameObject).onClick = OnClickAutoDeck; + UIEventListener.Get(_btnCamera.gameObject).onClick = OnClickFromCamera; + UIEventListener.Get(_btnLibrary.gameObject).onClick = OnClickFromLibrary; + } + + private void SetParentDialog(DialogBase dialog) + { + _parentDialog = dialog; + } + + private void OnClickCreateNew(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList()); + ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam); + OnSelectFinally(); + } + + private void OnClickCopy(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + Format format = _format; + if (format == Format.Crossover) + { + format = Format.All; + } + DeckInfoTask task = new DeckInfoTask(); + task.SetParameterForCopySrcGet(Format.All, format); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DeckGroupListData deckGroupListData = task.DeckGroupListData; + if (!_formatBehavior.UseSubClass) + { + deckGroupListData.RemoveUseSubClassDeckList(); + } + if (_format != Format.MyRotation) + { + deckGroupListData.RemoveFormat(Format.MyRotation); + } + deckGroupListData.ForceVisiblePreRotation(Prerelease.Status != Prerelease.eStatus.NONE); + Format value = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT); + DeckSelectUIDialog.Create(Data.SystemText.Get("Card_0109"), deckGroupListData, value, DeckSelectUIDialog.eFormatChangeUIType.UseOtherCategory, isVisibleCreateNew: false, returnDeckSelect, new DeckSelectUI.InitOptions + { + OnUpdateDeckUICustomize = OnUpdateDeckUIForConvention + }).SetPanelDepth(12); + _parentDialog.Close(); + })); + } + + private void OnUpdateDeckUIForConvention(DeckUI deckUI) + { + if (_conventionDeckList == null) + { + return; + } + if (!deckUI.Deck.IsUsable(canUseNonPossessionCard: true)) + { + deckUI.SetSelectable(isSelectable: false); + return; + } + bool flag = _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckClassID()); + if (_formatBehavior.UseSubClass && _conventionDeckList.GetConventionDeckClassList().Contains(deckUI.Deck.GetDeckSubClassID())) + { + flag = true; + } + if (flag) + { + deckUI.SetTextCenterLabe(Data.SystemText.Get("RoomBattle_0085")); + deckUI.SetSelectable(isSelectable: false); + } + } + + private void OnClickDeckCode(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + DialogBase nameEditDialog = InputDialog.Create(16, 16, UIInput.KeyboardType.EmailAddress); + nameEditDialog.InputAreaObjs.labels[2].text = Data.SystemText.Get("Card_0110"); + nameEditDialog.InputAreaObjs.labels[3].text = ""; + nameEditDialog.SetTitleLabel(Data.SystemText.Get("Card_0111")); + if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.QuestSelectionPage)) + { + AllLabelColorChanger.ChangeAllLabel(nameEditDialog.InputAreaObjs.gameObject); + } + Action method_btn = delegate + { + string text = nameEditDialog.InputAreaObjs.labels[0].text; + GetDeckDataFromCodeTask getDeckDataFromCodeTask = new GetDeckDataFromCodeTask(); + getDeckDataFromCodeTask.SetParameter(text); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(getDeckDataFromCodeTask, OnSuccessDeckCodeInfo, OnFailedDeckCodeInfo, OnFailedDeckCodeInfo, encrypt: false)); + }; + nameEditDialog.SetButtonDelegate(method_btn); + nameEditDialog.SetPanelDepth(2000); + nameEditDialog.SetButtonDisable(isEnableOK: true); + UIInput deckCodeInput = nameEditDialog.GetComponentInChildren(); + if (deckCodeInput != null) + { + deckCodeInput.onChange.Add(new EventDelegate(delegate + { + nameEditDialog.SetButtonDisable(deckCodeInput.value.Length < 4); + })); + } + _parentDialog.Close(); + } + + private void OnClickAutoDeck(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.AUTO_DECK_CREATE)) + { + ButtonMaintenance(); + return; + } + bool canUseNonPossessionCard = _conventionDeckList == null; + DeckCardEditUI.SetCreateAutoParameter(_format, canUseNonPossessionCard); + ClassSelectionPageParam sceneParam = ClassSelectionPageParam.CreateDeckEdit(_format, (_conventionDeckList != null) ? _conventionDeckList.Conventioninfo : null, GetConventionUsedClassIdList()); + ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, sceneParam); + OnSelectFinally(); + } + + private void OnClickFromCamera(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE)) + { + ButtonMaintenance(); + return; + } + GameObject qrCameraObject = UnityEngine.Object.Instantiate(Resources.Load("Prefab/UI/QrCamera")); + QrCamera qrCamera = qrCameraObject.GetComponent(); + UIButton backButton = qrCamera.backButton; + qrCamera.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo); + UIManager.GetInstance().createInSceneCenterLoading(); + UIManager.GetInstance().StartCoroutine(qrCamera.StartQRCamera(qrCameraObject, _formatBehavior.CardMasterId, delegate + { + _parentDialog.Close(); + UIManager.GetInstance().closeInSceneCenterLoading(); + backButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + qrCamera.StopQRCamera(); + UnityEngine.Object.Destroy(qrCameraObject); + })); + }, delegate + { + qrCamera.StopQRCamera(); + UnityEngine.Object.Destroy(qrCameraObject); + FailedToStartQRCamera(); + UIManager.GetInstance().closeInSceneCenterLoading(); + _parentDialog.Close(); + })); + } + + private void OnClickFromLibrary(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.DECK_QR_CODE)) + { + ButtonMaintenance(); + return; + } + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("Prefab/UI/QrCamera")); + QrCamera component = gameObject.GetComponent(); + component.SetCallBacks(OnSuccessQRCodeDeckInfo, OnFailedQRCodeDeckInfo); + component.StartGetQRCodeFromImageFile(gameObject, _formatBehavior.CardMasterId); + UnityEngine.Object.Destroy(gameObject); + _parentDialog.Close(); + } + + private void FailedToStartQRCamera() + { + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0270")); + dialogBase.SetPanelDepth(2000); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.OnClose = delegate + { + OnSelectFinally(); + }; + } + + private void ButtonMaintenance() + { + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Card_0266")); + dialogBase.SetPanelDepth(2000); + dialogBase.SetSize(DialogBase.Size.M); + } + + private DialogBase CreateDeckCopyDialog(DialogBase dialogDeckList, DeckData deck) + { + bool flag = _formatBehavior.UseSubClass && FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass; + if (_format == Format.MyRotation) + { + if (deck.Format == Format.MyRotation) + { + return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck); + } + return DeckCopyDialog.CreateDeckCopyDialogForMyRotation(_deckCopyDialogPrefab, deck); + } + if (flag) + { + return DeckCopyDialog.CreateDeckCopyDialogUseSubClass(_useSubClassDeckCopyDialogPrefab, deck); + } + return DeckCopyDialog.CreateDeckCopyDialog(_deckCopyDialogPrefab, deck); + } + + private void returnDeckSelect(DialogBase dialogDeckList, DeckData deck) + { + DialogBase dialog = CreateDeckCopyDialog(dialogDeckList, deck); + dialog.onPushButton1 = delegate + { + if (!_formatBehavior.UseSubClass) + { + OnChangeViewSceneFromDeckCopy(dialogDeckList, deck); + } + else if (FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS)) + { + OnChangeViewSceneFromDeckCopy(dialogDeckList, deck); + } + else + { + OnSelectSubClassFromDeckCopy(dialog, dialogDeckList, deck); + } + }; + dialog.SetPanelDepth(100); + } + + private void OnSelectSubClassFromDeckCopy(DialogBase dialog, DialogBase dialogDeckList, DeckData deck) + { + dialog.Close(); + SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId) + { + deck.SetDeckSubClassID(classId); + OnChangeViewSceneFromDeckCopy(dialogDeckList, deck); + }); + } + + private void OnChangeViewSceneFromDeckCopy(DialogBase dialogDeckList, DeckData deck) + { + bool isCopySubClass = FormatBehaviorManager.Create(deck.Format, _conventionDeckList).UseSubClass && PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.IS_COPY_SUBCLASS_CARDS); + MyRotationInfo myRotationInfo = null; + if (_format == Format.MyRotation) + { + myRotationInfo = ((deck.Format != Format.MyRotation) ? deck.GetMyRotationInfoFromCardList() : Data.MyRotationAllInfo.Get(deck.MyRotationId)); + } + DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: false, isCopySubClass, _conventionDeckList, myRotationInfo); + dialogDeckList.CloseWithoutSelect(); + ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null); + OnSelectFinally(); + } + + private void OnSuccessDeckCodeInfo(NetworkTask.ResultCode errorcode) + { + OnSuccessCodeDeckInfo(DeckCopyCodeType.DeckCode); + } + + private void OnSuccessQRCodeDeckInfo() + { + OnSuccessCodeDeckInfo(DeckCopyCodeType.QRCode); + } + + private void OnSuccessCodeDeckInfo(DeckCopyCodeType copyCodeType) + { + bool flag = false; + SetCodeCopyDeckParam(copyCodeType, out var clanId, out var subClanId, out var isSubClassSet, out var cardIds, out var myRotationInfo); + if (_conventionDeckList != null) + { + List conventionDeckClassList = _conventionDeckList.GetConventionDeckClassList(); + for (int i = 0; i < conventionDeckClassList.Count; i++) + { + if (conventionDeckClassList[i] == clanId) + { + flag = true; + break; + } + } + if (_formatBehavior.UseSubClass) + { + for (int j = 0; j < conventionDeckClassList.Count; j++) + { + if (conventionDeckClassList[j] == subClanId) + { + flag = true; + break; + } + } + } + } + if (isDeckcodeIncludingNonExistentCard(cardIds)) + { + string title = Data.SystemText.Get("Card_0196"); + string text = Data.SystemText.Get("Card_0197"); + CreateErrorDialog(title, text).OnClose = delegate + { + OnSelectFinally(); + }; + } + else if (flag) + { + string title2 = Data.SystemText.Get("ErrorHeader_10002"); + string text2 = Data.SystemText.Get("Arena_0067"); + if (_formatBehavior.UseSubClass) + { + text2 = Data.SystemText.Get("Arena_0141"); + } + CreateErrorDialog(title2, text2).OnClose = delegate + { + OnSelectFinally(); + }; + } + else if (!_formatBehavior.UseSubClass && isSubClassSet) + { + string title3 = Data.SystemText.Get("Card_0196"); + string text3 = ""; + switch (copyCodeType) + { + case DeckCopyCodeType.QRCode: + text3 = Data.SystemText.Get("Card_0285"); + break; + case DeckCopyCodeType.DeckCode: + text3 = Data.SystemText.Get("Card_0295"); + break; + } + CreateErrorDialog(title3, text3).OnClose = delegate + { + OnSelectFinally(); + }; + } + else if (myRotationInfo != null && _format != Format.MyRotation) + { + string title4 = Data.SystemText.Get("Card_0196"); + string text4 = ""; + switch (copyCodeType) + { + case DeckCopyCodeType.QRCode: + text4 = Data.SystemText.Get("MyRotation_ID_17"); + break; + case DeckCopyCodeType.DeckCode: + text4 = Data.SystemText.Get("MyRotation_ID_18"); + break; + } + CreateErrorDialog(title4, text4).OnClose = delegate + { + OnSelectFinally(); + }; + } + else + { + DeckData deck = CreateDeckFromCopyCode(clanId, subClanId, isSubClassSet, cardIds, myRotationInfo); + if (_formatBehavior.UseSubClass && !isSubClassSet) + { + OnCreateDeckFromCodeSelectSubClass(deck); + } + else + { + OnCreateDeckFromCode(deck); + } + } + } + + private void SetCodeCopyDeckParam(DeckCopyCodeType deckCopyCodeTypeout, out int clanId, out int subClanId, out bool isSubClassSet, out int[] cardIds, out MyRotationInfo myRotationInfo) + { + clanId = 10; + subClanId = 10; + isSubClassSet = false; + cardIds = null; + myRotationInfo = null; + switch (deckCopyCodeTypeout) + { + case DeckCopyCodeType.QRCode: + clanId = (int)QRCodeUtility.deckDataFromQRCode.ClanId; + subClanId = (int)QRCodeUtility.deckDataFromQRCode.SubClanId; + isSubClassSet = QRCodeUtility.deckDataFromQRCode.IsSubClassSet; + cardIds = QRCodeUtility.deckDataFromQRCode.CardIds; + myRotationInfo = QRCodeUtility.deckDataFromQRCode.MyRotationInfo; + break; + case DeckCopyCodeType.DeckCode: + clanId = Data.DeckDataFromDeckCode.ClanId; + subClanId = Data.DeckDataFromDeckCode.SubClanId; + isSubClassSet = Data.DeckDataFromDeckCode.IsSubClanSet; + cardIds = Data.DeckDataFromDeckCode.CardIds; + if (Data.DeckDataFromDeckCode.MyRotationId != null) + { + myRotationInfo = Data.MyRotationAllInfo.Get(Data.DeckDataFromDeckCode.MyRotationId); + } + break; + } + } + + private DeckData CreateDeckFromCopyCode(int clanId, int subClanId, bool isSubClassSet, int[] cardIds, MyRotationInfo myRotationInfo) + { + DeckData deckData = new DeckData(_format); + deckData.SetDeckClassID(clanId); + if (isSubClassSet) + { + deckData.SetDeckSubClassID(subClanId); + } + deckData.SetDeckName(""); + deckData.SetDeckSleeveID(3000011L); + deckData.SetDeckIsComplete(isComplete: true); + deckData.SetCardIdList(cardIds.ToList()); + if (myRotationInfo != null) + { + deckData.MyRotationId = myRotationInfo.Id; + } + return deckData; + } + + private DialogBase CreateErrorDialog(string title, string text) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(2000); + dialogBase.SetTitleLabel(title); + dialogBase.SetText(text); + dialogBase.SetSize(DialogBase.Size.M); + return dialogBase; + } + + private void OnFailedQRCodeDeckInfo(string message) + { + DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(message); + dialogBase.SetPanelDepth(2000); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.OnClose = delegate + { + OnSelectFinally(); + }; + } + + private void OnCreateDeckFromCode(DeckData deck) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(2000); + dialogBase.SetTitleLabel(Data.SystemText.Get("Card_0142")); + dialogBase.SetText(Data.SystemText.Get("Card_0115")); + if (_format == Format.MyRotation && Data.MyRotationAllInfo.Get(deck.MyRotationId) == null) + { + MyRotationInfo myRotationInfoFromCardList = deck.GetMyRotationInfoFromCardList(); + deck.MyRotationId = myRotationInfoFromCardList.Id; + } + dialogBase.OnCloseStart = delegate + { + DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: true, _conventionDeckList); + ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null); + OnSelectFinally(); + }; + } + + private void OnCreateDeckFromCodeSelectSubClass(DeckData deck) + { + SubClassSelectDialog.Create(deck, _subClassSelectDialogPrefab, GetConventionUsedClassIdList(), delegate(int classId) + { + deck.SetDeckSubClassID(classId); + DeckCardEditUI.SetDeckCopyParameter(deck, isCreatedByBuilder: true, isCopySubClass: false, _conventionDeckList); + ChangeViewScene(UIManager.ViewScene.DeckCardEdit, null); + OnSelectFinally(); + }); + } + + private bool isDeckcodeIncludingNonExistentCard(int[] targetDeckCardIds) + { + List allCardIds = CardMaster.GetInstance(_formatBehavior.CardMasterId).GetAllCardIds(); + int num = targetDeckCardIds.Length; + for (int i = 0; i < num; i++) + { + int item = targetDeckCardIds[i]; + if (!allCardIds.Contains(item)) + { + return true; + } + } + return false; + } + + private void OnFailedDeckCodeInfo(NetworkTask.ResultCode errorcode) + { + OnSelectFinally(); + } + + private void OnFailedDeckCodeInfo(int errorcode) + { + OnSelectFinally(); + } + + private List GetConventionUsedClassIdList() + { + List result = new List(); + if (_conventionDeckList == null) + { + return result; + } + return _conventionDeckList.GetConventionDeckClassList(); + } + + private void ChangeViewScene(UIManager.ViewScene viewScene, object sceneParam) + { + _onStartChangeViewScene.Call(); + if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Battle)) + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(viewScene, null, null, sceneParam); + } + else + { + UIManager.GetInstance().ChangeViewScene(viewScene, null, sceneParam); + } + } +} diff --git a/SVSim.BattleEngine/Engine/DeckFrame.cs b/SVSim.BattleEngine/Engine/DeckFrame.cs new file mode 100644 index 0000000..2fdcaff --- /dev/null +++ b/SVSim.BattleEngine/Engine/DeckFrame.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +public class DeckFrame +{ + public int DeckId { get; set; } + + public Transform Transform { get; set; } + + public Vector3 TweenTargetPosition { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/DeckIntroduction.cs b/SVSim.BattleEngine/Engine/DeckIntroduction.cs new file mode 100644 index 0000000..865831a --- /dev/null +++ b/SVSim.BattleEngine/Engine/DeckIntroduction.cs @@ -0,0 +1,552 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.UI.Common; +using Wizard.UI.Profile; + +public class DeckIntroduction : MonoBehaviour +{ + private const int MAX_WIDTH_ANNOTATION_LABEL = 210; + + private const Format DEFAULT_FORMAT = Format.Rotation; + + private static readonly Vector2 FORMAT_CHANGE_UI_POSITION = new Vector2(-466f, 246f); + + private static readonly Dictionary FORMAT_TO_FORMAT_CATEGORY = new Dictionary + { + { + Format.Rotation, + FormatChangeUI.FormatCategory.Rotation + }, + { + Format.Unlimited, + FormatChangeUI.FormatCategory.Unlimited + }, + { + Format.Crossover, + FormatChangeUI.FormatCategory.Crossover + } + }; + + [SerializeField] + private TabList _tabList; + + [SerializeField] + private UISprite _classIcon; + + [SerializeField] + private UITexture _classCharaTexture; + + [SerializeField] + private UILabel _className; + + [SerializeField] + private UITexture _classBG; + + private Format _formatState; + + [SerializeField] + private UILabel _labelAnnotation; + + private UIAtlas _classIconAtlas; + + private List _resourceList = new List(); + + private List _loadTopCardAssetList = new List(); + + private List _loadCardAssetList; + + private List _deckIntroductionItem = new List(); + + [SerializeField] + private GameObject _dialogAttachRoot; + + [SerializeField] + private GameObject _deckViewPrefab; + + [SerializeField] + private GameObject _cardDetailPrefab; + + [SerializeField] + private GameObject _introductionItemPrefab; + + [SerializeField] + private UIGrid _deckListGrid; + + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private GameObject _confirmLabelForRotation; + + private DialogBase _dialog; + + private DeckIntroductionTask _introductionTask; + + private GameObject _deckViewObj; + + private UICardList _cardList; + + private GameObject _cardDetailObj; + + private CardDetailUI _cardDetail; + + private CardBasePrm.ClanType _classType = CardBasePrm.ClanType.NONE; + + private bool _isUpdateDeckList = true; + + private FormatChangeUI _formatChangeUI; + + private Vector3 _anotationLabelDefaultPosition; + + private int _seriesId; + + public const int LATEST_SERIES_ID = -1; + + public static void Create(GameObject prefab, GameObject parent, int seriesId = -1, Format format = Format.Max) + { + GameObject obj = NGUITools.AddChild(parent, prefab); + DeckIntroduction component = obj.GetComponent(); + component.SetSeriesId(seriesId); + component._formatState = format; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.AddButton(DialogBase.ButtonType.Gray, isReflect: false, Data.SystemText.Get("OtherTop_0065")); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE; + dialogBase.isNotCloseWindowButton1 = true; + dialogBase.onPushButton1 = component.CreateSelectSeriesIdDialog; + dialogBase.AddButton(DialogBase.ButtonType.Close); + dialogBase.TitleOnOff(flag: false); + dialogBase.CloseOnOff(flag: false); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + UnityEngine.Object.Destroy(obj); + }); + dialogBase.SetObj(component._dialogAttachRoot); + component._dialog = dialogBase; + dialogBase.gameObject.SetActive(value: false); + } + + private void SetSeriesId(int seriesId) + { + _seriesId = seriesId; + } + + private IEnumerator Start() + { + _anotationLabelDefaultPosition = _labelAnnotation.transform.localPosition; + yield return LoadAtlas(); + yield return StartCoroutine(StartDeckIntroductionTask()); + SetSeriesId(_introductionTask.DisplaySeriesId); + yield return LoadResource(); + _dialog.gameObject.SetActive(value: true); + if (_formatState == Format.Max) + { + _formatState = _introductionTask.DisplayFormat; + } + InitFormatBtn(_formatState); + InitClassTab(_introductionTask); + } + + private void OnDestroy() + { + ReleaseResource(); + } + + private IEnumerator StartDeckIntroductionTask() + { + _introductionTask = new DeckIntroductionTask(); + if (_seriesId != -1) + { + _introductionTask.SetParameter(_seriesId); + } + bool isSuccess = false; + yield return StartCoroutine(Toolbox.NetworkManager.Connect(_introductionTask, delegate + { + isSuccess = true; + })); + while (!isSuccess) + { + yield return null; + } + } + + private void ReleaseResource() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_resourceList); + _resourceList.Clear(); + RemoveTopCardResource(); + } + + private IEnumerator LoadAtlas() + { + string sceneAssetPath = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null); + _resourceList.Add(sceneAssetPath); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(sceneAssetPath, null)); + sceneAssetPath = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Profile, null, isload: true); + _classIconAtlas = Toolbox.ResourcesManager.LoadObject(sceneAssetPath).GetComponent(); + } + + private static string GetClassBGPath(CardBasePrm.ClanType classType, bool isFetch) + { + int num = (int)classType; + return Toolbox.ResourcesManager.GetAssetTypePath("bg_deck_info_" + num.ToString("00"), ResourcesManager.AssetLoadPathType.Background, isFetch); + } + + private string GetClassCharaPath(CardBasePrm.ClanType classType, bool isFetch) + { + string charaTexName = ClassPage.GetCharaTexName(GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId((int)classType, isCurrentChara: false) + .skin_id); + return Toolbox.ResourcesManager.GetAssetTypePath(charaTexName, ResourcesManager.AssetLoadPathType.ClassCharaProfile, isFetch); + } + + private IEnumerator LoadResource() + { + List loadList = new List(); + int num = 9; + for (int i = 1; i < num; i++) + { + loadList.Add(GetClassCharaPath((CardBasePrm.ClanType)i, isFetch: false)); + loadList.Add(GetClassBGPath((CardBasePrm.ClanType)i, isFetch: false)); + } + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null)); + _resourceList.AddRange(loadList); + } + + private IEnumerator LoadTopCardResource(CardBasePrm.ClanType classType, Action onFinish) + { + UIManager.GetInstance().createInSceneCenterLoading(); + List tempLoadList = new List(_loadTopCardAssetList); + _loadTopCardAssetList.Clear(); + for (int i = 0; i < _introductionTask._result.Count; i++) + { + DeckIntroductionTask.IntroductionData introductionData = _introductionTask._result[i]; + string cardMaterialPath = DeckIntroductionItem.GetCardMaterialPath(introductionData.TopCardId); + if (introductionData.Deck.Format == _formatState && introductionData.Deck.GetDeckClassID() == (int)classType && !_loadTopCardAssetList.Contains(cardMaterialPath)) + { + _loadTopCardAssetList.Add(cardMaterialPath); + } + } + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadTopCardAssetList, null)); + Toolbox.ResourcesManager.RemoveAssetGroup(tempLoadList); + onFinish.Call(classType); + UIManager.GetInstance().closeInSceneCenterLoading(); + } + + private void RemoveTopCardResource() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadTopCardAssetList); + _loadTopCardAssetList.Clear(); + } + + private void InitClassTab(DeckIntroductionTask task) + { + _classIcon.atlas = _classIconAtlas; + int num = 9; + CardBasePrm.ClanType clanType = CardBasePrm.ClanType.NONE; + for (int i = 1; i < num; i++) + { + CardBasePrm.ClanType classType = (CardBasePrm.ClanType)i; + Tab tab = _tabList.AddTab(delegate + { + ChangePage(classType); + }, "class_tab_" + i.ToString("00")); + if (task.IsExistClass(classType, _formatState)) + { + if (clanType == CardBasePrm.ClanType.NONE) + { + clanType = classType; + } + } + else + { + _tabList.SetTabToGrayByIndex(i - 1, disable: true); + } + tab.name = "Class_" + i + "(Clone)"; + } + _tabList.Reset(); + _tabList.SelectTabByIndex((int)(clanType - 1), isForceSet: true); + } + + private bool NeedResurgentConfirmLabel() + { + if ((_seriesId == 34 || _seriesId == 33 || _seriesId == 9) && _formatState == Format.Rotation) + { + return true; + } + return false; + } + + private void ChangePage(CardBasePrm.ClanType classType) + { + if (_classType == classType && !_isUpdateDeckList) + { + return; + } + _classType = classType; + _isUpdateDeckList = false; + ClassCharacterMasterData charaPrmByClassId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId((int)classType, isCurrentChara: false); + _className.text = charaPrmByClassId._className; + ClassCharaPrm.SetClassLabelSetting(_className, classType); + _classCharaTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(GetClassCharaPath(classType, isFetch: true)) as Texture; + _classBG.mainTexture = Toolbox.ResourcesManager.LoadObject(GetClassBGPath(classType, isFetch: true)) as Texture; + _confirmLabelForRotation.SetActive(NeedResurgentConfirmLabel()); + _labelAnnotation.transform.localPosition = _anotationLabelDefaultPosition; + string value; + if (IsNotCopyToUnlimited(classType) && _formatState == Format.Rotation) + { + _labelAnnotation.gameObject.SetActive(value: false); + } + else if (_introductionTask.AlternativeFormatAndSeries != null && _introductionTask.AlternativeFormatAndSeries.TryGetValue(_formatState, out value)) + { + _labelAnnotation.gameObject.SetActive(value: true); + SetAnnotationText(value); + if (NeedResurgentConfirmLabel()) + { + _labelAnnotation.transform.localPosition = new Vector3(_anotationLabelDefaultPosition.x, 209f, _anotationLabelDefaultPosition.z); + } + } + else + { + _labelAnnotation.gameObject.SetActive(value: false); + } + StartCoroutine(LoadTopCardResource(classType, InitDeckList)); + } + + private bool IsNotCopyToUnlimited(CardBasePrm.ClanType classType) + { + for (int i = 0; i < _introductionTask._result.Count; i++) + { + DeckData deck = _introductionTask._result[i].Deck; + if (deck.HasResurgentCard() && deck.IsOutOfRotationFormat && deck.GetDeckClassID() == (int)classType) + { + return true; + } + } + return false; + } + + private void InitDeckList(CardBasePrm.ClanType classType) + { + for (int i = 0; i < _deckIntroductionItem.Count; i++) + { + _deckIntroductionItem[i].gameObject.SetActive(value: false); + } + List list = new List(); + for (int j = 0; j < _introductionTask._result.Count; j++) + { + DeckIntroductionTask.IntroductionData introductionData = _introductionTask._result[j]; + if (introductionData.Deck.GetDeckClassID() == (int)classType && introductionData.Deck.Format == _formatState) + { + list.Add(introductionData); + } + } + for (int k = 0; k < list.Count; k++) + { + DeckIntroductionItem deckIntroductionItem = null; + if (k < _deckIntroductionItem.Count) + { + deckIntroductionItem = _deckIntroductionItem[k]; + deckIntroductionItem.gameObject.SetActive(value: true); + } + else + { + deckIntroductionItem = NGUITools.AddChild(_deckListGrid.gameObject, _introductionItemPrefab).GetComponent(); + _deckIntroductionItem.Add(deckIntroductionItem); + } + deckIntroductionItem.Initialize(list[k]); + deckIntroductionItem.OnClick = delegate(DeckIntroductionTask.IntroductionData data) + { + OnClickDeck(data); + }; + } + _deckListGrid.Reposition(); + _scrollView.ResetPosition(); + } + + private void InitFormatBtn(Format format) + { + _formatState = format; + FormatChangeUI.FormatCategory defaultFormatCategory = FORMAT_TO_FORMAT_CATEGORY[_formatState]; + FormatChangeUI.FormatCategory anotherFormatCategory = (_introductionTask.IsExistFormat(Format.Crossover) ? FORMAT_TO_FORMAT_CATEGORY[Format.Crossover] : FormatChangeUI.FormatCategory.Invalid); + _formatChangeUI = FormatChangeUI.Create(defaultFormatCategory, anotherFormatCategory, OnClickFormatBtn); + _formatChangeUI.ShowOldRotationIcon(); + _dialog.SetObj(_formatChangeUI.gameObject, FORMAT_CHANGE_UI_POSITION); + } + + private void SetAnnotationText(string serieasName) + { + _labelAnnotation.overflowMethod = UILabel.Overflow.ResizeFreely; + _labelAnnotation.text = Data.SystemText.Get("OtherTop_0068", serieasName); + _labelAnnotation.ProcessText(); + if (_labelAnnotation.width > 210) + { + _labelAnnotation.overflowMethod = UILabel.Overflow.ShrinkContent; + _labelAnnotation.width = 210; + } + } + + private void OnClickDeck(DeckIntroductionTask.IntroductionData data) + { + ShowDeckView(data.Deck); + } + + private void ShowDeckView(DeckData deck) + { + string text = "Detail"; + if (_cardDetailObj == null) + { + _cardDetailObj = NGUITools.AddChild(base.gameObject, _cardDetailPrefab); + _cardDetail = _cardDetailObj.GetComponent(); + _cardDetail.Initialize(LayerMask.NameToLayer(text), CardMaster.CardMasterId.Default); + _cardDetailObj.SetActive(value: false); + } + if (_deckViewObj == null) + { + _deckViewObj = UnityEngine.Object.Instantiate(_deckViewPrefab); + _cardList = _deckViewObj.GetComponent(); + _cardList.Init(base.gameObject, _cardDetail, null, OnCloseDeckView, text, in_DetailCameraUse: true, null, 40); + _deckViewObj.SetActive(value: false); + } + _scrollView.DisableSpring(); + UIManager.GetInstance().createInSceneCenterLoading(); + StartCoroutine(CardLoadCoroutine(deck)); + } + + private IEnumerator CardLoadCoroutine(DeckData deck) + { + IList cardIdList = deck.GetCardIdList(); + _cardList.RemoveData(); + _loadCardAssetList = _cardList.GetLoadFileList(cardIdList as List); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadCardAssetList, null)); + _cardList.IsEnableMyRotationDisplay = false; + _cardList.IsConventionDeckIntroduction = true; + _cardList.SetDeck(deck, null); + if (deck.Format == Format.Rotation) + { + _cardList.SetFormatIcon("icon_rotation_s"); + } + _cardList.UpdateShortageRedEther(); + _cardList.SetShortageCardVisible(_cardList.IsEnableShortageCardVisible); + _cardList.SetActiveDeckIntroductionObj(isActive: true); + yield return null; + _dialog.SetDisp(inDisp: false); + _deckViewObj.SetActive(value: true); + UIManager.GetInstance().closeInSceneCenterLoading(); + } + + private void OnCloseDeckView() + { + _dialog.SetDisp(inDisp: true); + _deckViewObj.SetActive(value: false); + _scrollView.UpdatePosition(); + if (_loadCardAssetList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList); + _loadCardAssetList.Clear(); + } + } + + private void CreateSelectSeriesIdDialog() + { + int prevSeriesId = _seriesId; + List seriesIdList = _introductionTask.ResultDeckSeriesIdList; + _ = _introductionTask.ResultDeckSeriesNameList; + seriesIdList.IndexOf(_seriesId); + DialogBase dialogBase = DeckIntroductionPeriodSelectDialog.Create(_seriesId, _introductionTask, delegate(int newId) + { + _seriesId = newId; + }); + int num = _dialogAttachRoot.GetComponentInChildren().depth + 5; + dialogBase.SetPanelDepth(num); + dialogBase.InsideObject.GetComponent().depth = num + 1; + UIPanel[] componentsInChildren = dialogBase.InsideObject.GetComponentsInChildren(); + for (int num2 = 0; num2 < componentsInChildren.Length; num2++) + { + componentsInChildren[num2].depth += num + 2; + } + dialogBase.SetTitleLabel(Data.SystemText.Get("OtherTop_0066")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE; + dialogBase.onPushButton1 = delegate + { + if (_seriesId != prevSeriesId) + { + StartCoroutine(ChangeDeckIntroductionSeries()); + } + }; + dialogBase.onCloseWithoutSelect = delegate + { + _seriesId = prevSeriesId; + }; + } + + private IEnumerator ChangeDeckIntroductionSeries() + { + yield return StartCoroutine(StartDeckIntroductionTask()); + UpdateFormatChangeUI(); + UpdateClassTab(); + } + + private void UpdateClassTab() + { + _isUpdateDeckList = true; + CardBasePrm.ClanType clanType = CardBasePrm.ClanType.NONE; + for (int i = 1; i < 9; i++) + { + CardBasePrm.ClanType clanType2 = (CardBasePrm.ClanType)i; + if (_introductionTask.IsExistClass(clanType2, _formatState)) + { + if (clanType == CardBasePrm.ClanType.NONE) + { + clanType = clanType2; + } + _tabList.SetTabToGrayByIndex(i - 1, disable: false); + } + else + { + _tabList.SetTabToGrayByIndex(i - 1, disable: true); + } + } + _tabList.Reset(); + _tabList.SelectTabByIndex((int)(clanType - 1), isForceSet: true); + } + + private void OnClickFormatBtn(FormatChangeUI.FormatCategory formatCategory) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + Format key = FORMAT_TO_FORMAT_CATEGORY.First((KeyValuePair data) => data.Value == formatCategory).Key; + if (_formatState != key) + { + _formatState = key; + UpdateClassTab(); + } + } + + private void UpdateFormatChangeUI() + { + bool flag = _introductionTask.IsExistFormat(Format.Rotation); + bool flag2 = _introductionTask.IsExistFormat(Format.Unlimited); + bool flag3 = _introductionTask.IsExistFormat(Format.Crossover); + _formatChangeUI.SetEnableFormatButton(FORMAT_TO_FORMAT_CATEGORY[Format.Rotation], flag); + _formatChangeUI.SetEnableFormatButton(FORMAT_TO_FORMAT_CATEGORY[Format.Unlimited], flag2); + _formatChangeUI.UpdateAnotherFormatButton(flag3 ? FORMAT_TO_FORMAT_CATEGORY[Format.Crossover] : FormatChangeUI.FormatCategory.Invalid); + if (_formatState == Format.Crossover && !flag3) + { + _formatState = Format.Rotation; + } + if (!flag) + { + _formatState = Format.Unlimited; + } + else if (!flag2) + { + _formatState = Format.Rotation; + } + _formatChangeUI.ChangeFormat(FORMAT_TO_FORMAT_CATEGORY[_formatState]); + } + } diff --git a/SVSim.BattleEngine/Engine/DeckIntroductionCopyDialog.cs b/SVSim.BattleEngine/Engine/DeckIntroductionCopyDialog.cs new file mode 100644 index 0000000..ce78b9b --- /dev/null +++ b/SVSim.BattleEngine/Engine/DeckIntroductionCopyDialog.cs @@ -0,0 +1,147 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard; +using Wizard.DeckCardEdit; +using Wizard.Dialog.Setting; + +public class DeckIntroductionCopyDialog : MonoBehaviour +{ + private const float GRID_Y_WITH_MY_ROTATION = -15f; + + private const float HINT_Y_WITH_MY_ROTATION = 53f; + + [SerializeField] + private UILabel _labelCopyConfirm; + + [SerializeField] + private UILabel _labelHint; + + [SerializeField] + private ItemToggle _copyToMyRotation; + + [SerializeField] + private ItemToggle _premium; + + [SerializeField] + private ItemToggle _prize; + + [SerializeField] + private UIGrid _grid; + + public bool IsMyRotationDeck; + + public bool IsResurgentToMyRotationDeck; + + private bool _isRotationPeriod; + + public bool IsCopyToMyRotation + { + get + { + if (!IsMyRotationDeck) + { + if (DisplayCopyToMyRotation) + { + return _copyToMyRotation.GetValue(); + } + return false; + } + return true; + } + } + + public string LabelCopyConfirm + { + set + { + _labelCopyConfirm.text = value; + } + } + + public string LabelHint + { + set + { + _labelHint.text = value; + } + } + + private bool DisplayCopyToMyRotation + { + get + { + if (Data.MyRotationAllInfo.IsWithinCopyDeckIntroductionPeriod && !IsMyRotationDeck) + { + return !IsDisableMyRotation; + } + return false; + } + } + + public bool IsDisableMyRotation { get; set; } + + private KeyValuePair MyRotationSaveDataKey + { + get + { + if (!_isRotationPeriod) + { + return PlayerPrefsWrapper.DECK_INTRO_IS_MYROTATION_COPY_NOT_EQUAL_PERIOD; + } + return PlayerPrefsWrapper.DECK_INTRO_IS_MYROTATION_COPY_EQUAL_PERIOD; + } + } + + public void Initialize(bool isRotationPeriod) + { + _isRotationPeriod = isRotationPeriod; + } + + private void Start() + { + if (IsResurgentToMyRotationDeck) + { + _copyToMyRotation.gameObject.SetActive(value: false); + _copyToMyRotation.SetValue(value: false); + _copyToMyRotation.SetActive_SeparatorLine(isActive: false); + } + else + { + _copyToMyRotation.gameObject.SetActive(DisplayCopyToMyRotation); + _copyToMyRotation.SetValue(DisplayCopyToMyRotation); + _copyToMyRotation.SetActive_SeparatorLine(isActive: true); + _copyToMyRotation.SetValue(PlayerPrefsWrapper.GetBool(MyRotationSaveDataKey)); + _copyToMyRotation.AddChangeCallback(delegate + { + PlayerPrefsWrapper.SetValue(MyRotationSaveDataKey, _copyToMyRotation.GetValue() ? 1 : 0); + }); + if (DisplayCopyToMyRotation) + { + ChangeY(_grid.transform, -15f); + ChangeY(_labelHint.transform, 53f); + } + } + ItemToggle itemPremium = _premium; + itemPremium.SetValue(Data.Load.data._userConfig.IsFoilPreferred); + itemPremium.AddChangeCallback(delegate + { + DeckCardEditUI.SendConfigUpdateFoilPreferred(itemPremium.GetValue()); + }); + itemPremium.SetActive_SeparatorLine(isActive: true); + ItemToggle itemPrize = _prize; + itemPrize.SetValue(Data.Load.data._userConfig.IsPrizePreferred); + itemPrize.AddChangeCallback(delegate + { + DeckCardEditUI.SendConfigUpdatePrizePreferred(itemPrize.GetValue()); + }); + itemPrize.SetActive_SeparatorLine(isActive: true); + _grid.Reposition(); + } + + private static void ChangeY(Transform trans, float y) + { + Vector3 localPosition = trans.localPosition; + localPosition.y = y; + trans.localPosition = localPosition; + } +} diff --git a/SVSim.BattleEngine/Engine/DeckIntroductionItem.cs b/SVSim.BattleEngine/Engine/DeckIntroductionItem.cs new file mode 100644 index 0000000..882c3bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/DeckIntroductionItem.cs @@ -0,0 +1,172 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; +using Wizard; + +public class DeckIntroductionItem : MonoBehaviour +{ + private const int WIDTH_DECK_NAME_LABEL_NORMAL = 284; + + private const int WIDTH_DECK_NAME_LABEL_USE_SUBCLASS = 242; + + [SerializeField] + private CostCurveUI _costCurve; + + [SerializeField] + private UILabel _deckName; + + [SerializeField] + private UISprite _formatIcon; + + [SerializeField] + private ClassInfoParts _classInfoParts; + + [SerializeField] + private UILabel _playerName; + + [SerializeField] + private UILabel _deckDetail; + + [SerializeField] + private UILabel _followerCount; + + [SerializeField] + private UILabel _amuletCount; + + [SerializeField] + private UILabel _spellCount; + + [SerializeField] + private UITexture _cardTexture; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private TweenScale _buttonAnimationTween; + + private DeckIntroductionTask.IntroductionData _data; + + public Action OnClick { get; set; } + + public void Initialize(DeckIntroductionTask.IntroductionData data) + { + IFormatBehavior defaultBehaviour = FormatBehaviorManager.GetDefaultBehaviour(data.Deck.Format); + _data = data; + _playerName.text = data.PlayerName; + _deckDetail.text = data.Detail; + _formatIcon.spriteName = defaultBehaviour.SmallIconSpriteName; + if (data.Deck.Format == Format.Rotation) + { + _formatIcon.spriteName = "icon_rotation_s"; + } + _deckName.text = data.Deck.GetDeckName(); + _deckName.width = (defaultBehaviour.UseSubClass ? 242 : 284); + _classInfoParts.gameObject.SetActive(defaultBehaviour.UseSubClass); + if (defaultBehaviour.UseSubClass) + { + _classInfoParts.InitByCharaPrm(GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(data.Deck.GetDeckClassID())); + _classInfoParts.SetSubClass((CardBasePrm.ClanType)data.Deck.GetDeckSubClassID()); + } + int followerCount = 0; + int spellCount = 0; + int amuletCount = 0; + GetCardCountEachType(data.Deck, out followerCount, out spellCount, out amuletCount); + _followerCount.text = followerCount.ToString(); + _spellCount.text = spellCount.ToString(); + _amuletCount.text = amuletCount.ToString(); + _costCurve.Initialize(defaultBehaviour.CardMasterId); + _costCurve.Refresh(data.Deck.GetCardIdList().ToArray()); + _button.onClick.Clear(); + _button.onClick.Add(new EventDelegate(delegate + { + OnClickButton(); + })); + string battleLogTexturePath = GetBattleLogTexturePath(data.TopCardId); + _cardTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(battleLogTexturePath); + } + + private void Start() + { + UIEventListener uIEventListener = UIEventListener.Get(_button.gameObject); + uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, (UIEventListener.BoolDelegate)delegate + { + StartCoroutine(ButtonAnimation()); + }); + } + + private IEnumerator ButtonAnimation() + { + BoxCollider btn = _button.GetComponent(); + Vector3 to = _buttonAnimationTween.to; + Vector3 defaultSize = btn.size; + Vector3 size = new Vector3(btn.size.x / to.x, btn.size.y / to.y, btn.size.z / to.z); + if ((bool)_buttonAnimationTween) + { + _buttonAnimationTween.PlayForward(); + btn.size = size; + while (Input.GetMouseButton(0)) + { + yield return null; + } + _buttonAnimationTween.PlayReverse(); + btn.size = defaultSize; + } + } + + public static string GetCardMaterialPath(int cardId) + { + CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + CardParameter cardParameterFromId = instance.GetCardParameterFromId(cardId); + CardParameter cardParameterFromId2 = instance.GetCardParameterFromId(cardParameterFromId.NormalCardId); + ResourcesManager.AssetLoadPathType type = ResourcesManager.AssetLoadPathType.UnitCardMaterial; + if (instance.GetCardParameterFromId(cardId).CharType != CardBasePrm.CharaType.NORMAL && !CardMaster.IsMutationCardCheck(instance.GetCardParameterFromId(cardId).BaseCardId)) + { + type = ResourcesManager.AssetLoadPathType.SpellCardMaterial; + } + return Toolbox.ResourcesManager.GetAssetTypePath(cardParameterFromId2.ResourceCardId.ToString(), type); + } + + private static string GetBattleLogTexturePath(int cardId) + { + CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + ResourcesManager.AssetLoadPathType assetLoadPathType = ResourcesManager.AssetLoadPathType.UnitHeader; + string path = instance.GetCardParameterFromId(cardId).ResourceCardId + "0"; + assetLoadPathType = ((instance.GetCardParameterFromId(cardId).CharType != CardBasePrm.CharaType.NORMAL && !CardMaster.IsMutationCardCheck(instance.GetCardParameterFromId(cardId).BaseCardId)) ? ResourcesManager.AssetLoadPathType.OtherHeader : ResourcesManager.AssetLoadPathType.UnitHeader); + return Toolbox.ResourcesManager.GetAssetTypePath(path, assetLoadPathType, isfetch: true); + } + + private void GetCardCountEachType(DeckData deck, out int followerCount, out int spellCount, out int amuletCount) + { + CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + int num = 0; + int num2 = 0; + int num3 = 0; + foreach (int cardId in deck.GetCardIdList()) + { + switch (instance.GetCardParameterFromId(cardId).CharType) + { + case CardBasePrm.CharaType.NORMAL: + num++; + break; + case CardBasePrm.CharaType.SPELL: + num2++; + break; + case CardBasePrm.CharaType.FIELD: + case CardBasePrm.CharaType.CHANT_FIELD: + num3++; + break; + } + } + followerCount = num; + spellCount = num2; + amuletCount = num3; + } + + private void OnClickButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OnClick.Call(_data); + } +} diff --git a/SVSim.BattleEngine/Engine/DeckListMenuUI.cs b/SVSim.BattleEngine/Engine/DeckListMenuUI.cs new file mode 100644 index 0000000..7eb7042 --- /dev/null +++ b/SVSim.BattleEngine/Engine/DeckListMenuUI.cs @@ -0,0 +1,1079 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard; + +public class DeckListMenuUI : MonoBehaviour +{ + private enum EditMode + { + Default, + DeckSort, + MultiDelete + } + + public class PageData + { + public readonly DeckData[] DeckList; + + public readonly GameObject Obj; + + public PageData(DeckData[] deckArray, GameObject obj) + { + DeckList = deckArray; + Obj = obj; + } + } + + public enum eEditState + { + CanEdit, + DeleteOnly, + Lock + } + + private const int MAXNUM_DECK_PER_TABLE = 9; + + private const int PAGE_SHOW_LABEL_BORDER = 11; + + [SerializeField] + private DeckUI _deckFrameOriginal; + + [SerializeField] + private UIGrid _deckTableOriginal; + + [SerializeField] + private UISprite _radioIconOriginal; + + [SerializeField] + private GameObject _deckTableRoot; + + [SerializeField] + private UIGrid _radioIconsGrid; + + [SerializeField] + private UILabel _pageLabel; + + [SerializeField] + private UIButton _leftButton; + + [SerializeField] + private UIButton _rightButton; + + [SerializeField] + private BoxCollider _flickCollider; + + private List _radioIconClones; + + private List _pageList = new List(); + + private int _currentPage; + + private List _resourcePathList; + + private Coroutine _loadCoroutine; + + private bool _isChangePage; + + private float _timeChangePage; + + private List _deckUIList = new List(); + + private Action _onMultiDeckDelete; + + private Action _onLongTapMultiDeckDelete; + + private Func, BaseTask> _funcCreateDeckDeleteTask; + + private Func, BaseTask> _funcCreateSaveDeckOrderTask; + + private bool _isOnDestroy; + + [SerializeField] + private UIButton _deckSortStartButton; + + [SerializeField] + private UIButton _deckSortSaveButton; + + [SerializeField] + private UIButton _deckSortCancelButton; + + [SerializeField] + private GameObject _deckSortButtonBase; + + [SerializeField] + private GameObject _multiDeckDeleteMenuRoot; + + [SerializeField] + private UIButton _multiDeckDeleteStartButton; + + [SerializeField] + private UIButton _multiDeckDeleteCancelButton; + + [SerializeField] + private UIButton _multiDeckDeleteDecideButton; + + [SerializeField] + private GameObject _deckSortBlackBg; + + private EditMode _editMode; + + private DeckUI _newCreateObject; + + private bool _enableDeckSortDeckCount; + + private bool _initializeEnd; + + private List> _deckFrameDefaultList = new List>(); + + private List> _deckFrameListTempSort = new List>(); + + private DeckGroup _deckGroup; + + private bool _isVisibleCreateNewButton; + + private bool _enableFirstViewLastUseDeck = true; + + public eEditState EditState { get; private set; } + + public bool EnableDrag { get; set; } = true; + + public bool IsSortMode => _editMode == EditMode.DeckSort; + + private bool _isSortUse => EditState != eEditState.Lock; + + public bool IsSortDragging { get; set; } + + public bool IsPlayingSortAnimation { get; private set; } + + public GameObject SortDragObject { get; set; } + + public List DeckPageList { get; private set; } = new List(); + + public event Action OnSelectDeck; + + private void Awake() + { + _radioIconClones = new List(); + DeckSortInit(); + } + + public void Initialize(DeckGroup deckGroup, eEditState editState, Action onSelectDeck, Action onMultiDeckDelete, Action onLongPressMultiDeckDelete, Func, BaseTask> funcCreateDeckDeleteTask, Func, BaseTask> funcCreateSaveDeckOrderTask, bool isVisibleCreateNewButton, bool enableFirstViewLastUseDeck, Action onFinish) + { + EditState = editState; + OnSelectDeck += onSelectDeck; + _onMultiDeckDelete = onMultiDeckDelete; + _onLongTapMultiDeckDelete = onLongPressMultiDeckDelete; + _funcCreateDeckDeleteTask = funcCreateDeckDeleteTask; + _funcCreateSaveDeckOrderTask = funcCreateSaveDeckOrderTask; + _isVisibleCreateNewButton = isVisibleCreateNewButton; + _enableFirstViewLastUseDeck = enableFirstViewLastUseDeck; + _rightButton.gameObject.SetActive(value: false); + _leftButton.gameObject.SetActive(value: false); + 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(); + }); + _deckSortStartButton.onClick.Add(new EventDelegate(delegate + { + OnClickDeckSortStart(); + })); + _deckSortSaveButton.onClick.Add(new EventDelegate(delegate + { + OnClickDeckSortSave(); + })); + _deckSortCancelButton.onClick.Add(new EventDelegate(delegate + { + OnClickDeckSortCancel(); + })); + UIEventListener uIEventListener4 = UIEventListener.Get(_multiDeckDeleteStartButton.gameObject); + uIEventListener4.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener4.onClick, (UIEventListener.VoidDelegate)delegate + { + OnClickMultiDeckDeleteStartButton(); + }); + UIEventListener uIEventListener5 = UIEventListener.Get(_multiDeckDeleteCancelButton.gameObject); + uIEventListener5.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener5.onClick, (UIEventListener.VoidDelegate)delegate + { + OnClickMultiDeckDeleteCancelButton(); + }); + UIEventListener uIEventListener6 = UIEventListener.Get(_multiDeckDeleteDecideButton.gameObject); + uIEventListener6.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener6.onClick, (UIEventListener.VoidDelegate)delegate + { + OnClickMultiDeckDeleteDecideButton(); + }); + UpdateDeckList(deckGroup, delegate + { + _initializeEnd = true; + onFinish.Call(); + }); + } + + private void Update() + { + if (_isChangePage) + { + _timeChangePage += Time.deltaTime; + if (_timeChangePage >= 0.2f) + { + _isChangePage = false; + _timeChangePage = 0f; + } + } + } + + public void UpdateDeckList(DeckGroup deckGroup, Action onFinish) + { + if (deckGroup != null) + { + if (_initializeEnd) + { + Delete(); + } + _deckGroup = deckGroup; + _loadCoroutine = UIManager.GetInstance().StartCoroutine(LoadResourceCoroutine(delegate + { + SetupEditableDeckList(); + onFinish.Call(); + })); + } + } + + private IEnumerator LoadResourceCoroutine(Action onFinish) + { + _resourcePathList = new List(); + List list = new List(); + List list2 = new List(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + for (int i = 1; i < 9; i++) + { + int skin_id = dataMgr.GetCharaPrmByClassId(i).skin_id; + if (!list.Contains(skin_id)) + { + list.Add(skin_id); + _resourcePathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(skin_id.ToString(), ResourcesManager.AssetLoadPathType.DeckListTexture)); + } + } + int num = 3000011; + if (!list2.Contains(num)) + { + list2.Add(num); + _resourcePathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(num.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture)); + } + foreach (DeckData deckData in _deckGroup.DeckDataList) + { + LoadSkinSleeve(deckData, list, list2); + } + yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_resourcePathList, null)); + _loadCoroutine = null; + if (!_isOnDestroy) + { + onFinish.Call(); + } + } + + private void LoadSkinSleeve(DeckData deck, List skinIdList, List sleeveIdList) + { + if (deck.IsNoCard()) + { + return; + } + int skinId = deck.GetSkinId(); + if (!skinIdList.Contains(skinId)) + { + skinIdList.Add(skinId); + _resourcePathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(skinId.ToString(), ResourcesManager.AssetLoadPathType.DeckListTexture)); + } + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(deck.GetDeckSleeveID()); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId); + if (!sleeveIdList.Contains(existingSleeveId)) + { + sleeveIdList.Add(existingSleeveId); + _resourcePathList.Add(Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture)); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref _resourcePathList, sleeve); + } + } + } + + private void SetupEditableDeckList() + { + SetupDeckList(); + foreach (List deckFrameDefault in _deckFrameDefaultList) + { + foreach (DeckFrame item in deckFrameDefault) + { + item.Transform.gameObject.AddMissingComponent().DeckListMenuClass = this; + } + } + } + + private void SetupDeckList() + { + int newPage = 0; + _deckUIList.Clear(); + AddCustomDeckTable(_deckGroup.DeckDataList); + if (_enableFirstViewLastUseDeck && _deckGroup.DeckDataList.Any((DeckData deck) => deck.IsUsable())) + { + DeckData firstDisplayDeck = GetFirstDisplayDeck(); + if (firstDisplayDeck != null) + { + for (int num = 0; num < _pageList.Count; num++) + { + DeckData[] deckList = _pageList[num].DeckList; + for (int num2 = 0; num2 < deckList.Length; num2++) + { + if (deckList[num2] == firstDisplayDeck) + { + newPage = num; + break; + } + } + } + } + } + ChangePage(newPage, isImmediate: true); + SetDefaultMode(); + } + + private DeckData GetFirstDisplayDeck() + { + int deckId = 0; + switch (_deckGroup.DeckFormat) + { + case Format.Rotation: + deckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_ROTATION); + break; + case Format.Unlimited: + deckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_UNLIMITED); + break; + case Format.PreRotation: + deckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_PRE_ROTATION); + break; + case Format.Crossover: + deckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_CROSSOVER); + break; + case Format.MyRotation: + deckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_MY_ROTATION); + break; + case Format.Avatar: + deckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_AVATAR); + break; + } + DeckData deckData = _deckGroup.DeckDataList.FirstOrDefault((DeckData deck) => deck.GetDeckID() == deckId && !deck.IsNoCard()); + if (deckData != null) + { + return deckData; + } + deckData = _deckGroup.DeckDataList.FirstOrDefault((DeckData deck) => deck.IsUsable()); + if (deckData != null) + { + return deckData; + } + return _deckGroup.DeckDataList.FirstOrDefault(); + } + + private void AddCustomDeckTable(List deckList) + { + int num = 0; + List list = new List(); + deckList.FindLastIndex((DeckData d) => !d.IsNoCard()); + int num2 = 0; + List list2 = DeckUI.DeckViewData.CreateDeckViewList(deckList, _isVisibleCreateNewButton); + for (int num3 = 0; num3 < deckList.Count; num3++) + { + list.Add(list2[num3]); + if (!deckList[num3].IsNoCard()) + { + num2++; + } + if (list.Count == 9 || num3 + 1 == deckList.Count) + { + num++; + AddDeckTable(list); + list.Clear(); + } + } + if (_isSortUse) + { + _enableDeckSortDeckCount = num2 >= 2; + } + } + + private void AddDeckTable(List deckViewList) + { + UIGrid uIGrid = UnityEngine.Object.Instantiate(_deckTableOriginal); + uIGrid.transform.parent = _deckTableRoot.transform; + uIGrid.transform.localScale = Vector3.one; + int num = 0; + uIGrid.sorting = UIGrid.Sorting.Custom; + uIGrid.onCustomSort = SortUiGridCustom; + DeckPageList.Add(uIGrid); + _deckFrameListTempSort.Add(new List()); + _deckFrameDefaultList.Add(new List()); + for (int i = 0; i < _deckFrameListTempSort.Count; i++) + { + num += _deckFrameListTempSort[i].Count; + } + for (int j = 0; j < deckViewList.Count; j++) + { + DeckData deck = deckViewList[j].Deck; + Transform transform = CreateDeckFrame(deckViewList[j]); + uIGrid.AddChild(transform); + transform.localScale = Vector3.one; + transform.gameObject.name = (num + j).ToString(); + if (!deck.IsNoCard()) + { + DeckFrame deckFrame = new DeckFrame(); + deckFrame.Transform = transform; + deckFrame.DeckId = deck.GetDeckID(); + _deckFrameListTempSort[_deckFrameListTempSort.Count - 1].Add(deckFrame); + _deckFrameDefaultList[_deckFrameListTempSort.Count - 1].Add(deckFrame); + } + } + UISprite uISprite = UnityEngine.Object.Instantiate(_radioIconOriginal); + _radioIconClones.Add(uISprite); + _radioIconsGrid.AddChild(uISprite.transform); + uISprite.transform.localScale = Vector3.one; + PageData item = new PageData(deckViewList.Select((DeckUI.DeckViewData deckView) => deckView.Deck).ToArray(), uIGrid.gameObject); + _pageList.Add(item); + } + + public static int SortUiGridCustom(Transform a, Transform b) + { + if (int.TryParse(a.name, out var result) && int.TryParse(b.name, out var result2)) + { + if (result > result2) + { + return 1; + } + if (result < result2) + { + return -1; + } + } + return 0; + } + + public bool DeckSort(string inTargetObjectName, string inSortObjectName, ref Vector3 sortObjectPosition) + { + if (inTargetObjectName == inSortObjectName + 1) + { + return false; + } + if (_deckFrameListTempSort[0].Count < 2) + { + return false; + } + if (inTargetObjectName == inSortObjectName) + { + return false; + } + int num = int.Parse(inTargetObjectName); + int num2 = int.Parse(inSortObjectName) / 9; + int num3 = num / 9; + if (num2 < num3 && num % 9 == 0 && _currentPage != num2) + { + return false; + } + DeckFrame deckFrame = null; + for (int i = 0; i < _deckFrameListTempSort.Count; i++) + { + deckFrame = _deckFrameListTempSort[i].FindLast((DeckFrame a) => inSortObjectName == a.Transform.name); + if (deckFrame != null) + { + break; + } + } + for (int num4 = 0; num4 < _deckFrameListTempSort.Count && _deckFrameListTempSort[num4].FindLast((DeckFrame a) => inTargetObjectName == a.Transform.name) == null; num4++) + { + } + List list = new List(); + for (int num5 = 0; num5 < _deckFrameListTempSort.Count; num5++) + { + list.AddRange(_deckFrameListTempSort[num5]); + } + list.Remove(deckFrame); + int index = list.FindIndex((DeckFrame a) => inTargetObjectName == a.Transform.name); + list.Insert(index, deckFrame); + sortObjectPosition = CreateSortedDeckPage(list, deckFrame, inIsMoveAnimation: true); + return true; + } + + public void DeckSortAddLast(DeckFrame inAddObject) + { + List list = new List(); + for (int i = 0; i < _deckFrameListTempSort.Count; i++) + { + list.AddRange(_deckFrameListTempSort[i]); + } + for (int j = 0; j < list.Count; j++) + { + if (list[j].DeckId == inAddObject.DeckId) + { + list.RemoveAt(j); + break; + } + } + list.Add(inAddObject); + CreateSortedDeckPage(list, inAddObject, inIsMoveAnimation: true); + } + + private Vector3 CreateSortedDeckPage(List inSortedAllList, DeckFrame inSortObject, bool inIsMoveAnimation) + { + List> list = new List>(); + List list2 = new List(); + for (int i = 0; i <= inSortedAllList.Count / 9; i++) + { + if (i < DeckPageList.Count) + { + list.Add(new List()); + list[i].AddRange(inSortedAllList.GetRange(i * 9, _deckFrameListTempSort[i].Count)); + } + } + int num = 0; + for (int j = 0; j < list.Count; j++) + { + for (int k = 0; k < list[j].Count; k++) + { + list[j][k].Transform.name = num.ToString(); + list[j][k].Transform.SetParent(DeckPageList[j].transform); + num++; + list2.Add(list[j][k].Transform.localPosition); + } + } + for (int l = 0; l < DeckPageList.Count; l++) + { + DeckPageList[l].Reposition(); + } + Vector3 result = Vector3.zero; + if (inSortObject != null) + { + result = inSortObject.Transform.localPosition; + } + if (inIsMoveAnimation) + { + int num2 = 0; + for (int m = 0; m < list.Count; m++) + { + for (int n = 0; n < list[m].Count; n++) + { + if (inSortObject != list[m][n] && list[m][n].Transform.localPosition != list2[num2]) + { + if (!list[m][n].Transform.gameObject.activeInHierarchy) + { + list[m][n].TweenTargetPosition = list[m][n].Transform.localPosition; + list[m][n].Transform.localPosition = list[m][n].TweenTargetPosition; + } + else + { + list[m][n].TweenTargetPosition = list[m][n].Transform.localPosition; + UITweenPosition uITweenPosition = list[m][n].Transform.gameObject.AddMissingComponent(); + IsPlayingSortAnimation = true; + uITweenPosition.OnFinishCallBack = delegate(UITweenPosition fadeObject) + { + fadeObject.GetComponent().SortAnimeComplete(); + IsPlayingSortAnimation = false; + }; + uITweenPosition.From = list2[num2]; + uITweenPosition.To = list[m][n].TweenTargetPosition; + uITweenPosition.EndTime = 0.2f; + uITweenPosition.PlayForward(resetFlag: true); + list[m][n].Transform.gameObject.GetComponent().enabled = false; + } + } + num2++; + } + } + } + _deckFrameListTempSort = list; + return result; + } + + public int GetDeckNoFromGameObject(GameObject inObject) + { + for (int i = 0; i < _deckFrameListTempSort.Count; i++) + { + for (int j = 0; j < _deckFrameListTempSort[i].Count; j++) + { + if (_deckFrameListTempSort[i][j].Transform.gameObject == inObject) + { + return _deckFrameListTempSort[i][j].DeckId; + } + } + } + return 0; + } + + public bool ChangePage(int newPage, bool isImmediate = false) + { + int currentPage = _currentPage; + if (_isChangePage) + { + return false; + } + int count = _radioIconClones.Count; + bool flag = false; + if (currentPage == newPage) + { + isImmediate = true; + } + if (!IsValidPage(newPage)) + { + return false; + } + _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); + ClearLongPress(); + if (!isImmediate) + { + _isChangePage = true; + } + for (int i = 0; i < count; i++) + { + if (i == newPage) + { + _radioIconClones[i].spriteName = _radioIconClones[i].spriteName.Replace("_off", "_on"); + } + else + { + _radioIconClones[i].spriteName = _radioIconClones[i].spriteName.Replace("_on", "_off"); + } + } + bool flag2 = _pageList.Count >= 11; + bool flag3 = IsValidPage(newPage + 1); + bool flag4 = IsValidPage(newPage - 1); + bool active = (flag3 || flag4) && !flag2; + _rightButton.gameObject.SetActive(flag3); + _leftButton.gameObject.SetActive(flag4); + _radioIconsGrid.gameObject.SetActive(active); + _pageLabel.gameObject.SetActive(flag2); + _pageLabel.text = Data.SystemText.Get("Card_0053", (newPage + 1).ToString(), _pageList.Count.ToString()); + return true; + } + + private IEnumerator DeleteWaitCoroutine() + { + while (_loadCoroutine != null) + { + yield return null; + } + DeleteResource(); + } + + private void Delete() + { + if (_loadCoroutine != null) + { + StopCoroutine(_loadCoroutine); + _loadCoroutine = null; + } + _radioIconClones.Clear(); + _pageList.Clear(); + Transform[] componentsInChildren = _deckTableRoot.GetComponentsInChildren(); + for (int i = 0; i < componentsInChildren.Length; i++) + { + if (_deckTableRoot.transform != componentsInChildren[i]) + { + UnityEngine.Object.Destroy(componentsInChildren[i].gameObject); + } + } + componentsInChildren = _radioIconsGrid.GetComponentsInChildren(); + for (int j = 0; j < componentsInChildren.Length; j++) + { + if (_radioIconsGrid.transform != componentsInChildren[j]) + { + UnityEngine.Object.Destroy(componentsInChildren[j].gameObject); + } + } + DeckPageList.Clear(); + _deckFrameDefaultList.Clear(); + _deckFrameListTempSort.Clear(); + DeleteResource(); + } + + private void DeleteResource() + { + if (_resourcePathList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_resourcePathList); + _resourcePathList.Clear(); + } + } + + private bool IsValidPage(int page) + { + int count = _radioIconClones.Count; + if (count > 0 && page >= 0) + { + return page < count; + } + return false; + } + + private Transform CreateDeckFrame(DeckUI.DeckViewData deckViewData) + { + DeckUI deckUI = UnityEngine.Object.Instantiate(_deckFrameOriginal); + deckUI.Initialize(OnClickDeck, OnLongPress); + deckUI.UpdateView(deckViewData); + if (deckViewData.ViewType == DeckUI.eViewType.CreateNew) + { + _newCreateObject = deckUI; + } + UIEventListener uIEventListener = UIEventListener.Get(deckUI.gameObject); + uIEventListener.onDrag = (UIEventListener.VectorDelegate)Delegate.Combine(uIEventListener.onDrag, new UIEventListener.VectorDelegate(OnDragPanel)); + _deckUIList.Add(deckUI); + return deckUI.transform; + } + + public void NextPage() + { + if (ChangePage(_currentPage + 1)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + public void PrevPage() + { + if (ChangePage(_currentPage - 1)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + } + } + + private void OnDragPanel(GameObject obj, Vector2 dir) + { + if (EnableDrag && !IsSortDragging) + { + if (dir.x >= 70f) + { + PrevPage(); + } + else if (dir.x <= -70f) + { + NextPage(); + } + } + } + + private void OnClickDeck(DeckUI deckDisplay) + { + if (UIManager.GetInstance().IsTouchable) + { + switch (_editMode) + { + case EditMode.Default: + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + this.OnSelectDeck.Call(deckDisplay.Deck); + break; + case EditMode.MultiDelete: + OnClickDeckForMultiDeckDelete(deckDisplay); + break; + case EditMode.DeckSort: + break; + } + } + } + + private void DeckSortInit() + { + SetDefaultMode(); + _deckSortStartButton.gameObject.SetActive(value: false); + } + + private void OnClickDeckSortStart() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SetSortMode(); + } + + private void OnClickDeckSortCancel() + { + if (!IsSortDragging && !IsPlayingSortAnimation) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + SetDefaultMode(); + List list = new List(); + for (int i = 0; i < _deckFrameDefaultList.Count; i++) + { + list.AddRange(_deckFrameDefaultList[i]); + } + CreateSortedDeckPage(list, null, inIsMoveAnimation: false); + ClearBackButtonAction(); + } + } + + private void OnClickDeckSortSave() + { + if (!IsSortDragging && !IsPlayingSortAnimation) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SaveDeckOrder(delegate + { + SetDefaultMode(); + ClearBackButtonAction(); + }); + } + } + + private void SaveDeckOrder(Action onSuccess) + { + List list = new List(); + for (int i = 0; i < _deckFrameListTempSort.Count; i++) + { + for (int j = 0; j < _deckFrameListTempSort[i].Count; j++) + { + list.Add(_deckFrameListTempSort[i][j].DeckId); + } + } + BaseTask task = _funcCreateSaveDeckOrderTask.Call(list); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _deckFrameDefaultList.Clear(); + _deckFrameDefaultList.AddRange(_deckFrameListTempSort); + onSuccess.Call(); + })); + } + + private void DeckCreateEmptyChange(bool isEmpty) + { + if (!(_newCreateObject == null) && (_newCreateObject.ViewType == DeckUI.eViewType.CreateNew || _newCreateObject.ViewType == DeckUI.eViewType.Empty)) + { + _newCreateObject.UpdateView(_newCreateObject.Deck, isEmpty ? DeckUI.eViewType.Empty : DeckUI.eViewType.CreateNew); + } + } + + private void OnDestroy() + { + _isOnDestroy = true; + UIManager.GetInstance().StartCoroutine(DeleteWaitCoroutine()); + } + + public DeckData GetDeckDataSamePage(DeckData targetDeck) + { + foreach (PageData page in _pageList) + { + bool flag = false; + DeckData[] deckList = page.DeckList; + foreach (DeckData deckData in deckList) + { + if (deckData.Format == targetDeck.Format && !deckData.IsNoCard() && deckData.GetDeckID() == targetDeck.GetDeckID()) + { + flag = true; + } + } + if (!flag) + { + continue; + } + deckList = page.DeckList; + foreach (DeckData deckData2 in deckList) + { + if (!deckData2.IsNoCard() && deckData2.GetDeckID() != targetDeck.GetDeckID()) + { + return deckData2; + } + } + } + return null; + } + + private void OnClickMultiDeckDeleteStartButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SaveDeckOrder(delegate + { + SetMultiDeleteMode(); + }); + } + + private void OnClickDeckForMultiDeckDelete(DeckUI deckDisplay) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + deckDisplay.SetVisibleCheckMark(!deckDisplay.IsCheckeMark); + deckDisplay.SetColorToGrey(deckDisplay.IsCheckeMark); + RefreshMultiDeleteDecideButtonEnable(); + } + + private void RefreshMultiDeleteDecideButtonEnable() + { + bool flag = GetMultiDeleteCount() > 0; + UIManager.SetObjectToGrey(_multiDeckDeleteDecideButton.gameObject, !flag); + } + + private void SetDefaultMode() + { + _editMode = EditMode.Default; + IsSortDragging = false; + DeckCreateEmptyChange(isEmpty: false); + _deckSortButtonBase.SetActive(value: false); + _deckSortBlackBg.SetActive(value: false); + _multiDeckDeleteMenuRoot.SetActive(value: false); + _multiDeckDeleteStartButton.gameObject.SetActive(value: false); + _deckSortStartButton.gameObject.SetActive(_isSortUse && _enableDeckSortDeckCount); + SetSelectableDeckAll(isSelectable: true); + ClearAllCheckMark(); + ClearLongPress(); + } + + private void SetSortMode() + { + _editMode = EditMode.DeckSort; + IsSortDragging = false; + _deckSortButtonBase.SetActive(value: true); + _deckSortBlackBg.SetActive(value: true); + _multiDeckDeleteMenuRoot.SetActive(value: false); + _multiDeckDeleteStartButton.gameObject.SetActive(value: true); + DeckCreateEmptyChange(isEmpty: true); + _deckSortStartButton.gameObject.SetActive(value: false); + SetSelectableDeckAll(isSelectable: false); + ClearAllCheckMark(); + ClearLongPress(); + } + + private void SetMultiDeleteMode() + { + _editMode = EditMode.MultiDelete; + _deckSortButtonBase.SetActive(value: false); + _multiDeckDeleteMenuRoot.SetActive(value: true); + _multiDeckDeleteStartButton.gameObject.SetActive(value: false); + SetBackButtonForMultiDeleteMode(); + SetSelectableDeckAll(isSelectable: true); + ClearAllCheckMark(); + ClearLongPress(); + RefreshMultiDeleteDecideButtonEnable(); + } + + private void SetBackButtonForMultiDeleteMode() + { + } + + private void ClearBackButtonAction() + { + } + + private void ClearAllCheckMark() + { + foreach (DeckUI deckUI in _deckUIList) + { + deckUI.SetVisibleCheckMark(isVisible: false); + deckUI.SetColorToGrey(isGrey: false); + } + } + + private void SetSelectableDeckAll(bool isSelectable) + { + foreach (DeckUI deckUI in _deckUIList) + { + deckUI.SetSelectable(isSelectable); + } + } + + private int GetMultiDeleteCount() + { + int num = 0; + foreach (DeckUI deckUI in _deckUIList) + { + if (deckUI.IsCheckeMark) + { + num++; + } + } + return num; + } + + private void ClearLongPress() + { + foreach (DeckUI deckUI in _deckUIList) + { + deckUI.ClearLongPress(); + } + } + + private void OnClickMultiDeckDeleteCancelButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL); + SetSortMode(); + } + + private void OnClickMultiDeckDeleteDecideButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ClearBackButtonAction(); + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Dia_DeckEdit_001_Title")); + dialogBase.SetText(systemText.Get("Card_0218")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Card_0104")); + dialogBase.onPushButton1 = delegate + { + MultiDeckDelete(); + }; + dialogBase.OnCloseStart = delegate + { + SetBackButtonForMultiDeleteMode(); + }; + } + + private void MultiDeckDelete() + { + List list = new List(); + foreach (DeckUI deckUI in _deckUIList) + { + if (deckUI.IsCheckeMark) + { + list.Add(deckUI.Deck.GetDeckID()); + } + } + BaseTask task = _funcCreateDeckDeleteTask.Call(list); + StartCoroutine(Toolbox.NetworkManager.Connect(task, OnSuccessDeckDelete)); + } + + private void OnLongPress(DeckUI deckDisplay) + { + if (_editMode == EditMode.MultiDelete) + { + _onLongTapMultiDeckDelete.Call(deckDisplay.Deck); + } + } + + private void OnSuccessDeckDelete(NetworkTask.ResultCode code) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Dia_DeckEdit_002_Title")); + dialogBase.SetText(systemText.Get("Card_0010")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _onMultiDeckDelete.Call(); + ClearBackButtonAction(); + } +} diff --git a/SVSim.BattleEngine/Engine/EffectSetUp.cs b/SVSim.BattleEngine/Engine/EffectSetUp.cs new file mode 100644 index 0000000..460ba7c --- /dev/null +++ b/SVSim.BattleEngine/Engine/EffectSetUp.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; + +public class EffectSetUp : MonoBehaviour +{ + public bool isBattle; + + public bool isField; + + public bool isFinished; + + private List _loadAssetList = new List(); + + private void Start() + { + if (GameMgr.GetIns() != null) + { + base.gameObject.SetActive(value: true); + _loadAssetList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(base.gameObject, delegate + { + isFinished = true; + }, isBattle, isField)); + } + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadAssetList); + } +} diff --git a/SVSim.BattleEngine/Engine/EnemyStatusPanelControl.cs b/SVSim.BattleEngine/Engine/EnemyStatusPanelControl.cs new file mode 100644 index 0000000..e58c031 --- /dev/null +++ b/SVSim.BattleEngine/Engine/EnemyStatusPanelControl.cs @@ -0,0 +1,428 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class EnemyStatusPanelControl : MonoBehaviour, IStatusPanelControl +{ + private BattleManagerBase _battleMgr; + + [SerializeField] + private GameObject StatusPanel; + + [SerializeField] + private GameObject PPPanel; + + [SerializeField] + private GameObject StatusPanelAllwaysDisp; + + [SerializeField] + private UISprite EpPanel; + + [SerializeField] + private UISprite DeckIconSprite; + + [SerializeField] + private UILabel DeckLabelAlwaysDisp; + + [SerializeField] + private UISprite GraveIconSprite; + + [SerializeField] + private UILabel GraveLabelAlwaysDisp; + + [SerializeField] + private UILabel DeckLabel; + + [SerializeField] + private UILabel GraveLabel; + + [SerializeField] + private UILabel PPLabel; + + [SerializeField] + private UILabel PPLineLabel; + + [SerializeField] + private UILabel PPMaxLabel; + + [SerializeField] + private UILabel EpLabel; + + [SerializeField] + private UISprite[] EpList; + + [SerializeField] + private UISprite EpIcon; + + [SerializeField] + private UILabel HandCountLabel; + + [SerializeField] + private UILabel HandCountLabelAlwaysDisp; + + [SerializeField] + private UISprite HandCountIconSpriteAlwaysDisp; + + private const float ALWAYS_STATUS_PANEL_SHOW_ANIMATION_OFFSET = 350f; + + private const float ALWAYS_STATUS_PANEL_SHOW_ANIMATION_SECOND = 0.5f; + + private readonly Vector3 EP_PANEL_POSITION = new Vector3(235f, -90f, 0f); + + private readonly Vector3 ANYA_EP_PANEL_POSITION = new Vector3(207f, -90f, 0f); + + private const float EP_PANEL_OFFSET = 350f; + + private const float PP_PANEL_OFFSET = 300f; + + private const int ANYA_HIGH_RANK_SKIN_ID = 4413; + + private ParticleSystem[] GaugeShiftEfcChild; + + private bool isPlayer; + + private IDictionary DefaultPosDict; + + private Vector3 EpPanelPosition + { + get + { + if (GameMgr.GetIns().GetDataMgr().GetEnemySkinId() != 4413) + { + return EP_PANEL_POSITION; + } + return ANYA_EP_PANEL_POSITION; + } + } + + public Vector3 EpPanelOffScreenPosition => EpPanelPosition + Vector3.up * 350f; + + public Vector3 BpPanelOffScreenPosition => DefaultPosDict["BPPanel"] + Vector3.up * 350f; + + private void Start() + { + string text = Toolbox.SavedataManager.GetString("LANG_SETTING", "Eng"); + if (text == Global.LANG_TYPE.Eng.ToString() || text == Global.LANG_TYPE.Ger.ToString()) + { + PPPanel.transform.Find("PPIcon/PPSprite").gameObject.SetActive(value: false); + Vector3 vector = new Vector3(0f, 11f, 0f); + PPLabel.transform.localPosition += vector; + PPLineLabel.transform.localPosition += vector; + PPMaxLabel.transform.localPosition += vector; + } + PPPanel.transform.parent = BattleManagerBase.GetIns().Battle3DContainer.transform; + DefaultPosDict = new Dictionary(); + DefaultPosDict["StatusPanel"] = StatusPanel.transform.localPosition; + DefaultPosDict["PPPanel"] = new Vector3(PPPanel.transform.localPosition.x, 460f, PPPanel.transform.localPosition.z); + DefaultPosDict["StatusPanelAllwaysDisp"] = StatusPanelAllwaysDisp.transform.localPosition; + SetPp(0, 0); + SetDeck(0); + SetGrave(0); + PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f; + EpPanel.transform.localPosition = EpPanelOffScreenPosition; + PPPanel.SetActive(value: false); + EpPanel.gameObject.SetActive(value: false); + PPPanel.SetActive(value: false); + EpPanel.gameObject.SetActive(value: false); + StatusPanelAllwaysDisp.gameObject.SetActive(value: false); + List list = new List(); + list.Add(base.gameObject); + list.Add(PPPanel); + list.Add(EpPanel.gameObject); + UIManager.GetInstance().AttachAtlas(list); + } + + public void ChangePPPanelParent(Transform parent, Vector3 position) + { + PPPanel.transform.parent = parent; + DefaultPosDict["PPPanel"] = position; + if (PPPanel.GetComponent() != null) + { + StartPPPanelAnimation(); + } + else + { + PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f; + } + } + + public void SetUp(BattleManagerBase battleMgr) + { + _battleMgr = battleMgr; + } + + public void ShowStatus(bool isNewReplayMoveTurn) + { + if (BattlePlayerViewBase.AlwaysShowStatusPanel && !isNewReplayMoveTurn) + { + ShowStatusPanelAlways(); + } + else + { + StatusPanel.SetActive(value: true); + } + } + + public void ShowStatusPanelOnBattle() + { + StatusPanelAllwaysDisp.gameObject.SetActive(BattlePlayerViewBase.AlwaysShowStatusPanel); + } + + public void ShowStatusPanelAlways() + { + if (BattlePlayerViewBase.AlwaysShowStatusPanel) + { + StatusPanelAllwaysDisp.gameObject.SetActive(value: true); + Vector3 localPosition = DefaultPosDict["StatusPanelAllwaysDisp"] + Vector3.up * 350f; + StatusPanelAllwaysDisp.transform.localPosition = localPosition; + iTween.MoveTo(StatusPanelAllwaysDisp, iTween.Hash("position", DefaultPosDict["StatusPanelAllwaysDisp"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + } + } + + public void HideStatusPanelAlways() + { + if (BattlePlayerViewBase.AlwaysShowStatusPanel) + { + StatusPanelAllwaysDisp.gameObject.SetActive(value: false); + } + } + + public void ShowPpEp(bool isNotEPMax3, bool fixDirection = false, bool isNewReplay = false, bool isBanmenkun = false) + { + if (fixDirection) + { + isNotEPMax3 = false; + } + EpPanel.spriteName = GetEvoPanelSprite(isNotEPMax3); + bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413; + if (isNotEPMax3) + { + EpIcon.transform.localPosition = new Vector3(-7.5f, -3.6f, 0f); + EpList[0].spriteName = "battle_icon_evo_off_mini"; + EpList[1].spriteName = "battle_icon_evo_off_mini"; + EpList[2].spriteName = "battle_icon_evo_off_mini"; + EpList[0].transform.localPosition = new Vector3(5.1f, -59.2f, 0f); + EpList[1].transform.localPosition = new Vector3(23.8f, -59.2f, 0f); + EpList[2].gameObject.SetActive(value: false); + if (isNewReplay) + { + EpPanel.transform.localScale = new Vector3(Mathf.Abs(EpPanel.transform.localScale.x), EpPanel.transform.localScale.y, EpPanel.transform.localScale.z); + EpIcon.transform.localScale = new Vector3(Mathf.Abs(EpIcon.transform.localScale.x), EpIcon.transform.localScale.y, EpIcon.transform.localScale.z); + } + if (flag) + { + EpPanel.transform.localScale = new Vector3(0f - Mathf.Abs(EpPanel.transform.localScale.x), EpPanel.transform.localScale.y, EpPanel.transform.localScale.z); + EpIcon.transform.localScale = new Vector3(0f - Mathf.Abs(EpIcon.transform.localScale.x), EpIcon.transform.localScale.y, EpIcon.transform.localScale.z); + } + } + else + { + EpIcon.transform.localPosition = new Vector3(8f, -3.6f, 0f); + EpList[0].spriteName = "battle_icon_evo_off_mini"; + EpList[1].spriteName = "battle_icon_evo_off_mini"; + EpList[2].spriteName = "battle_icon_evo_off_mini"; + EpList[0].transform.localPosition = new Vector3(17.1f, -59.2f, 0f); + EpList[1].transform.localPosition = new Vector3(-1.6f, -59.2f, 0f); + EpList[2].transform.localPosition = new Vector3(-20.2f, -59.2f, 0f); + if (isNewReplay) + { + EpList[2].gameObject.SetActive(value: true); + } + float x = ((fixDirection || isNewReplay || isBanmenkun) ? (0f - Mathf.Abs(EpPanel.transform.localScale.x)) : (0f - EpPanel.transform.localScale.x)); + if (flag) + { + x = Mathf.Abs(EpPanel.transform.localScale.x); + } + EpPanel.transform.localScale = new Vector3(x, EpPanel.transform.localScale.y, EpPanel.transform.localScale.z); + float x2 = ((fixDirection || isNewReplay || isBanmenkun) ? (0f - Mathf.Abs(EpIcon.transform.localScale.x)) : (0f - EpIcon.transform.localScale.x)); + if (flag) + { + x2 = Mathf.Abs(EpIcon.transform.localScale.x); + } + EpIcon.transform.localScale = new Vector3(x2, EpIcon.transform.localScale.y, EpIcon.transform.localScale.z); + } + if (!isNewReplay) + { + StartPPPanelAnimation(); + EpPanel.transform.localPosition = EpPanelOffScreenPosition; + iTween.MoveTo(EpPanel.gameObject, iTween.Hash("position", EpPanelPosition, "time", 0.5f, "delay", 0.1f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + } + else + { + PPPanel.transform.localPosition = DefaultPosDict["PPPanel"]; + EpPanel.transform.localPosition = EpPanelPosition; + } + EpPanel.gameObject.SetActive(value: true); + } + + private void StartPPPanelAnimation() + { + PPPanel.transform.localPosition = DefaultPosDict["PPPanel"] + Vector3.up * 300f; + iTween.MoveTo(PPPanel, iTween.Hash("position", DefaultPosDict["PPPanel"], "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + PPPanel.SetActive(value: true); + } + + public void HideUI() + { + iTween.MoveTo(PPPanel, iTween.Hash("position", DefaultPosDict["PPPanel"] + Vector3.up * 300f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.MoveTo(EpPanel.gameObject, iTween.Hash("position", EpPanelOffScreenPosition, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + } + + public void SetDeck(int num) + { + DeckLabel.text = num.ToString(); + DeckLabelAlwaysDisp.text = num.ToString(); + } + + public void SetGrave(int num) + { + GraveLabel.text = num.ToString(); + GraveLabelAlwaysDisp.text = num.ToString(); + } + + public void SetHandCount(int num) + { + HandCountLabelAlwaysDisp.text = num.ToString(); + UISprite handCountIconSpriteAlwaysDisp = HandCountIconSpriteAlwaysDisp; + Color color = (HandCountLabelAlwaysDisp.color = ClassInfomationUIBase.GetHandCardCountColor(num)); + handCountIconSpriteAlwaysDisp.color = color; + } + + public void SetPp(int num, int max, bool isNewReplayMoveTurn = false) + { + PPLabel.text = num.ToString(); + PPMaxLabel.text = max.ToString(); + } + + public void PlayIncreasePpAnimation(int oldPp, int newPp) + { + } + + public void SetEp(int evo, int cnt) + { + if (evo > 0) + { + EpIcon.spriteName = "battle_icon_evo_off"; + EpLabel.gameObject.SetActive(value: true); + EpLabel.text = evo.ToString(); + return; + } + if (!_battleMgr.BattleEnemy.IsEpEvolveThisTurn) + { + EpIcon.spriteName = "battle_icon_evo_on"; + } + else + { + EpIcon.spriteName = "battle_icon_evo_off"; + } + EpLabel.gameObject.SetActive(value: false); + bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413; + for (int i = 0; i < 3; i++) + { + if (EpList[i] != null && EpList[i].gameObject.activeSelf) + { + if (flag) + { + EpList[i].spriteName = ((i < _battleMgr.BattleEnemy.EpTotal - cnt) ? "battle_icon_evo_off_mini" : "battle_icon_evo_on_mini"); + } + else + { + EpList[i].spriteName = ((i < cnt) ? "battle_icon_evo_on_mini" : "battle_icon_evo_off_mini"); + } + } + } + if (cnt <= 0) + { + EpIcon.spriteName = "battle_icon_evo_off"; + } + } + + public VfxBase PlayIncreaseMaxEpAnimation(int oldMaxEp, int newMaxEp) + { + return InstantVfx.Create(delegate + { + EpPanel.spriteName = GetEvoPanelSprite(isNotEpMax3: false); + EpIcon.transform.localPosition = new Vector3(8f, -3.6f, 0f); + EpList[0].transform.localPosition = new Vector3(17.1f, -59.2f, 0f); + EpList[1].transform.localPosition = new Vector3(-1.6f, -59.2f, 0f); + EpList[2].transform.localPosition = new Vector3(-20.2f, -59.2f, 0f); + EpList[2].gameObject.SetActive(value: true); + EpPanel.transform.localScale = new Vector3(0f - EpPanel.transform.localScale.x, EpPanel.transform.localScale.y, EpPanel.transform.localScale.z); + EpIcon.transform.localScale = new Vector3(0f - EpIcon.transform.localScale.x, EpIcon.transform.localScale.y, EpIcon.transform.localScale.z); + }); + } + + public VfxBase PlayIncreaseUsableEpAnimation(int oldUsableEpAmount, int amountOfUsableEpGained, int maxEp) + { + return InstantVfx.Create(delegate + { + bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413; + for (int i = oldUsableEpAmount; i < oldUsableEpAmount + amountOfUsableEpGained; i++) + { + GameMgr.GetIns().GetEffectMgr().Start(EffectMgr.EffectType.CMN_UI_EP_5, EpList[flag ? (_battleMgr.BattleEnemy.EpTotal - i - 1) : i].transform.position); + } + }); + } + + public VfxBase PlayDecreaseUsableEpAnimation(int oldUsableEpAmount, int usedEp) + { + return InstantVfx.Create(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CMN_UI_EP_6); + int num = Mathf.Max(oldUsableEpAmount - usedEp, 0); + EffectMgr effectMgr = GameMgr.GetIns().GetEffectMgr(); + bool flag = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() == 4413; + for (int i = num; i < oldUsableEpAmount; i++) + { + effectMgr.Start(EffectMgr.EffectType.CMN_UI_EP_6, EpList[flag ? (_battleMgr.BattleEnemy.EpTotal - i - 1) : i].transform.position); + } + }); + } + + public void ChangeColor(Color color, float time) + { + TweenColor.Begin(StatusPanel, time, color); + TweenColor.Begin(DeckLabel.gameObject, time, color); + TweenColor.Begin(GraveLabel.gameObject, time, color); + TweenColor.Begin(DeckIconSprite.gameObject, time, color); + TweenColor.Begin(GraveIconSprite.gameObject, time, color); + } + + public Transform GetClassInfoAnchor() + { + return base.gameObject.transform.Find("AnchorTR"); + } + + public GameObject GetPPPanel() + { + return PPPanel; + } + + public GameObject GetEPIcon() + { + return EpIcon.gameObject; + } + + private string GetEvoPanelSprite(bool isNotEpMax3) + { + string text = "battle_evo_"; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + int enemySkinId = dataMgr.GetEnemySkinId(); + if (dataMgr.IsHighRankSkinEnemy()) + { + text = text + enemySkinId + "_"; + } + else if (dataMgr.Is3DSkin(isPlayer: false)) + { + text += "uma_"; + } + else if (Global.IsSnCollabSkin(enemySkinId)) + { + text += "sn_"; + } + return text + "base_" + (isNotEpMax3 ? "02" : "01"); + } +} diff --git a/SVSim.BattleEngine/Engine/EpSetModifier.cs b/SVSim.BattleEngine/Engine/EpSetModifier.cs new file mode 100644 index 0000000..fecab59 --- /dev/null +++ b/SVSim.BattleEngine/Engine/EpSetModifier.cs @@ -0,0 +1,16 @@ +public class EpSetModifier : ICardEpModifier +{ + private readonly int m_ep; + + public bool IsClearBeforeModifier => true; + + public EpSetModifier(int ep) + { + m_ep = ep; + } + + public int CalcEp(int baseEp) + { + return m_ep; + } +} diff --git a/SVSim.BattleEngine/Engine/FieldCardCreator.cs b/SVSim.BattleEngine/Engine/FieldCardCreator.cs new file mode 100644 index 0000000..ba5e4de --- /dev/null +++ b/SVSim.BattleEngine/Engine/FieldCardCreator.cs @@ -0,0 +1,36 @@ +using UnityEngine; +using Wizard; + +public class FieldCardCreator : CardCreatorBase +{ + public FieldCardCreator(GameObject rootObject) + : base(rootObject) + { + } + + public static void SetupFieldCardMaterialToCardMesh(Transform rootCardTransform, CardParameter cardBasePrm, Material normalCardArtMaterial) + { + MeshRenderer component = rootCardTransform.transform.Find("NormalField").GetComponent(); + Transform transform = rootCardTransform.Find("Normal"); + LOD[] lODs = transform.GetComponent().GetLODs(); + UIManager.GetInstance().SetLayerRecursive(transform, 10); + Material[] sharedMaterials = lODs[0].renderers[0].sharedMaterials; + Material[] sharedMaterials2 = component.sharedMaterials; + int rarity = cardBasePrm.Rarity; + Material handFieldFrame = SBattleLoad.CardFrameMaterialHolder.GetHandFieldFrame(rarity); + Material inPlayNormalUnitFrame = SBattleLoad.CardFrameMaterialHolder.GetInPlayNormalUnitFrame(rarity); + handFieldFrame.shader = Shader.Find(handFieldFrame.shader.name); + inPlayNormalUnitFrame.shader = Shader.Find(inPlayNormalUnitFrame.shader.name); + sharedMaterials[0] = handFieldFrame; + sharedMaterials2[0] = inPlayNormalUnitFrame; + sharedMaterials[1] = (sharedMaterials2[1] = normalCardArtMaterial); + sharedMaterials[2] = CardCreatorBase.GetSharedClassIconMaterial(cardBasePrm.Clan); + for (int i = 0; i < lODs.Length; i++) + { + lODs[i].renderers[0].sharedMaterials = sharedMaterials; + } + component.sharedMaterials = sharedMaterials2; + component.materials[1].mainTextureScale = cardBasePrm.NormalTilling; + component.materials[1].mainTextureOffset = cardBasePrm.NormalOffset; + } +} diff --git a/SVSim.BattleEngine/Engine/GetDataTranslateTask.cs b/SVSim.BattleEngine/Engine/GetDataTranslateTask.cs new file mode 100644 index 0000000..a188207 --- /dev/null +++ b/SVSim.BattleEngine/Engine/GetDataTranslateTask.cs @@ -0,0 +1,26 @@ +using Cute; + +public class GetDataTranslateTask : NetworkTask +{ + public override string Url => NtDataTranslateManager.GetInstance().GetTranslateInfoUrl(); + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + string text = base.ResponseData["data"]["email_address"].ToString(); + NtDataTranslateManager.GetInstance().curBindEmail = text; + if (string.IsNullOrEmpty(text)) + { + NtDataTranslateManager.GetInstance().isTranslate = false; + } + else + { + NtDataTranslateManager.GetInstance().isTranslate = true; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/IPaymentCallback.cs b/SVSim.BattleEngine/Engine/IPaymentCallback.cs new file mode 100644 index 0000000..102ff38 --- /dev/null +++ b/SVSim.BattleEngine/Engine/IPaymentCallback.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +public interface IPaymentCallback +{ + void evInitializeSucceeded(); + + void evInitializeFailed(string error); + + void evPurchaseSucceeded(PaymentPurchase purchase); + + void evPurchaseFailed(string error); + + void evPurchaseCancelled(string error); + + void evGetProductListSucceeded(List infos); + + void evGetProductListFailed(string error); + + void evConsumePurchaseSucceeded(); + + void evConsumePurchaseSucceedediOS(); + + void evConsumePurchaseFailed(string error); +} diff --git a/SVSim.BattleEngine/Engine/LocalNotificationPriority.cs b/SVSim.BattleEngine/Engine/LocalNotificationPriority.cs new file mode 100644 index 0000000..1d1c518 --- /dev/null +++ b/SVSim.BattleEngine/Engine/LocalNotificationPriority.cs @@ -0,0 +1,5 @@ +public enum LocalNotificationPriority +{ + High = 1, + Normal +} diff --git a/SVSim.BattleEngine/Engine/Mission.cs b/SVSim.BattleEngine/Engine/Mission.cs new file mode 100644 index 0000000..9edc97c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Mission.cs @@ -0,0 +1,488 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class Mission : UIBase +{ + public enum MissionViewTab + { + NormalMission, + Achievement, + BattlePassMission + } + + public const int ONE_DAY_HOURS = 24; + + public const double CAN_CHANGE_MISSION_CHECK_MARGIN_SECONDS = 10.0; + + private static readonly Vector3 POS_SOLO_PLAY_MISSION_LABEL_CHANGE_ENABLE = new Vector3(990f, -31f, 0f); + + private static readonly Vector3 POS_SOLO_PLAY_MISSION_LABEL_CHANGE_DISABLE = new Vector3(990f, -21f, 0f); + + public static readonly int PERIOD_TEXT_SIZE_BIG = 21; + + [SerializeField] + private UIButton MissionButton; + + [SerializeField] + private UIButton AchievementButton; + + [SerializeField] + private UIButton BattlePassMissionButton; + + [SerializeField] + private UIButton ReceiveButton; + + [SerializeField] + private UILabel _labelSoloPlayMssion; + + [SerializeField] + private UIToggle _soloPlayMissionToggleUI; + + [SerializeField] + private UIEventListener _soloPlayMissionEventListener; + + [SerializeField] + private UILabel _soloPlayMssionChangeWaitTime; + + public GameObject goAchievementBaseTop; + + public GameObject goAchievementWindowBase; + + private GameObject[] scrollItems; + + private MissionViewTab _currentViewTab; + + private static MissionViewTab _transitionViewTab = MissionViewTab.NormalMission; + + [SerializeField] + private UILabel LabelMission; + + [SerializeField] + private UILabel LabelAchievement; + + [SerializeField] + private UILabel AchievementTopText; + + [SerializeField] + private UILabel _labelBgCenter; + + [SerializeField] + private GameObject _topObjMission; + + [SerializeField] + private UILabel _labelMissionChangeText; + + [SerializeField] + private GameObject _mailReceive; + + [SerializeField] + private UILabel AchievementCanReceiveCount; + + [SerializeField] + private GameObject _battlePassMontlyMissionRoot; + + [SerializeField] + private GameObject _missionAndAchievementRoot; + + [SerializeField] + private UILabel _battlePassMontlyMissionPeriodLabel; + + [SerializeField] + private SimpleScrollViewUI _battlePassMontlyMissionScrollView; + + [SerializeField] + private UIButton _btnTransitionBattlePass; + + [SerializeField] + private UILabel _labelNoBattlePassMission; + + public ResourceHandler Handler { get; private set; } + + public override void onFirstStart() + { + Handler = base.gameObject.AddMissingComponent(); + base.IsShowFooterMenu = true; + base.onFirstStart(); + SystemText systemText = Data.SystemText; + UIManager.GetInstance().CreateTopBar(base.gameObject, systemText.Get("Mission_0001"), UIManager.ViewScene.MyPage); + LabelMission.text = systemText.Get("Mission_0001"); + LabelAchievement.text = systemText.Get("Mission_0002"); + MissionButton.onClick.Clear(); + MissionButton.onClick.Add(new EventDelegate(delegate + { + OnPushTabButton(MissionViewTab.NormalMission); + })); + AchievementButton.onClick.Clear(); + AchievementButton.onClick.Add(new EventDelegate(delegate + { + OnPushTabButton(MissionViewTab.Achievement); + })); + BattlePassMissionButton.onClick.Clear(); + BattlePassMissionButton.onClick.Add(new EventDelegate(delegate + { + OnPushTabButton(MissionViewTab.BattlePassMission); + })); + _btnTransitionBattlePass.onClick.Clear(); + _btnTransitionBattlePass.onClick.Add(new EventDelegate(delegate + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.BattlePass); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + })); + UIEventListener uIEventListener = UIEventListener.Get(_soloPlayMissionEventListener.gameObject); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate + { + CreateChangeReceiveTypeConfirmDialog(); + }); + UIManager.GetInstance().SetLayerRecursive(base.transform, LayerMask.NameToLayer("MyPage")); + } + + private void OnPushTabButton(MissionViewTab viewTab) + { + if (_currentViewTab != viewTab) + { + UpdateMissionView(viewTab); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + } + } + + private void CreateChangeReceiveTypeConfirmDialog() + { + MissionInfoDetail.eMissionReceiveType receiveType; + string text; + if (Data.MissionInfo.data._missionReceiveType == MissionInfoDetail.eMissionReceiveType.normal) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + receiveType = MissionInfoDetail.eMissionReceiveType.solo; + text = Data.SystemText.Get("Mission_0083"); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_OFF); + receiveType = MissionInfoDetail.eMissionReceiveType.normal; + text = Data.SystemText.Get("Mission_0084"); + } + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("Mission_0082")); + dialogBase.SetText(text); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Mission_0085")); + dialogBase.onPushButton1 = delegate + { + MissionChangeReceiveSettingTask missionChangeReceiveSettingTask = new MissionChangeReceiveSettingTask(); + missionChangeReceiveSettingTask.SetParameter(receiveType); + StartCoroutine(Toolbox.NetworkManager.Connect(missionChangeReceiveSettingTask, delegate + { + UpdateMissionView(MissionViewTab.NormalMission); + })); + }; + } + + private void SetMissionTypeToggleBtn(MissionInfoDetail.eMissionReceiveType type) + { + _soloPlayMissionToggleUI.value = type == MissionInfoDetail.eMissionReceiveType.solo; + bool flag = Data.MissionInfo.data.CanChangeReceiveType; + TimeSpan timeSpan = default(TimeSpan); + if (!flag) + { + timeSpan = TimeSpan.FromSeconds(Data.MissionInfo.data.WaitTimeCanChangeReceiveType - GameMgr.GetIns().GetMissionInfoTask().NowUnixTime()); + flag = timeSpan.TotalSeconds < -10.0; + } + _soloPlayMssionChangeWaitTime.gameObject.SetActive(!flag); + UIManager.SetObjectToGrey(_soloPlayMissionEventListener.gameObject, !flag); + _soloPlayMissionToggleUI.activeSprite.alpha = (_soloPlayMissionToggleUI.value ? 1f : 0f); + _labelSoloPlayMssion.transform.localPosition = (flag ? POS_SOLO_PLAY_MISSION_LABEL_CHANGE_ENABLE : POS_SOLO_PLAY_MISSION_LABEL_CHANGE_DISABLE); + if (!flag) + { + int num = timeSpan.Hours; + int num2 = timeSpan.Minutes; + if (num <= 0 && num2 <= 0) + { + num = 0; + num2 = 1; + } + _soloPlayMssionChangeWaitTime.text = Data.SystemText.Get("Mission_0081", num.ToString("00"), num2.ToString("00")); + } + } + + public static void ChangeViewSceneTransitionMissionViewTab(MissionViewTab viewTab) + { + _transitionViewTab = viewTab; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mission); + } + + protected override void onOpen() + { + base.onOpen(); + if (_currentViewTab != _transitionViewTab) + { + _currentViewTab = _transitionViewTab; + ResetTransitionViewTab(); + } + bool flag = Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.BATTLE_PASS); + UIManager.SetObjectToGrey(BattlePassMissionButton.gameObject, flag); + if (flag && _currentViewTab == MissionViewTab.BattlePassMission) + { + _currentViewTab = MissionViewTab.NormalMission; + } + UpdateMissionView(_currentViewTab); + UIManager.GetInstance().OnReadyViewScene(isFadein: true); + int canReceiveAchievementRewards = GetCanReceiveAchievementRewards(); + AchievementCanReceiveCount.gameObject.SetActive(canReceiveAchievementRewards > 0); + AchievementCanReceiveCount.text = canReceiveAchievementRewards.ToString(); + } + + private void ResetTransitionViewTab() + { + _transitionViewTab = MissionViewTab.NormalMission; + } + + private void UpdateMissionView(MissionViewTab viewTab) + { + switch (viewTab) + { + case MissionViewTab.NormalMission: + changeMission(); + break; + case MissionViewTab.Achievement: + changeAchievement(); + break; + case MissionViewTab.BattlePassMission: + ChangeBattlePassMission(); + break; + } + } + + public override bool IsUseCommonBackground() + { + return true; + } + + public void changeMission() + { + setScene(MissionViewTab.NormalMission); + ReceiveButton.gameObject.SetActive(value: false); + _soloPlayMissionToggleUI.gameObject.SetActive(value: true); + SetMissionTypeToggleBtn(Data.MissionInfo.data._missionReceiveType); + bool flag = Data.MissionInfo.data._isChangeMission; + long num = GameMgr.GetIns().GetMissionInfoTask().NowUnixTime(); + TimeSpan timeSpan = TimeSpan.FromSeconds(Data.MissionInfo.data._canChangeMissionTime - num); + if (!flag) + { + flag = timeSpan.TotalSeconds < -10.0; + } + List user_mission_list = Data.MissionInfo.data.user_mission_list; + scrollItems = new GameObject[user_mission_list.Count]; + int num2 = 0; + foreach (UserMission item in user_mission_list) + { + if (item.end_time <= 0 || item.GetMissionPeriodSec(num) > 0) + { + GameObject gameObject = UnityEngine.Object.Instantiate(goAchievementWindowBase); + scrollItems[num2] = gameObject; + scrollItems[num2].transform.parent = goAchievementBaseTop.transform; + scrollItems[num2].transform.localPosition = Vector3.zero; + scrollItems[num2].transform.localScale = Vector3.one; + scrollItems[num2].SetActive(value: true); + gameObject.GetComponent().SetMission(item, Handler, flag, enableSeparator: false, displayChange: true, delegate + { + UpdateMissionView(MissionViewTab.NormalMission); + }); + num2++; + } + } + if (flag) + { + _labelMissionChangeText.text = Data.SystemText.Get("Mission_0036"); + } + else + { + int num3 = timeSpan.Hours; + int num4 = timeSpan.Minutes; + if (timeSpan.TotalHours >= 24.0) + { + num3 = 24; + num4 = 0; + } + else if (num3 <= 0 && num4 <= 0) + { + num3 = 0; + num4 = 1; + } + _labelMissionChangeText.text = Data.SystemText.Get("Mission_0031", num3.ToString("00"), num4.ToString("00")); + } + _topObjMission.gameObject.SetActive(value: true); + DisplayScrollItems(); + _labelBgCenter.gameObject.SetActive(value: false); + AchievementTopText.gameObject.SetActive(value: false); + } + + public void changeAchievement() + { + setScene(MissionViewTab.Achievement); + scrollItems = new GameObject[Data.MissionInfo.data.user_achievement_list.Count]; + int num = 0; + int num2 = 0; + foreach (UserAchievement item in Data.MissionInfo.data.user_achievement_list) + { + scrollItems[num] = UnityEngine.Object.Instantiate(goAchievementWindowBase); + scrollItems[num].transform.parent = goAchievementBaseTop.transform; + scrollItems[num].transform.localPosition = Vector3.zero; + scrollItems[num].transform.localScale = Vector3.one; + scrollItems[num].SetActive(value: true); + AchievementWindowBase component = scrollItems[num].GetComponent(); + component.SetAchievement(item, Handler, delegate + { + UpdateMissionView(MissionViewTab.Achievement); + }); + if (item.achievement_status == 1) + { + num2++; + } + component.type = item.achievement_type; + component.iType = num; + component.level = item.level; + num++; + } + AchievementCanReceiveCount.gameObject.SetActive(num2 > 0); + AchievementCanReceiveCount.text = num2.ToString(); + AchievementTopText.text = Data.SystemText.Get("Mission_0021", num2.ToString()); + AchievementTopText.gameObject.SetActive(value: true); + _topObjMission.SetActive(value: false); + _soloPlayMissionToggleUI.gameObject.SetActive(value: false); + ReceiveButton.gameObject.SetActive(value: true); + UIManager.SetObjectToGrey(ReceiveButton.gameObject, num2 == 0); + ReceiveButton.onClick.Clear(); + ReceiveButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ReceiveAllAchievementRewards(); + })); + goAchievementWindowBase.SetActive(value: false); + DisplayScrollItems(); + _labelBgCenter.gameObject.SetActive(value: false); + } + + private void ChangeBattlePassMission() + { + setScene(MissionViewTab.BattlePassMission); + BattlePassMonthlyMission monthlyMission = Data.MissionInfo.data.BattlePassMonthlyMissionData; + bool flag = monthlyMission != null; + _battlePassMontlyMissionScrollView.gameObject.SetActive(flag); + _battlePassMontlyMissionPeriodLabel.gameObject.SetActive(flag); + _btnTransitionBattlePass.gameObject.SetActive(flag); + _labelNoBattlePassMission.gameObject.SetActive(!flag); + if (flag) + { + _battlePassMontlyMissionScrollView.CreateScrollView(monthlyMission.MissionList.Count, delegate(int index, GameObject plate) + { + plate.GetComponent().SetBttlePassMonthlyMission(monthlyMission.MissionList[index], Handler); + }); + DateTime? dateTime = ConvertTime.GetDateTime(monthlyMission.EndDate); + if (dateTime.HasValue) + { + string remainingTime = ConvertTime.GetRemainingTime(ConvertTime.GetTimeSpan(GameMgr.GetIns().GetMissionInfoTask().NowUnixTime(), dateTime.Value)); + _battlePassMontlyMissionPeriodLabel.text = remainingTime; + _battlePassMontlyMissionPeriodLabel.fontSize = PERIOD_TEXT_SIZE_BIG; + _battlePassMontlyMissionPeriodLabel.color = LabelDefine.TEXT_COLOR_ORANGE; + } + else + { + _battlePassMontlyMissionPeriodLabel.text = Data.SystemText.Get("BattlePass_0007", ConvertTime.GetLocalPeriod(monthlyMission.StartDate, monthlyMission.EndDate)); + } + } + } + + private void setScene(MissionViewTab next_scene) + { + if (scrollItems != null) + { + for (int i = 0; i < scrollItems.Length; i++) + { + if ((bool)scrollItems[i]) + { + UnityEngine.Object.Destroy(scrollItems[i]); + } + } + scrollItems = null; + } + goAchievementBaseTop.GetComponent().repositionNow = true; + goAchievementBaseTop.GetComponent().ResetPosition(); + UpdateTabSprite(next_scene); + _battlePassMontlyMissionRoot.SetActive(next_scene == MissionViewTab.BattlePassMission); + _missionAndAchievementRoot.SetActive(next_scene != MissionViewTab.BattlePassMission); + AchievementTopText.gameObject.SetActive(next_scene == MissionViewTab.Achievement); + _topObjMission.SetActive(next_scene == MissionViewTab.NormalMission); + _currentViewTab = next_scene; + } + + private void UpdateTabSprite(MissionViewTab scene) + { + switch (scene) + { + case MissionViewTab.NormalMission: + MissionButton.normalSprite = MissionButton.pressedSprite; + AchievementButton.normalSprite = AchievementButton.disabledSprite; + BattlePassMissionButton.normalSprite = BattlePassMissionButton.disabledSprite; + break; + case MissionViewTab.Achievement: + MissionButton.normalSprite = MissionButton.disabledSprite; + AchievementButton.normalSprite = AchievementButton.pressedSprite; + BattlePassMissionButton.normalSprite = BattlePassMissionButton.disabledSprite; + break; + case MissionViewTab.BattlePassMission: + MissionButton.normalSprite = MissionButton.disabledSprite; + AchievementButton.normalSprite = AchievementButton.disabledSprite; + BattlePassMissionButton.normalSprite = BattlePassMissionButton.pressedSprite; + break; + } + } + + private void DisplayScrollItems() + { + goAchievementBaseTop.GetComponent().repositionNow = true; + goAchievementBaseTop.GetComponent().ResetPosition(); + } + + public void ReceiveAndDisplayRewards(GameObject obj, GameObject prefab, List rewards) + { + obj.AddMissingComponent().ShowReadDialog(rewards, prefab, obj, Handler); + MyPageMenu.Instance.UpdateMissionCount(); + } + + private void ReceiveAllAchievementRewards() + { + AchievementReceiveRewardTask achievementReceiveRewardTask = new AchievementReceiveRewardTask(); + achievementReceiveRewardTask.SetParameter(0, 0); + StartCoroutine(Toolbox.NetworkManager.Connect(achievementReceiveRewardTask, OnRequestAllAchievementReward, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + private void OnRequestAllAchievementReward(NetworkTask.ResultCode error) + { + ReceiveAndDisplayRewards(base.gameObject, _mailReceive, Data.MissionInfo.data.total_reward_list); + UpdateMissionView(MissionViewTab.Achievement); + } + + protected override void onClose() + { + base.onClose(); + Handler.UnloadAll(); + _currentViewTab = MissionViewTab.NormalMission; + ResetTransitionViewTab(); + } + + private int GetCanReceiveAchievementRewards() + { + int num = 0; + foreach (UserAchievement item in Data.MissionInfo.data.user_achievement_list) + { + if (item.achievement_status == 1) + { + num++; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkAIBattleSetupCardEvent.cs b/SVSim.BattleEngine/Engine/NetworkAIBattleSetupCardEvent.cs new file mode 100644 index 0000000..79e716a --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkAIBattleSetupCardEvent.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +public class NetworkAIBattleSetupCardEvent : NetworkBattleSetupCardEvent +{ + public NetworkAIBattleSetupCardEvent(BattleManagerBase manager, RegisterActionManager registerCardList, NetworkBattleData data) + : base(manager, registerCardList, data) + { + } + + public override void SetupCardEvent(BattleManagerBase mgr, RegisterActionManager actionManager, BattleCardBase card, List registerUnapprovedList) + { + } + + public override void SetupCardSkillEvent(BattleCardBase card) + { + } +} diff --git a/SVSim.BattleEngine/Engine/NetworkNullLogger.cs b/SVSim.BattleEngine/Engine/NetworkNullLogger.cs new file mode 100644 index 0000000..bf60c10 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NetworkNullLogger.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; + +public class NetworkNullLogger : INetworkLogger, IEnumerable, IEnumerable +{ + public void LogInfo(string text) + { + } + + public void LogError(string text) + { + } + + public void LogWarning(string text) + { + } + + public void ClearLog() + { + } + + public IEnumerator GetEnumerator() + { + yield break; + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } +} diff --git a/SVSim.BattleEngine/Engine/NtDataTranslate.cs b/SVSim.BattleEngine/Engine/NtDataTranslate.cs new file mode 100644 index 0000000..44b6c06 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NtDataTranslate.cs @@ -0,0 +1,59 @@ +using Cute; +using UnityEngine; + +public class NtDataTranslate : MonoBehaviour +{ + [SerializeField] + private TitleUI _titleUI; + + public GameObject BtnTranslate; + + public NtDataTranslateInput InputObj; + + public UILabel TxtTranslate; + + public static NtDataTranslate Instance; + + private void Start() + { + initUI(); + requestData(); + } + + private void initUI() + { + Instance = this; + initEventListener(); + } + + private void initEventListener() + { + UIEventListener.Get(BtnTranslate).onClick = onClickTranslate; + } + + private void requestData() + { + NtDataTranslateManager.GetInstance().GetTranslateInfo(); + } + + private void onClickTranslate(GameObject btn) + { + if (!_titleUI.IsEnableClickButton()) + { + return; + } + GetDataTranslateTask task = new GetDataTranslateTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + NtDataTranslateManager instance = NtDataTranslateManager.GetInstance(); + if (instance.isTranslate) + { + instance.ShowRebind(); + } + else + { + instance.ShowMainNotice(instance.HongKongMacaoUserConfirm); + } + })); + } +} diff --git a/SVSim.BattleEngine/Engine/NtDataTranslateInput.cs b/SVSim.BattleEngine/Engine/NtDataTranslateInput.cs new file mode 100644 index 0000000..cba8d91 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NtDataTranslateInput.cs @@ -0,0 +1,96 @@ +using System; +using System.Text.RegularExpressions; +using Cute; +using UnityEngine; + +public class NtDataTranslateInput : MonoBehaviour +{ + public UIInput InputEmail1; + + public UIInput InputEmail2; + + public UILabel TxtEmailTitle1; + + public UILabel TxtEmailTitle2; + + public UILabel TxtEmailTip; + + public string EmailAddress; + + private NtDataTranslateInfo info; + + private void Start() + { + initUI(); + initEventListener(); + } + + private void initUI() + { + info = NtDataTranslateManager.GetInstance().TranslateInfo; + TxtEmailTitle1.text = info.emailAddress1; + TxtEmailTitle2.text = info.emailAddress2; + TxtEmailTip.text = string.Empty; + } + + private void initEventListener() + { + EventDelegate.Add(InputEmail1.onChange, onValueChange); + EventDelegate.Add(InputEmail2.onChange, onValueChange); + } + + private void onValueChange() + { + if (checkInput().Equals(info.emailAddressTip1)) + { + if (!string.IsNullOrEmpty(InputEmail2.value)) + { + TxtEmailTip.text = checkInput(); + } + else + { + TxtEmailTip.text = ""; + } + } + else + { + TxtEmailTip.text = checkInput(); + } + } + + private string checkInput() + { + string result = string.Empty; + string value = InputEmail1.value; + string value2 = InputEmail2.value; + if (string.IsNullOrEmpty(value)) + { + result = info.emailAddressTip2; + } + else if (!Regex.IsMatch(value, "(?i)^([a-z0-9\\+_\\-]+)(\\.[a-z0-9\\+_\\-]+)*@([a-z0-9\\-]+\\.)+[a-z]{2,6}$")) + { + result = info.emailAddressTip2; + } + else if (!value2.Equals(value)) + { + result = info.emailAddressTip1; + } + return result; + } + + public void UpLoadEmail(Action callback) + { + string text = checkInput(); + if (string.IsNullOrEmpty(text)) + { + EmailAddress = InputEmail1.value; + callback.Call(); + return; + } + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(info.ERROR_TITLE); + dialogBase.SetText(text); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dialogBase.SetPanelDepth(6000); + } +} diff --git a/SVSim.BattleEngine/Engine/NullBattlePlayerVfxCreator.cs b/SVSim.BattleEngine/Engine/NullBattlePlayerVfxCreator.cs new file mode 100644 index 0000000..777485f --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullBattlePlayerVfxCreator.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +public class NullBattlePlayerVfxCreator : IBattlePlayerVfxCreator +{ + public VfxBase CreateUsePp(int pp, int maxPp, Vector3 labelPosition, bool newReplayMoveTurn) + { + return NullVfx.GetInstance(); + } + + public VfxBase CreateUseBp(int bp, int deltaBp, Func getPosition, bool isVariableCost, bool isSelf) + { + return NullVfx.GetInstance(); + } + + public VfxBase CreateUpdateEp(int evolCount, int evolveWaitTurnCount) + { + return NullVfx.GetInstance(); + } + + public VfxBase CreateCardDraw(IEnumerable cards, bool isOpenDrawSkill = false) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/NullClassInfomationUI.cs b/SVSim.BattleEngine/Engine/NullClassInfomationUI.cs new file mode 100644 index 0000000..b2fb891 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullClassInfomationUI.cs @@ -0,0 +1,71 @@ +using UnityEngine; +using Wizard.Battle.UI; +using Wizard.Battle.View.Vfx; + +public class NullClassInfomationUI : IClassInfomationUI +{ + private static NullClassInfomationUI _instance; + + public static NullClassInfomationUI GetInstance() + { + if (_instance == null) + { + _instance = new NullClassInfomationUI(); + } + return _instance; + } + + protected NullClassInfomationUI() + { + } + + public void ShowInfomation(bool playEffect) + { + } + + public void NewReplayUpdateInfomation(NetworkBattleReceiver.ClassInfoUiInfo classInfo) + { + } + + public void HideInfomation() + { + } + + public void HideOtherInfomation() + { + } + + public void HideAllInfomation() + { + } + + public VfxBase LoadResources(Transform parent, bool isPlayer) + { + return NullVfx.GetInstance(); + } + + public void SetUpEvent(BattlePlayerBase player) + { + } + + public void Recovery() + { + } + + public GameObject GetInfomationUI() + { + return null; + } + + public void SetIsSelect(bool flg) + { + } + + public void SetInCardFocus(bool flg) + { + } + + public void SetTouchable(bool flag) + { + } +} diff --git a/SVSim.BattleEngine/Engine/NullNotMulliganEndToJudgeChecker.cs b/SVSim.BattleEngine/Engine/NullNotMulliganEndToJudgeChecker.cs new file mode 100644 index 0000000..27719bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullNotMulliganEndToJudgeChecker.cs @@ -0,0 +1,18 @@ +public class NullNotMulliganEndToJudgeChecker : NotMulliganEndToJudgeChecker +{ + protected override void IntervalCheck() + { + } + + public override void StartChecker(string log = "") + { + } + + public override void FinishChecker() + { + } + + public override void StopChecker() + { + } +} diff --git a/SVSim.BattleEngine/Engine/NullNotTurnEndToLoseChecker.cs b/SVSim.BattleEngine/Engine/NullNotTurnEndToLoseChecker.cs new file mode 100644 index 0000000..b01651d --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullNotTurnEndToLoseChecker.cs @@ -0,0 +1,23 @@ +public class NullNotTurnEndToLoseChecker : NotTurnEndToLoseChecker +{ + public NullNotTurnEndToLoseChecker(NetworkBattleManagerBase manager) + : base(manager) + { + } + + public override void StopChecker() + { + } + + protected override void IntervalCheck() + { + } + + public override void StartChecker(string log = "") + { + } + + public override void FinishChecker() + { + } +} diff --git a/SVSim.BattleEngine/Engine/NullNotTurnStartToLoseChecker.cs b/SVSim.BattleEngine/Engine/NullNotTurnStartToLoseChecker.cs new file mode 100644 index 0000000..51d8f86 --- /dev/null +++ b/SVSim.BattleEngine/Engine/NullNotTurnStartToLoseChecker.cs @@ -0,0 +1,18 @@ +public class NullNotTurnStartToLoseChecker : NotTurnStartToLoseChecker +{ + public override void StopChecker() + { + } + + protected override void IntervalCheck() + { + } + + public override void FinishChecker() + { + } + + public override void StartChecker(string log = "") + { + } +} diff --git a/SVSim.BattleEngine/Engine/OmotePlugin.cs b/SVSim.BattleEngine/Engine/OmotePlugin.cs new file mode 100644 index 0000000..de7a46d --- /dev/null +++ b/SVSim.BattleEngine/Engine/OmotePlugin.cs @@ -0,0 +1,506 @@ +using System; +using UnityEngine; + +public class OmotePlugin : MonoBehaviour +{ + public delegate void OnNotifyEnabledReceivedEventHandler(bool enabled); + + public delegate void OnUnregisterReceivedEventHandler(bool isSuccess); + + [Serializable] + private class OmotenashiFirebaseOptions + { + public string ApiKey; + + public string ProjectId; + + public string ApplicationId; + + public string SenderId; + } + + public delegate void OmoteEventHandler(object sender, TEventArgs e) where TEventArgs : EventArgs; + + public class RequestResultEventArgs : EventArgs + { + internal class RawData + { + public int type; + + public int result; + + public string body; + + public string endpoint; + + public int statusCode; + + public string reason; + } + + public int Type { get; private set; } + + public int Result { get; private set; } + + public string Body { get; private set; } + + public string EndPoint { get; private set; } + + public int StatusCode { get; private set; } + + public string Reason { get; private set; } + + internal RequestResultEventArgs(RawData data) + { + Type = data.type; + Result = data.result; + Body = data.body; + EndPoint = data.endpoint; + StatusCode = data.statusCode; + Reason = data.reason; + } + } + + public class LocalNotification + { + private static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); + + public string Message { get; private set; } + + public DateTime When { get; private set; } + + public string LabelId { get; private set; } + + public LocalNotificationPriority Priority { get; set; } + + public int NotificationId { get; set; } + + public string Title { get; set; } + + public string ExtraText { get; set; } + + public string ImagePath { get; set; } + + public LocalNotification(string message, DateTime when, string labelId) + { + if (message == null) + { + throw new ArgumentNullException("message"); + } + if (labelId == null) + { + throw new ArgumentNullException("labelId"); + } + Message = message; + When = when; + LabelId = labelId; + Priority = LocalNotificationPriority.Normal; + ExtraText = string.Empty; + } + + public void Schedule() + { + _ = (When.ToUniversalTime() - UnixEpoch).TotalSeconds; + } + + public void Cancel() + { + Cancel(LabelId); + } + + public static void Cancel(string labelId) + { + if (labelId == null) + { + OmoteLog.Error("labelId must not be null."); + } + } + + public static void CancelAll() + { + } + } + + public class RegistrationTokenEventArgs : EventArgs + { + public string RegistrationToken { get; set; } + } + + public class PushNotificationEventArgs : EventArgs + { + internal class RawData + { + public string id; + + public string message; + + public string extra; + } + + public string Id { get; private set; } + + public string Message { get; private set; } + + public string Extra { get; private set; } + + internal PushNotificationEventArgs(RawData data) + { + Id = data.id; + Message = data.message; + Extra = data.extra; + } + + public override string ToString() + { + return $"Id={Id}, Message={Message}, Extra={Extra}"; + } + } + + public class LocalNotificationEventArgs : EventArgs + { + internal class RawData + { + public string scheduleId; + + public string label; + + public string scheduled; + + public string message; + + public string extra; + } + + public string ScheduleId { get; private set; } + + public string LabelId { get; private set; } + + public DateTime ScheduledAt { get; private set; } + + public string MessageText { get; private set; } + + public string ExtraText { get; private set; } + + internal LocalNotificationEventArgs(RawData data) + { + ScheduleId = data.scheduleId; + LabelId = data.label; + ScheduledAt = DateTime.Parse(data.scheduled); + MessageText = data.message; + ExtraText = data.extra; + } + + public override string ToString() + { + return $"MessageText={MessageText}, ScheduledAt={ScheduledAt}, LabelId={LabelId}, ScheduleId={ScheduleId}, ExtraText={ExtraText}"; + } + } + + public class NotificationChangedEventArgs : EventArgs + { + internal class RawData + { + public bool result; + } + + public bool Result { get; private set; } + + internal NotificationChangedEventArgs(RawData data) + { + Result = data.result; + } + + public override string ToString() + { + return $"Result={Result}"; + } + } + + public delegate void OnRegistrationTokenReceivedEventHandler(object sender, RegistrationTokenEventArgs e); + + public delegate void OnFailToRegisterForRemoteNotificationsEventHandler(object sender, string e); + + [SerializeField] + private OmotenashiFirebaseOptions omotenashiFirebaseOptions; + + [SerializeField] + private bool IsAutomatic = true; + + public string country; + + public event OnNotifyEnabledReceivedEventHandler OnNotificationReceived; + + public event OnUnregisterReceivedEventHandler OnUnregisterReceived; + + public event OmoteEventHandler OnRequestResult; + + public event OnRegistrationTokenReceivedEventHandler OnRegistrationTokenReceived; + + public event OmoteEventHandler OnReceivedPushNotification; + + public event OmoteEventHandler OnReceivedLocalNotification; + + public event OmoteEventHandler OnLaunchFromPushNotification; + + public event OmoteEventHandler OnLaunchFromLocalNotification; + + public event OmoteEventHandler OnNotificationEnableChanged; + + public event OmoteEventHandler OnNotificationCountryChanged; + + public event OnFailToRegisterForRemoteNotificationsEventHandler OnFailToRegisterForRemoteNotifications; + + private void Awake() + { + } + + private void AwakePush(OmotenashiFirebaseOptions options, AndroidJavaObject baseObject) + { + } + + private void Start() + { + StartPush(); + } + + private void StartPush() + { + if (string.IsNullOrEmpty(country)) + { + OmoteLog.Error("Country code is not set."); + } + } + + public void SetSandbox(bool isSandbox) + { + OmoteLog.Info("setDebugMode(isDebuggable: {0}) called.", isSandbox); + } + + public void SetDebugLogEnabled(bool isEnabled) + { + OmoteLog.SetEnable(isEnabled); + OmoteLog.Info("setDebugLogEnabled(isEnabled: {0}) called.", isEnabled); + } + + public void SendConversion(string appViewerId) + { + if (string.IsNullOrEmpty(appViewerId)) + { + OmoteLog.Error("appViewerId is not set."); + return; + } + OmoteLog.Info("SendConversion(appViewerId: {0}) called.", appViewerId); + } + + public void SendSession(string userId, string deviceId) + { + OmoteLog.Info("SendSession({0}, {1}) called.", userId, deviceId); + } + + public void SetRequestEnabled(bool isEnabled) + { + } + + public bool IsRequestEnabled() + { + return true; + } + + public void CallbackUnregister(string isSuccess) + { + if (this.OnUnregisterReceived != null) + { + if (isSuccess.Equals("Success")) + { + OmoteLog.Info("Unregister: Success"); + this.OnUnregisterReceived(isSuccess: true); + } + else if (isSuccess.Equals("Fail")) + { + OmoteLog.Info("Unregister: Fail"); + this.OnUnregisterReceived(isSuccess: false); + } + else + { + OmoteLog.Info("Unregister: unknown {0}", isSuccess); + this.OnUnregisterReceived(isSuccess: false); + } + } + else + { + OmoteLog.Info("Unregister: delegate is null"); + } + } + + public void GetNotificationEnabled() + { + if (this.OnNotificationReceived != null) + { + this.OnNotificationReceived(enabled: true); + } + } + + private void InvokeFromJson(string json, Func argsCreator, OmoteEventHandler action) where TArg : EventArgs + { + OmoteLog.Info("{0}", json); + TRaw arg = JsonUtility.FromJson(json); + TArg val = argsCreator(arg); + OmoteLog.Info("{0}", val); + action?.Invoke(this, val); + } + + public void CallStartPush() + { + StartPush(); + } + + public void Unregister(bool isLocalOnly) + { + CallbackUnregister("Success"); + } + + private void CallbackOnRequestResult(string json) + { + OmoteLog.Info("CallbackOnRequestResult."); + InvokeFromJson(json, (RequestResultEventArgs.RawData raw) => new RequestResultEventArgs(raw), this.OnRequestResult); + } + + private void OnApplicationPause(bool pause) + { + } + + public bool CanScheduleExactAlarms() + { + return true; + } + + public void RescheduleLocalNotification() + { + } + + public void OpenExactAlarmSettings() + { + } + + [Obsolete("Use LocalNotificationBuilder.")] + public void ScheduleLocalNotification(string messageText, DateTime dateTime, string labelId, LocalNotificationPriority priority, int notificationId) + { + ScheduleLocalNotification(messageText, dateTime, labelId, priority, notificationId, string.Empty); + } + + [Obsolete("Use LocalNotificationBuilder.")] + public void ScheduleLocalNotification(string messageText, DateTime date, string labelId, LocalNotificationPriority priority, int notificationId, string extraText) + { + LocalNotification localNotification = new LocalNotification(messageText, date, labelId); + localNotification.Priority = priority; + localNotification.NotificationId = notificationId; + localNotification.ExtraText = extraText; + localNotification.Schedule(); + } + + [Obsolete("Use OmotePlugin.Localnotification.Cancel(string)")] + public void CancelLocalNotification(string labelId) + { + LocalNotification.Cancel(labelId); + } + + [Obsolete("Use OmotePlugin.Localnotificatin.CancelAll()")] + public void CancelAllLocalNotification() + { + LocalNotification.CancelAll(); + } + + private void OnApnsTokenReceived(string token) + { + } + + public void SetNotificationsEnabled(bool enabled) + { + } + + public bool IsNotificationsEnabled() + { + return false; + } + + public void UpdateCountry(string country) + { + if (string.IsNullOrEmpty(country)) + { + OmoteLog.Error("country must not be null nor empty."); + } + } + + public void RegisterForRemoteNotification() + { + } + + public bool isNotificationAuthorized() + { + return true; + } + + public void RequestNotificationPermission() + { + } + + private void CallbackOnTokenReceived(string token) + { + if (!string.IsNullOrEmpty(token)) + { + RegistrationTokenEventArgs e = new RegistrationTokenEventArgs + { + RegistrationToken = token + }; + if (this.OnRegistrationTokenReceived != null) + { + this.OnRegistrationTokenReceived(this, e); + } + } + } + + private void CallbackOnReceivedPushNotificationInForeground(string json) + { + OmoteLog.Info("CallbackOnReceivedPushNotificationInForeground."); + InvokeFromJson(json, (PushNotificationEventArgs.RawData raw) => new PushNotificationEventArgs(raw), this.OnReceivedPushNotification); + } + + private void CallbackOnReceivedLocalNotificationInForeground(string json) + { + OmoteLog.Info("CallbackOnReceivedLocalNotificationInForeground."); + InvokeFromJson(json, (LocalNotificationEventArgs.RawData raw) => new LocalNotificationEventArgs(raw), this.OnReceivedLocalNotification); + } + + private void CallbackOnLaunchFromPushNotification(string json) + { + OmoteLog.Info("CallbackOnLaunchFromPushNotification."); + InvokeFromJson(json, (PushNotificationEventArgs.RawData raw) => new PushNotificationEventArgs(raw), this.OnLaunchFromPushNotification); + } + + private void CallbackOnLaunchFromLocalNotification(string json) + { + OmoteLog.Info("CallbackOnLaunchFromLocalNotification."); + InvokeFromJson(json, (LocalNotificationEventArgs.RawData raw) => new LocalNotificationEventArgs(raw), this.OnLaunchFromLocalNotification); + } + + private void CallbackOnNotificationEnableChanged(string json) + { + OmoteLog.Info("CallbackOnNotificationEnableChanged."); + InvokeFromJson(json, (NotificationChangedEventArgs.RawData raw) => new NotificationChangedEventArgs(raw), this.OnNotificationEnableChanged); + } + + private void CallbackOnNotificationCountryChanged(string json) + { + OmoteLog.Info("CallbackOnNotificationCountryChanged"); + InvokeFromJson(json, (NotificationChangedEventArgs.RawData raw) => new NotificationChangedEventArgs(raw), this.OnNotificationCountryChanged); + } + + private void CallbackOnFailToRegisterForRemoteNotifications(string errorString) + { + OmoteLog.Info("CallbackOnFailToRegisterForRemoteNotifications."); + if (errorString != null && this.OnFailToRegisterForRemoteNotifications != null) + { + this.OnFailToRegisterForRemoteNotifications(this, errorString); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Payment.cs b/SVSim.BattleEngine/Engine/Payment.cs new file mode 100644 index 0000000..6df1403 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Payment.cs @@ -0,0 +1,43 @@ +using Wizard; + +public static class Payment +{ + private static bool initialized; + + public static void initialize(PaymentImpl callback, string productKey) + { + PaymentImpl.GetInstance().paymentUI.StartLoading(); + _ = initialized; + initialized = true; + } + + public static void finalize() + { + if (initialized) + { + initialized = false; + } + } + + public static void purchaseProduct(string productId, PaymentBase.RefundWarningType refundWarningType) + { + RefundWarningDialog.Start(refundWarningType, delegate + { + PaymentImpl.GetInstance().paymentUI.StartLoading(useTimeCount: true); + }); + } + + public static void getProductList(string[] productIds) + { + PaymentImpl.GetInstance().paymentUI.StartLoading(useTimeCount: true, forProductListInit: true); + } + + public static void consumePurchase(string[] productIds, string orderId) + { + PaymentImpl.GetInstance().paymentUI.StartLoading(useTimeCount: true); + } + + public static void UseDebugLog(bool useDebugLog) + { + } +} diff --git a/SVSim.BattleEngine/Engine/PaymentBase.cs b/SVSim.BattleEngine/Engine/PaymentBase.cs new file mode 100644 index 0000000..6010f4c --- /dev/null +++ b/SVSim.BattleEngine/Engine/PaymentBase.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +public class PaymentBase : MonoBehaviour +{ + public enum RefundWarningType + { + NONE, + WARNING, + PENALTY + } + + protected bool IsAlertAgree; + + protected void CallPaymentStartFromAlert(string ProductId) + { + IsAlertAgree = true; + purchaceStart(ProductId, isFromAlert: true); + } + + public virtual void purchaceStart(string ProductId, bool isFromAlert = false) + { + } +} diff --git a/SVSim.BattleEngine/Engine/PaymentImpl.cs b/SVSim.BattleEngine/Engine/PaymentImpl.cs new file mode 100644 index 0000000..7b7e6b5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PaymentImpl.cs @@ -0,0 +1,585 @@ +using System; +using System.Collections.Generic; +using Cute; +using Cute.Payment; +using UnityEngine; +using Wizard; + +public class PaymentImpl : PaymentBase, IPaymentCallback, IPaymentCommonCallback +{ + public enum PaymentOriginalScreen + { + SHOP_PLUS, + MYPAGE, + NONE + } + + public List ProductIdList; + + public List IdList; + + public Dictionary ProductPriceList; + + public Dictionary FormatProductPriceList; + + public Dictionary ProductNameList; + + public Dictionary ProductTextList; + + public Dictionary ProductPurchaseLimitList; + + public Dictionary ProductPurchaseNumberList; + + public Dictionary ProductCsvIdList; + + public Dictionary ProductImageNameList; + + public Dictionary ProductIsSpecialShop; + + public Dictionary ProductCurrentPurchaseCount; + + public Dictionary ProductPurchaseLimitCount; + + public Dictionary ProductEndTime; + + private string lastErrorMethod; + + private string lastErrorMessage; + + private long lastLogTimeTicks = DateTime.Now.Ticks; + + private int sameLogCount; + + public PaymentOriginalScreen PaymentFromScreen; + + public List skuInfos; + + public string selectedStoreProductId; + + public List lastSucceededPurchases = new List(); + + public int resumePurchaseTransactionCount; + + public bool inProcessingResumePurchaseTransaction; + + public bool inProcessingPurchaseTransaction; + + public bool isPaymentListErrorDialogOpen; + + private bool _receivePaymentSuccess; + + private bool _receivePaymentCancel; + + private static PaymentImpl instance; + + private bool isCountTime; + + private bool isCountTimeForProductListInit; + + private float timer; + + public string StoreProductCountryCode { get; private set; } + + public string StoreProductCurrencyCode { get; private set; } + + public bool IsRefundedReceipt { get; private set; } + + public PaymentUI paymentUI { get; private set; } + + public event Action ProductListSucceeded; + + public event Action ProductListFailed; + + public event Action FinishFailureEvent; + + public event Action purchaseFinishSuccessEvent; + + public event Action purchaseFinishHttpErrorEvent; + + public event Action purchaseFinishResultCodeErrorEvent; + + public event Action purchaseRetryResultEvent; + + public event Action ConsumePurchaseSucceeded; + + private void Awake() + { + if (paymentUI == null) + { + paymentUI = new PaymentUI(); + } + } + + private void Update() + { + if (isCountTime) + { + checkTimeOut(); + } + } + + public static PaymentImpl GetInstance() + { + if (instance == null) + { + GameObject obj = new GameObject("PaymentImpl"); + UnityEngine.Object.DontDestroyOnLoad(obj); + instance = obj.AddComponent(); + } + return instance; + } + + private void OnItemListFailure(NetworkTask.ResultCode code) + { + Debug.LogError("OnItemListFailure" + code); + Debug.LogError("プロダクトIDリストリクエストが失敗しました。やり直してください。"); + } + + private void OnItemListResultCodeError(int code) + { + Debug.LogError("OnItemListResultCodeError" + code); + this.ProductListFailed.Call(); + } + + private void OnFinishSuccess(NetworkTask.ResultCode code) + { + string[] array = new string[lastSucceededPurchases.Count]; + for (int i = 0; i < lastSucceededPurchases.Count; i++) + { + array[i] = lastSucceededPurchases[i].getProductId(); + } + string orderId = ((lastSucceededPurchases.Count > 0) ? lastSucceededPurchases[0].getOrderId() : ""); + Payment.consumePurchase(array, orderId); + } + + private void OnFinishFailure(NetworkTask.ResultCode code) + { + paymentUI.StopLoading(); + Debug.LogError("OnFinishFailure:" + code); + if (this.purchaseFinishHttpErrorEvent != null) + { + this.purchaseFinishHttpErrorEvent(code); + } + inProcessingPurchaseTransaction = false; + } + + private void OnFinishResultCodeError(int resultCode) + { + paymentUI.StopLoading(); + Debug.LogError("OnFinishResultCodeError" + resultCode); + Debug.LogError("チェック不正です。"); + if (this.purchaseFinishResultCodeErrorEvent != null) + { + this.purchaseFinishResultCodeErrorEvent(resultCode); + } + inProcessingPurchaseTransaction = false; + } + + public void OnPaymentCancelByRefundWarningDialog() + { + inProcessingPurchaseTransaction = false; + } + + public void evInitializeSucceeded() + { + paymentUI.StopLoading(); + Payment.getProductList(ProductIdList.ToArray()); + } + + public void OnInitializeSucceeded() + { + evInitializeSucceeded(); + } + + public void evInitializeFailed(string error) + { + paymentUI.StopLoading(); + if (BattleManagerBase.GetIns() == null) + { + sendPaymentErrorLog("evInitializeFailed", error); + this.ProductListFailed.Call(); + } + } + + public void OnInitializeFailed(int errorCode, string errorMessage) + { + evInitializeFailed(errorMessage); + } + + public void evPurchaseSucceeded(PaymentPurchase purchase) + { + if (BattleManagerBase.GetIns() == null) + { + paymentUI.StopLoading(); + _receivePaymentSuccess = true; + lastSucceededPurchases.Add(purchase); + selectedStoreProductId = purchase.getProductId(); + } + } + + public void OnPurchaseFailed(string error) + { + evPurchaseFailed(error); + } + + public void OnPurchaseFailed(int errorCode, string errorMessage) + { + evPurchaseFailed(errorCode + ":" + errorMessage); + } + + public void evPurchaseFailed(string error) + { + if (BattleManagerBase.GetIns() != null) + { + return; + } + paymentUI.StopLoading(); + string message = paymentUI.GetText("Shop_0072"); + if (_receivePaymentCancel) + { + return; + } + _receivePaymentCancel = true; + PaymentCancelTask paymentCancelTask = new PaymentCancelTask(); + paymentCancelTask.SetParameter(getSkuInfo(GetInstance().selectedStoreProductId), error); + StartCoroutine(Toolbox.NetworkManager.Connect(paymentCancelTask, delegate + { + if (!error.Contains("Received a pending purchase of SKU:") && !_receivePaymentSuccess) + { + if (this.FinishFailureEvent != null) + { + this.FinishFailureEvent(message); + } + else + { + paymentUI.PurchaseFailed(); + } + } + }, delegate + { + }, delegate(int code) + { + Debug.LogError("OnPurchaseFailedCancelTaskResultCodeError" + code); + })); + inProcessingPurchaseTransaction = false; + } + + public void OnPurchaseCancelled(string productId, string price, string currencyCode) + { + evPurchaseCancelled(""); + } + + public void evPurchaseCancelled(string error) + { + paymentUI.StopLoading(); + string message = paymentUI.GetText("Shop_0073"); + PaymentCancelTask paymentCancelTask = new PaymentCancelTask(); + paymentCancelTask.SetParameter(getSkuInfo(GetInstance().selectedStoreProductId), error); + StartCoroutine(Toolbox.NetworkManager.Connect(paymentCancelTask, delegate + { + if (this.FinishFailureEvent != null) + { + this.FinishFailureEvent(message); + } + else + { + paymentUI.PurchaseCancelled(); + } + }, delegate + { + }, delegate(int code) + { + Debug.LogError("OnCancelResultCodeError" + code); + })); + inProcessingPurchaseTransaction = false; + } + + public void OnGetProductListSucceeded(List productInfo, bool waitUnfinishedTransaction) + { + evGetProductListSucceeded(productInfo); + } + + public void evGetProductListSucceeded(List infos) + { + skuInfos = infos; + string text = "アイテムリストを取得しました" + Environment.NewLine; + ProductPriceList.Clear(); + FormatProductPriceList.Clear(); + int count = infos.Count; + for (int i = 0; i < count; i++) + { + ProductPriceList.Add(infos[i].productId, infos[i].price); + FormatProductPriceList.Add(infos[i].productId, infos[i].formattedPrice); + StoreProductCountryCode = infos[i].currencyCode; + StoreProductCurrencyCode = infos[i].currencyCode; + if (!string.IsNullOrEmpty(StoreProductCountryCode)) + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.CURRENT_REGION_CODE, StoreProductCountryCode); + } + text = text + " " + infos[i].title + " : " + infos[i].formattedPrice + Environment.NewLine; + } + if (!inProcessingResumePurchaseTransaction) + { + paymentUI.StopLoading(); + } + } + + public void OnGetProductListFailed(int errorCode, string errorMessage) + { + evGetProductListFailed(errorCode + ":" + errorMessage); + } + + public void evGetProductListFailed(string error) + { + paymentUI.StopLoading(); + if (BattleManagerBase.GetIns() == null) + { + sendPaymentErrorLog("evGetProductListFailed", error); + this.ProductListFailed.Call(); + inProcessingPurchaseTransaction = false; + } + } + + public void OnConsumePurchaseSucceeded() + { + evConsumePurchaseSucceeded(); + } + + public void evConsumePurchaseSucceeded() + { + paymentUI.StopLoading(); + lastSucceededPurchases.Clear(); + this.ConsumePurchaseSucceeded.Call(); + inProcessingPurchaseTransaction = false; + } + + public void OnConsumePurchaseFailed(int errorCode, string errorMessage) + { + evConsumePurchaseFailed(errorCode + ":" + errorMessage); + } + + public void evConsumePurchaseFailed(string error) + { + paymentUI.StopLoading(); + sendPaymentErrorLog("evConsumePurchaseFailed", error); + inProcessingPurchaseTransaction = false; + } + + public void evConsumePurchaseSucceedediOS() + { + } + + public void TryToShowBuyResultPopUp(int amount, int sum, bool isRefundedReceipt = false) + { + IsRefundedReceipt = isRefundedReceipt; + if (this.purchaseFinishSuccessEvent != null) + { + this.purchaseFinishSuccessEvent(NetworkTask.ResultCode.Success); + return; + } + string value = ""; + ProductNameList.TryGetValue(selectedStoreProductId, out value); + paymentUI.PurchaseFinished(value, amount, sum, isRefundedReceipt); + } + + public void TryToShowBuyResultPopUpSecond(bool isRefundedReceipt = false) + { + IsRefundedReceipt = isRefundedReceipt; + string value = ""; + ProductNameList.TryGetValue(selectedStoreProductId, out value); + paymentUI.PurchaseFinished(value, 0, 0, isRefundedReceipt); + if (this.purchaseRetryResultEvent != null) + { + this.purchaseRetryResultEvent(); + } + } + + public override void purchaceStart(string storeProductId, bool isFromAlert = false) + { + if (inProcessingPurchaseTransaction) + { + return; + } + inProcessingPurchaseTransaction = true; + string message = ""; + if (false) + { + sendPaymentErrorLog("purchaceStart", message); + if (this.FinishFailureEvent != null) + { + string text = paymentUI.GetText("Shop_0072"); + this.FinishFailureEvent(string.Format(text, resumePurchaseTransactionCount)); + } + else + { + paymentUI.PurchaseFailed(); + } + inProcessingPurchaseTransaction = false; + return; + } + _receivePaymentSuccess = false; + _receivePaymentCancel = false; + bool isAlertOn = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PURCHASE_ALERT); + if (!isFromAlert) + { + IsAlertAgree = false; + } + PaymentStartTask task = new PaymentStartTask(); + task.SetParameter(getSkuInfo(storeProductId), IsAlertAgree, isAlertOn); + task.SkipAllCuteResultCodeCheckErrorPopup(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Payment.purchaseProduct(storeProductId, task.NeedRefundWarningType); + }, delegate + { + inProcessingPurchaseTransaction = false; + }, delegate(int code) + { + inProcessingPurchaseTransaction = false; + if (code == 329) + { + if (isAlertOn) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0329")); + dialogBase.SetText(systemText.Get("Error_0329")); + dialogBase.SetButtonText(systemText.Get("Shop_0082")); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetPanelDepth(6000); + dialogBase.SetPanelSortingOrder(2); + dialogBase.SetButtonDelegate(new EventDelegate(delegate + { + CallPaymentStartFromAlert(storeProductId); + })); + } + else + { + CallPaymentStartFromAlert(storeProductId); + } + } + else + { + Toolbox.NetworkManager.NetworkUI.OpenCloseOnlyErrorPopUp(code); + } + })); + selectedStoreProductId = storeProductId; + } + + public void initialize() + { + if (!inProcessingPurchaseTransaction) + { + this.ProductListSucceeded = null; + this.ProductListFailed = null; + this.FinishFailureEvent = null; + this.purchaseFinishSuccessEvent = null; + this.purchaseFinishHttpErrorEvent = null; + this.purchaseFinishResultCodeErrorEvent = null; + this.purchaseRetryResultEvent = null; + this.ConsumePurchaseSucceeded = null; + ProductIdList = new List(); + IdList = new List(); + ProductNameList = new Dictionary(); + ProductPriceList = new Dictionary(); + FormatProductPriceList = new Dictionary(); + ProductTextList = new Dictionary(); + ProductPurchaseLimitList = new Dictionary(); + ProductPurchaseNumberList = new Dictionary(); + ProductCsvIdList = new Dictionary(); + ProductImageNameList = new Dictionary(); + ProductIsSpecialShop = new Dictionary(); + ProductCurrentPurchaseCount = new Dictionary(); + ProductPurchaseLimitCount = new Dictionary(); + lastSucceededPurchases = new List(); + ProductEndTime = new Dictionary(); + PaymentItemListTask task = new PaymentItemListTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Payment.initialize(GetInstance(), ""); + }, OnItemListFailure, OnItemListResultCodeError)); + } + } + + public void finalize() + { + inProcessingPurchaseTransaction = false; + inProcessingResumePurchaseTransaction = false; + resumePurchaseTransactionCount = 0; + this.ProductListSucceeded = null; + this.ProductListFailed = null; + this.FinishFailureEvent = null; + this.purchaseFinishSuccessEvent = null; + this.purchaseFinishHttpErrorEvent = null; + this.purchaseFinishResultCodeErrorEvent = null; + this.purchaseRetryResultEvent = null; + this.ConsumePurchaseSucceeded = null; + Payment.finalize(); + } + + public void StartTimeCount(bool forProductListInit = false) + { + isCountTime = true; + isCountTimeForProductListInit = forProductListInit; + } + + public void StopTimeCount() + { + isCountTime = false; + timer = 0f; + } + + private void checkTimeOut() + { + timer += Time.deltaTime; + if (!(timer >= 30f)) + { + return; + } + timer = 0f; + paymentUI.StopLoading(); + if (isCountTimeForProductListInit) + { + if (PaymentFromScreen == PaymentOriginalScreen.SHOP_PLUS) + { + paymentUI.ProductListInitTimeOut(); + } + } + else + { + paymentUI.PurchaseTimeOut(); + } + } + + public PaymentSkuInfo getSkuInfo(PaymentPurchase purchase) + { + return skuInfos.Find((PaymentSkuInfo x) => x.productId == purchase.getProductId()); + } + + public PaymentSkuInfo getSkuInfo(string productId) + { + return skuInfos.Find((PaymentSkuInfo x) => x.productId == productId); + } + + public bool isGoogleReward(string productId) + { + return productId.EndsWith(".rew"); + } + + private void sendPaymentErrorLog(string method, string message) + { + long ticks = DateTime.Now.Ticks; + if (method == lastErrorMethod && message == lastErrorMessage && ticks - lastLogTimeTicks < 600000000) + { + sameLogCount++; + return; + } + LocalLog.AccumulateTraceLog(((sameLogCount > 0) ? $"same log : {sameLogCount}\n" : string.Empty) + "\n method:" + method + " message: " + message); + lastLogTimeTicks = ticks; + lastErrorMethod = method; + lastErrorMessage = message; + sameLogCount = 0; + } +} diff --git a/SVSim.BattleEngine/Engine/PaymentPC.cs b/SVSim.BattleEngine/Engine/PaymentPC.cs new file mode 100644 index 0000000..179d5a4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PaymentPC.cs @@ -0,0 +1,289 @@ +using System; +using System.Collections.Generic; +using Cute; +using Steamworks; +using UnityEngine; +using Wizard; + +public class PaymentPC : PaymentBase +{ + public List ProductIdList; + + public List IdList; + + public Dictionary ProductPriceList; + + public Dictionary FormatProductPriceList; + + public Dictionary ProductNameList; + + public Dictionary ProductTextList; + + public Dictionary ProductPurchaseLimitList; + + public Dictionary ProductPurchaseNumberList; + + public Dictionary ProductCsvIdList; + + public Dictionary ProductImageNameList; + + public Dictionary ProductIsSpecialShop; + + public Dictionary ProductCurrentPurchaseCount; + + public Dictionary ProductPurchaseLimitCount; + + public Dictionary ProductEndTime; + + public string selectedStoreProductId; + + private static PaymentPC instance; + + private bool isCountTime; + + private float timer; + + protected Callback m_MicroTxnAuthorizationResponse; + + public PaymentUI paymentUI { get; private set; } + + public event Action ProductListSucceeded; + + public event Action ProductListFailed; + + public event Action FinishFailureEvent; + + public event Action purchaseFinishSuccessEvent; + + public event Action purchaseFinishHttpErrorEvent; + + public event Action purchaseFinishResultCodeErrorEvent; + + public event Action purchaseRetryResultEvent; + + public event Action ConsumePurchaseSucceeded; + + private void Awake() + { + if (paymentUI == null) + { + paymentUI = new PaymentUI(); + } + m_MicroTxnAuthorizationResponse = Callback.Create(OnMicroTxnAuthorizationResponse); + } + + private void OnMicroTxnAuthorizationResponse(MicroTxnAuthorizationResponse_t pCallback) + { + if (!Convert.ToBoolean(pCallback.m_bAuthorized)) + { + return; + } + PaymentPCFinishTask paymentPCFinishTask = new PaymentPCFinishTask(); + paymentPCFinishTask.SetParameter(selectedStoreProductId, pCallback.m_unAppID.ToString(), pCallback.m_ulOrderID.ToString()); + StartCoroutine(Toolbox.NetworkManager.Connect(paymentPCFinishTask, delegate + { + string value = ""; + ProductNameList.TryGetValue(selectedStoreProductId, out value); + if (!ProductIsSpecialShop[selectedStoreProductId]) + { + paymentUI.PurchaseFinished(value); + } + if (this.ConsumePurchaseSucceeded != null) + { + this.ConsumePurchaseSucceeded(); + } + }, paymentUI.PurchaseFailedPC)); + } + + private void Update() + { + if (isCountTime) + { + checkTimeOut(); + } + SteamAPI.RunCallbacks(); + } + + public static PaymentPC GetInstance() + { + if (instance == null) + { + GameObject obj = new GameObject("PaymentPC"); + UnityEngine.Object.DontDestroyOnLoad(obj); + instance = obj.AddComponent(); + } + return instance; + } + + private void OnItemListFailure(NetworkTask.ResultCode code) + { + Debug.LogError("OnItemListFailure" + code); + Debug.LogError("プロダクトIDリストリクエストが失敗しました。やり直してください。"); + } + + private void OnItemListResultCodeError(int code) + { + Debug.LogError("OnItemListResultCodeError" + code); + if (this.ProductListFailed != null) + { + this.ProductListFailed(); + } + } + + private void OnFinishResultCodeError(int resultCode) + { + Debug.LogError("OnFinishResultCodeError" + resultCode); + Debug.LogError("チェック不正です。"); + if (this.purchaseFinishResultCodeErrorEvent != null) + { + this.purchaseFinishResultCodeErrorEvent(resultCode); + } + } + + public override void purchaceStart(string ProductId, bool isFromAlert = false) + { + if (!isFromAlert) + { + IsAlertAgree = false; + } + bool isAlertOn = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.PURCHASE_ALERT); + PaymentPCStartTask task = new PaymentPCStartTask(); + task.SetParameter(ProductId, IsAlertAgree, isAlertOn); + task.SkipAllCuteResultCodeCheckErrorPopup(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + PurchasePC(ProductId, task); + }, delegate + { + }, delegate(int code) + { + if (code == 329) + { + if (isAlertOn) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0329")); + dialogBase.SetText(systemText.Get("Error_0329")); + dialogBase.SetButtonText(systemText.Get("Shop_0082")); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetPanelDepth(6000); + dialogBase.SetPanelSortingOrder(2); + dialogBase.SetButtonDelegate(new EventDelegate(delegate + { + CallPaymentStartFromAlert(ProductId); + })); + } + else + { + CallPaymentStartFromAlert(ProductId); + } + } + else + { + Toolbox.NetworkManager.NetworkUI.OpenCloseOnlyErrorPopUp(code); + } + })); + selectedStoreProductId = ProductId; + } + + private void PurchasePC(string ProductId, PaymentPCStartTask task) + { + RefundWarningDialog.Start(task.NeedRefundWarningType, delegate + { + SteamMicroTxnInitTask steamMicroTxnInitTask = new SteamMicroTxnInitTask(); + steamMicroTxnInitTask.SetParameter(ProductId); + StartCoroutine(Toolbox.NetworkManager.Connect(steamMicroTxnInitTask)); + }); + } + + public void purchaceFinish(string ProductId) + { + PaymentPCFinishTask paymentPCFinishTask = new PaymentPCFinishTask(); + paymentPCFinishTask.SetParameter(ProductId); + paymentPCFinishTask.SkipCuteTimeOutPopup(); + StartCoroutine(Toolbox.NetworkManager.Connect(paymentPCFinishTask, delegate + { + string value = ""; + ProductNameList.TryGetValue(ProductId, out value); + if (!ProductIsSpecialShop[ProductId]) + { + paymentUI.PurchaseFinished(value); + } + if (this.ConsumePurchaseSucceeded != null) + { + this.ConsumePurchaseSucceeded(); + } + }, paymentUI.PurchaseFailedPC)); + } + + public void initialize() + { + this.ProductListSucceeded = null; + this.ProductListFailed = null; + this.FinishFailureEvent = null; + this.purchaseFinishSuccessEvent = null; + this.purchaseFinishHttpErrorEvent = null; + this.purchaseFinishResultCodeErrorEvent = null; + this.purchaseRetryResultEvent = null; + this.ConsumePurchaseSucceeded = null; + ProductIdList = new List(); + IdList = new List(); + ProductNameList = new Dictionary(); + ProductPriceList = new Dictionary(); + FormatProductPriceList = new Dictionary(); + ProductTextList = new Dictionary(); + ProductPurchaseLimitList = new Dictionary(); + ProductPurchaseNumberList = new Dictionary(); + ProductCsvIdList = new Dictionary(); + ProductImageNameList = new Dictionary(); + ProductIsSpecialShop = new Dictionary(); + ProductCurrentPurchaseCount = new Dictionary(); + ProductPurchaseLimitCount = new Dictionary(); + ProductEndTime = new Dictionary(); + PaymentPCItemListTask task = new PaymentPCItemListTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + if (this.ProductListSucceeded != null) + { + this.ProductListSucceeded(); + } + }, OnItemListFailure, OnItemListResultCodeError)); + } + + public void finalize() + { + this.ProductListSucceeded = null; + this.ProductListFailed = null; + this.FinishFailureEvent = null; + this.purchaseFinishSuccessEvent = null; + this.purchaseFinishHttpErrorEvent = null; + this.purchaseFinishResultCodeErrorEvent = null; + this.purchaseRetryResultEvent = null; + this.ConsumePurchaseSucceeded = null; + Payment.finalize(); + } + + public void StartTimeCount() + { + isCountTime = true; + } + + public void StopTimeCount() + { + isCountTime = false; + } + + private void checkTimeOut() + { + timer += Time.deltaTime; + if (timer >= 30f) + { + timer = 0f; + paymentUI.StopLoading(); + paymentUI.PurchaseTimeOut(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/PaymentPurchase.cs b/SVSim.BattleEngine/Engine/PaymentPurchase.cs new file mode 100644 index 0000000..019b310 --- /dev/null +++ b/SVSim.BattleEngine/Engine/PaymentPurchase.cs @@ -0,0 +1,12 @@ +public class PaymentPurchase +{ + public string getProductId() + { + return ""; + } + + public string getOrderId() + { + return ""; + } +} diff --git a/SVSim.BattleEngine/Engine/PaymentSkuInfo.cs b/SVSim.BattleEngine/Engine/PaymentSkuInfo.cs new file mode 100644 index 0000000..50aee5d --- /dev/null +++ b/SVSim.BattleEngine/Engine/PaymentSkuInfo.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; + +public class PaymentSkuInfo +{ + public string title; + + public string price; + + public string description; + + public string productId; + + public string currencyCode; + + public string currencySymbol; + + public string formattedPrice; + + public double priceAmountMicros; + + public string countryCode; + + public string downloadContentVersion; + + public bool downloadable; + + public List downloadContentLengths = new List(); + + public string type; + + public PaymentSkuInfo(string strShopName, string strPrice, string strShopDescription, string strProductID) + { + title = strShopName; + price = strPrice; + description = strShopDescription; + productId = strProductID; + } +} diff --git a/SVSim.BattleEngine/Engine/PaymentUI.cs b/SVSim.BattleEngine/Engine/PaymentUI.cs new file mode 100644 index 0000000..46caa0b --- /dev/null +++ b/SVSim.BattleEngine/Engine/PaymentUI.cs @@ -0,0 +1,153 @@ +using System.Collections; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.ErrorDialog; + +public class PaymentUI +{ + public IEnumerator GooglePlayPointRewardFinished(string message) + { + yield return new WaitForSeconds(0.5f); + while (Toolbox.NetworkManager.isConnect || Toolbox.NetworkManager.isTimeOut || Toolbox.NetworkManager.isError || UIManager.GetInstance().isOpenDialog()) + { + yield return 0; + } + createNewDialog(Wizard.Data.SystemText.Get("Common_0021"), message); + } + + public void PurchaseFinished(string name = "", int amount = 0, int sum = 0, bool isRefundedReceipt = false) + { + if (string.IsNullOrEmpty(name)) + { + name = Wizard.Data.SystemText.Get("Common_0201"); + } + string message = Wizard.Data.SystemText.Get("Shop_0022", name); + if (amount != 0) + { + } + if (!isRefundedReceipt) + { + createNewDialog("", message); + } + } + + public void PurchaseFailed(string name = "", int amount = 0, int sum = 0) + { + SystemText systemText = Wizard.Data.SystemText; + string title = systemText.Get("Shop_0025"); + string message = systemText.Get("Shop_0084"); + createNewDialog(title, message); + } + + public void PurchaseCancelled(string name = "", int amount = 0, int sum = 0) + { + SystemText systemText = Wizard.Data.SystemText; + string title = systemText.Get("Shop_0025"); + string message = systemText.Get("Shop_0085"); + createNewDialog(title, message); + } + + public void PurchaseTimeOut(string message = "", string title = "", DialogBase.Size size = DialogBase.Size.M) + { + if (BattleManagerBase.GetIns() == null) + { + SystemText systemText = Wizard.Data.SystemText; + if (string.IsNullOrEmpty(title)) + { + title = systemText.Get("Shop_0025"); + } + if (string.IsNullOrEmpty(message)) + { + message = systemText.Get("Shop_0086"); + } + createNewDialog(title, message, size); + } + } + + public void ProductListInitTimeOut() + { + if (BattleManagerBase.GetIns() == null) + { + SystemText systemText = Wizard.Data.SystemText; + string title = systemText.Get("Shop_0094"); + string message = systemText.Get("Shop_0093"); + createNewDialog(title, message, DialogBase.Size.M); + } + } + + public void StartLoading(bool useTimeCount = false, bool forProductListInit = false) + { + if (useTimeCount) + { + PaymentImpl.GetInstance().StartTimeCount(forProductListInit); + } + UIManager.GetInstance().createInSceneCenterLoading(); + } + + public void StopLoading() + { + PaymentImpl.GetInstance().StopTimeCount(); + UIManager.GetInstance().closeInSceneCenterLoading(); + } + + private static void createNewDialog(string title, string message, DialogBase.Size size = DialogBase.Size.S) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + if (title != "") + { + dialogBase.SetTitleLabel(title); + } + dialogBase.SetText(message); + dialogBase.SetSize(size); + dialogBase.SetPanelDepth(3000); + } + + public string GetText(string text_id) + { + return Wizard.Data.SystemText.Get(text_id); + } + + public void PurchaseConfirm(string productId, string name = "", int amount = 0, int sum = 0) + { + if (string.IsNullOrEmpty(name)) + { + name = Wizard.Data.SystemText.Get("Common_0201"); + } + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + string text = ""; + if (amount <= sum) + { + text = Wizard.Data.SystemText.Get("Shop_0110", name, sum.ToString()); + dialogBase.SetButtonDelegate(new EventDelegate(delegate + { + PaymentPC.GetInstance().purchaceFinish(productId); + })); + } + else + { + text = Wizard.Data.SystemText.Get("Shop_0111", name, sum.ToString()); + dialogBase.SetButtonDelegate(new EventDelegate(delegate + { + BrowserURL.Open("https://point.dmm.com/choice/pay"); + })); + } + dialogBase.SetText(text); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(Wizard.Data.SystemText.Get("Shop_0003")); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetPanelDepth(3000); + } + + public void PurchaseFailedPC(NetworkTask.ResultCode resultCode) + { + if (resultCode == NetworkTask.ResultCode.TimeOut) + { + DialogBase dialogBase = Dialog.Create("TIMEOUT_NORETRY"); + SystemText systemText = Wizard.Data.SystemText; + dialogBase.SetTitleLabel(systemText.Get("ErrorHeader_0012")); + dialogBase.SetText(systemText.Get("Error_0006")); + } + } +} diff --git a/SVSim.BattleEngine/Engine/PuzzleGenerator.cs b/SVSim.BattleEngine/Engine/PuzzleGenerator.cs new file mode 100644 index 0000000..5605d7b --- /dev/null +++ b/SVSim.BattleEngine/Engine/PuzzleGenerator.cs @@ -0,0 +1,282 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; +using Wizard; +using Wizard.Battle.UI; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +public class PuzzleGenerator +{ + private const int EVOLVED_PUZZLE_ID = 109; + + public VfxBase Generate(PuzzleQuestData puzzleQuestData) + { + PuzzleBattleManager obj = BattleManagerBase.GetIns() as PuzzleBattleManager; + BattlePlayer battlePlayer = obj.BattlePlayer; + BattleEnemy battleEnemy = obj.BattleEnemy; + IEnumerable playerFieldCards = new List(battlePlayer.InPlayCards); + IEnumerable playerHandCards = new List(battlePlayer.HandCardList); + IEnumerable playerDeckCards = new List(battlePlayer.DeckCardList); + IEnumerable enemyFieldCards = new List(battleEnemy.InPlayCards); + IEnumerable enemyHandCards = new List(battleEnemy.HandCardList); + IEnumerable enemyDeckCards = new List(battleEnemy.DeckCardList); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + parallelVfxPlayer.Register(ClearInPlayAndHand(battlePlayer, playerFieldCards, playerHandCards)); + parallelVfxPlayer.Register(ClearInPlayAndHand(battleEnemy, enemyFieldCards, enemyHandCards)); + battlePlayer.ClearBattleCount(); + battleEnemy.ClearBattleCount(); + battlePlayer.EvolveWaitTurnCount = 0; + battleEnemy.EvolveWaitTurnCount = 0; + battlePlayer.DeckCardList.Clear(); + battleEnemy.DeckCardList.Clear(); + battlePlayer.DeckSkillCardList.Clear(); + battleEnemy.DeckSkillCardList.Clear(); + bool isSkillLost = battlePlayer.Class.IsSkillLost; + bool isSkillLost2 = battleEnemy.Class.IsSkillLost; + battlePlayer.Class.LoseSkill().Play(); + battleEnemy.Class.LoseSkill().Play(); + battlePlayer.Class.DamagedCounter.Clear(); + battlePlayer.Class.SkillApplyInformation.ForceDepriveForceWrath(); + battleEnemy.Class.DamagedCounter.Clear(); + battleEnemy.Class.SkillApplyInformation.ForceDepriveForceWrath(); + battlePlayer.Class.IsSkillLost = isSkillLost; + battleEnemy.Class.IsSkillLost = isSkillLost2; + if (BattleManagerBase.GetIns().DetailMgr.DetailPanelControl.EvoTargetPanelColliderGameObject != null) + { + BattleManagerBase.GetIns().DetailMgr.DetailPanelControl.EvoTargetPanelColliderGameObject.transform.parent = BattleManagerBase.GetIns().DetailMgr.DetailPanel.transform; + } + SetUpField(battlePlayer, battleEnemy, puzzleQuestData); + battlePlayer.EvolvedCards.Clear(); + if (puzzleQuestData.Id != 109) + { + battleEnemy.EvolvedCards.Clear(); + } + battlePlayer.TurnEvolveCardCountInfo.Clear(); + battleEnemy.TurnEvolveCardCountInfo.Clear(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(parallelVfxPlayer, InstantVfx.Create(delegate + { + DestroyCardAndCorutine(playerDeckCards); + DestroyCardAndCorutine(playerHandCards); + DestroyCardAndCorutine(playerFieldCards); + DestroyCardAndCorutine(enemyDeckCards); + DestroyCardAndCorutine(enemyHandCards); + DestroyCardAndCorutine(enemyFieldCards); + }), RecoveryClassView(battlePlayer, battleEnemy), RecoveryInPlayAndHand(battlePlayer), RecoveryInPlayAndHand(battleEnemy), new DummyDeckChangeCardVfx(battlePlayer.IsPlayer, battlePlayer.DeckCardList.Count), new DummyDeckChangeCardVfx(battleEnemy.IsPlayer, battleEnemy.DeckCardList.Count), battlePlayer.StartBattleMainView(playEffect: false), battleEnemy.StartBattleMainView(playEffect: false)); + return ParallelVfxPlayer.Create(sequentialVfxPlayer); + } + + private VfxBase RecoveryClassView(BattlePlayerBase player, BattlePlayerBase enemy) + { + return InstantVfx.Create(delegate + { + if (player.Class.BattleCardView is PlayerClassBattleCardView playerClassBattleCardView) + { + iTween.Stop(playerClassBattleCardView.GameObject); + playerClassBattleCardView.GameObject.transform.localPosition = Vector3.zero; + playerClassBattleCardView.GameObject.SetActive(value: true); + playerClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION)); + playerClassBattleCardView.GameObject.GetComponent().Collider.enabled = true; + } + if (enemy.Class.BattleCardView is EnemyClassBattleCardView enemyClassBattleCardView) + { + iTween.Stop(enemyClassBattleCardView.GameObject); + enemyClassBattleCardView.GameObject.transform.localPosition = Vector3.zero; + enemyClassBattleCardView.GameObject.SetActive(value: true); + enemyClassBattleCardView.ClassCharacter.SetAnimationEnable(PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_LEADER_ANIMATION)); + enemyClassBattleCardView.GameObject.GetComponent().Collider.enabled = true; + } + }); + } + + private void SetUpField(BattlePlayer player, BattleEnemy enemy, PuzzleQuestData puzzleQuestData) + { + BattleLogManager.GetInstance().AddLogTurn(isSelfTurn: true); + player.BattleView.ClearPlayQueue(); + if (!player.ClassAndInPlayCardList.Any((BattleCardBase c) => c.IsClass)) + { + player.ClassAndInPlayCardList.Insert(0, player.Class); + } + if (!enemy.ClassAndInPlayCardList.Any((BattleCardBase c) => c.IsClass)) + { + enemy.ClassAndInPlayCardList.Insert(0, enemy.Class); + } + player.ClassAndInPlayCardList.RemoveAll((BattleCardBase c) => !c.IsClass); + enemy.ClassAndInPlayCardList.RemoveAll((BattleCardBase c) => !c.IsClass); + player.TurnPlayCards.Clear(); + player.Class.SkillApplyInformation.LifeModifierList.Clear(); + player.Class.SkillApplyInformation.DamageList.Clear(); + enemy.Class.SkillApplyInformation.LifeModifierList.Clear(); + enemy.Class.SkillApplyInformation.DamageList.Clear(); + player.NowTurnEvol = true; + player.Turn = 0; + player.Class.SkillApplyInformation.LifeModifierList.Add(new DamageCardParameterModifier(20 - puzzleQuestData.BattleData.PlayerLife, -1, isSelfTurn: false)); + int playerPPCount = puzzleQuestData.BattleData.PlayerPPCount; + player.SetCurrentEpCount(puzzleQuestData.BattleData.PlayerEPCount); + int playerGraveCount = puzzleQuestData.BattleData.PlayerGraveCount; + player.PpTotal = puzzleQuestData.BattleData.PlayerPPCount; + if (player.IsShortageDeck) + { + PuzzleBattleManager puzzleBattleManager = BattleManagerBase.GetIns() as PuzzleBattleManager; + player.ResetIsShortageDeck(); + iTween.Stop(puzzleBattleManager.ReaperCard); + puzzleBattleManager.ReaperCard.transform.SetParent(puzzleBattleManager.CardHolder.transform); + MotionUtils.SetLayerAll(puzzleBattleManager.ReaperCard, 10); + puzzleBattleManager.ReaperCard.transform.localPosition = new Vector3(-4.1f, 16.4f, 4.1f); + puzzleBattleManager.ReaperCard.transform.localRotation = Quaternion.Euler(0f, 0f, 0f); + puzzleBattleManager.ReaperCard.transform.localScale = Global.CARD_BASE_STAY_SCALE; + TweenColor.Begin(puzzleBattleManager.ReaperCard, 0f, Color.white); + } + enemy.NowTurnEvol = true; + enemy.Turn = 0; + int enemyLife = puzzleQuestData.BattleData.EnemyLife; + if (enemyLife <= 20) + { + enemy.Class.SkillApplyInformation.LifeModifierList.Add(new DamageCardParameterModifier(20 - puzzleQuestData.BattleData.EnemyLife, -1, isSelfTurn: false)); + } + else + { + ((ClassBattleCardBase)enemy.Class).InitBaseMaxLife(enemyLife); + } + int enemyPPCount = puzzleQuestData.BattleData.EnemyPPCount; + enemy.SetCurrentEpCount(puzzleQuestData.BattleData.EnemyEPCount); + int enemyGraveCount = puzzleQuestData.BattleData.EnemyGraveCount; + enemy.Pp = enemyPPCount; + enemy.PpTotal = enemyPPCount; + CardPrm[] playerInplay = puzzleQuestData.BattleData.PlayerInplay; + foreach (CardPrm cardPrm in playerInplay) + { + player.Pp = playerPPCount; + FieldGenSetCard(player, enemy, cardPrm); + } + playerInplay = puzzleQuestData.BattleData.EnemyInplay; + foreach (CardPrm cardPrm2 in playerInplay) + { + enemy.Pp = enemyPPCount; + FieldGenSetCard(enemy, player, cardPrm2); + } + int[] playerHand = puzzleQuestData.BattleData.PlayerHand; + foreach (int cardId in playerHand) + { + player.HandCardList.Add(player.CreateNextIndexCard(cardId)); + } + playerHand = puzzleQuestData.BattleData.EnemyHand; + foreach (int cardId2 in playerHand) + { + enemy.HandCardList.Add(enemy.CreateNextIndexCard(cardId2)); + } + playerHand = puzzleQuestData.BattleData.PlayerDeck; + foreach (int cardId3 in playerHand) + { + AddToDeckNoIndexChange(player, player.CreateNextIndexCard(cardId3)); + } + playerHand = puzzleQuestData.BattleData.EnemyDeck; + foreach (int cardId4 in playerHand) + { + AddToDeckNoIndexChange(enemy, enemy.CreateNextIndexCard(cardId4)); + } + player.Pp = playerPPCount; + enemy.Pp = enemyPPCount; + foreach (BattleCardBase handCard in player.HandCardList) + { + handCard.BattleCardView.ShowHandCardInfo().Play(); + } + player.GainCemetery(1000); + player.CemeteryList.Clear(); + for (int num2 = 0; num2 < playerGraveCount; num2++) + { + BattleCardBase targetCard = CardCreatorBase.CreateDummyInstance(); + player.DummyCardToCemetery(targetCard); + } + enemy.GainCemetery(1000); + enemy.CemeteryList.Clear(); + for (int num3 = 0; num3 < enemyGraveCount; num3++) + { + BattleCardBase targetCard2 = CardCreatorBase.CreateDummyInstance(); + enemy.DummyCardToCemetery(targetCard2); + } + for (int num4 = 0; num4 < puzzleQuestData.BattleData.PlayerDeckCount - puzzleQuestData.BattleData.PlayerDeck.Count(); num4++) + { + player.AddToDeck(player.CreateNextIndexCard(100011040)); + } + for (int num5 = 0; num5 < puzzleQuestData.BattleData.EnemyDeckCount - puzzleQuestData.BattleData.EnemyDeck.Count(); num5++) + { + enemy.AddToDeck(enemy.CreateNextIndexCard(100011040)); + } + } + + private VfxBase ClearInPlayAndHand(BattlePlayerBase player, IEnumerable fieldCardList, IEnumerable handCardList) + { + if (BattleManagerBase.GetIns() == null) + { + return NullVfx.GetInstance(); + } + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(); + foreach (BattleCardBase fieldCard in fieldCardList) + { + parallelVfxPlayer.Register(fieldCard.SkillApplyInformation.AllSkillEffectStop()); + player.BattleView.InPlayView.RemoveCardFromView(fieldCard.BattleCardView); + player.ClassAndInPlayCardList.Remove(fieldCard); + } + foreach (BattleCardBase handCard in handCardList) + { + parallelVfxPlayer.Register(handCard.SkillApplyInformation.AllSkillEffectStop()); + player.BattleView.HandView.RemoveCardFromViewWithoutRearrange(handCard.BattleCardView); + player.HandCardList.Remove(handCard); + } + return parallelVfxPlayer; + } + + private void DestroyCardAndCorutine(IEnumerable cardList) + { + foreach (BattleCardBase card in cardList) + { + if (card.BattleCardView._inPlayRearrangeCoroutine != null) + { + BattleCoroutine.GetInstance().StopCoroutine(card.BattleCardView._inPlayRearrangeCoroutine); + } + Object.Destroy(card.BattleCardView.GameObject); + } + } + + private VfxBase RecoveryInPlayAndHand(BattlePlayerBase player) + { + return ParallelVfxPlayer.Create(new RefreshHealthVfx(player), player.Class.SkillApplyInformation.CreateVfxSkillProtection(), player.BattleView.RecoveryInPlayCards(), player.BattleView.RecoveryInHandCards(), OpeningVfx.ShowBattleUIImmediatelyVfx(player, fixDirection: true), player.UsePp(0), InstantVfx.Create(player.BattleView.HideCommonPanel)); + } + + private void AddToDeckNoIndexChange(BattlePlayerBase player, BattleCardBase card) + { + player.DeckCardList.Add(card); + if (card.HasDeckSelfSkill) + { + player.AddDeckSkillCard(card); + } + } + + private void FieldGenSetCard(BattlePlayerBase player, BattlePlayerBase enemy, CardPrm cardPrm) + { + bool isRecovery = BattleManagerBase.GetIns().IsRecovery; + BattleManagerBase.GetIns().IsRecovery = true; + SkillProcessor skillProcessor = new SkillProcessor(); + BattleCardBase battleCardBase = player.CreateNextIndexCard(cardPrm.Id); + player.HandCardList.Add(battleCardBase); + SkillConditionCheckerOption skillConditionCheckerOption = new SkillConditionCheckerOption(); + skillConditionCheckerOption.PlayedCard = battleCardBase; + skillConditionCheckerOption.SummonedCard = battleCardBase; + battleCardBase.PlayCard(skillProcessor, skillConditionCheckerOption, isInplayGeneration: true); + battleCardBase.SelfBattlePlayer.StartSkillWhenChangeInplay(null, new List { battleCardBase }, skillProcessor, isSummonCheck: false, null, skillConditionCheckerOption); + skillProcessor.Process(new BattlePlayerPair(player, enemy)); + if (cardPrm.IsEvolve) + { + SkillProcessor skillProcessor2 = new SkillProcessor(); + battleCardBase.Evolution(isSkill: true, skillProcessor2, skillConditionCheckerOption); + skillProcessor2.Process(new BattlePlayerPair(player, enemy)); + } + if (cardPrm.ChantCount != -1) + { + battleCardBase.SkillApplyInformation.GiveChantCount(new ChantCountSetModifier(cardPrm.ChantCount)); + } + battleCardBase.BattleCardView.InitializeBattleCardIcon(battleCardBase, battleCardBase.Skills).Play(); + BattleManagerBase.GetIns().IsRecovery = isRecovery; + } +} diff --git a/SVSim.BattleEngine/Engine/ReceiveIntervalTriggerStandard.cs b/SVSim.BattleEngine/Engine/ReceiveIntervalTriggerStandard.cs new file mode 100644 index 0000000..6cb8a2d --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReceiveIntervalTriggerStandard.cs @@ -0,0 +1,11 @@ +public class ReceiveIntervalTriggerStandard : ReceiveIntervalTrigger +{ + public override void ReceiveDataCheck(NetworkBattleManagerBase networkBattleManager, NetworkBattleData networkBattleData, bool isPlayer, bool isExTurn) + { + base.ReceiveDataCheck(networkBattleManager, networkBattleData, isPlayer, isExTurn); + if (ReceiveIntervalTrigger.IsEffectiveURI(networkBattleData.GetReceiveData().dataUri)) + { + (networkBattleManager as NetworkStandardBattleMgr).battleStopChecker.StartChecker(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ReceiveReward.cs b/SVSim.BattleEngine/Engine/ReceiveReward.cs new file mode 100644 index 0000000..2a321c5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReceiveReward.cs @@ -0,0 +1,353 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class ReceiveReward : MonoBehaviour +{ + private GameObject currentItem; + + private GameObject currentExpand; + + private UIButton currentExpandButton; + + private List _allItem = new List(); + + private const int RECEIVE_ITEM_CENTER_IF_LESS = 3; + + private const float ITEM_MOVE_TIME = 0.2f; + + private const float ITEM_MOVE_X = 800f; + + private const int OBJ_BUTTON_TABLE = 1; + + private const int LABEL_NOT_USABLE = 2; + + public DialogBase ShowReadDialog(List texts, GameObject itemPrefab, GameObject current, ResourceHandler resourceHandler, DialogBase dialog = null) + { + if (texts == null) + { + return null; + } + currentItem = null; + currentExpand = null; + currentExpandButton = null; + DialogBase dia; + if (dialog == null) + { + dia = createDialog(); + } + else + { + dia = dialog; + } + UITable table = createTable(dia, texts.Count); + Action gotoScene = delegate(SceneTransition.TransitionData data) + { + dia.SetBackViewToNotCloseDialog(); + dia.gameObject.SetActive(value: false); + SceneTransition.ChangeScene(data, delegate + { + if (current != null) + { + current.SetActive(value: false); + } + }); + }; + foreach (ReceivedReward t in texts) + { + GameObject gameObject = UnityEngine.Object.Instantiate(itemPrefab); + gameObject.transform.parent = table.transform; + gameObject.transform.localScale = Vector3.one; + gameObject.transform.localPosition = Vector3.zero; + NguiObjs component = gameObject.GetComponent(); + _allItem.Add(gameObject); + UIButton expandButton = component.buttons[0]; + UIButton actionButton = component.buttons[1]; + UIButton actionButtonAlone = component.buttons[2]; + GameObject expandPart = component.objs[0]; + GameObject itemPart = component.objs[2]; + SystemText sysText = Data.SystemText; + Action AddButtonAction = delegate(string textid, SceneTransition.TransitionData data, bool alone, Action action2) + { + UIManager.SetObjectToGrey(AddDialogItemButton(alone ? actionButtonAlone : actionButton, sysText.Get(textid), action2).gameObject, SceneTransition.IsMaintenance(data)); + }; + Action action = delegate(string textid, SceneTransition.TransitionData data, bool alone) + { + AddButtonAction(textid, data, alone, delegate + { + gotoScene(data); + }); + }; + GiftTransition giftTransition = Data.Master.GiftTransitionList.Find((GiftTransition data) => (t.reward_type == 4) ? (data._rewardType == t.reward_type && data._rewardDetailId == t.rewardUserGoodsId) : (data._rewardType == t.reward_type)); + bool flag = t.IsUsable; + if (giftTransition != null) + { + bool arg = giftTransition._buttons.Count == 1; + foreach (GiftTransition.TransitionButton button in giftTransition._buttons) + { + action(button._text, button._transitionData, arg); + } + } + else + { + flag = false; + } + bool flag2 = t.reward_type == 4; + component.textures[0].gameObject.SetActive(value: true); + if (flag2) + { + SetTicket(t.rewardUserGoodsId, t.reward_count, component.textures[0], component.labels[0], resourceHandler); + } + else + { + component.labels[0].text = getTitle((UserGoods.Type)t.reward_type, t.rewardUserGoodsId, t.reward_count); + SetTexture((UserGoods.Type)t.reward_type, t.rewardUserGoodsId, component.textures[0], resourceHandler); + } + initExpand(expandPart, expandButton, itemPart, component); + actionButton.gameObject.SetActive(value: false); + actionButtonAlone.gameObject.SetActive(value: false); + component.objs[1].SetActive(flag); + component.objs[1].GetComponent().Reposition(); + component.labels[2].gameObject.SetActive(!flag); + if (!flag) + { + if (flag2 && t.rewardUserGoodsId == 2) + { + component.labels[2].text = Data.SystemText.Get("Mail_0060"); + } + else + { + component.labels[2].text = Data.SystemText.Get("Mission_0045"); + } + } + } + table.onReposition = delegate + { + dia.SetScrollViewActive(b: true); + table.onReposition = null; + }; + table.Reposition(); + dia.SetScrollViewActive(b: true); + return dia; + } + + public void SetAllButtonDisable() + { + foreach (GameObject item in _allItem) + { + UIButton[] buttons = item.GetComponent().buttons; + foreach (UIButton uIButton in buttons) + { + if (uIButton != null) + { + uIButton.isEnabled = false; + } + } + } + } + + private static DialogBase createDialog() + { + bool num = Data.Load.data._userTutorial.TutorialStep != 100; + SystemText systemText = Data.SystemText; + DialogBase dialogBase = (num ? MyPageMenu.CreateDialogForTutorial() : UIManager.GetInstance().CreateDialogClose()); + dialogBase.SetTitleLabel(systemText.Get("Mail_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetScrollViewActive(b: true); + if (num) + { + dialogBase.SetDialogNoClose(); + MyPageMenu.Instance.SetGuideToOkOnlyDialog(dialogBase); + } + return dialogBase; + } + + private static UITable createTable(DialogBase dia, int rewardNum) + { + GameObject gameObject = new GameObject("table"); + dia.ScrollView.contentPivot = ((rewardNum >= 3) ? UIWidget.Pivot.Top : UIWidget.Pivot.Center); + dia.AttachToScrollView(gameObject.transform); + UITable uITable = gameObject.AddComponent(); + uITable.columns = 1; + uITable.padding = new Vector2(0f, 5f); + uITable.pivot = UIWidget.Pivot.Center; + uITable.cellAlignment = UIWidget.Pivot.Center; + return uITable; + } + + private void DoAction(Action action) + { + action(); + } + + private void initExpand(GameObject expandPart, UIButton expandButton, GameObject itemPart, NguiObjs obs) + { + expandPart.SetActive(value: false); + expandButton.gameObject.SetActive(value: true); + expandButton.gameObject.AddComponent(); + currentItem = null; + float itemOriginalX = itemPart.transform.localPosition.x; + expandButton.onClick.Add(new EventDelegate(delegate + { + if (currentItem != null) + { + currentItem.SetActive(value: true); + RemoveITween(currentItem); + iTween.MoveTo(currentItem, iTween.Hash("x", itemOriginalX, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeOutQuad)); + currentExpandButton.gameObject.SetActive(value: true); + currentExpand.SetActive(value: false); + } + Action action = delegate + { + itemPart.SetActive(value: false); + }; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_GIFT_ALL); + RemoveITween(itemPart); + iTween.MoveTo(itemPart, iTween.Hash("x", itemOriginalX + 800f, "time", 0.2f, "islocal", true, "easetype", iTween.EaseType.easeInQuad, "oncomplete", "DoAction", "oncompletetarget", base.gameObject, "oncompleteparams", action)); + expandButton.gameObject.SetActive(value: false); + expandPart.SetActive(value: true); + obs.tweenAlpha.delay = 0.2f; + obs.tweenAlpha.ResetToBeginning(); + obs.tweenAlpha.PlayForward(); + currentItem = itemPart; + currentExpand = expandPart; + currentExpandButton = expandButton; + })); + } + + private void RemoveITween(GameObject obj) + { + iTween component = obj.GetComponent(); + if (component != null) + { + UnityEngine.Object.Destroy(component); + } + } + + private static UIButton AddDialogItemButton(UIButton orig, string buttonText, Action action) + { + UIButton uIButton = UnityEngine.Object.Instantiate(orig); + uIButton.GetComponentInChildren().text = buttonText; + uIButton.transform.parent = orig.transform.parent; + uIButton.transform.localPosition = orig.transform.localPosition; + uIButton.transform.localScale = orig.transform.localScale; + uIButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + action(); + })); + return uIButton; + } + + public static string getTitle(MailData mailData) + { + return getTitle((UserGoods.Type)mailData.reward_type, mailData.RewardUserGoodsId, mailData.reward_count); + } + + public static string getTitle(UserGoods.Type reward_type, long userGoodsId, long count) + { + string unit = getUnit(reward_type, userGoodsId); + string userGoodsName = UserGoods.getUserGoodsName(reward_type, userGoodsId); + return string.Format(unit, userGoodsName, count); + } + + private static string getUnit(UserGoods.Type reward_type, long userGoodsId) + { + SystemText systemText = Data.SystemText; + if (reward_type == UserGoods.Type.Item && ((int)userGoodsId == 1000 || (int)userGoodsId == 1001)) + { + return systemText.Get("Mail_0040"); + } + switch (reward_type) + { + case UserGoods.Type.Item: + case UserGoods.Type.Card: + case UserGoods.Type.SpotCard: + case UserGoods.Type.SpotCardOnlyLatestCardPack: + return systemText.Get("Mail_0041"); + case UserGoods.Type.Rupy: + return systemText.Get("Mail_0042"); + case UserGoods.Type.SpotCardPoint: + return systemText.Get("Mail_0063"); + default: + return systemText.Get("Mail_0040"); + } + } + + public static void SetTicket(long userGoodsId, long count, UITexture tex, UILabel label, ResourceHandler resourceHandler) + { + Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == userGoodsId); + if (item != null) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item); + resourceHandler.Add(assetTypePath, delegate + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + tex.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + }); + string unitFormat = item.unitFormat; + label.text = string.Format(unitFormat, item.name, count); + } + else + { + tex.gameObject.SetActive(value: false); + label.text = ""; + } + } + + public static string SetTicketTitle(int itemId, int count) + { + Item itemData = Item.GetItemData(UserGoods.Type.Item, itemId); + return string.Format(itemData.unitFormat, itemData.name, count); + } + + public static void SetTexture(UserGoods.Type type, UITexture tex, ResourceHandler resourceHandler) + { + string texName = UserGoods.GetUserGoodsImageName(type, 0L); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item); + resourceHandler.Add(assetTypePath, delegate + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(texName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + tex.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + }); + } + + public static void SetTexture(UserGoods.Type type, long goodsId, UITexture texture, ResourceHandler resourceHandler) + { + string thumbnailName = GetThumbnailName(type, goodsId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(thumbnailName, ResourcesManager.AssetLoadPathType.Item); + resourceHandler.Add(assetTypePath, delegate + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(thumbnailName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + texture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + }); + } + + public static string GetThumbnailName(UserGoods.Type type, long id) + { + if (type == UserGoods.Type.Skin) + { + return GetSkinThumbnailName(id); + } + return UserGoods.GetUserGoodsImageName(type, id); + } + + public static string GetSkinThumbnailName(long id) + { + if (ExistsIndividualSkinThumbnail(id, out var imageName)) + { + return imageName; + } + return UserGoods.GetUserGoodsImageName(UserGoods.Type.Skin, 0L); + } + + public static bool ExistsIndividualSkinThumbnail(long id, out string imageName) + { + UserGoods userGoods = new UserGoods(UserGoods.Type.Skin, id); + imageName = userGoods.GetUserGoodsIndividualImageName(); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(imageName, ResourcesManager.AssetLoadPathType.Item); + return Toolbox.ResourcesManager.ExistsAssetBundleManifest(assetTypePath); + } +} diff --git a/SVSim.BattleEngine/Engine/RecoveryNetworkInPlayAction.cs b/SVSim.BattleEngine/Engine/RecoveryNetworkInPlayAction.cs new file mode 100644 index 0000000..dcec948 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RecoveryNetworkInPlayAction.cs @@ -0,0 +1,11 @@ +public class RecoveryNetworkInPlayAction : InPlayCardReflection +{ + public RecoveryNetworkInPlayAction(BattleManagerBase battleMgr, OperateMgr operateMgr) + : base(battleMgr, operateMgr) + { + } + + protected override void RegisterPairToAttackSelectControl(BattleCardBase attackCard, BattleCardBase targetCard) + { + } +} diff --git a/SVSim.BattleEngine/Engine/RecoveryReplaceReceivedCard.cs b/SVSim.BattleEngine/Engine/RecoveryReplaceReceivedCard.cs new file mode 100644 index 0000000..bde4fd6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RecoveryReplaceReceivedCard.cs @@ -0,0 +1,24 @@ +using UnityEngine; +using Wizard; + +public class RecoveryReplaceReceivedCard : ReplaceReceivedCard +{ + public RecoveryReplaceReceivedCard(NetworkBattleManagerBase battleMgrBase, CardDataModel cardData) + : base(battleMgrBase, cardData) + { + } + + protected override BattleCardBase CreateActualCard(BattlePlayerBase battlePlayer, bool isCardInDeck, bool isOpenDrawSkill) + { + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(CardId); + BattleCardBase battleCardBase = _networkBattleMgr.CreateBattleCard(CardId, battlePlayer.IsPlayer, null, cardParameterFromId, battlePlayer, CardIdx); + InheritedCardData(battleCardBase); + ReplaceBuffInfoList(battleCardBase, _originalDummyCard); + battleCardBase.ShallowCopyBuffInfoList(_originalDummyCard); + Object.DestroyImmediate(_originalDummyCard.BattleCardView.GameObject); + _originalDummyCard.SelfBattlePlayer.BattleView.HandView.RemoveCardFromViewWithoutRearrange(_originalDummyCard.BattleCardView); + SettingTargetDeckSelfCardAddDeckSkillCardList(battleCardBase, isCardInDeck); + RemoveOpenCardRemoveAfterActionSkills(battleCardBase); + return battleCardBase; + } +} diff --git a/SVSim.BattleEngine/Engine/RedShellUnity/RedShell.cs b/SVSim.BattleEngine/Engine/RedShellUnity/RedShell.cs new file mode 100644 index 0000000..35715cb --- /dev/null +++ b/SVSim.BattleEngine/Engine/RedShellUnity/RedShell.cs @@ -0,0 +1,96 @@ +using com.adjust.sdk; +using RedShellSDK; +using UnityEngine; + +namespace RedShellUnity; + +public class RedShell : MonoBehaviour +{ + private static RedShell instance; + + private static bool quitting; + + private static bool verboseLogs; + + public static void SetApiKey(string apiKey) + { + if (!Adjust.IsEditor()) + { + _ = verboseLogs; + setupInstance(); + global::RedShellSDK.RedShellSDK.SetApiKey(apiKey); + } + } + + public static void SetUserId(string userId) + { + if (!Adjust.IsEditor()) + { + _ = verboseLogs; + setupInstance(); + global::RedShellSDK.RedShellSDK.SetUserId(userId); + } + } + + public static void SetVerboseLogs(bool verboseLogs) + { + if (!Adjust.IsEditor()) + { + RedShell.verboseLogs = verboseLogs; + setupInstance(); + global::RedShellSDK.RedShellSDK.SetVerboseLogs(verboseLogs); + } + } + + public static void MarkConversion() + { + if (!Adjust.IsEditor()) + { + _ = verboseLogs; + setupInstance(); + instance.StartCoroutine(global::RedShellSDK.RedShellSDK.MarkConversion()); + } + } + + public static void LogEvent(string type) + { + if (!Adjust.IsEditor()) + { + _ = verboseLogs; + setupInstance(); + instance.StartCoroutine(global::RedShellSDK.RedShellSDK.LogEvent(type)); + } + } + + private void Awake() + { + if (!Adjust.IsEditor()) + { + if (instance != null) + { + Object.Destroy(base.gameObject.GetComponent()); + return; + } + instance = this; + Object.DontDestroyOnLoad(base.gameObject); + } + } + + private void OnDestroy() + { + if (!(instance != this)) + { + quitting = true; + instance = null; + } + } + + private static void setupInstance() + { + if (!Adjust.IsEditor() && !quitting && instance == null) + { + _ = verboseLogs; + instance = new GameObject("Red Shell").AddComponent(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterChangeUnionBurstCount.cs b/SVSim.BattleEngine/Engine/RegisterChangeUnionBurstCount.cs new file mode 100644 index 0000000..13a84d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterChangeUnionBurstCount.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterChangeUnionBurstCount : RegisterAlter +{ + private int _gainValue; + + private readonly string UnionBurstCountParameter = "unionburst"; + + public RegisterChangeUnionBurstCount(List cardList, SkillBase skill, int gainCount) + : base(cardList, skill) + { + base.IndexList = new List(); + if (cardList != null && cardList.Count > 0) + { + cardList.ForEach(delegate(BattleCardBase x) + { + if (!base.IndexList.Any((int z) => z == x.Index)) + { + base.IndexList.Add(x.Index); + } + }); + } + _gainValue = gainCount; + IsSelf = skill.SkillPrm.ownerCard.IsPlayer; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + dictionary.Add(ActionBaseParameter.type.ToString(), ActionBaseParameter.add.ToString()); + dictionary.Add(UnionBurstCountParameter, "a+" + _gainValue); + return MakeAttachTarget(dictionary); + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterCostChangeCard.cs b/SVSim.BattleEngine/Engine/RegisterCostChangeCard.cs new file mode 100644 index 0000000..2c583da --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterCostChangeCard.cs @@ -0,0 +1,186 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class RegisterCostChangeCard : RegisterAlter +{ + public enum CostChangeType + { + addCost, + setCost, + halfCost, + halfCostRoundDown + } + + public int CostVal; + + private Dictionary _data; + + private RegisterActionManager _registerActionManager; + + private BattleManagerBase _mgr; + + private ICardCostModifier _costModifier; + + private const string FOR_HAND_RESIDENT = "forHandResident"; + + public CostChangeType CostChangeTypeVal { get; private set; } + + public int Index => base.IndexList[0]; + + public RegisterCostChangeCard(BattleManagerBase mgr, RegisterActionManager registerActionManager, ICardCostModifier costModifier, List cards, SkillBase skill, SkillConditionCheckerOption option, RegisterTargetBase registerTarget = null, bool isNotCheckCard = false) + : base(cards, skill) + { + RegisterCostChangeCard registerCostChangeCard = this; + if (!isNotCheckCard && cards == null && skill == null) + { + return; + } + base.IndexList = new List(); + if (cards == null) + { + base.IndexList.Add(-1); + } + else + { + cards.ForEach(delegate(BattleCardBase x) + { + if (!registerCostChangeCard.IndexList.Any((int z) => z == x.Index)) + { + registerCostChangeCard.IndexList.Add(x.Index); + } + }); + if (cards.Count() == 0) + { + IsSelf = false; + } + else + { + IsSelf = cards.First().IsPlayer; + } + } + if (isNotCheckCard) + { + IsSelf = false; + } + _registerActionManager = registerActionManager; + _mgr = mgr; + _costModifier = costModifier; + if (_costModifier != null) + { + SettingCostChangeType(_costModifier); + } + if (registerTarget != null) + { + registerTarget.SettingGroupIndexMsg(this); + } + if (_data == null) + { + _data = base.MakeSendData(); + _data.Add(ActionBaseParameter.type.ToString(), ActionBaseParameter.add.ToString()); + switch (CostChangeTypeVal) + { + case CostChangeType.addCost: + _data.Add(ActionBaseParameter.cost.ToString(), "a" + CostVal); + break; + case CostChangeType.setCost: + _data.Add(ActionBaseParameter.cost.ToString(), "s" + CostVal); + break; + case CostChangeType.halfCost: + _data.Add(ActionBaseParameter.cost.ToString(), "d" + CostVal); + break; + case CostChangeType.halfCostRoundDown: + _data.Add(ActionBaseParameter.cost.ToString(), "D" + CostVal); + break; + } + if (registerActionManager.RegisterDataList.Any((RegisterActionBase r) => r is RegisterMetamorphoseData)) + { + List registerMetamorphoses = registerActionManager.RegisterDataList.Where((RegisterActionBase r) => r is RegisterMetamorphoseData).ToList(); + int i; + for (i = 0; i < registerMetamorphoses.Count(); i++) + { + if (base.IndexList.Any((int index) => index != -1 && index == (registerMetamorphoses[i] as RegisterMetamorphoseData).Index) && IsSelf == registerMetamorphoses[i].IsSelf) + { + _data.Add(ActionBaseParameter.isForce.ToString(), 1); + break; + } + } + } + _data = MakeAttachTarget(_data); + Dictionary data = new Dictionary(_data); + Func, SkillConditionCheckerOption, SkillProcessor, VfxBase> value = delegate(SkillBase _skill, List _cards, SkillConditionCheckerOption _checkerOption, SkillProcessor _skillProcessor) + { + bool flag = _skill.SkillPrm.ownerCard.IsPlayer; + if (_skill.ApplyBattlePlayerFilter is OpponentBattlePlayerFilter) + { + flag = !flag; + } + RegisterFilter registerFilter = new RegisterFilter(registerCostChangeCard._registerActionManager, registerCostChangeCard._mgr, flag, _skill, _cards, isStop: true, option); + registerCostChangeCard._registerActionManager.Add(registerFilter); + RegisterCostChangeCard registerCostChangeCard2 = new RegisterCostChangeCard(registerCostChangeCard._mgr, registerCostChangeCard._registerActionManager, registerCostChangeCard._costModifier, null, null, option); + List groupMsgList = registerFilter.GetGroupMsgList(); + if (registerTarget != null && groupMsgList != null && groupMsgList.Count > 0) + { + data[NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx]] = groupMsgList[0]; + } + registerCostChangeCard2.SetSendData(data); + registerCostChangeCard2.SetCostChangeType(ActionBaseParameter.del.ToString()); + registerCostChangeCard._registerActionManager.Add(registerCostChangeCard2); + return NullVfx.GetInstance(); + }; + _skill.OnSkillStopEnd -= value; + _skill.OnSkillStopEnd += value; + _skill.OnSkillStopEnd -= ((NetworkBattleManagerBase)_mgr)._networkBattleSetupCardEventBase.Event_RegisterFilterSkillEnd; + _skill.OnSkillStopEnd += ((NetworkBattleManagerBase)_mgr)._networkBattleSetupCardEventBase.Event_RegisterFilterSkillEnd; + } + if (skill is NetworkSkill_cost_change { IsForHandResident: not false }) + { + _data.Add("forHandResident", 1); + } + } + + public void SetCostChangeType(string type) + { + _data[ActionBaseParameter.type.ToString()] = type; + } + + public override Dictionary MakeSendData() + { + return _data; + } + + private void SettingCostChangeType(ICardCostModifier costModifiers) + { + if (costModifiers is CostAddModifier) + { + CostAddModifier costAddModifier = costModifiers as CostAddModifier; + if (costAddModifier.Cost != 0) + { + CostVal = costAddModifier.Cost; + CostChangeTypeVal = CostChangeType.addCost; + } + } + else if (costModifiers is CostSetModifier) + { + int cost = (costModifiers as CostSetModifier).Cost; + CostVal = cost; + CostChangeTypeVal = CostChangeType.setCost; + } + else if (costModifiers is CostHalfRoundUpModifier) + { + CostVal = 2; + CostChangeTypeVal = CostChangeType.halfCost; + } + else if (costModifiers is CostHalfRoundDownModifier) + { + CostVal = 2; + CostChangeTypeVal = CostChangeType.halfCostRoundDown; + } + } + + private void SetSendData(Dictionary data) + { + _data = data; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterExtraTurn.cs b/SVSim.BattleEngine/Engine/RegisterExtraTurn.cs new file mode 100644 index 0000000..de03c3e --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterExtraTurn.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +public class RegisterExtraTurn : RegisterActionBase +{ + private int _extraTurnNum; + + public RegisterExtraTurn(int turnNum, bool isSelf) + { + _extraTurnNum = turnNum; + IsSelf = isSelf; + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } + + public override Dictionary MakeSendData() + { + return new Dictionary + { + { + RegisterTool.OrderListParameter.count.ToString(), + _extraTurnNum + }, + { + NetworkBattleDefine.NetworkParameter.isSelf.ToString(), + IsSelf ? 1 : 0 + } + }; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.exTurn.ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterPlayCountChange.cs b/SVSim.BattleEngine/Engine/RegisterPlayCountChange.cs new file mode 100644 index 0000000..df90ad2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterPlayCountChange.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +public class RegisterPlayCountChange : RegisterActionBase +{ + public enum PlayCountParameter + { + count, + isSelf + } + + public int PlayCount { get; private set; } + + public RegisterPlayCountChange(bool isSelf, int playCount) + { + IsSelf = isSelf; + PlayCount = playCount; + base.IndexList = null; + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = base.MakeSendData(); + dictionary.Add(PlayCountParameter.count.ToString(), PlayCount); + return dictionary; + } + + public override string GetUriMsg() + { + return RegisterTool.OrderListParameter.playCount.ToString(); + } + + public override bool IsUseLotCard(RegisterLotCardBase lot) + { + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/RegisterSpellboost.cs b/SVSim.BattleEngine/Engine/RegisterSpellboost.cs new file mode 100644 index 0000000..4726ff5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/RegisterSpellboost.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; +using System.Linq; + +public class RegisterSpellboost : RegisterAlter +{ + private int _addValue; + + private int _deffSet; + + private readonly string SpellboostParameter = "spellboost"; + + public List SpellBoostIndexList { get; private set; } + + public List SpellBoostGroupIndexList { get; private set; } + + public RegisterSpellboost(List cardList, SkillBase skill, int addCount, int deffSet) + : base(cardList, skill) + { + base.IndexList = new List(); + if (cardList != null && cardList.Count > 0) + { + cardList.ForEach(delegate(BattleCardBase x) + { + if (!base.IndexList.Any((int z) => z == x.Index)) + { + base.IndexList.Add(x.Index); + } + }); + } + _addValue = addCount; + _deffSet = deffSet; + IsSelf = skill.SkillPrm.ownerCard.IsPlayer; + SpellBoostGroupIndexList = new List(); + SpellBoostIndexList = new List(); + } + + public override Dictionary MakeSendData() + { + Dictionary dictionary = new Dictionary(); + if (SpellBoostGroupIndexList.Count > 0) + { + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx], SpellBoostGroupIndexList[0]); + } + else if (base.IndexList.Count > 0) + { + List list = new List(); + foreach (int index in base.IndexList) + { + list.Add(index); + } + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.idx], list); + } + dictionary.Add(NetworkBattleDefine.NetworkParameterNames[NetworkBattleDefine.NetworkParameter.isSelf], IsSelf ? 1 : 0); + dictionary.Add(ActionBaseParameter.type.ToString(), ActionBaseParameter.add.ToString()); + if (_deffSet == 0) + { + dictionary.Add(SpellboostParameter, "a" + _addValue); + } + else + { + dictionary.Add(SpellboostParameter, "s" + _deffSet); + } + return MakeAttachTarget(dictionary); + } + + public void SettingSpellBoostGrope(string message) + { + SpellBoostGroupIndexList.Add(message); + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayInPlayAction.cs b/SVSim.BattleEngine/Engine/ReplayInPlayAction.cs new file mode 100644 index 0000000..e5d7cdb --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayInPlayAction.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; + +public class ReplayInPlayAction : WatchInPlayAction +{ + public ReplayInPlayAction(BattleManagerBase battleMgr, OperateMgr operateMgr) + : base(battleMgr, operateMgr) + { + } + + public override void StartSelect(int actingCardIndex, bool isPlayer = true) + { + if (isPlayer) + { + base.StartSelect(actingCardIndex, isPlayer); + } + } + + public override void StartChoiceSelect(int actingCardIndex, bool isPlayer = true) + { + if (isPlayer) + { + base.StartChoiceSelect(actingCardIndex, isPlayer); + } + } + + public override void CancelSelect(bool isPlayer = true) + { + if (isPlayer) + { + base.CancelSelect(isPlayer); + } + } + + public override void CancelChoiceSelect(bool isPlayer = true) + { + if (isPlayer) + { + base.CancelChoiceSelect(isPlayer); + } + } + + public override void SelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer = true, bool isBurialRite = false, bool isChoiceBrave = false, bool isComplete = true) + { + if (isPlayer) + { + base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite); + } + } + + public override void CompleteSelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer, bool isBurialRite, bool isChoiceBrave) + { + if (isPlayer) + { + base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite); + } + } + + public override void SelectChoiceCard(int selectedChoiceCardId, bool isEvolve = false, bool isPlayer = true, bool isComplete = false) + { + if (isPlayer && isComplete) + { + base.SelectChoiceCard(selectedChoiceCardId, isEvolve, isPlayer, isComplete); + } + } + + public override void WatchSelectChoiceCards(List selectedChoiceCardIds, bool isEvolve = false, bool isPlayer = true, bool isComplete = false) + { + if (isPlayer && isComplete) + { + base.WatchSelectChoiceCards(selectedChoiceCardIds, isEvolve, isPlayer, isComplete); + } + } + + public override void CompleteChoiceCard(List choiceIdList, bool isEvolveTargetSelect, bool isPlayer = true) + { + if (isPlayer) + { + CompleteChoiceDataIns = new CompleteChoiceData(); + OverrideChoicecard(isPlayer); + } + } + + public override void OverrideChoicecard(bool isPlayer) + { + if (isPlayer) + { + base.OverrideChoicecard(isPlayer); + } + } +} diff --git a/SVSim.BattleEngine/Engine/ReplayPlayCardAction.cs b/SVSim.BattleEngine/Engine/ReplayPlayCardAction.cs new file mode 100644 index 0000000..8e40fbf --- /dev/null +++ b/SVSim.BattleEngine/Engine/ReplayPlayCardAction.cs @@ -0,0 +1,114 @@ +using System.Collections.Generic; + +public class ReplayPlayCardAction : WatchPlayCardAction +{ + public ReplayPlayCardAction(BattleManagerBase battleMgr, OperateMgr operateMgr, NetworkBattleData networkBattleData) + : base(battleMgr, operateMgr, networkBattleData) + { + } + + public override void StartSelect(int actingCardIndex, bool isPlayer = true) + { + if (isPlayer) + { + base.StartSelect(actingCardIndex, isPlayer); + } + } + + public override void StartChoiceSelect(int actingCardIndex, bool isPlayer = true) + { + if (isPlayer) + { + base.StartChoiceSelect(actingCardIndex, isPlayer); + } + } + + public override void StartSelectFusion(int actingCardIndex, bool isPlayer = true) + { + if (isPlayer) + { + base.StartSelectFusion(actingCardIndex, isPlayer); + } + } + + public override void SelectFusionIngredientCard(int cardIndex, bool isPlayer = true) + { + if (isPlayer) + { + base.SelectFusionIngredientCard(cardIndex, isPlayer); + } + } + + public override void CompleteSelectFusionIngredientCard(bool isPlayer) + { + if (isPlayer) + { + base.CompleteSelectFusionIngredientCard(isPlayer); + } + } + + public override void CancelSelect(bool isPlayer = true) + { + if (isPlayer) + { + base.CancelSelect(isPlayer); + } + } + + public override void CancelChoiceSelect(bool isPlayer = true) + { + if (isPlayer) + { + base.CancelChoiceSelect(isPlayer); + } + } + + public override void SelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer = true, bool isBurialRite = false, bool isChoiceBrave = false, bool isComplete = true) + { + if (isPlayer) + { + base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite, isChoiceBrave: false, isComplete); + } + } + + public override void CompleteSelectCard(int selectedCardIndex, bool isSelfCard, bool isEvolve, bool isPlayer, bool isBurialRite, bool isChoiceBrave) + { + if (isPlayer) + { + base.SelectCard(selectedCardIndex, isSelfCard, isEvolve, isPlayer, isBurialRite, isChoiceBrave); + } + } + + public override void SelectChoiceCard(int selectedChoiceCardId, bool isEvolve = false, bool isPlayer = true, bool isComplete = false) + { + if (isPlayer && isComplete) + { + base.SelectChoiceCard(selectedChoiceCardId, isEvolve, isPlayer, isComplete); + } + } + + public override void WatchSelectChoiceCards(List selectedChoiceCardIds, bool isEvolve = false, bool isPlayer = true, bool isComplete = false) + { + if (isPlayer && isComplete) + { + base.WatchSelectChoiceCards(selectedChoiceCardIds, isEvolve, isPlayer, isComplete); + } + } + + public override void CompleteChoiceCard(List choiceIdList, bool isEvolveTargetSelect, bool isPlayer = true) + { + if (isPlayer) + { + CompleteChoiceDataIns = new CompleteChoiceData(); + OverrideChoicecard(isPlayer); + } + } + + public override void OverrideChoicecard(bool isPlayer) + { + if (isPlayer) + { + base.OverrideChoicecard(isPlayer); + } + } +} diff --git a/SVSim.BattleEngine/Engine/RoomInviteReceiveDialog.cs b/SVSim.BattleEngine/Engine/RoomInviteReceiveDialog.cs new file mode 100644 index 0000000..5c4033b --- /dev/null +++ b/SVSim.BattleEngine/Engine/RoomInviteReceiveDialog.cs @@ -0,0 +1,259 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.ErrorDialog; +using Wizard.RoomMatch; +using Wizard.UIFriend; + +public class RoomInviteReceiveDialog : MonoBehaviour +{ + [SerializeField] + protected UIWrapContent WrapContents; + + [SerializeField] + protected WrapContentsScrollBarSize WrapScrollbarSize; + + [SerializeField] + protected GameObject ScrollViewObject; + + [SerializeField] + protected GameObject ScrollBarObject; + + [SerializeField] + protected GameObject ScrollAreaObject; + + protected List _playerList; + + protected Dictionary> _loadQueueDict = new Dictionary>(); + + protected List _loadBookingList = new List(); + + protected List _loadedList = new List(); + + protected LoadQueue _loadQueue = new LoadQueue(); + + protected int _choicePlayerIndex; + + protected DialogBase _dialog; + + protected bool _isJoinRoom; + + private const int LOAD_MIN = 6; + + public MyPageMenu MyPageClass { get; set; } + + public void SetFriendList() + { + _playerList = new List(); + Friend.PlayerData item = default(Friend.PlayerData); + foreach (UserFriend friend in Wizard.Data.FriendInfo.data.friendList) + { + item.Copy(friend); + _playerList.Add(item); + } + StartCoroutine(LoadCoroutine()); + } + + private IEnumerator LoadCoroutine() + { + if (_playerList.Count == 0) + { + _dialog = UIManager.GetInstance().CreateDialogClose(); + _dialog.SetTitleLabel(Wizard.Data.SystemText.Get("RoomBattle_0068")); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _dialog.SetText(Wizard.Data.SystemText.Get("RoomBattle_0067")); + ReturnTopFromError(_playerList.Count); + } + else + { + _loadedList.Clear(); + _loadBookingList.Clear(); + _loadQueueDict.Clear(); + List list = new List(); + for (int i = 0; i < _playerList.Count; i++) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(_playerList[i].EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_S); + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(_playerList[i].Rank.ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S); + string text = (string.IsNullOrEmpty(_playerList[i].Country) ? null : Toolbox.ResourcesManager.GetAssetTypePath(_playerList[i].Country, ResourcesManager.AssetLoadPathType.Country_S)); + List list2 = new List(); + if (!_loadedList.Contains(assetTypePath) && !list.Contains(assetTypePath)) + { + list.Add(assetTypePath); + list2.Add(assetTypePath); + } + foreach (string degreeResource in DegreeHelper.GetDegreeResourceList(_playerList[i].DegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false)) + { + if (!_loadedList.Contains(degreeResource) && !list.Contains(degreeResource)) + { + list.Add(degreeResource); + list2.Add(degreeResource); + } + } + if (!_loadedList.Contains(assetTypePath2) && !list.Contains(assetTypePath2)) + { + list.Add(assetTypePath2); + list2.Add(assetTypePath2); + } + if (text != null && !_loadedList.Contains(text) && !list.Contains(text)) + { + list.Add(text); + list2.Add(text); + } + if (6 > i) + { + _loadBookingList.AddRange(list2); + continue; + } + _loadQueueDict.Add(i, list2); + LoadQueue.Callback onEnd = delegate(string id) + { + _loadedList.AddRange(_loadQueueDict[int.Parse(id)]); + }; + _loadQueue.AddToLast(i.ToString(), list2, null, onEnd); + } + bool loadEndFlg = false; + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadBookingList, delegate + { + loadEndFlg = true; + })); + while (!loadEndFlg) + { + yield return null; + } + _loadedList.AddRange(_loadBookingList); + _loadQueue.StartLoad(); + _dialog = UIManager.GetInstance().CreateDialogClose(); + _dialog.SetTitleLabel(Wizard.Data.SystemText.Get("RoomBattle_0069")); + _dialog.SetObj(base.gameObject); + _dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + _dialog.SetSize(DialogBase.Size.M); + _dialog.OnClose = delegate + { + UIManager.GetInstance().StartCoroutine(InviteDialogClose()); + }; + Init(); + } + UIManager.GetInstance().closeInSceneCenterLoading(); + } + + protected IEnumerator InviteDialogClose() + { + if (!_isJoinRoom) + { + UIManager.GetInstance().createInSceneCenterLoading(); + } + _loadQueue.Clear(); + while (_loadQueue.IsClearing) + { + yield return null; + } + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedList); + if (!_isJoinRoom) + { + UIManager.GetInstance().closeInSceneCenterLoading(); + } + } + + public void Init() + { + WrapContents.onInitializeItem = _OnInitializeItem; + WrapContents.maxIndex = 0; + ScrollBarObject.GetComponent().m_WrapContents = WrapContents; + WrapContents.minIndex = -(_playerList.Count - 1); + WrapScrollbarSize.ContentUpdate(); + WrapContents.SortBasedOnScrollMovement(); + UIPanel component = ScrollViewObject.GetComponent(); + int count = _playerList.Count; + if (component.height > (float)(count * WrapContents.itemSize)) + { + ScrollBarObject.SetActive(value: false); + ScrollAreaObject.SetActive(value: false); + ScrollViewObject.GetComponent().ResetPosition(); + } + else + { + ScrollBarObject.SetActive(value: true); + ScrollAreaObject.SetActive(value: true); + } + ScrollViewObject.GetComponent().ResetPosition(); + ScrollBarObject.GetComponent().value = 0f; + } + + protected void _OnInitializeItem(GameObject go, int wrapIndex, int realIndex) + { + int num = realIndex * -1; + go.name = num.ToString(); + Transform[] componentsInChildren = go.GetComponentsInChildren(includeInactive: true); + Transform[] array; + if (num >= _playerList.Count || num < 0) + { + array = componentsInChildren; + for (int i = 0; i < array.Length; i++) + { + array[i].gameObject.SetActive(value: false); + } + return; + } + array = componentsInChildren; + for (int i = 0; i < array.Length; i++) + { + array[i].gameObject.SetActive(value: true); + } + go.transform.GetComponent().SetPlayerData(_playerList[num], _loadedList); + EventDelegate eventDelegate = new EventDelegate(this, "RoomJoin"); + eventDelegate.parameters[0].value = num; + RoomInviteFriendColum component = go.GetComponent(); + component.ButtonObject.onClick.Clear(); + component.ButtonObject.onClick.Add(eventDelegate); + if (num + 1 == _playerList.Count) + { + component.UnderLineObject.SetActive(value: false); + } + else + { + component.UnderLineObject.SetActive(value: true); + } + } + + protected void RoomJoin(int inPlayerIndex) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + InviteAcceptTask inviteAcceptTask = new InviteAcceptTask(); + inviteAcceptTask.SetParameter(_playerList[inPlayerIndex].ViewerId); + inviteAcceptTask.SkipAllCuteResultCodeCheckErrorPopup(); + StartCoroutine(Toolbox.NetworkManager.Connect(inviteAcceptTask, AcceptSuccess, null, ErrorDialog)); + } + + private void AcceptSuccess(NetworkTask.ResultCode inResultCode) + { + if (!(_dialog == null)) + { + _dialog.Close(); + _isJoinRoom = true; + RoomConnectController.InitializeParameter param = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.VISITOR, new BattleParameter(NetworkDefine.ServerBattleType.OpenRoom, Format.Max, TwoPickFormat.None, Wizard.Data.InviteFriendBattle.BattleParameterInstance.Rule, isOpenDeckRoom: false), Wizard.Data.InviteFriendBattle.RoomId); + UIManager.GetInstance().StartCoroutine(MyPageMenu.Instance.BattleMenu.JoinRoom(param, isInvite: true)); + } + } + + protected void ErrorDialog(int inErrorNo) + { + ReturnTopFromError(Wizard.Data.Load.data._receiveInviteCount); + _dialog.Close(); + Dialog.Create(inErrorNo); + } + + protected void ReturnTopFromError(int inInviteCount) + { + if (inInviteCount <= 1) + { + InviteReset(); + } + } + + protected void InviteReset() + { + Object.Destroy(base.gameObject); + } +} diff --git a/SVSim.BattleEngine/Engine/SendIntervalTriggerStandard.cs b/SVSim.BattleEngine/Engine/SendIntervalTriggerStandard.cs new file mode 100644 index 0000000..bed65ce --- /dev/null +++ b/SVSim.BattleEngine/Engine/SendIntervalTriggerStandard.cs @@ -0,0 +1,11 @@ +public class SendIntervalTriggerStandard : SendIntervalTrigger +{ + public override void SendDataCheck(NetworkBattleManagerBase networkBattleManager, NetworkBattleDefine.NetworkBattleURI sendUri) + { + base.SendDataCheck(networkBattleManager, sendUri); + if (ReceiveIntervalTrigger.IsEffectiveURI(sendUri)) + { + (networkBattleManager as NetworkStandardBattleMgr).battleStopChecker.StartChecker(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/SetDamageInfo.cs b/SVSim.BattleEngine/Engine/SetDamageInfo.cs new file mode 100644 index 0000000..f4a89fc --- /dev/null +++ b/SVSim.BattleEngine/Engine/SetDamageInfo.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; + +public class SetDamageInfo : DamageModifier +{ + public int SetDamage { get; private set; } + + public SetDamageInfo(int setDamage, string damageType, CardBasePrm.ClanType damageClan, bool isUseClass, int order) + { + SetDamage = setDamage; + base.DamageType = new List(); + base.DamageType.AddRange(damageType.Split(new string[1] { "_and_" }, StringSplitOptions.None)); + base.DamageClan = new List { damageClan }; + base.IsUseClass = isUseClass; + base.OrderCount = order; + } + + public override int Calc(int damage) + { + return SetDamage; + } +} diff --git a/SVSim.BattleEngine/Engine/SetHealModifierInfo.cs b/SVSim.BattleEngine/Engine/SetHealModifierInfo.cs new file mode 100644 index 0000000..4b9c256 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SetHealModifierInfo.cs @@ -0,0 +1,27 @@ +public class SetHealModifierInfo : HealModifier +{ + private bool _isTargetSelfClass; + + public int SetHealAmount { get; private set; } + + public SetHealModifierInfo(int setHealAmount, int order, BattleCardBase owner, bool isTargetSelfClass) + { + SetHealAmount = setHealAmount; + base.OrderCount = order; + _owner = owner; + _isTargetSelfClass = isTargetSelfClass; + } + + public override int Calc(int healAmount, BattleCardBase healOwner, BattleCardBase target) + { + if (_isTargetSelfClass) + { + if (target.IsClass && _owner == target) + { + return SetHealAmount; + } + return healAmount; + } + return SetHealAmount; + } +} diff --git a/SVSim.BattleEngine/Engine/SpecialCrystalDialog.cs b/SVSim.BattleEngine/Engine/SpecialCrystalDialog.cs new file mode 100644 index 0000000..83d4637 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpecialCrystalDialog.cs @@ -0,0 +1,468 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.ErrorDialog; + +public class SpecialCrystalDialog : MonoBehaviour +{ + private const int TIME_LIMIT_ERROR_CODE = 4305; + + private const float FLICK_MARGIN = 70f; + + private List _assetList = new List(); + + [SerializeField] + private UITexture _tipsTexture; + + [SerializeField] + private GameObject _jpnOnlyRoot; + + [SerializeField] + private UIDragScrollView _dragScrollView; + + [SerializeField] + private UIButton _fundSettlementButton; + + [SerializeField] + private UIButton _legalButton; + + [SerializeField] + private UILabel _priceLabel; + + [SerializeField] + private UILabel _timeLimitLabel; + + [SerializeField] + private UILabel _purchaseCountLabel; + + [SerializeField] + private GameObject _buyFinishDialogPrefab; + + [SerializeField] + private GameObject _rootObject; + + [SerializeField] + private UIButton _arrowLeftButton; + + [SerializeField] + private UIButton _arrowRightButton; + + [SerializeField] + private GameObject _dragObject; + + private string _defaultOpen = string.Empty; + + private bool _isDragging; + + private int _selectIndex; + + private DialogBase _dialog; + + private bool _finishGetProduct; + + private static string _defaultOpenPageStatus = string.Empty; + + private static GameObject _originalPrefab; + + private static string _productName; + + private static Action _saveOnCancel; + + private static Action _saveOnFinish; + + private static string saveScrollToProductId; + + private static List _specialCrystalInfo = null; + + private static GameObject _finishDialogPrefab; + + public static void Create(GameObject prefab, string scrollToProductId, Action onCancel, Action onFinish) + { + _originalPrefab = prefab; + _saveOnCancel = onCancel; + _saveOnFinish = onFinish; + saveScrollToProductId = scrollToProductId; + SystemText systemText = Wizard.Data.SystemText; + GameObject gameObject = UnityEngine.Object.Instantiate(prefab); + SpecialCrystalDialog specialDialog = gameObject.GetComponent(); + specialDialog._defaultOpen = _defaultOpenPageStatus; + _defaultOpenPageStatus = string.Empty; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonText(systemText.Get("Dia_BuyCrystal_004_Button"), systemText.Get("MyPage_0054")); + dialogBase.onPushButton1 = delegate + { + specialDialog.OnClickBuyButton(); + }; + dialogBase.onPushButton2 = delegate + { + BuyCrystal.InstantiateCrystalDialog(scrollToProductId, onlyInputBirthday: false, onCancel, onFinish); + }; + dialogBase.onCloseWithoutSelect = delegate + { + PaymentPC.GetInstance().finalize(); + }; + dialogBase.ClickSe_Btn2 = Se.TYPE.SYS_BTN_DECIDE; + dialogBase.SetDisp(inDisp: false); + dialogBase.gameObject.SetActive(value: false); + specialDialog._dialog = dialogBase; + specialDialog._rootObject.SetActive(value: false); + } + + public static void SetDefaultOpenPage(string openPageStatus) + { + _defaultOpenPageStatus = openPageStatus; + } + + private string CorrectPriceText(string price) + { + return Wizard.Data.SystemText.Get("Shop_0083") + "$" + price; + } + + private void Start() + { + UIManager.GetInstance().StartCoroutine(Initialize()); + } + + private IEnumerator Initialize() + { + _finishDialogPrefab = _buyFinishDialogPrefab; + UIManager.GetInstance().createInSceneCenterLoading(); + bool oldBackKeyEnable = GameMgr.GetIns().GetInputMgr().isBackKeyEnable; + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false; + foreach (SpecialCrystalInfo item in Wizard.Data.Load.data._userCrystalCount.SpecialCrystalInfo) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(item.DialogBGImageFileName, ResourcesManager.AssetLoadPathType.SpecialCrystal); + _assetList.Add(assetTypePath); + } + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroup(_assetList, null)); + _ = Wizard.Data.SystemText; + PaymentPC paymentImpl = PaymentPC.GetInstance(); + paymentImpl.initialize(); + paymentImpl.ProductListSucceeded += OnSuccessGetProductList; + paymentImpl.ProductListFailed += OnFailedGetProductList; + while (!_finishGetProduct) + { + yield return null; + } + _specialCrystalInfo = new List(); + foreach (SpecialCrystalInfo item2 in Wizard.Data.Load.data._userCrystalCount.SpecialCrystalInfo) + { + if (paymentImpl.FormatProductPriceList.ContainsKey(item2.ProductId) && item2.RemainTime.Second > 0) + { + _specialCrystalInfo.Add(item2); + } + } + UIManager.GetInstance().closeInSceneCenterLoading(); + _dialog.gameObject.SetActive(value: true); + _dialog.SetDisp(inDisp: true); + _dialog.SetObj(base.gameObject); + _rootObject.SetActive(value: true); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = oldBackKeyEnable; + if (!string.IsNullOrEmpty(_defaultOpen) && !_specialCrystalInfo.Exists((SpecialCrystalInfo info) => info.Status == _defaultOpen)) + { + CloseDialogOnErrorFinish(); + Dialog.Create(4305); + yield break; + } + if (_specialCrystalInfo.Count == 0) + { + CloseDialogOnErrorFinish(); + BuyCrystal.InstantiateCrystalDialog(null, onlyInputBirthday: false, _saveOnCancel, _saveOnFinish); + yield break; + } + UpdateRemainTimeLabel(); + UIEventListener.Get(_arrowLeftButton.gameObject).onClick = delegate + { + OnClickButtonLeft(); + }; + UIEventListener.Get(_arrowRightButton.gameObject).onClick = delegate + { + OnClickButtonRight(); + }; + if (_specialCrystalInfo.Count <= 1) + { + _arrowLeftButton.gameObject.SetActive(value: false); + _arrowRightButton.gameObject.SetActive(value: false); + } + _jpnOnlyRoot.gameObject.SetActive(value: false); + _dragScrollView.enabled = false; + InitializeDragEvent(); + int page = 0; + for (int num = 0; num < _specialCrystalInfo.Count; num++) + { + if (_specialCrystalInfo[num].Status == _defaultOpen) + { + page = num; + break; + } + } + ChangeSelectSpecialCrystal(page); + } + + private void CloseDialogOnErrorFinish() + { + base.gameObject.SetActive(value: false); + _dialog.SetDisp(inDisp: false); + _dialog.Close(); + _specialCrystalInfo = null; + } + + private void InitializeDragEvent() + { + if (_specialCrystalInfo.Count <= 1) + { + return; + } + UIEventListener.Get(_dragObject).onDragStart = delegate + { + _isDragging = true; + }; + UIEventListener.Get(_dragObject).onDragEnd = delegate + { + _isDragging = false; + }; + UIEventListener.Get(_dragObject).onDrag = delegate(GameObject obj, Vector2 delta) + { + if (delta.x >= 70f) + { + if (_isDragging) + { + OnClickButtonLeft(); + _isDragging = false; + } + } + else if (delta.x <= -70f && _isDragging) + { + OnClickButtonRight(); + _isDragging = false; + } + }; + UIEventListener.Get(_dragObject).onScroll = delegate(GameObject obj, float delta) + { + if (delta > 0f) + { + if (_isDragging) + { + OnClickButtonLeft(); + _isDragging = false; + } + } + else if (_isDragging) + { + OnClickButtonRight(); + _isDragging = false; + } + }; + } + + private void UpdateRemainTimeLabel() + { + if (_specialCrystalInfo != null && _selectIndex <= _specialCrystalInfo.Count) + { + SpecialCrystalInfo specialCrystalInfo = _specialCrystalInfo[_selectIndex]; + _timeLimitLabel.text = specialCrystalInfo.RemainTime.GetShowText(); + } + } + + private void Update() + { + UpdateRemainTimeLabel(); + } + + private void OnSuccessGetProductList() + { + _finishGetProduct = true; + ClearPaymentHandler(); + } + + private void OnFailedGetProductList() + { + _finishGetProduct = true; + ClearPaymentHandler(); + BuyCrystal.PaymentListErrorDialog(); + _dialog.Close(); + } + + private void ClearPaymentHandler() + { + PaymentPC instance = PaymentPC.GetInstance(); + instance.ProductListSucceeded -= OnSuccessGetProductList; + instance.ProductListFailed -= OnFailedGetProductList; + } + + private void OnClickFundSettingButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.FUND_SETTLEMENT); + } + + private void OnClickLegalButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.LEGALTEXT); + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_assetList); + _assetList.Clear(); + } + + private void OnClickBuyButton() + { + if (PlayerStaticData.IsLootBoxRegulation(PlayerStaticData.LootBoxType.SPECIAL_CRYSTAL)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + LootBoxDialogUtility.CreateLootBoxRegulationDialog(PlayerStaticData.LootBoxType.SPECIAL_CRYSTAL); + } + else if (CreateItemList.IsBirthdayNotInput()) + { + ShowBirthdayInputDialog(); + } + else + { + ShowPayment(_selectIndex); + } + } + + private void ShowBirthdayInputDialog() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + Action onFinish = delegate + { + OnDecideBirthday(_selectIndex); + }; + bool onlyInputBirthday = true; + BuyCrystal.CreateBuyCrystal(isPlaySe: false, null, onlyInputBirthday, OnCancelBirthdayDialog, onFinish, isSpecialCrystal: true); + } + + private static void OnCancelBirthdayDialog() + { + Create(_originalPrefab, saveScrollToProductId, _saveOnCancel, _saveOnFinish); + } + + private static void OnDecideBirthday(int index) + { + ShowPayment(index); + } + + private static void ShowPayment(int index) + { + SpecialCrystalInfo info = _specialCrystalInfo[index]; + Action value = delegate + { + OnCunsumePurchageSuccess(info); + }; + if (!PaymentPC.GetInstance().ProductPriceList.ContainsKey(info.ProductId)) + { + Dialog.Create(4305); + return; + } + PaymentPC.GetInstance().purchaceStart(info.ProductId); + PaymentPC.GetInstance().ConsumePurchaseSucceeded += value; + } + + private static void OnCunsumePurchageSuccess(SpecialCrystalInfo info) + { + OnFinishPayment(info); + } + + private static void OnPurchageFinishSuccess(SpecialCrystalInfo info) + { + OnFinishPayment(info); + } + + private static void OnFinishPayment(SpecialCrystalInfo info) + { + UIManager.GetInstance().StartCoroutine(OnFinishPaymentCoroutine(info)); + } + + private static IEnumerator OnFinishPaymentCoroutine(SpecialCrystalInfo info) + { + UIManager.GetInstance().OpenNotTouch(); + SpecialCrystalTaskInfo task = new SpecialCrystalTaskInfo(); + bool taskSuccess = false; + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + taskSuccess = true; + })); + while (!taskSuccess) + { + yield return null; + } + UIManager.GetInstance().offNotTouch(); + ShowBuyFinishDialog(info); + } + + private static void ShowBuyFinishDialog(SpecialCrystalInfo info) + { + Action value = delegate + { + OnPurchageFinishSuccess(info); + }; + PaymentImpl.GetInstance().ConsumePurchaseSucceeded -= value; + if (!PaymentImpl.GetInstance().IsRefundedReceipt) + { + SpecialCrystalBuyFinishDialog.Create(_finishDialogPrefab, info, _productName); + } + } + + private void OnClickButtonLeft() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + _selectIndex--; + if (_selectIndex < 0) + { + _selectIndex = _specialCrystalInfo.Count - 1; + } + ChangeSelectSpecialCrystal(_selectIndex); + } + + private void OnClickButtonRight() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + _selectIndex++; + if (_selectIndex >= _specialCrystalInfo.Count) + { + _selectIndex = 0; + } + ChangeSelectSpecialCrystal(_selectIndex); + } + + private void ChangeSelectSpecialCrystal(int page) + { + _selectIndex = page; + PaymentPC instance = PaymentPC.GetInstance(); + SpecialCrystalInfo specialCrystalInfo = _specialCrystalInfo[_selectIndex]; + Dictionary formatProductPriceList = instance.FormatProductPriceList; + _dialog.SetTitleLabel(specialCrystalInfo.DialogTitle); + if (formatProductPriceList != null) + { + bool flag = false; + foreach (KeyValuePair item in formatProductPriceList) + { + if (item.Key == specialCrystalInfo.ProductId) + { + _priceLabel.text = CorrectPriceText(item.Value); + flag = true; + break; + } + } + if (!flag) + { + _priceLabel.text = string.Empty; + } + else + { + _productName = instance.ProductNameList[specialCrystalInfo.ProductId]; + } + _purchaseCountLabel.text = Wizard.Data.SystemText.Get("MyPage_0060", specialCrystalInfo.AvailablePurchaseCount.ToString()); + } + _tipsTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(specialCrystalInfo.DialogBGImageFileName, ResourcesManager.AssetLoadPathType.SpecialCrystal, isfetch: true)) as Texture; + } +} diff --git a/SVSim.BattleEngine/Engine/SpecialSkillBattleCard.cs b/SVSim.BattleEngine/Engine/SpecialSkillBattleCard.cs new file mode 100644 index 0000000..55d882e --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpecialSkillBattleCard.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using Wizard; +using Wizard.Battle.Card; + +public class SpecialSkillBattleCard : BattleCardBase +{ + public BossRushSpecialSkill Skill; + + public override bool IsSpecialSkill => true; + + public SpecialSkillBattleCard(BossRushSpecialSkill skill, BuildInfo buildInfo) + : base(buildInfo) + { + Skill = skill; + } + + public override string SkillDescription(BattlePlayerBase.SideLogInfo sideLogInfo = null, bool isSkipOption = false, BuffInfo buff = null, string divergenceId = "", List skillDescriptionValueList = null, List sideLogDescriptionValueList = null) + { + return ConvertSkillDescription(Skill.SkillDescText, sideLogInfo, isSkipOption, buff, divergenceId, skillDescriptionValueList, (base.IsBuffDetail && base.ReplayBuffDetailSkillDescriptionValueList.Count > 0) ? base.ReplayBuffDetailSkillDescriptionValueList : base.ReplaySkillDescriptionValueList); + } + + public override string EvoSkillDescription(BattlePlayerBase.SideLogInfo sideLogInfo = null, bool isSkipOption = false, BuffInfo buff = null, string divergenceId = "", List skillDescriptionValueList = null, List sideLogDescriptionValueList = null) + { + return string.Empty; + } + + public override BattleCardBase VirtualClone(BattlePlayerBase selfBattlePlayer, BattlePlayerBase opponentBattlePlayer) + { + VirtualSpecialSkillBattleCard virtualSpecialSkillBattleCard = new VirtualSpecialSkillBattleCard(Skill, _buildInfo.VirtualClone(selfBattlePlayer, opponentBattlePlayer)); + CopyToVirtualCardBase(virtualSpecialSkillBattleCard); + return virtualSpecialSkillBattleCard; + } +} diff --git a/SVSim.BattleEngine/Engine/SpecialSkillCardCreator.cs b/SVSim.BattleEngine/Engine/SpecialSkillCardCreator.cs new file mode 100644 index 0000000..bcc3d64 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpecialSkillCardCreator.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +public class SpecialSkillCardCreator : CardCreatorBase +{ + public SpecialSkillCardCreator(GameObject rootObject) + : base(rootObject) + { + } +} diff --git a/SVSim.BattleEngine/Engine/SpellCardCreator.cs b/SVSim.BattleEngine/Engine/SpellCardCreator.cs new file mode 100644 index 0000000..e005499 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpellCardCreator.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +public class SpellCardCreator : CardCreatorBase +{ + public SpellCardCreator(GameObject rootObject) + : base(rootObject) + { + } +} diff --git a/SVSim.BattleEngine/Engine/SpellSkillCollection.cs b/SVSim.BattleEngine/Engine/SpellSkillCollection.cs new file mode 100644 index 0000000..b583651 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SpellSkillCollection.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard; +using Wizard.Battle.View.Vfx; + +public class SpellSkillCollection : SkillCollectionBase +{ + public SpellSkillCollection(BattleCardBase ownerCard) + : base(ownerCard) + { + } + + public override VfxWith CreateWhenPlayInfo(BattleCardBase playCard, SkillProcessor skillProcessor, BattlePlayerReadOnlyInfoPair playerInfoPair, SkillConditionCheckerOption option) + { + SkillProcessor.ProcessInfo value = CreateProcessInfo((SkillBase s) => s.OnWhenPlayStart, skillProcessor, playerInfoPair, option); + return new VfxWith(NullVfx.GetInstance(), value); + } + + public override bool CheckWhenPlayCondition(BattlePlayerReadOnlyInfoPair playerInfoPair, bool isPrePlay) + { + List list = _skillList.Where((SkillBase s) => s.IsWhenPlaySkill).ToList(); + SkillBase item = list.First((SkillBase s) => s is Skill_spell_charge); + list.Remove(item); + return list.Any((SkillBase s) => s.CheckCondition(playerInfoPair, new SkillConditionCheckerOption(), isPrePlay)); + } +} diff --git a/SVSim.BattleEngine/Engine/Sqlite3Plugin/DatabaseCorruptionException.cs b/SVSim.BattleEngine/Engine/Sqlite3Plugin/DatabaseCorruptionException.cs new file mode 100644 index 0000000..3874476 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Sqlite3Plugin/DatabaseCorruptionException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Sqlite3Plugin; + +public class DatabaseCorruptionException : Exception +{ + public DatabaseCorruptionException(int rc) + : base($"Database is corrupted: code {rc}") + { + } +} diff --git a/SVSim.BattleEngine/Engine/Sqlite3Plugin/ResultCode.cs b/SVSim.BattleEngine/Engine/Sqlite3Plugin/ResultCode.cs new file mode 100644 index 0000000..be40b49 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Sqlite3Plugin/ResultCode.cs @@ -0,0 +1,80 @@ +using System; + +namespace Sqlite3Plugin; + +public class ResultCode +{ + public const int SQLITE_OK = 0; + + public const int SQLITE_ERROR = 1; + + public const int SQLITE_INTERNAL = 2; + + public const int SQLITE_PERM = 3; + + public const int SQLITE_ABORT = 4; + + public const int SQLITE_BUSY = 5; + + public const int SQLITE_LOCKED = 6; + + public const int SQLITE_NOMEM = 7; + + public const int SQLITE_READONLY = 8; + + public const int SQLITE_INTERRUPT = 9; + + public const int SQLITE_IOERR = 10; + + public const int SQLITE_CORRUPT = 11; + + public const int SQLITE_NOTFOUND = 12; + + public const int SQLITE_FULL = 13; + + public const int SQLITE_CANTOPEN = 14; + + public const int SQLITE_PROTOCOL = 15; + + public const int SQLITE_EMPTY = 16; + + public const int SQLITE_SCHEMA = 17; + + public const int SQLITE_TOOBIG = 18; + + public const int SQLITE_CONSTRAINT = 19; + + public const int SQLITE_MISMATCH = 20; + + public const int SQLITE_MISUSE = 21; + + public const int SQLITE_NOLFS = 22; + + public const int SQLITE_AUTH = 23; + + public const int SQLITE_FORMAT = 24; + + public const int SQLITE_RANGE = 25; + + public const int SQLITE_NOTADB = 26; + + public const int SQLITE_NOTICE = 27; + + public const int SQLITE_WARNING = 28; + + public const int SQLITE_ROW = 100; + + public const int SQLITE_DONE = 101; + + public static void CheckCorruption(int rc, string errMsg = null) + { + if (rc == 11 || rc == 26) + { + throw new DatabaseCorruptionException(rc); + } + if (!string.IsNullOrEmpty(errMsg) && errMsg.IndexOf("unsupported file format", StringComparison.OrdinalIgnoreCase) >= 0) + { + throw new DatabaseCorruptionException(26); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Sqlite3Plugin/Sqlite3LibImport.cs b/SVSim.BattleEngine/Engine/Sqlite3Plugin/Sqlite3LibImport.cs new file mode 100644 index 0000000..4a873c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Sqlite3Plugin/Sqlite3LibImport.cs @@ -0,0 +1,72 @@ +using System; +using System.Runtime.InteropServices; + +namespace Sqlite3Plugin; + +public static class Sqlite3LibImport +{ + private const string LibraryName = "libsqlite3"; + + [DllImport("libsqlite3")] + public static extern int sqlite3_open(byte[] zFilename, out IntPtr ppDB); + + [DllImport("libsqlite3")] + public static extern int sqlite3_open_v2(byte[] zFilename, out IntPtr ppDB, int flags, byte[] zVfs); + + [DllImport("libsqlite3")] + public static extern int sqlite3_close(IntPtr db); + + [DllImport("libsqlite3")] + public static extern int sqlite3_exec(IntPtr db, byte[] zSql, IntPtr xCallback, IntPtr pArg, out IntPtr pzErrMsg); + + [DllImport("libsqlite3")] + public static extern int sqlite3_prepare_v2(IntPtr db, byte[] zSql, int nBytes, out IntPtr ppStmt, IntPtr pzTail); + + [DllImport("libsqlite3")] + public static extern int sqlite3_bind_text(IntPtr pStmt, int i, byte[] zData, int nData, IntPtr xDel); + + [DllImport("libsqlite3")] + public static extern int sqlite3_bind_int(IntPtr pStmt, int i, int iValue); + + [DllImport("libsqlite3")] + public static extern int sqlite3_bind_double(IntPtr pStmt, int i, double rValue); + + [DllImport("libsqlite3")] + public static extern int sqlite3_bind_null(IntPtr pStmt, int i); + + [DllImport("libsqlite3")] + public static extern int sqlite3_reset(IntPtr pStmt); + + [DllImport("libsqlite3")] + public static extern int sqlite3_step(IntPtr pStmt); + + [DllImport("libsqlite3")] + public static extern int sqlite3_finalize(IntPtr pStmt); + + [DllImport("libsqlite3")] + public static extern int sqlite3_column_int(IntPtr pStmt, int i); + + [DllImport("libsqlite3")] + public static extern double sqlite3_column_double(IntPtr pStmt, int i); + + [DllImport("libsqlite3")] + public static extern int sqlite3_column_bytes(IntPtr pStmt, int i); + + [DllImport("libsqlite3")] + public static extern IntPtr sqlite3_column_blob(IntPtr pStmt, int i); + + [DllImport("libsqlite3")] + public static extern IntPtr sqlite3_column_text(IntPtr pStmt, int i); + + [DllImport("libsqlite3")] + public static extern int sqlite3_column_type(IntPtr pStmt, int i); + + [DllImport("libsqlite3")] + public static extern int sqlite3_vfs_register(IntPtr pStmt, int makeDflt); + + [DllImport("libsqlite3")] + public static extern int sqlite3_vfs_unregister(IntPtr pVfs); + + [DllImport("libsqlite3")] + public static extern IntPtr sqlite3_vfs_find(byte[] zVfsName); +} diff --git a/SVSim.BattleEngine/Engine/StaticTextForUILabel.cs b/SVSim.BattleEngine/Engine/StaticTextForUILabel.cs new file mode 100644 index 0000000..aec28be --- /dev/null +++ b/SVSim.BattleEngine/Engine/StaticTextForUILabel.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using Wizard; + +public class StaticTextForUILabel : MonoBehaviour +{ + [SerializeField] + private string m_textID = ""; + + private void Start() + { + UILabel component = GetComponent(); + if ((bool)component) + { + component.text = Data.SystemText.Get(m_textID); + } + } + + public void Set(string id, string memo) + { + m_textID = id; + } +} diff --git a/SVSim.BattleEngine/Engine/StorySection.cs b/SVSim.BattleEngine/Engine/StorySection.cs new file mode 100644 index 0000000..193befd --- /dev/null +++ b/SVSim.BattleEngine/Engine/StorySection.cs @@ -0,0 +1,4 @@ +public class StorySection +{ + public static readonly int TUTORIAL_SECTION_ID; +} diff --git a/SVSim.BattleEngine/Engine/SwitchLanguage.cs b/SVSim.BattleEngine/Engine/SwitchLanguage.cs new file mode 100644 index 0000000..8364a04 --- /dev/null +++ b/SVSim.BattleEngine/Engine/SwitchLanguage.cs @@ -0,0 +1,445 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard; + +public class SwitchLanguage : MonoBehaviour +{ + private const int DEFAULT_INDEX = 0; + + [SerializeField] + private UILabel _labelSelectTextLanguage; + + [SerializeField] + private UILabel _labelSelectVoiceLanguage; + + [SerializeField] + private GameObject _myPageLayoutRoot; + + [SerializeField] + private GameObject _titleLayoutRoot; + + [SerializeField] + private UIToggle _useSmallResource; + + private List _languageTextList = new List(); + + private List _languageKeyList = new List(); + + private List _languageTextListVoice = new List(); + + private int _currentTextIndex; + + private int _currentVoiceIndex; + + private string _selectTextLanguage = ""; + + private string _selectVoiceLanguage = ""; + + private bool _isFirstCallUseSmallResourceToggleChange = true; + + private static readonly Dictionary _dictTableVoiceLanguage = new Dictionary + { + { + Global.LANG_TYPE.Eng.ToString(), + new string[2] + { + Global.LANG_TYPE.Eng.ToString(), + Global.LANG_TYPE.Jpn.ToString() + } + }, + { + Global.LANG_TYPE.Kor.ToString(), + new string[2] + { + Global.LANG_TYPE.Kor.ToString(), + Global.LANG_TYPE.Jpn.ToString() + } + }, + { + Global.LANG_TYPE.Chs.ToString(), + new string[1] { Global.LANG_TYPE.Jpn.ToString() } + }, + { + Global.LANG_TYPE.Cht.ToString(), + new string[1] { Global.LANG_TYPE.Jpn.ToString() } + }, + { + Global.LANG_TYPE.Fre.ToString(), + new string[2] + { + Global.LANG_TYPE.Eng.ToString(), + Global.LANG_TYPE.Jpn.ToString() + } + }, + { + Global.LANG_TYPE.Ita.ToString(), + new string[2] + { + Global.LANG_TYPE.Eng.ToString(), + Global.LANG_TYPE.Jpn.ToString() + } + }, + { + Global.LANG_TYPE.Ger.ToString(), + new string[2] + { + Global.LANG_TYPE.Eng.ToString(), + Global.LANG_TYPE.Jpn.ToString() + } + }, + { + Global.LANG_TYPE.Spa.ToString(), + new string[2] + { + Global.LANG_TYPE.Eng.ToString(), + Global.LANG_TYPE.Jpn.ToString() + } + } + }; + + private Dictionary> _dictTableVoiceLanguageViewText = new Dictionary> + { + { + Global.LANG_TYPE.Eng.ToString(), + new Dictionary + { + { + Global.LANG_TYPE.Eng.ToString(), + "System_Eng_Eng" + }, + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Eng_Jpn" + } + } + }, + { + Global.LANG_TYPE.Kor.ToString(), + new Dictionary + { + { + Global.LANG_TYPE.Kor.ToString(), + "System_Kor_Kor" + }, + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Kor_Jpn" + } + } + }, + { + Global.LANG_TYPE.Chs.ToString(), + new Dictionary { + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Chs_Jpn" + } } + }, + { + Global.LANG_TYPE.Cht.ToString(), + new Dictionary { + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Cht_Jpn" + } } + }, + { + Global.LANG_TYPE.Fre.ToString(), + new Dictionary + { + { + Global.LANG_TYPE.Eng.ToString(), + "System_Fre_Eng" + }, + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Fre_Jpn" + } + } + }, + { + Global.LANG_TYPE.Ita.ToString(), + new Dictionary + { + { + Global.LANG_TYPE.Eng.ToString(), + "System_Ita_Eng" + }, + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Ita_Jpn" + } + } + }, + { + Global.LANG_TYPE.Ger.ToString(), + new Dictionary + { + { + Global.LANG_TYPE.Eng.ToString(), + "System_Ger_Eng" + }, + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Ger_Jpn" + } + } + }, + { + Global.LANG_TYPE.Spa.ToString(), + new Dictionary + { + { + Global.LANG_TYPE.Eng.ToString(), + "System_Spa_Eng" + }, + { + Global.LANG_TYPE.Jpn.ToString(), + "System_Spa_Jpn" + } + } + } + }; + + private DialogBase _switchLanguageDialog; + + public static void Create(bool isForceConfirmDialog, bool isTitle, Action decideCallback, Action decideCallbackWhenSameChoice = null) + { + SwitchLanguage switchLanguage = UnityEngine.Object.Instantiate(UIManager.GetInstance().SwitchLanguagePrefab); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetObj(switchLanguage.gameObject); + switchLanguage.CreateSwitchLanguageDialog(dialogBase, isForceConfirmDialog, isTitle, decideCallback, decideCallbackWhenSameChoice); + } + + public static string GetDefaultVoiceLanguage(string languageKey) + { + if (_dictTableVoiceLanguage.ContainsKey(languageKey)) + { + return _dictTableVoiceLanguage[languageKey][0]; + } + return "Eng"; + } + + public void CreateSwitchLanguageDialog(DialogBase dialog, bool isForceConfirmDialog, bool isTitle, Action decideCallback, Action decideCallbackWhenSameChoice = null) + { + SystemText text = Data.SystemText; + _switchLanguageDialog = dialog; + _switchLanguageDialog.SetSize(DialogBase.Size.M); + _switchLanguageDialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + _switchLanguageDialog.SetButtonText(text.Get("Common_0004")); + _switchLanguageDialog.SetTitleLabel(text.Get("Dia_Language_003_Title")); + _languageKeyList.Clear(); + _languageTextList.Clear(); + Global.LanguageProps[] languagePropList = Global.LanguagePropList; + for (int i = 0; i < languagePropList.Length; i++) + { + Global.LanguageProps languageProps = languagePropList[i]; + _languageKeyList.Add(languageProps.LangType); + _languageTextList.Add(languageProps.DisplayName); + } + isTitle = true; + _titleLayoutRoot.SetActive(isTitle); + _myPageLayoutRoot.SetActive(!isTitle); + _useSmallResource.value = PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 2; + _useSmallResource.onChange.Add(new EventDelegate(delegate + { + OnClickUseSmallResource(); + })); + _selectTextLanguage = Toolbox.SavedataManager.GetString("LANG_SETTING", "Eng"); + _selectVoiceLanguage = Toolbox.SavedataManager.GetString("LANG_SOUND_SETTING", GetDefaultVoiceLanguage(_selectTextLanguage)); + UpdateSelectLanguageLabel(); + _switchLanguageDialog.SetButtonDelegate(delegate + { + bool flag = PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 2; + bool afterUseSmallResource = _useSmallResource.value; + if (isTitle) + { + afterUseSmallResource = flag; + } + if (IsSameCurrentLanguage() && flag == afterUseSmallResource && !isForceConfirmDialog) + { + Toolbox.SavedataManager.SetString("LANG_FIRST_SET", "1"); + decideCallbackWhenSameChoice.Call(); + } + else + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(text.Get("System_0040")); + string textLanguageViewText = GetTextLanguageViewText(_selectTextLanguage); + string voiceLanguageViewText = GetVoiceLanguageViewText(_selectTextLanguage, _selectVoiceLanguage); + string arg = Data.SystemText.Get(afterUseSmallResource ? "System_0062" : "System_0061"); + string key = ((PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS) == 0) ? "System_0063" : "System_0041"); + dialogBase.SetText(string.Format(text.Get(key), textLanguageViewText, voiceLanguageViewText, arg)); + string selectText = _selectTextLanguage; + string selectVoice = _selectVoiceLanguage; + bool isSameCurrentLanguage = IsSameCurrentLanguage(); + dialogBase.SetButtonText(text.Get("Common_0004")); + dialogBase.SetButtonDelegate(delegate + { + if (UIManager.GetInstance().GetCurrentScene() != UIManager.ViewScene.Title) + { + CheckTimeSlipRotationPeriodTask task = new CheckTimeSlipRotationPeriodTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + ChangeLanguage(isTitle, afterUseSmallResource, decideCallback, selectText, selectVoice, isSameCurrentLanguage); + })); + } + else + { + ChangeLanguage(isTitle, afterUseSmallResource, decideCallback, selectText, selectVoice, isSameCurrentLanguage); + } + }); + } + }); + } + + private static void ChangeLanguage(bool isTitle, bool afterUseSmallResource, Action decideCallback, string selectTextLanguage, string selectVoiceLanguage, bool isSameCurrentLanguage) + { + Toolbox.SavedataManager.SetString("LANG_SETTING", selectTextLanguage); + string fontLangType = Global.GetFontLangType(selectTextLanguage); + Toolbox.SavedataManager.SetString("LANG_FONT", fontLangType); + CustomPreference.SetTextLanguage(Toolbox.SavedataManager.GetString("LANG_SETTING", "Eng")); + Toolbox.SavedataManager.SetString("LANG_SOUND_SETTING", selectVoiceLanguage); + CustomPreference.SetSoundLanguage(Toolbox.SavedataManager.GetString("LANG_SOUND_SETTING", "Eng")); + if (!isTitle) + { + PlayerPrefsCache.Instance.SetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS, (!afterUseSmallResource) ? 1 : 2); + } + Toolbox.SavedataManager.SetString("LANG_FIRST_SET", "1"); + ToolboxGame.SetUp.InitFrameWorkSettings(); + CustomPreference.createResourcePath(); + Data.Initialize(); + Data.SystemText.Initialize(); + if (selectTextLanguage != selectVoiceLanguage) + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.MOVIE_SUBTITLES, flag: true); + } + else + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.MOVIE_SUBTITLES, flag: false); + } + decideCallback.Call(!isSameCurrentLanguage); + } + + public void CreateSwitchTextLanguageDialog() + { + _switchLanguageDialog.SetDisp(inDisp: false); + _currentTextIndex = _languageKeyList.FindIndex((string k) => k == _selectTextLanguage); + if (_currentTextIndex == -1) + { + _currentTextIndex = 0; + } + DialogBase dia = DrumrollDialog.Create(_languageTextList, _currentTextIndex, onSelectTextLanguage); + SystemText systemText = Data.SystemText; + dia.SetTitleLabel(systemText.Get("Dia_Language_001_Text_Title")); + dia.SetButtonText(systemText.Get("Common_0004")); + dia.ResetBackViewAlpha(); + dia.onPushButton1 = delegate + { + _selectTextLanguage = _languageKeyList[_currentTextIndex]; + _selectVoiceLanguage = GetDefaultVoiceLanguage(_selectTextLanguage); + UpdateSelectLanguageLabel(); + _switchLanguageDialog.ReOpen(isResetBackViewAlpha: true); + dia.InactiveBackView(); + }; + dia.onCloseWithoutSelect = delegate + { + _switchLanguageDialog.ReOpen(isResetBackViewAlpha: true); + dia.InactiveBackView(); + }; + } + + private void onSelectTextLanguage(int index) + { + _currentTextIndex = index; + } + + public void CreateSwitchVoiceLanguageDialog() + { + _switchLanguageDialog.SetDisp(inDisp: false); + string[] array = _dictTableVoiceLanguage[_selectTextLanguage]; + _currentVoiceIndex = 0; + _languageTextListVoice.Clear(); + for (int i = 0; i < array.Length; i++) + { + string text = array[i]; + _languageTextListVoice.Add(GetVoiceLanguageViewText(_selectTextLanguage, text)); + if (_selectVoiceLanguage == text) + { + _currentVoiceIndex = i; + } + } + DialogBase dia = DrumrollDialog.Create(_languageTextListVoice, _currentVoiceIndex, onSelectVoiceLanguage); + SystemText systemText = Data.SystemText; + dia.SetTitleLabel(systemText.Get("Dia_Language_002_Voice_Title")); + dia.SetButtonText(systemText.Get("Common_0004")); + dia.ResetBackViewAlpha(); + dia.onPushButton1 = delegate + { + _selectVoiceLanguage = _dictTableVoiceLanguage[_selectTextLanguage][_currentVoiceIndex]; + UpdateSelectLanguageLabel(); + _switchLanguageDialog.ReOpen(isResetBackViewAlpha: true); + dia.InactiveBackView(); + }; + dia.onCloseWithoutSelect = delegate + { + _switchLanguageDialog.ReOpen(isResetBackViewAlpha: true); + dia.InactiveBackView(); + }; + } + + private void onSelectVoiceLanguage(int index) + { + _currentVoiceIndex = index; + } + + private void UpdateSelectLanguageLabel() + { + _labelSelectTextLanguage.text = GetTextLanguageViewText(_selectTextLanguage); + _labelSelectVoiceLanguage.text = GetVoiceLanguageViewText(_selectTextLanguage, _selectVoiceLanguage); + } + + private string GetTextLanguageViewText(string key) + { + string result = string.Empty; + if (Global.IsSupportedLanguageType(key)) + { + result = Global.GetDisplayLanguage(key); + } + return result; + } + + private string GetVoiceLanguageViewText(string textKey, string voiceKey) + { + string text = string.Empty; + if (_dictTableVoiceLanguageViewText.ContainsKey(textKey) && _dictTableVoiceLanguageViewText[textKey].ContainsKey(voiceKey)) + { + text = Data.SystemText.Get(_dictTableVoiceLanguageViewText[textKey][voiceKey]); + } + _ = text == string.Empty; + return text; + } + + private bool IsSameCurrentLanguage() + { + string text = Toolbox.SavedataManager.GetString("LANG_SETTING", "Eng"); + string text2 = Toolbox.SavedataManager.GetString("LANG_SOUND_SETTING", "Eng"); + if (_selectTextLanguage == text && _selectVoiceLanguage == text2) + { + return true; + } + return false; + } + + private void OnClickUseSmallResource() + { + if (!_isFirstCallUseSmallResourceToggleChange) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(_useSmallResource.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + } + _isFirstCallUseSmallResourceToggleChange = false; + } +} diff --git a/SVSim.BattleEngine/Engine/TimeLeftUpdate.cs b/SVSim.BattleEngine/Engine/TimeLeftUpdate.cs new file mode 100644 index 0000000..d6a8467 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TimeLeftUpdate.cs @@ -0,0 +1,28 @@ +using System; +using UnityEngine; +using Wizard; + +public class TimeLeftUpdate : MonoBehaviour +{ + [NonSerialized] + public MailData mailData; + + [SerializeField] + public UILabel timeLeft; + + public void UpdateTime() + { + if (mailData != null) + { + SystemText systemText = Data.SystemText; + if (mailData.limit_type == 1) + { + timeLeft.text = Mail.GetTimeLeft(mailData.reward_limit_time); + } + else + { + timeLeft.text = systemText.Get("Mail_0030"); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/TitleUI.cs b/SVSim.BattleEngine/Engine/TitleUI.cs new file mode 100644 index 0000000..94240e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TitleUI.cs @@ -0,0 +1,722 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; +using Wizard; +using Wizard.Battle.Recovery; +using Wizard.Title; + +public class TitleUI : UIBase +{ + public enum ImageType + { + Default, + Special1, + Special2, + Special3 + } + + public enum BgmType + { + Default, + Special1, + Special2 + } + + private class GuidelineParam + { + public float DisplayTime { get; private set; } + + public bool IncludeFadeInOut { get; private set; } + + public bool EnableTouch { get; private set; } + + public float FadeInTime { get; private set; } + + public float PanelFadeOutTime { get; private set; } + + public float BgFadeOutTime { get; private set; } + + public GuidelineParam(float displayTime, bool includeFadeInOut, bool enableTouch, float fadeInTime, float panelFadeOutTime, float bgFadeOutTime) + { + DisplayTime = displayTime; + IncludeFadeInOut = includeFadeInOut; + EnableTouch = enableTouch; + FadeInTime = fadeInTime; + PanelFadeOutTime = panelFadeOutTime; + BgFadeOutTime = bgFadeOutTime; + } + } + + public const string DEFAULT_TITLE_ID = "0"; + + public const string USE_LOCAL_PREFAB_ID = "1"; + + private const string DEFAULT_TITLE_PATH = "Title/NormalTitle/NormalTitle"; + + [SerializeField] + private GameObject BtnTouchStart; + + [SerializeField] + private UILabel VersionIDLabel; + + [SerializeField] + private UILabel UserIDLabel; + + [SerializeField] + private GameObject _userIdRoot; + + [SerializeField] + private UIButton ButtonMenu; + + [SerializeField] + private UILabel ButtonMenuLabel; + + [SerializeField] + private GameObject ButtonMenuObject; + + [SerializeField] + private UIButton ButtonTransfer; + + [SerializeField] + private UILabel ButtonTransferLabel; + + [SerializeField] + private NguiObjs LoginInput; + + [SerializeField] + private GameObject _korGuidelineRoot; + + [SerializeField] + private UIPanel _korGuidelineDisplayRootPanel; + + [SerializeField] + private UISprite _korGuidelineBG; + + [SerializeField] + private GameObject _jpnGuidelineRoot; + + [SerializeField] + private UIPanel _jpnGuidelineDisplayRootPanel; + + [SerializeField] + private UISprite _jpnGuidelineBG; + + [SerializeField] + private float _jpnGuidelineDisplayTime; + + [SerializeField] + private bool _jpnGuidelineIncludeFadeInOut; + + [SerializeField] + private GameObject _parentTitleView; + + [SerializeField] + private SpecialTitleAssetBundle _specialTitle; + + private GameObject _normalTitle; + + private DialogBase dia; + + private GameSetup _gameSetup; + + private bool _isAutoCacheExecution; + + private Coroutine _fadeInCoroutine; + + private bool _isSteamKor; + + private DataMgr _dataManager; + + private SoundMgr _soundManager; + + private bool IsDownloadTitle + { + get + { + if (_dataManager.TitleId != "0") + { + return _dataManager.TitleId != "1"; + } + return false; + } + } + + public override void onFirstStart() + { + if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Kor.ToString()) + { + _isSteamKor = true; + } + else + { + _isSteamKor = false; + } + string appVersionName = Toolbox.DeviceManager.GetAppVersionName(); + try + { + VideoHostingUtil.AutoPausePublishing(isSave: true); + VideoHostingUtil.AutoStopRecording(isSave: true); + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 VideoHostingUtil InitializeException"); + throw; + } + Toolbox.SceneManager.SceneChangeParameter.KeepAssets = false; + VersionIDLabel.text = "Ver." + appVersionName; + if (Certification.ViewerId > 0) + { + SetUserIdLabel(Certification.ViewerId); + } + else + { + try + { + RecoveryRecordManagerBase.DeleteRecoveryFile(); + SetUserIdLabel(Certification.ViewerId); + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 DeleteRecoveryDataException"); + throw; + } + } + SystemText systemText = Data.SystemText; + try + { + ButtonMenuLabel.text = systemText.Get("Title_0006"); + ButtonTransferLabel.text = systemText.Get("Account_0001"); + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 ButtonTextSetException"); + throw; + } + try + { + base.onFirstStart(); + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 BaseFirstStartException"); + } + GameMgr ins = GameMgr.GetIns(); + _dataManager = ins.GetDataMgr(); + _soundManager = ins.GetSoundMgr(); + try + { + SetChangeableTitleUI(); + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 SetChangeableTitleUIException"); + } + try + { + ins.GetGameObjMgr().GetUIContainer().SetActive(value: false); + Toolbox.AssetManager.AddNoUnloadAssetGroupName("card_foil"); + _gameSetup = new GameSetup(this); + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 InitializeExeption"); + } + try + { + UIEventListener.Get(BtnTouchStart.gameObject).onClick = OnClickStartButton; + UIEventListener.Get(ButtonMenu.gameObject).onClick = OnClickMenuButton; + UIEventListener.Get(ButtonTransfer.gameObject).onClick = OnClickTransferButton; + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 ButtonCallBackException"); + } + if (!DisplayGuideline()) + { + PlayChangeableTitleBGM(); + } + UIManager.GetInstance().CreatFadeOpen(); + if (PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.AUTO_CACHE_CLEAR_FLAG)) + { + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.AUTO_CACHE_CLEAR_FLAG, flag: false); + _isAutoCacheExecution = true; + ClearCache(); + } + } + + private void SetUserIdLabel(int id) + { + if (id > 0) + { + UserIDLabel.text = VideoHostingUtil.GetUserIDHidden($"ID: {id:#,0}".Replace(",", " ")); + } + else + { + UserIDLabel.text = ""; + } + _userIdRoot.SetActive(id > 0); + } + + private void PlayChangeableTitleBGM() + { + switch (_dataManager.TitleId) + { + case "0": + _soundManager.PlayBGM(Bgm.BGM_TYPE.TITLE); + break; + case "1": + _soundManager.PlayBGM(Bgm.BGM_TYPE.TITLE_SPECIAL_1); + break; + default: + _specialTitle.PlayBGM(); + break; + } + } + + private void SetChangeableTitleUI() + { + switch (_dataManager.TitleId) + { + case "0": + _normalTitle = InitializeLocalPrefabTitle("Title/NormalTitle/NormalTitle"); + break; + case "1": + InitializeLocalPrefabTitle("Title/SpecialTitle1/SpecialTitle1"); + break; + default: + _specialTitle.Initialize(_dataManager.TitleId); + break; + } + } + + private GameObject InitializeLocalPrefabTitle(string path) + { + ChangeableTitleUIParts component = NGUITools.AddChild(_parentTitleView, Resources.Load(path) as GameObject).GetComponent(); + if (component != null) + { + component.Init(); + return component.gameObject; + } + return null; + } + + private bool DisplayGuideline() + { + bool result = false; + try + { + if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Jpn.ToString()) + { + GuidelineParam param = new GuidelineParam(_jpnGuidelineDisplayTime, _jpnGuidelineIncludeFadeInOut, enableTouch: true, 0.5f, 0.5f, 0.5f); + _fadeInCoroutine = StartCoroutine(GuidelineFadeCoroutine(_jpnGuidelineRoot, _jpnGuidelineDisplayRootPanel, _jpnGuidelineBG, param)); + result = true; + } + else + { + _jpnGuidelineRoot.SetActive(value: false); + } + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 DisplayGuideline.JapanInitializeException"); + throw; + } + try + { + if (_isSteamKor) + { + GuidelineParam param2 = new GuidelineParam(3f, includeFadeInOut: false, enableTouch: false, 0.3f, 0.3f, 0.3f); + _fadeInCoroutine = StartCoroutine(GuidelineFadeCoroutine(_korGuidelineRoot, _korGuidelineDisplayRootPanel, _korGuidelineBG, param2)); + result = true; + } + else + { + _korGuidelineRoot.SetActive(value: false); + } + } + catch (Exception) + { + LocalLog.AccumulateTraceLog("690753 DisplayGuideline.KorInitializeException"); + throw; + } + return result; + } + + private IEnumerator GuidelineFadeCoroutine(GameObject guidelineRoot, UIPanel guidelineRootPanel, UISprite bg, GuidelineParam param) + { + guidelineRoot.SetActive(value: true); + guidelineRootPanel.alpha = 0f; + TweenAlpha.Begin(guidelineRootPanel.gameObject, param.FadeInTime, 1f); + if (param.EnableTouch) + { + UIEventListener uIEventListener = UIEventListener.Get(bg.gameObject); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate(GameObject g) + { + SkipGuidelineEvent(g, guidelineRoot, guidelineRootPanel, bg, param, _fadeInCoroutine); + }); + } + yield return new WaitForSeconds(param.FadeInTime); + float time = 0f; + float waitFadeTime = param.DisplayTime; + if (param.IncludeFadeInOut) + { + waitFadeTime = waitFadeTime - param.FadeInTime - param.PanelFadeOutTime - param.BgFadeOutTime; + } + while (true) + { + time += Time.deltaTime; + if (time > waitFadeTime) + { + break; + } + yield return null; + } + StartCoroutine(EndGuideline(guidelineRoot, guidelineRootPanel, bg, param)); + } + + private void SkipGuidelineEvent(GameObject g, GameObject guidelineRoot, UIPanel guidelineRootPanel, UISprite bg, GuidelineParam param, Coroutine fadeInCoroutine) + { + StopCoroutine(fadeInCoroutine); + StartCoroutine(EndGuideline(guidelineRoot, guidelineRootPanel, bg, param)); + } + + private IEnumerator EndGuideline(GameObject guidelineRoot, UIPanel guidelineRootPanel, UISprite bg, GuidelineParam param) + { + if (param.EnableTouch) + { + UIEventListener.Get(bg.gameObject).onClick = null; + } + TweenAlpha.Begin(guidelineRootPanel.gameObject, param.PanelFadeOutTime, 0f); + yield return new WaitForSeconds(param.PanelFadeOutTime); + PlayChangeableTitleBGM(); + TweenAlpha.Begin(bg.gameObject, param.BgFadeOutTime, 0f); + yield return new WaitForSeconds(param.BgFadeOutTime); + guidelineRoot.SetActive(value: false); + } + + public bool IsEnableClickButton() + { + if (!_gameSetup.IsRunning) + { + return !_isAutoCacheExecution; + } + return false; + } + + private void OnClickStartButton(GameObject g) + { + if (IsEnableClickButton()) + { + NtDataTranslateManager.GetInstance().ShowCygamesStatement(attendSetLanguage, fromTitle: true); + } + } + + private void StartCuteCertification() + { + StartCoroutine(cuteCertification(delegate + { + if (!ShowRefundDialogIfNeeded()) + { + attendSocialAccountDataTrans(); + } + })); + } + + private void OnClickMenuButton(GameObject g) + { + if (IsEnableClickButton()) + { + _soundManager.PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + ShowMenu(); + } + } + + private void OnClickTransferButton(GameObject g) + { + if (IsEnableClickButton()) + { + _soundManager.PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + StartCoroutine(cuteCertification(ShowTransferMenu)); + } + } + + private IEnumerator cuteCertification(Action callback) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true, notCollider: false, force: false); + yield return StartCoroutine(Toolbox.NetworkManager._certification.Login()); + while (!Toolbox.BootNetwork.IsDoneGameStartCheck) + { + yield return 0; + } + UIManager.GetInstance().closeInSceneCenterLoading(); + CustomPreference.createResourcePath(); + callback?.Invoke(); + } + + private void attendSetLanguage() + { + Action onFinish = delegate + { + StartCuteCertification(); + }; + if (string.IsNullOrEmpty(Toolbox.SavedataManager.GetString("LANG_FIRST_SET"))) + { + SwitchLanguage.Create(isForceConfirmDialog: true, isTitle: true, delegate + { + onFinish(); + }, attendSocialAccountDataTrans); + } + else + { + onFinish(); + } + } + + private bool ShowRefundDialogIfNeeded() + { + string refundUrl = GameStartCheckTask.RefundUrl; + if (string.IsNullOrEmpty(refundUrl)) + { + return false; + } + OutOfService.ShowRefundDialog(refundUrl); + return true; + } + + private void attendSocialAccountDataTrans() + { + if (GameStartCheckTask.IsSocialAccountDataTransNotSetAndTutorialClear && !GameStartCheckTask.HasAppliedForAccountDeletion && PlayerStaticData._tosAgreementState != PlayerStaticData.AgreementState.Reset && PlayerStaticData._privacyPolicyAgreementState != PlayerStaticData.AgreementState.Reset && PlayerStaticData.KorAuthorityAgreementState != PlayerStaticData.AgreementState.Reset && !UIManager.GetInstance().IsAutoCacheClearAfter) + { + ShowAccountConnectWindow(); + } + else + { + startGameSetup(); + } + } + + private void startGameSetup() + { + LocalLog.RecordFreezeLogIfLoadErrorOccured(); + SetUserIdLabel(Certification.ViewerId); + if (!_gameSetup.IsRunning) + { + StartUpDateRegion(); + } + } + + private void StartUpDateRegion() + { + new UserRegionUpdater().UpDateRegion(delegate + { + StartCoroutine(_gameSetup.StartSetup()); + }); + } + + private void ShowMenu() + { + GameObject gameObject = UnityEngine.Object.Instantiate(ButtonMenuObject); + TitleMenu component = gameObject.GetComponent(); + SystemText systemText = Data.SystemText; + dia = UIManager.GetInstance().CreateDialogClose(); + dia.SetTitleLabel(systemText.Get("Title_0006")); + dia.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + dia.SetObj(gameObject); + dia.SetPanelDepth(1); + component.ParentObject = base.gameObject; + } + + private void ShowTransferMenu() + { + SetUserIdLabel(Certification.ViewerId); + SystemText systemText = Data.SystemText; + dia = UIManager.GetInstance().CreateDialogClose(); + dia.SetSize(DialogBase.Size.M); + dia.SetTitleLabel(systemText.Get("Account_0001")); + string text = systemText.Get("OtherTop_0020"); + dia.SetText(text); + dia.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dia.SetButtonText(systemText.Get("Account_0089")); + EventDelegate method_btn = new EventDelegate(delegate + { + UIManager.GetInstance().AccountTransferHelper.CreateAccountTransferDialog(AccountBase.DisplayType.TITLE, AccountBase.TransitionOriginalScreen.TITLE); + }); + dia.SetButtonDelegate(method_btn); + } + + public void ClearCache() + { + if (dia != null) + { + dia.CloseWithoutSelect(); + } + if (IsViewerIdDecided()) + { + ClientCacheClearTask task = new ClientCacheClearTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + ClearCacheCore(); + })); + } + else + { + ClearCacheCore(); + } + } + + private void ClearCacheCore() + { + UIManager.GetInstance().createInSceneLoading(); + if (IsDownloadTitle) + { + _soundManager.PlayBGM(Bgm.BGM_TYPE.TITLE); + } + StartCoroutine(WaitCoroutine(0.2f, delegate + { + if (IsDownloadTitle) + { + _specialTitle.UnloadBGM(); + _specialTitle.RemoveSpecialTitle(); + } + WebViewManager.getInstance().CacheClear(); + StartCoroutine(StartCleanCache()); + CardMasterLocalFileUtility.DeleteAllCardMasterLocalFile(); + RecoveryRecordManagerBase.DeleteRecoveryFile(); + LocalLog.ClearAllLog(); + NativePluginWrapper.ClearWWWCache(); + LocalLog.ClearTraceLog(); + TaskManager.GetInstance().ClearLastLogKey(); + NewReplayBattleMgr.DeleteReplayFiles(); + if (_normalTitle == null && IsDownloadTitle) + { + _normalTitle = InitializeLocalPrefabTitle("Title/NormalTitle/NormalTitle"); + } + LocalLog.AccumulateTraceLog("Clear Cache"); + })); + } + + private IEnumerator WaitCoroutine(float time, Action onFinish) + { + yield return new WaitForSeconds(time); + onFinish.Call(); + } + + public void DeleteUserData() + { + if (dia != null) + { + dia.CloseWithoutSelect(); + } + if (IsViewerIdDecided()) + { + DeleteUserDataTask task = new DeleteUserDataTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DeleteUserDataCore(); + CreateDeleteUserDataDialog(); + })); + } + else + { + DeleteUserDataCore(); + CreateDeleteUserDataDialog(); + } + } + + private void DeleteUserDataCore() + { + Certification.InitializeFileds(); + Toolbox.SavedataManager.DeleteAll(); + LocalLog.ClearAllLog(); + RecoveryRecordManagerBase.DeleteRecoveryFile(); + GameObject gameObject = GameObject.Find("OmotePlugin"); + if (gameObject != null) + { + OmotePlugin component = gameObject.GetComponent(); + if (component != null) + { + component.Unregister(isLocalOnly: false); + OmotePlugin.LocalNotification.CancelAll(); + } + } + } + + private void CreateDeleteUserDataDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0021")); + dialogBase.SetText(Data.SystemText.Get("Title_0050")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueButton); + dialogBase.SetButtonText(Data.SystemText.Get("Common_0004")); + dialogBase.OnClose = delegate + { + SoftwareReset.exec(null, isFromUserDelete: true); + }; + } + + private bool IsViewerIdDecided() + { + return Certification.ViewerId != 0; + } + + private IEnumerator StartCleanCache() + { + yield return new WaitForSeconds(1f); + FontChanger.FontReset(); + UILabel[] array = UnityEngine.Object.FindObjectsOfType(typeof(UILabel)) as UILabel[]; + if (array.Length != 0) + { + UILabel[] array2 = array; + foreach (UILabel uILabel in array2) + { + if (uILabel != null) + { + uILabel.RefreshCustom(); + } + } + } + Toolbox.AssetManager.ClearAllAssetFile(); + Toolbox.AssetManager.ClearAssetCacheAssetBundle(); + while (!Caching.ready) + { + yield return null; + } + _gameSetup = new GameSetup(this); + if (!_isAutoCacheExecution) + { + SystemText systemText = Data.SystemText; + dia = UIManager.GetInstance().CreateDialogClose(); + dia.SetTitleLabel(systemText.Get("Title_0007")); + dia.SetText(systemText.Get("Title_0009")); + dia.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dia.SetPanelDepth(3000); + } + else + { + _isAutoCacheExecution = false; + UIManager.GetInstance().IsAutoCacheClearAfter = true; + OnClickStartButton(null); + } + UIManager.GetInstance().closeInSceneLoading(); + } + + private void ShowAccountConnectWindow() + { + SystemText systemText = Data.SystemText; + dia = UIManager.GetInstance().CreateDialogClose(); + dia.SetSize(DialogBase.Size.M); + dia.SetTitleLabel(systemText.Get("Account_0082")); + string text = systemText.Get("Account_0083"); + dia.SetText(text); + dia.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dia.SetButtonText(systemText.Get("Account_0084"), systemText.Get("Account_0085")); + EventDelegate method_btn = new EventDelegate(delegate + { + UIManager.GetInstance().AccountTransferHelper.CreateAccountTransferDialog(AccountBase.DisplayType.ACCOUNT_LINK, AccountBase.TransitionOriginalScreen.OTHER); + }); + EventDelegate method_btn2 = new EventDelegate(startGameSetup); + dia.SetButtonDelegate(method_btn, method_btn2); + } +} diff --git a/SVSim.BattleEngine/Engine/TutorialNextSceneSelector.cs b/SVSim.BattleEngine/Engine/TutorialNextSceneSelector.cs new file mode 100644 index 0000000..b524426 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TutorialNextSceneSelector.cs @@ -0,0 +1,16 @@ +using UnityEngine; + +public class TutorialNextSceneSelector : INextSceneSelector +{ + public TutorialNextSceneSelector(BattleResultUIController battleResultControl) + { + } + + public void Setup(bool isWin, GameObject gameObject) + { + } + + public void Show() + { + } +} diff --git a/SVSim.BattleEngine/Engine/TutorialReportEndAgent.cs b/SVSim.BattleEngine/Engine/TutorialReportEndAgent.cs new file mode 100644 index 0000000..fa869a5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TutorialReportEndAgent.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +public class TutorialReportEndAgent : MonoBehaviour +{ + public bool IsEnd { get; private set; } + + public void Finished() + { + IsEnd = true; + } +} diff --git a/SVSim.BattleEngine/Engine/TutorialResultAnimationAgent.cs b/SVSim.BattleEngine/Engine/TutorialResultAnimationAgent.cs new file mode 100644 index 0000000..9699d10 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TutorialResultAnimationAgent.cs @@ -0,0 +1,170 @@ +using System.Collections; +using Cute; +using UnityEngine; +using Wizard; + +public class TutorialResultAnimationAgent : 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.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: true); + battleResultControl.TitleLose.gameObject.SetActive(value: false); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + battleResultControl.TitleWin.alpha = 0f; + battleResultControl.Bg.color = new Color32(32, 24, 0, 0); + battleResultControl.ResultTitle.spriteName = "result_top_win"; + } + else + { + battleResultControl.TitleLose.transform.localScale = Vector3.one * 10f; + battleResultControl.TitleWin.gameObject.SetActive(value: false); + battleResultControl.TitleLose.gameObject.SetActive(value: true); + battleResultControl.TitleDraw.gameObject.SetActive(value: false); + 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)); + } + yield return new WaitForSeconds(2f); + if (BattleManagerBase.IsTutorial) + { + Invoke("returnTutorial", 2f); + } + else if (Data.SelectedStoryInfo.IsTutorialReplay) + { + BattleEndTutorialReplay(isWin); + } + GameMgr.GetIns().GetDataMgr().SetPlayerEmotionId(string.Empty); + GameMgr.GetIns().GetDataMgr().SetEnemyEmotionId(string.Empty); + battleResultControl.FinishResult(); + } + + private void returnTutorial() + { + int tutorial_step = Data.Load.data._userTutorial.tutorial_step; + if (tutorial_step <= 11) + { + if (tutorial_step != 1 && tutorial_step != 11) + { + return; + } + } + else + { + switch (tutorial_step) + { + default: + _ = 100; + return; + case 21: + break; + case 31: + return; + } + } + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.AreaSelect); + } + + private void BattleEndTutorialReplay(bool isWin) + { + switch (Data.Load.data._userTutorial.tutorial_replay_step) + { + case 1: + case 11: + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.AreaSelect); + break; + case 21: + case 100: + if (isWin) + { + UIManager.GetInstance().createInSceneLoading(); + UIManager.GetInstance().CreatFadeClose(delegate + { + UIManager.GetInstance().StartCoroutine(GameMgr.GetIns().GetBattleCtrl().BattleEnd(delegate + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Scenario2); + })); + }); + } + else + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.AreaSelect); + } + break; + } + } + + private void OnRequestTutorialFinish(NetworkTask.ResultCode successcode) + { + ToolboxGame.SetUp.BuildFirstScene(); + UIManager.GetInstance().createInSceneLoading(); + UIManager.GetInstance().CreatFadeClose(delegate + { + UIManager.GetInstance().StartCoroutine(GameMgr.GetIns().GetBattleCtrl().BattleEnd(delegate + { + UIManager.GetInstance().DestroyView(UIManager.ViewScene.AreaSelect); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Scenario2); + })); + }); + } +} diff --git a/SVSim.BattleEngine/Engine/TutorialResultAnimationHandler.cs b/SVSim.BattleEngine/Engine/TutorialResultAnimationHandler.cs new file mode 100644 index 0000000..5311dbe --- /dev/null +++ b/SVSim.BattleEngine/Engine/TutorialResultAnimationHandler.cs @@ -0,0 +1,22 @@ +using UnityEngine; + +public class TutorialResultAnimationHandler : IResultAnimationHandler +{ + private readonly GameObject m_resultAnimationAgentObj; + + private readonly TutorialResultAnimationAgent m_resultAnimationAgentIns; + + public ResultAnimationAgent m_resultAnimationAgent => m_resultAnimationAgentIns; + + public TutorialResultAnimationHandler(BattleCamera battleCamera) + { + m_resultAnimationAgentObj = new GameObject(); + m_resultAnimationAgentIns = m_resultAnimationAgentObj.AddComponent(); + m_resultAnimationAgentIns.GetComponent().SetBattleCamera(battleCamera); + } + + public void Destroy() + { + Object.Destroy(m_resultAnimationAgentObj); + } +} diff --git a/SVSim.BattleEngine/Engine/TutorialResultReporter.cs b/SVSim.BattleEngine/Engine/TutorialResultReporter.cs new file mode 100644 index 0000000..b6debd2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TutorialResultReporter.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; +using Wizard; +using Wizard.Battle.Tutorial; +using Wizard.Lottery; + +public class TutorialResultReporter : IBattleResultReporter +{ + private readonly GameObject m_reportEndAgentObj; + + private readonly TutorialReportEndAgent m_reportEndAgent; + + public bool IsEnd => m_reportEndAgent.IsEnd; + + public int ClassExp => GetClassExp(); + + public List UserAchievement => GetUserAchievementList(); + + public List UserMission => GetUserMissionList(); + + public List MissionRewards => null; + + public List VictoryRewards => null; + + public LotteryApplyData LotteryData => LotteryApplyData.EmptyData(); + + public MyPageHomeDialogData HomeDialogData => null; + + public bool IsDataExist => true; + + public TutorialResultReporter() + { + m_reportEndAgentObj = new GameObject(); + m_reportEndAgent = m_reportEndAgentObj.AddComponent(); + } + + public void Report(bool isWin) + { + int tutorial_step = 0; + if (isWin && Data.SelectedStoryInfo.IsTutorial) + { + if (Data.Load.data._userTutorial.tutorial_step == 1) + { + tutorial_step = 11; + } + else if (Data.Load.data._userTutorial.tutorial_step == 11) + { + tutorial_step = 21; + } + else if (Data.Load.data._userTutorial.tutorial_step == 21) + { + tutorial_step = 31; + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.FIRST_TIPS_AFTER_ROTATION_USER_FLAG, 1); + } + bool isSkip = BattleManagerBase.GetIns() is TutorialBattleMgrBase tutorialBattleMgrBase && tutorialBattleMgrBase.IsUseTutorialSkip; + StartTutorialUpdateTaskData(tutorial_step, isSkip, delegate + { + m_reportEndAgent.Finished(); + }); + } + else + { + m_reportEndAgent.Finished(); + } + } + + public void StartTutorialUpdateTaskData(int tutorial_step, bool isSkip, Action callback) + { + FinishTutorialReport(tutorial_step); + TutorialUpdateTask tutorialUpdateTask = new TutorialUpdateTask(); + tutorialUpdateTask.SetParameter(tutorial_step, isSkip); + m_reportEndAgent.StartCoroutine(Toolbox.NetworkManager.Connect(tutorialUpdateTask, delegate + { + callback.Call(); + }, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public JsonData GetFinishResponseData() + { + return null; + } + + public List GetUserAchievementList() + { + return new List(); + } + + public List GetUserMissionList() + { + return new List(); + } + + public void Destroy() + { + UnityEngine.Object.Destroy(m_reportEndAgentObj); + } + + public int GetClassExp() + { + return 0; + } + + private void FinishTutorialReport(int tutorial_step) + { + if (tutorial_step == 31) + { + AdjustManager.TutorialCompleteEvent(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/TweenPositionX.cs b/SVSim.BattleEngine/Engine/TweenPositionX.cs new file mode 100644 index 0000000..32b4e7a --- /dev/null +++ b/SVSim.BattleEngine/Engine/TweenPositionX.cs @@ -0,0 +1,134 @@ +using System; +using UnityEngine; + +[AddComponentMenu("NGUI/Tween/Tween Position X")] +public class TweenPositionX : UITweener +{ + public float from; + + public float to; + + [HideInInspector] + public bool worldSpace; + + private Transform mTrans; + + private UIRect mRect; + + public Transform cachedTransform + { + get + { + if (mTrans == null) + { + mTrans = base.transform; + } + return mTrans; + } + } + + [Obsolete("Use 'value' instead")] + public float positionX + { + get + { + return Xvalue; + } + set + { + Xvalue = value; + } + } + + public float Xvalue + { + get + { + if (!worldSpace) + { + return cachedTransform.localPosition.x; + } + return cachedTransform.position.x; + } + set + { + if (mRect == null || !mRect.isAnchored || worldSpace) + { + if (worldSpace) + { + cachedTransform.position = new Vector3(value, cachedTransform.position.y, cachedTransform.position.z); + } + else + { + cachedTransform.localPosition = new Vector3(value, cachedTransform.localPosition.y, cachedTransform.localPosition.z); + } + } + else + { + value -= cachedTransform.localPosition.x; + NGUIMath.MoveRect(mRect, value, 0f); + } + } + } + + private void Awake() + { + mRect = GetComponent(); + } + + protected override void OnUpdate(float factor, bool isFinished) + { + Xvalue = from * (1f - factor) + to * factor; + } + + public static TweenPosition Begin(GameObject go, float duration, Vector3 pos) + { + TweenPosition tweenPosition = UITweener.Begin(go, duration); + tweenPosition.from = tweenPosition.value; + tweenPosition.to = pos; + if (duration <= 0f) + { + tweenPosition.Sample(1f, isFinished: true); + tweenPosition.enabled = false; + } + return tweenPosition; + } + + public static TweenPosition Begin(GameObject go, float duration, Vector3 pos, bool worldSpace) + { + TweenPosition tweenPosition = UITweener.Begin(go, duration); + tweenPosition.worldSpace = worldSpace; + tweenPosition.from = tweenPosition.value; + tweenPosition.to = pos; + if (duration <= 0f) + { + tweenPosition.Sample(1f, isFinished: true); + tweenPosition.enabled = false; + } + return tweenPosition; + } + + [ContextMenu("Set 'From' to current value")] + public override void SetStartToCurrentValue() + { + from = Xvalue; + } + + [ContextMenu("Set 'To' to current value")] + public override void SetEndToCurrentValue() + { + to = Xvalue; + } + + [ContextMenu("Assume value of 'From'")] + private void SetCurrentValueToStart() + { + Xvalue = from; + } + + [ContextMenu("Assume value of 'To'")] + private void SetCurrentValueToEnd() + { + Xvalue = to; + } +} diff --git a/SVSim.BattleEngine/Engine/TweenPositionY.cs b/SVSim.BattleEngine/Engine/TweenPositionY.cs new file mode 100644 index 0000000..f60e467 --- /dev/null +++ b/SVSim.BattleEngine/Engine/TweenPositionY.cs @@ -0,0 +1,134 @@ +using System; +using UnityEngine; + +[AddComponentMenu("NGUI/Tween/Tween Position Y")] +public class TweenPositionY : UITweener +{ + public float from; + + public float to; + + [HideInInspector] + public bool worldSpace; + + private Transform mTrans; + + private UIRect mRect; + + public Transform cachedTransform + { + get + { + if (mTrans == null) + { + mTrans = base.transform; + } + return mTrans; + } + } + + [Obsolete("Use 'value' instead")] + public float positionY + { + get + { + return Yvalue; + } + set + { + Yvalue = value; + } + } + + public float Yvalue + { + get + { + if (!worldSpace) + { + return cachedTransform.localPosition.y; + } + return cachedTransform.position.y; + } + set + { + if (mRect == null || !mRect.isAnchored || worldSpace) + { + if (worldSpace) + { + cachedTransform.position = new Vector3(cachedTransform.position.x, value, cachedTransform.position.z); + } + else + { + cachedTransform.localPosition = new Vector3(cachedTransform.localPosition.x, value, cachedTransform.localPosition.z); + } + } + else + { + value -= cachedTransform.localPosition.y; + NGUIMath.MoveRect(mRect, 0f, value); + } + } + } + + private void Awake() + { + mRect = GetComponent(); + } + + protected override void OnUpdate(float factor, bool isFinished) + { + Yvalue = from * (1f - factor) + to * factor; + } + + public static TweenPosition Begin(GameObject go, float duration, Vector3 pos) + { + TweenPosition tweenPosition = UITweener.Begin(go, duration); + tweenPosition.from = tweenPosition.value; + tweenPosition.to = pos; + if (duration <= 0f) + { + tweenPosition.Sample(1f, isFinished: true); + tweenPosition.enabled = false; + } + return tweenPosition; + } + + public static TweenPosition Begin(GameObject go, float duration, Vector3 pos, bool worldSpace) + { + TweenPosition tweenPosition = UITweener.Begin(go, duration); + tweenPosition.worldSpace = worldSpace; + tweenPosition.from = tweenPosition.value; + tweenPosition.to = pos; + if (duration <= 0f) + { + tweenPosition.Sample(1f, isFinished: true); + tweenPosition.enabled = false; + } + return tweenPosition; + } + + [ContextMenu("Set 'From' to current value")] + public override void SetStartToCurrentValue() + { + from = Yvalue; + } + + [ContextMenu("Set 'To' to current value")] + public override void SetEndToCurrentValue() + { + to = Yvalue; + } + + [ContextMenu("Assume value of 'From'")] + private void SetCurrentValueToStart() + { + Yvalue = from; + } + + [ContextMenu("Assume value of 'To'")] + private void SetCurrentValueToEnd() + { + Yvalue = to; + } +} diff --git a/SVSim.BattleEngine/Engine/Twitter.cs b/SVSim.BattleEngine/Engine/Twitter.cs new file mode 100644 index 0000000..5549361 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Twitter.cs @@ -0,0 +1,276 @@ +using System; +using System.Collections; +using System.IO; +using Cute; +using UnityEngine; +using UnityEngine.Networking; +using Wizard; +using Wizard.ErrorDialog; + +public class Twitter : MonoBehaviour +{ + private const string UNITY_CLASS = "com.unity3d.player.UnityPlayer"; + + private const string UNITY_ACTIVITY = "currentActivity"; + + private const string TWITTER_URL = "http://twitter.com/intent/tweet?text={0}&url={1}&hashtags={2}"; + + private const string SAVED_IMAGE_NAME = "image_saved.png"; + + private const int ERROR_CODE_UNKNOWN = 102; + + public const int REQUEST_CODE = 555; + + private const float TIMEOUT = 20f; + + private GenerateDeckImageTask _task; + + private const string OBJECT_NAME = "TwitterShareObject"; + + private void Start() + { + base.gameObject.name = "TwitterShareObject"; + } + + public static void Logout(Action callback = null) + { + } + + public void TweetWithoutImage(string text, string url, string tags) + { + Post(text, url, tags, null); + } + + public void TweetWithScreenshot(string text, string url, string tags) + { + ScreenCapture.CaptureScreenshot("image_saved.png"); + string imageFilename = GetImagePath(); + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + StartCoroutine(CheckFileExistsAndExecute(delegate + { + Post(text, url, tags, imageFilename); + UIManager.GetInstance().closeInSceneCenterLoading(); + }, imageFilename, delegate(bool isTimeout) + { + CloseLoadingAndShowErrorDialog(isTimeout); + })); + } + + public void TweetWithDownloadImage(string text, string url, string tags, string imageUrl, Action callback = null) + { + string imageFilename = GetImagePath(); + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + Action action = delegate + { + StartCoroutine(CheckFileExistsAndExecute(delegate + { + Post(text, url, tags, imageFilename); + UIManager.GetInstance().closeInSceneCenterLoading(); + if (callback != null) + { + callback(); + } + }, imageFilename, delegate(bool isTimeout) + { + CloseLoadingAndShowErrorDialog(isTimeout); + })); + }; + StartCoroutine(DownloadImage(imageUrl, imageFilename, action, CloseLoadingAndShowErrorDialog)); + } + + public void TweetWithSavedImage(string text, string hashtags, string imagePath, Action callback = null) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + StartCoroutine(CheckFileExistsAndExecute(delegate + { + Post(text, "", hashtags, imagePath); + UIManager.GetInstance().closeInSceneCenterLoading(); + if (callback != null) + { + callback(); + } + }, imagePath, delegate(bool isTimeout) + { + CloseLoadingAndShowErrorDialog(isTimeout); + })); + } + + private static string MakeIntentUrl(string text, string url, string tags) + { + return $"http://twitter.com/intent/tweet?text={UnityWebRequest.EscapeURL(text)}&url={UnityWebRequest.EscapeURL(url)}&hashtags={UnityWebRequest.EscapeURL(tags)}"; + } + + private static string FormatText(string text, string url, string tags) + { + if (!string.IsNullOrEmpty(url)) + { + text = text + " " + url; + } + if (!string.IsNullOrEmpty(tags)) + { + string[] array = tags.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries); + foreach (string text2 in array) + { + text = text + " #" + text2; + } + } + return text; + } + + private void ShowDialogUrl(string text, string url, string tags) + { + bool isBackKeyEnable = GameMgr.GetIns().GetInputMgr().isBackKeyEnable; + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true; + SystemText systemText = Wizard.Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Card_0161")); + dialogBase.SetText(systemText.Get("Common_0208")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Dia_Web_001_Button")); + dialogBase.onPushButton1 = delegate + { + BrowserURL.Open(MakeIntentUrl(text, url, tags)); + }; + dialogBase.OnClose = delegate + { + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = isBackKeyEnable; + }; + } + + public void Post(string text, string url, string tags, string imageFilename) + { + ShowDialogUrl(text, url, tags); + } + + private IEnumerator DownloadImage(string url, string filename, Action action, Action onError) + { + using UnityWebRequest request = UnityWebRequestTexture.GetTexture(url); + yield return request.SendWebRequest(); + bool isTimeout = false; + float startDownloadTime = Time.time; + while (!request.isDone && !isTimeout) + { + isTimeout = Time.time - startDownloadTime > 20f; + yield return null; + } + if (request.error != null || isTimeout) + { + onError(isTimeout); + request.Dispose(); + yield break; + } + Texture2D content = DownloadHandlerTexture.GetContent(request); + request.Dispose(); + byte[] bytes = content.EncodeToPNG(); + UnityEngine.Object.Destroy(content); + File.WriteAllBytes(filename, bytes); + action(); + } + + private IEnumerator CheckFileExistsAndExecute(Action onFileExists, string filePath, Action onError) + { + bool isFileTimeout = false; + float startWaitTime = Time.time; + while (!File.Exists(filePath) && !isFileTimeout) + { + isFileTimeout = Time.time - startWaitTime > 20f; + yield return null; + } + if (File.Exists(filePath)) + { + onFileExists(); + } + else + { + onError(obj: false); + } + } + + private static string GetImagePath() + { + return "" + "image_saved.png"; + } + + private void CloseLoadingAndShowErrorDialog(bool isTimeout) + { + UIManager.GetInstance().closeInSceneCenterLoading(); + if (isTimeout) + { + Dialog.Create("TIMEOUT_NORETRY"); + } + else + { + Dialog.Create(102); + } + } + + public void TweetDataFromPortal(int[] cardIds, ClassSet classSet, GenerateDeckCodeTask.SubmitDeckType submitType, int[] phantomCardIdList, string rotationId) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + StartTweet(cardIds, classSet, submitType, phantomCardIdList, rotationId); + } + + private void StartTweet(int[] cardIds, ClassSet classSet, GenerateDeckCodeTask.SubmitDeckType submitType, int[] phantomCardIdList, string rotationId) + { + UIManager.GetInstance().createInSceneCenterLoading(); + Action callbackOnSuccess = delegate + { + if (CardBasePrm.ClanTypeIsUseable(classSet.SubClass)) + { + _task = new GenerateDeckImageTask(); + _task.SetParameter((int)classSet.MainClass, (int)classSet.SubClass, submitType, cardIds, phantomCardIdList); + StartCoroutine(Toolbox.NetworkManager.Connect(_task, GetImageResponse, null, null, encrypt: false)); + } + else + { + _task = new GenerateDeckImageTask(); + _task.SetParameter((int)classSet.MainClass, submitType, cardIds, rotationId, phantomCardIdList); + StartCoroutine(Toolbox.NetworkManager.Connect(_task, GetImageResponse, null, null, encrypt: false)); + } + }; + GenerateDeckImageMaintenanceTask task = new GenerateDeckImageMaintenanceTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, callbackOnSuccess)); + } + + private void GetImageResponse(NetworkTask.ResultCode error) + { + string imageFilename = GetImagePath(); + File.WriteAllBytes(imageFilename, _task.ImageBytes); + string text = _task.TwitterMessage; + _task = null; + StartCoroutine(CheckFileExistsAndExecute(delegate + { + Post(text, "", "", imageFilename); + UIManager.GetInstance().closeInSceneCenterLoading(); + }, imageFilename, delegate(bool isTimeout) + { + CloseLoadingAndShowErrorDialog(isTimeout); + })); + } + + public void OnResult(string result) + { + bool isBackKeyEnable = GameMgr.GetIns().GetInputMgr().isBackKeyEnable; + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + SystemText systemText = Wizard.Data.SystemText; + dialogBase.SetTitleLabel(systemText.Get("Dia_Share_005")); + string[] array = result.Split(','); + if (array.Length <= 1 || int.Parse(array[1]) == 555) + { + if (int.Parse(array[0]) == 1) + { + dialogBase.SetText(systemText.Get("Dia_Share_001")); + } + else + { + dialogBase.SetText(systemText.Get("Dia_Share_002")); + } + dialogBase.OnClose = delegate + { + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = isBackKeyEnable; + }; + } + } +} diff --git a/SVSim.BattleEngine/Engine/UICenterOnClick.cs b/SVSim.BattleEngine/Engine/UICenterOnClick.cs new file mode 100644 index 0000000..3986ba2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UICenterOnClick.cs @@ -0,0 +1,42 @@ +using UnityEngine; + +[AddComponentMenu("NGUI/Interaction/Center Scroll View on Click")] +public class UICenterOnClick : MonoBehaviour +{ + [SerializeField] + private Transform _otherCenteringTarget; + + private void OnClick() + { + UICenterOnChild uICenterOnChild = NGUITools.FindInParents(base.gameObject); + UIPanel uIPanel = NGUITools.FindInParents(base.gameObject); + if (uICenterOnChild != null) + { + if (uICenterOnChild.enabled) + { + if (_otherCenteringTarget != null) + { + uICenterOnChild.CenterOn(_otherCenteringTarget); + } + else + { + uICenterOnChild.CenterOn(base.transform); + } + } + } + else if (uIPanel != null && uIPanel.clipping != UIDrawCall.Clipping.None) + { + UIScrollView component = uIPanel.GetComponent(); + Vector3 pos = -uIPanel.cachedTransform.InverseTransformPoint(base.transform.position); + if (!component.canMoveHorizontally) + { + pos.x = uIPanel.cachedTransform.localPosition.x; + } + if (!component.canMoveVertically) + { + pos.y = uIPanel.cachedTransform.localPosition.y; + } + SpringPanel.Begin(uIPanel.cachedGameObject, pos, 6f); + } + } +} diff --git a/SVSim.BattleEngine/Engine/UICurveLabel.cs b/SVSim.BattleEngine/Engine/UICurveLabel.cs new file mode 100644 index 0000000..ac96924 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UICurveLabel.cs @@ -0,0 +1,111 @@ +using System; +using UnityEngine; + +public class UICurveLabel : MonoBehaviour +{ + [SerializeField] + private int _magnificationHeight; + + [SerializeField] + private AnimationCurve _animationCurve; + + private const float HALF_CHARACTER = 0.5f; + + private float _timeIntervalCharacter; + + public void Init(string text) + { + if (text.Length <= 1) + { + _timeIntervalCharacter = 0f; + } + else + { + _timeIntervalCharacter = 1f / (float)(text.Length - 1); + } + } + + public float GetTargetCharacterHeight(int inIndex) + { + return _animationCurve.Evaluate((float)inIndex * _timeIntervalCharacter) * (float)(-_magnificationHeight); + } + + private float GetTargetCharacterAnimationCurveValue(float inTime) + { + return _animationCurve.Evaluate(inTime * _timeIntervalCharacter); + } + + public Vector2[] SetTargetCharacterRotation(int inIndex, ref float v0x, ref float v0y, ref float v1x, ref float v1y) + { + Vector2 vector = default(Vector2); + Vector2 vector2 = default(Vector2); + if (inIndex == 0) + { + vector.x = 0f; + vector.y = GetTargetCharacterAnimationCurveValue(0f); + vector2.x = ((float)inIndex + 0.5f) * _timeIntervalCharacter; + vector2.y = GetTargetCharacterAnimationCurveValue((float)inIndex + 0.5f); + } + else + { + vector.x = ((float)inIndex - 0.5f) * _timeIntervalCharacter; + vector.y = GetTargetCharacterAnimationCurveValue((float)inIndex - 0.5f); + vector2.x = (float)inIndex * _timeIntervalCharacter; + vector2.y = GetTargetCharacterAnimationCurveValue(inIndex); + } + Vector2 vector3 = vector2 - vector; + float num = Mathf.Atan2(vector3.y, vector3.x); + float num2 = Mathf.Sin(num); + float num3 = Mathf.Cos(num); + Vector2 vector4 = new Vector2((v1x + v0x) / 2f, (v1y + v0y) / 2f); + Vector2[] array = new Vector2[4]; + array[0].x = v0x; + array[0].y = v0y; + array[1].x = v0x; + array[1].y = v1y; + array[2].x = v1x; + array[2].y = v1y; + array[3].x = v1x; + array[3].y = v0y; + for (int i = 0; i < 4; i++) + { + float num4 = array[i].x - vector4.x; + float num5 = array[i].y - vector4.y; + array[i].x = num3 * num4 - num2 * num5; + array[i].y = num2 * num4 + num3 * num5; + array[i].x += vector4.x; + array[i].y += vector4.y; + } + Vector2[] array2 = new Vector2[4]; + if (num < (float)Math.PI / 2f) + { + return array; + } + if (num < (float)Math.PI) + { + array2[0] = array[3]; + array2[1] = array[0]; + array2[2] = array[1]; + array2[3] = array[2]; + } + else if (num < 4.712389f) + { + array2[0] = array[2]; + array2[1] = array[3]; + array2[2] = array[0]; + array2[3] = array[1]; + } + else + { + array2[0] = array[1]; + array2[1] = array[2]; + array2[2] = array[3]; + array2[3] = array[0]; + } + for (int j = 0; j < 4; j++) + { + array[j] = array2[j]; + } + return array; + } +} diff --git a/SVSim.BattleEngine/Engine/UIPlaySound.cs b/SVSim.BattleEngine/Engine/UIPlaySound.cs new file mode 100644 index 0000000..c40f23b --- /dev/null +++ b/SVSim.BattleEngine/Engine/UIPlaySound.cs @@ -0,0 +1,115 @@ +using UnityEngine; + +[AddComponentMenu("NGUI/Interaction/Play Sound")] +public class UIPlaySound : MonoBehaviour +{ + public enum Trigger + { + OnClick, + OnMouseOver, + OnMouseOut, + OnPress, + OnRelease, + Custom, + OnEnable, + OnDisable + } + + public AudioClip audioClip; + + public Trigger trigger; + + [Range(0f, 1f)] + public float volume = 1f; + + [Range(0f, 2f)] + public float pitch = 1f; + + private bool mIsOver; + + private bool canPlay + { + get + { + if (!base.enabled) + { + return false; + } + UIButton component = GetComponent(); + if (!(component == null)) + { + return component.isEnabled; + } + return true; + } + } + + private void OnEnable() + { + if (trigger == Trigger.OnEnable) + { + NGUITools.PlaySound(audioClip, volume, pitch); + } + } + + private void OnDisable() + { + if (trigger == Trigger.OnDisable) + { + NGUITools.PlaySound(audioClip, volume, pitch); + } + } + + private void OnHover(bool isOver) + { + if (trigger == Trigger.OnMouseOver) + { + if (mIsOver == isOver) + { + return; + } + mIsOver = isOver; + } + if (canPlay && ((isOver && trigger == Trigger.OnMouseOver) || (!isOver && trigger == Trigger.OnMouseOut))) + { + NGUITools.PlaySound(audioClip, volume, pitch); + } + } + + private void OnPress(bool isPressed) + { + if (trigger == Trigger.OnPress) + { + if (mIsOver == isPressed) + { + return; + } + mIsOver = isPressed; + } + if (canPlay && ((isPressed && trigger == Trigger.OnPress) || (!isPressed && trigger == Trigger.OnRelease))) + { + NGUITools.PlaySound(audioClip, volume, pitch); + } + } + + private void OnClick() + { + if (canPlay && trigger == Trigger.OnClick) + { + NGUITools.PlaySound(audioClip, volume, pitch); + } + } + + private void OnSelect(bool isSelected) + { + if (canPlay && (!isSelected || UICamera.currentScheme == UICamera.ControlScheme.Controller)) + { + OnHover(isSelected); + } + } + + public void Play() + { + NGUITools.PlaySound(audioClip, volume, pitch); + } +} diff --git a/SVSim.BattleEngine/Engine/UIWrapMuchContent.cs b/SVSim.BattleEngine/Engine/UIWrapMuchContent.cs new file mode 100644 index 0000000..fc77b62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UIWrapMuchContent.cs @@ -0,0 +1,166 @@ +using UnityEngine; + +public class UIWrapMuchContent : UIWrapContent +{ + public override bool WrapContent() + { + bool result = false; + bool flag = true; + float num = (float)(itemSize * mChildren.Count) * 0.5f; + float num2 = num * 2f; + Vector3[] worldCorners = mPanel.worldCorners; + for (int i = 0; i < 4; i++) + { + Vector3 position = worldCorners[i]; + position = mTrans.InverseTransformPoint(position); + worldCorners[i] = position; + } + Vector3 vector = Vector3.Lerp(worldCorners[0], worldCorners[2], 0.5f); + if (mHorizontal) + { + float num3 = worldCorners[0].x - (float)itemSize; + float num4 = worldCorners[2].x + (float)itemSize; + float num5 = (worldCorners[2].x - worldCorners[0].x) * 0.5f - mPanel.clipSoftness.x; + float num6 = num - num5; + bool flag2 = 0f < num6 && num6 < (float)itemSize * 0.5f; + int j = 0; + for (int count = mChildren.Count; j < count; j++) + { + Transform transform = mChildren[j]; + float num7 = transform.localPosition.x - vector.x; + if (num7 < 0f - num) + { + Vector3 localPosition = transform.localPosition; + float num8 = Mathf.Ceil((0f - num - num7) / num2); + localPosition.x += num2 * num8; + num7 = localPosition.x - vector.x; + int num9 = Mathf.RoundToInt(localPosition.x / (float)itemSize); + if ((base.EnableNoLimit && minIndex == maxIndex) || (minIndex <= num9 && num9 <= maxIndex)) + { + transform.localPosition = localPosition; + UpdateItem(transform, j); + } + else + { + flag = false; + } + } + else if (num7 > num) + { + Vector3 localPosition2 = transform.localPosition; + float num10 = Mathf.Ceil((num7 - num) / num2); + localPosition2.x -= num2 * num10; + num7 = localPosition2.x - vector.x; + int num11 = Mathf.RoundToInt(localPosition2.x / (float)itemSize); + if ((base.EnableNoLimit && minIndex == maxIndex) || (minIndex <= num11 && num11 <= maxIndex)) + { + transform.localPosition = localPosition2; + UpdateItem(transform, j); + } + else + { + flag = false; + } + } + else + { + if (mFirstTime) + { + UpdateItem(transform, j); + } + if (flag2) + { + float num12 = (float)itemSize * 0.5f - num6; + if (num7 < 0f - (num - num12) || num7 > num - num12) + { + flag = false; + } + } + result = true; + } + if (cullContent) + { + num7 += mPanel.clipOffset.x - mTrans.localPosition.x; + if (!UICamera.IsPressed(transform.gameObject)) + { + NGUITools.SetActive(transform.gameObject, num7 > num3 && num7 < num4, compatibilityMode: false); + } + } + } + } + else + { + float num13 = worldCorners[0].y - (float)itemSize; + float num14 = worldCorners[2].y + (float)itemSize; + float num15 = (worldCorners[2].y - worldCorners[0].y) * 0.5f - mPanel.clipSoftness.y; + float num16 = num - num15; + bool flag3 = 0f < num16 && num16 < (float)itemSize * 0.5f; + int k = 0; + for (int count2 = mChildren.Count; k < count2; k++) + { + Transform transform2 = mChildren[k]; + float num17 = transform2.localPosition.y - vector.y; + if (num17 < 0f - num) + { + Vector3 localPosition3 = transform2.localPosition; + float num18 = Mathf.Ceil((0f - num - num17) / num2); + localPosition3.y += num2 * num18; + num17 = localPosition3.y - vector.y; + int num19 = Mathf.RoundToInt(localPosition3.y / (float)itemSize); + if ((base.EnableNoLimit && minIndex == maxIndex) || (minIndex <= num19 && num19 <= maxIndex)) + { + transform2.localPosition = localPosition3; + UpdateItem(transform2, k); + } + else + { + flag = false; + } + } + else if (num17 > num) + { + Vector3 localPosition4 = transform2.localPosition; + float num20 = Mathf.Ceil((num17 - num) / num2); + localPosition4.y -= num2 * num20; + num17 = localPosition4.y - vector.y; + int num21 = Mathf.RoundToInt(localPosition4.y / (float)itemSize); + if ((base.EnableNoLimit && minIndex == maxIndex) || (minIndex <= num21 && num21 <= maxIndex)) + { + transform2.localPosition = localPosition4; + UpdateItem(transform2, k); + } + else + { + flag = false; + } + } + else + { + if (mFirstTime) + { + UpdateItem(transform2, k); + } + if (flag3) + { + float num22 = (float)itemSize * 0.5f - num16; + if (num17 < 0f - (num - num22) || num17 > num - num22) + { + flag = false; + } + } + result = true; + } + if (cullContent) + { + num17 += mPanel.clipOffset.y - mTrans.localPosition.y; + if (!UICamera.IsPressed(transform2.gameObject)) + { + NGUITools.SetActive(transform2.gameObject, num17 > num13 && num17 < num14, compatibilityMode: false); + } + } + } + } + mScroll.restrictWithinPanel = !flag; + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/UIWrapVariableContentVertical.cs b/SVSim.BattleEngine/Engine/UIWrapVariableContentVertical.cs new file mode 100644 index 0000000..dad27b6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/UIWrapVariableContentVertical.cs @@ -0,0 +1,403 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Wizard; + +public class UIWrapVariableContentVertical : UIWrapContent +{ + public class ItemParam + { + public float Position { get; set; } + + public int Size { get; set; } + + public ItemParam(float pos, int size) + { + Position = pos; + Size = size; + } + } + + private int _cashNum; + + private int _nowIndex; + + private float _marginSize = float.MaxValue; + + public List ItemParamList { get; } = new List(); + + public void Init(int cashNum, int nowIndex, int maxIndex, OnInitializeItem _onInitializeItem) + { + _cashNum = cashNum; + _nowIndex = nowIndex; + maxIndex = 0; + onInitializeItem = _onInitializeItem; + } + + public bool IsBottom() + { + if (!IsScrollEnableSize()) + { + return true; + } + return mPanel.transform.localPosition.y > GetPosYBottomItem(); + } + + public void UpdateItemSize(int index, int size) + { + if (0 <= index && index > ItemParamList.Count) + { + return; + } + ItemParam itemParam = ItemParamList[index]; + int num = itemParam.Size - size; + itemParam.Size = size; + MoveScrollPanel(mPanel.gameObject.transform.localPosition.y - (float)num); + if (index++ < ItemParamList.Count) + { + for (int i = index; i < ItemParamList.Count; i++) + { + ItemParamList[i].Position += num; + } + } + UpdateItemCurrentAll(); + WrapContent(); + mScroll.UpdateScrollbars(); + } + + public void AddItemList(List addItemSizeList, bool isBottom) + { + if (isBottom) + { + for (int i = 0; i < addItemSizeList.Count; i++) + { + float pos = 0f; + if (ItemParamList.Count > 0) + { + ItemParam itemParam = ItemParamList[ItemParamList.Count - 1]; + pos = itemParam.Position - (float)itemParam.Size; + } + AddItemListBottom(pos, addItemSizeList[i]); + } + SortChildrenVertical(isAscendingOrder: false); + } + else + { + if (ItemParamList.Count > 0) + { + _nowIndex += addItemSizeList.Count; + } + for (int num = addItemSizeList.Count - 1; num >= 0; num--) + { + int num2 = addItemSizeList[num]; + float pos2 = 0f; + if (ItemParamList.Count > 0) + { + pos2 = ItemParamList[0].Position + (float)num2; + } + AddItemListTop(pos2, num2); + } + SortChildrenVertical(isAscendingOrder: true); + } + minIndex = -(ItemParamList.Count - 1); + } + + private void AddItemListBottom(float pos, int size) + { + ItemParamList.Add(new ItemParam(pos, size)); + if ((float)size < _marginSize) + { + _marginSize = size; + } + } + + private void AddItemListTop(float pos, int size) + { + ItemParamList.Insert(0, new ItemParam(pos, size)); + if ((float)size < _marginSize) + { + _marginSize = size; + } + } + + protected override void ResetChildPositions() + { + ResetChildPositionsByIndex(0); + } + + private void ResetChildPositionsByIndex(int index) + { + _nowIndex = index; + for (int i = 0; i < mChildren.Count; i++) + { + int num = index + i; + Transform transform = mChildren[i]; + if (num < ItemParamList.Count) + { + transform.localPosition = new Vector3(0f, ItemParamList[num].Position, 0f); + } + UpdateItem(transform, i); + } + } + + public void ResetScrollPositionByIndex(int centerIndex) + { + centerIndex = Mathf.Clamp(centerIndex, 0, ItemParamList.Count - 1); + int num = 0; + int num2 = ItemParamList.Count - 1; + float num3 = mPanel.GetViewSize().y - mPanel.clipSoftness.y * 2f; + float num4 = num3 / 2f; + for (int i = 0; i < ItemParamList.Count; i++) + { + num += ItemParamList[i].Size; + if (i >= centerIndex) + { + num4 -= (float)ItemParamList[i].Size; + if (num4 < 0f) + { + num2 = i; + break; + } + } + } + mScroll.ResetPosition(); + if (num3 > (float)num) + { + return; + } + Vector3 vector = new Vector3(0f, (float)num - num3); + mScroll.transform.localPosition += vector; + mPanel.clipOffset -= (Vector2)vector; + int num5 = Mathf.Max(0, ItemParamList.Count - _cashNum); + int value = num5; + int num6 = 0; + for (int j = 0; j < _cashNum; j++) + { + int num7 = num2 - j; + num6 += ItemParamList[num7].Size; + if ((float)num6 > num3) + { + value = num7; + break; + } + } + value = Mathf.Clamp(value, 0, num5); + ResetChildPositionsByIndex(value); + } + + public void ResetScrollPositionBottomEasing() + { + StartCoroutine(SetPositionBottomEasing()); + } + + private IEnumerator SetPositionBottomEasing() + { + mScroll.currentMomentum = Vector3.zero; + mScroll.DisableSpring(); + WrapContent(); + mScroll.UpdateScrollbars(); + float targetPosY = GetPosYBottomItem() + (float)ItemParamList[ItemParamList.Count - 1].Size; + CustomEasing easing = new CustomEasing(CustomEasing.eType.outQuad, mPanel.gameObject.transform.localPosition.y, targetPosY, 0.3f); + while (easing.IsMoving) + { + MoveScrollPanel(easing.GetCurVal(Time.deltaTime)); + yield return null; + } + MoveScrollPanel(targetPosY); + } + + private float GetPosYBottomItem() + { + return mPanel.baseClipRegion.y - mPanel.baseClipRegion.w * 0.5f + mPanel.clipSoftness.y * 2f - ItemParamList[ItemParamList.Count - 1].Position; + } + + public float GetDistanceBetweenBottomItemAndScrollBottomPos() + { + return GetPosYBottomItem() + (float)ItemParamList[ItemParamList.Count - 1].Size - mPanel.gameObject.transform.localPosition.y; + } + + public void MoveScrollPanel(float targetPosY) + { + Vector3 vector = (mPanel.gameObject.transform.localPosition.y - targetPosY) * Vector3.up; + mPanel.gameObject.transform.localPosition -= vector; + mPanel.clipOffset += (Vector2)vector; + mScroll.UpdateScrollbars(); + } + + public bool IsScrollEnableSize() + { + float num = mPanel.GetViewSize().y; + for (int i = 0; i < ItemParamList.Count; i++) + { + num -= (float)ItemParamList[i].Size; + if (num <= 0f) + { + return true; + } + } + return false; + } + + public float TopOverflowItemSize() + { + Vector3[] worldCorners = mPanel.worldCorners; + float num = mTrans.InverseTransformPoint(worldCorners[1]).y - mPanel.clipSoftness.y; + return ItemParamList[0].Position - num; + } + + public override bool WrapContent() + { + if (mHorizontal) + { + return true; + } + if (mChildren.Count <= 0) + { + return true; + } + bool result = false; + bool flag = true; + Vector3[] worldCorners = mPanel.worldCorners; + for (int i = 0; i < worldCorners.Length; i++) + { + Vector3 position = worldCorners[i]; + position = mTrans.InverseTransformPoint(position); + worldCorners[i] = position; + } + List list = new List(mChildren.Count); + int j = 0; + for (int count = mChildren.Count; j < count; j++) + { + list.Add(item: false); + } + SortChildrenVertical(isAscendingOrder: true); + float y = mChildren[mChildren.Count - 1].localPosition.y; + float num = mChildren[0].localPosition.y - (float)ItemParamList[-1 * GetRealIndex(mChildren[0].localPosition)].Size; + float num2 = worldCorners[2].y + _marginSize; + float num3 = worldCorners[0].y - _marginSize; + if (y < num2) + { + int num4 = 0; + for (int k = 0; k < ItemParamList.Count; k++) + { + Transform transform = mChildren[num4]; + int num5 = _nowIndex - 1; + int num6 = ((num5 < 0) ? 1 : (num5 * -1)); + if (minIndex > num6 || num6 > maxIndex) + { + flag = false; + break; + } + if (transform.localPosition.y > num3) + { + break; + } + transform.localPosition = new Vector3(transform.localPosition.x, ItemParamList[num5].Position, transform.localPosition.z); + _nowIndex--; + list[num4] = true; + num4 = (num4 + 1) % mChildren.Count; + } + } + else if (num > num3) + { + int num7 = mChildren.Count - 1; + for (int l = 0; l < ItemParamList.Count; l++) + { + Transform transform2 = mChildren[num7]; + int num8 = _nowIndex + _cashNum; + int num9 = ((num8 >= ItemParamList.Count) ? (minIndex - 1) : (num8 * -1)); + if (minIndex > num9 || num9 > maxIndex) + { + flag = false; + break; + } + if (transform2.localPosition.y - (float)ItemParamList[_nowIndex].Size < num2) + { + break; + } + transform2.localPosition = new Vector3(transform2.localPosition.x, ItemParamList[num8].Position, transform2.localPosition.z); + _nowIndex++; + list[num7] = true; + num7 = (num7 - 1 + mChildren.Count) % mChildren.Count; + } + } + else + { + if (mFirstTime) + { + int m = 0; + for (int count2 = mChildren.Count; m < count2; m++) + { + Transform item = mChildren[m]; + UpdateItem(item, m); + } + } + result = true; + } + int n = 0; + for (int count3 = mChildren.Count; n < count3; n++) + { + if (list[n]) + { + Transform item2 = mChildren[n]; + UpdateItem(item2, n); + } + } + mScroll.restrictWithinPanel = !flag; + return result; + } + + protected override void UpdateItem(Transform item, int index) + { + if (onInitializeItem != null) + { + int realIndex = GetRealIndex(item.localPosition); + onInitializeItem(item.gameObject, index, realIndex); + } + } + + private void UpdateItemCurrentAll() + { + int i = 0; + for (int count = mChildren.Count; i < count; i++) + { + Transform transform = mChildren[i]; + int num = _nowIndex + i; + if (num <= ItemParamList.Count) + { + Vector3 localPosition = transform.localPosition; + localPosition.y = ItemParamList[num].Position; + transform.localPosition = localPosition; + onInitializeItem?.Invoke(transform.gameObject, i, num * -1); + continue; + } + break; + } + } + + private int GetRealIndex(Vector3 item) + { + int result = 0; + for (int i = 0; i < ItemParamList.Count; i++) + { + if (item.y == ItemParamList[i].Position) + { + result = i * -1; + break; + } + } + return result; + } + + private void SortChildrenVertical(bool isAscendingOrder) + { + if (isAscendingOrder) + { + mChildren.Sort((Transform a, Transform b) => a.localPosition.y.CompareTo(b.localPosition.y)); + } + else + { + mChildren.Sort((Transform a, Transform b) => b.localPosition.y.CompareTo(a.localPosition.y)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/UnitCardCreator.cs b/SVSim.BattleEngine/Engine/UnitCardCreator.cs new file mode 100644 index 0000000..3c5c59c --- /dev/null +++ b/SVSim.BattleEngine/Engine/UnitCardCreator.cs @@ -0,0 +1,34 @@ +using UnityEngine; +using Wizard; + +public class UnitCardCreator : CardCreatorBase +{ + public UnitCardCreator(GameObject rootObject) + : base(rootObject) + { + } + + public static void SetupUnitCardMaterialToCardMesh(Transform rootCardTransform, CardParameter cardBasePrm, Material normalCardArtMaterial) + { + Transform transform = rootCardTransform.Find("Normal"); + UIManager.GetInstance().SetLayerRecursive(transform, 10); + MeshRenderer component = rootCardTransform.Find("NormalField").GetComponent(); + LOD[] lODs = transform.GetComponent().GetLODs(); + Material[] sharedMaterials = lODs[0].renderers[0].sharedMaterials; + Material[] sharedMaterials2 = component.sharedMaterials; + int rarity = cardBasePrm.Rarity; + Material handUnitFrame = SBattleLoad.CardFrameMaterialHolder.GetHandUnitFrame(rarity); + Material inPlayNormalUnitFrame = SBattleLoad.CardFrameMaterialHolder.GetInPlayNormalUnitFrame(rarity); + sharedMaterials[0] = handUnitFrame; + sharedMaterials2[0] = inPlayNormalUnitFrame; + sharedMaterials[1] = (sharedMaterials2[1] = normalCardArtMaterial); + sharedMaterials[2] = CardCreatorBase.GetSharedClassIconMaterial(cardBasePrm.Clan); + for (int i = 0; i < lODs.Length; i++) + { + lODs[i].renderers[0].sharedMaterials = sharedMaterials; + } + component.sharedMaterials = sharedMaterials2; + component.materials[1].mainTextureScale = cardBasePrm.NormalTilling; + component.materials[1].mainTextureOffset = cardBasePrm.NormalOffset; + } +} diff --git a/SVSim.BattleEngine/Engine/UnitSkillApplyInformation.cs b/SVSim.BattleEngine/Engine/UnitSkillApplyInformation.cs new file mode 100644 index 0000000..c70c27f --- /dev/null +++ b/SVSim.BattleEngine/Engine/UnitSkillApplyInformation.cs @@ -0,0 +1,93 @@ +using Wizard.Battle.View.Vfx; + +public class UnitSkillApplyInformation : SkillApplyInformation +{ + public UnitSkillApplyInformation(BattleCardBase card, ICardVfxCreator vfxCreator) + : base(card, vfxCreator) + { + } + + public override VfxBase GiveQuick() + { + base.QuickCount++; + base.IsQuick = base.QuickCount > 0; + if (_card.IsSummonDrunkenness && base.Player.IsSelfTurn) + { + _card.IsSummonDrunkenness = false; + } + return _vfxCreator.CreateQuick(_card.Attackable, _card.IsCantAttackClass); + } + + public override VfxBase DepriveQuick() + { + base.QuickCount--; + base.IsQuick = base.QuickCount > 0; + GiveDrunkenness(); + bool isCantAttackClass = _card.IsCantAttackClass; + return InstantVfx.Create(delegate + { + _card.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(() => isCantAttackClass); + }); + } + + public override VfxBase ForceDepriveQuick() + { + if (!_card.IsDead) + { + base.QuickCount = 0; + base.IsQuick = false; + GiveDrunkenness(); + } + bool isCantAttackClass = _card.IsCantAttackClass; + return InstantVfx.Create(delegate + { + _card.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(() => isCantAttackClass); + }); + } + + public override VfxBase GiveRush(RushInfo info) + { + base.RushInfo.Add(info); + base.IsRush = base.RushInfo.Count > 0; + if (_card.IsSummonDrunkenness && base.Player.IsSelfTurn) + { + _card.IsSummonDrunkenness = false; + } + return _vfxCreator.CreateQuick(_card.Attackable, _card.IsCantAttackClass); + } + + public override VfxBase DepriveRush(RushInfo info) + { + base.RushInfo.Remove(info); + base.IsRush = base.RushInfo.Count > 0; + GiveDrunkenness(); + bool isCantAttackClass = _card.IsCantAttackClass; + return InstantVfx.Create(delegate + { + _card.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(() => isCantAttackClass); + }); + } + + public override VfxBase ForceDepriveRush() + { + if (!_card.IsDead) + { + base.RushInfo.Clear(); + base.IsRush = false; + GiveDrunkenness(); + } + bool isCantAttackClass = _card.IsCantAttackClass; + return InstantVfx.Create(delegate + { + _card.BattleCardView._inPlayFrameEffect.UpdateCanAttackEffect(() => isCantAttackClass); + }); + } + + private void GiveDrunkenness() + { + if (base.RushInfo.Count <= 0 && base.QuickCount <= 0 && _card.IsFirstTurn) + { + _card.IsSummonDrunkenness = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/UtilityDrumrollItem.cs b/SVSim.BattleEngine/Engine/UtilityDrumrollItem.cs new file mode 100644 index 0000000..0d2469d --- /dev/null +++ b/SVSim.BattleEngine/Engine/UtilityDrumrollItem.cs @@ -0,0 +1,62 @@ +using UnityEngine; +using Wizard; + +[RequireComponent(typeof(UIDragScrollView), typeof(UICenterOnClick), typeof(UIEventListener))] +[RequireComponent(typeof(BoxCollider))] +public class UtilityDrumrollItem : MonoBehaviour +{ + [SerializeField] + private UILabel _childLabel; + + [SerializeField] + private UtilityDrumrollItemCustomize _customizeItem; + + private const float COLOR_DIFF_Y = 20f; + + private UIPanel _scrollView; + + private Vector2 _scrollSize = Vector2.zero; + + public int _index { get; private set; } + + public UtilityDrumrollItemCustomize CustomizeItem => _customizeItem; + + public void Init(UIPanel scroll, int index, string text) + { + _index = index; + _childLabel.text = text; + _scrollView = scroll; + _scrollSize = _scrollView.GetViewSize(); + } + + private void Update() + { + if (_childLabel != null) + { + float num = _scrollView.clipOffset.y - base.gameObject.transform.localPosition.y; + float num2 = _scrollSize.y / 2f; + float num3 = Mathf.Clamp(Mathf.Abs(num), 0f, num2); + float num4 = Mathf.LerpAngle(0f, 90f, num3 * (num3 / num2) / num2); + if (num > 0f) + { + num4 *= -1f; + } + _childLabel.transform.localEulerAngles = Vector3.right * num4; + Color32 color3; + if (num3 > 20f) + { + Color color = (_childLabel.color = LabelDefine.TEXT_COLOR_B0B0B0); + color3 = color; + } + else + { + Color color = (_childLabel.color = LabelDefine.TEXT_COLOR_NORMAL); + color3 = color; + } + if (_customizeItem != null) + { + _customizeItem.OnUpdate(num4, color3); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/VideoHostingImplBase.cs b/SVSim.BattleEngine/Engine/VideoHostingImplBase.cs new file mode 100644 index 0000000..122a76c --- /dev/null +++ b/SVSim.BattleEngine/Engine/VideoHostingImplBase.cs @@ -0,0 +1,185 @@ +using UnityEngine; + +public abstract class VideoHostingImplBase : MonoBehaviour +{ + protected virtual void Awake() + { + } + + protected virtual void Start() + { + } + + protected virtual void OnDestroy() + { + } + + public virtual bool IsVideoHostingSupported() + { + return false; + } + + public virtual void StartRecording() + { + } + + public virtual void StopRecording() + { + } + + public virtual void PauseRecording() + { + } + + public virtual void ResumeRecording() + { + } + + public virtual bool IsRecording() + { + return false; + } + + public virtual bool IsRecordingPause() + { + return false; + } + + public virtual bool HasRecordedData() + { + return false; + } + + public virtual void UploadRecording() + { + } + + public virtual bool IsUploading() + { + return false; + } + + public virtual void WatchRecording() + { + } + + public virtual void StartPublishing() + { + } + + public virtual void StopPublishing() + { + } + + public virtual void PausePublishing() + { + } + + public virtual void ResumePublishing() + { + } + + public virtual bool IsPublising() + { + return false; + } + + public virtual bool IsPublishingPause() + { + return false; + } + + public virtual void SetPublishingReceiveCommentEnable(bool isEnable) + { + } + + public virtual void ShowPublishingMenu() + { + } + + public virtual void SetRecordingFaceCameraMicrophoneStatus(bool isEnableCamera, bool isEnalbeMicrophon) + { + } + + public virtual bool GetRecordingFaceCameraEnable() + { + return false; + } + + public virtual bool GetRecordingMicrophoneEnable() + { + return false; + } + + public virtual void SetRecordingMicrophoneGain(float gain) + { + } + + public virtual float GetRecordingMicrophoneGain() + { + return 0f; + } + + public virtual void SetPublishingFaceCameraMicrophoneStatus(bool isEnableCamera, bool isEnalbeMicrophon) + { + } + + public virtual bool GetPublishingFaceCameraEnable() + { + return false; + } + + public virtual bool GetPublishingMicrophoneEnable() + { + return false; + } + + public virtual void SetPublishingMicrophoneGain(float gain) + { + } + + public virtual float GetPublishingMicrophoneGain() + { + return 0f; + } + + public virtual void SetFaceCameraWindowVisible(bool isVisible) + { + } + + public virtual int GetFaceCameraWindowX() + { + return 0; + } + + public virtual void SetFaceCameraWindowX(int screenX) + { + } + + public virtual int GetFaceCameraWindowY() + { + return 0; + } + + public virtual void SetFaceCameraWindowY(int screenY) + { + } + + public virtual int GetFaceCameraWindowWidth() + { + return 0; + } + + public virtual void SetFaceCameraWindowWidth(int w) + { + } + + public virtual int GetFaceCameraWindowHeight() + { + return 0; + } + + public virtual void SetFaceCameraWindowHeight(int h) + { + } +} diff --git a/SVSim.BattleEngine/Engine/VideoHostingManager.cs b/SVSim.BattleEngine/Engine/VideoHostingManager.cs new file mode 100644 index 0000000..67c25b8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/VideoHostingManager.cs @@ -0,0 +1,203 @@ +public class VideoHostingManager : SingletonMonoBehaviour +{ + private VideoHostingImplBase _impl; + + private void Start() + { + _impl = base.gameObject.AddComponent(); + } + + private void OnDestroy() + { + } + + public bool IsVideoHostingSupported() + { + return _impl.IsVideoHostingSupported(); + } + + public void StartRecording() + { + _impl.StartRecording(); + } + + public void StopRecording() + { + _impl.StopRecording(); + } + + public void PauseRecording() + { + _impl.PauseRecording(); + } + + public void ResumeRecording() + { + _impl.ResumeRecording(); + } + + public bool IsRecording() + { + return _impl.IsRecording(); + } + + public bool IsRecordingPause() + { + return _impl.IsRecordingPause(); + } + + public bool HasRecordedData() + { + return _impl.HasRecordedData(); + } + + public void UploadRecording() + { + _impl.UploadRecording(); + } + + public bool IsUploading() + { + return _impl.IsUploading(); + } + + public void WatchRecording() + { + _impl.WatchRecording(); + } + + public void StartPublishing() + { + _impl.StartPublishing(); + } + + public void StopPublishing() + { + _impl.StopPublishing(); + } + + public void PausePublishing() + { + _impl.PausePublishing(); + } + + public void ResumePublishing() + { + _impl.ResumePublishing(); + } + + public bool IsPublising() + { + return _impl.IsPublising(); + } + + public bool IsPublishingPause() + { + return _impl.IsPublishingPause(); + } + + public void SetPublishingReceiveCommentEnable(bool isEnable) + { + _impl.SetPublishingReceiveCommentEnable(isEnable); + } + + public void ShowPublishingMenu() + { + _impl.ShowPublishingMenu(); + } + + public void SetRecordingFaceCameraMicrophoneStatus(bool isEnableCamera, bool isEnableMicrophone) + { + _impl.SetRecordingFaceCameraMicrophoneStatus(isEnableCamera, isEnableMicrophone); + } + + public bool GetRecordingFaceCameraEnable() + { + return _impl.GetRecordingFaceCameraEnable(); + } + + public bool GetRecordingMicrophoneEnable() + { + return _impl.GetRecordingMicrophoneEnable(); + } + + public void SetRecordingMicrophoneGain(float gain) + { + _impl.SetRecordingMicrophoneGain(gain); + } + + public float GetRecordingMicrophoneGain() + { + return _impl.GetRecordingMicrophoneGain(); + } + + public void SetPublishingFaceCameraMicrophoneStatus(bool isEnableCamera, bool isEnableMicrophone) + { + _impl.SetPublishingFaceCameraMicrophoneStatus(isEnableCamera, isEnableMicrophone); + } + + public bool GetPublishingFaceCameraEnable() + { + return _impl.GetPublishingFaceCameraEnable(); + } + + public bool GetPublishingMicrophoneEnable() + { + return _impl.GetPublishingMicrophoneEnable(); + } + + public void SetPublishingMicrophoneGain(float gain) + { + _impl.SetPublishingMicrophoneGain(gain); + } + + public float GetPublishingMicrophoneGain() + { + return _impl.GetPublishingMicrophoneGain(); + } + + public void SetFaceCameraWindowVisible(bool isVisible) + { + _impl.SetFaceCameraWindowVisible(isVisible); + } + + public int GetFaceCameraWindowX() + { + return _impl.GetFaceCameraWindowX(); + } + + public void SetFaceCameraWindowX(int screenX) + { + _impl.SetFaceCameraWindowX(screenX); + } + + public int GetFaceCameraWindowY() + { + return _impl.GetFaceCameraWindowY(); + } + + public void SetFaceCameraWindowY(int screenY) + { + _impl.SetFaceCameraWindowY(screenY); + } + + public int GetFaceCameraWindowWidth() + { + return _impl.GetFaceCameraWindowWidth(); + } + + public void SetFaceCameraWindowWidth(int w) + { + _impl.SetFaceCameraWindowWidth(w); + } + + public int GetFaceCameraWindowHeight() + { + return _impl.GetFaceCameraWindowHeight(); + } + + public void SetFaceCameraWindowHeight(int h) + { + _impl.SetFaceCameraWindowHeight(h); + } +} diff --git a/SVSim.BattleEngine/Engine/VideoHostingNicoNicoNotification.cs b/SVSim.BattleEngine/Engine/VideoHostingNicoNicoNotification.cs new file mode 100644 index 0000000..b7559fd --- /dev/null +++ b/SVSim.BattleEngine/Engine/VideoHostingNicoNicoNotification.cs @@ -0,0 +1,95 @@ +using System; +using UnityEngine; +using Wizard; + +public class VideoHostingNicoNicoNotification : MonoBehaviour +{ + [SerializeField] + private UIToggle _toggleAgree; + + [SerializeField] + private UIButton _buttonNicoNico; + + [SerializeField] + private UIButton _buttonNicoNama; + + [SerializeField] + private UIButton _buttonAgree; + + [SerializeField] + private UILabel _buttonLabelNicoNico; + + [SerializeField] + private UILabel _buttonLabelNicoNama; + + [SerializeField] + private UILabel _buttonLabelAgree; + + [SerializeField] + private UILabel _labelDialogBody; + + private DialogBase _parent; + + private bool _isNicoNicoAgree; + + private void Start() + { + SystemText systemText = Data.SystemText; + _toggleAgree.onChange.Add(new EventDelegate(OnClickNicoNicoNotificationAgree)); + _buttonNicoNico.onClick.Add(new EventDelegate(OnClickNicoNico)); + _buttonNicoNama.onClick.Add(new EventDelegate(OnClickNicoNama)); + _buttonAgree.onClick.Add(new EventDelegate(OnClickNicoNicoNotificationAgreeButton)); + _buttonLabelNicoNico.text = systemText.Get("VideoHosting_0034"); + _buttonLabelNicoNama.text = systemText.Get("VideoHosting_0035"); + _buttonLabelAgree.text = systemText.Get("Title_0015"); + _labelDialogBody.text = systemText.Get("VideoHosting_0036"); + } + + public void SetParent(DialogBase parent) + { + _parent = parent; + _parent.SetButtonDisable(isEnableOK: true); + DialogBase parent2 = _parent; + parent2.onPushButton1 = (Action)Delegate.Combine(parent2.onPushButton1, new Action(OnClickNicoNicoNotificationOK)); + DialogBase parent3 = _parent; + parent3.onPushButton2 = (Action)Delegate.Combine(parent3.onPushButton2, new Action(OnNotificationClose)); + } + + private void OnClickNicoNico() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.CreateOpenURLWindow(WebViewHelper.UrlType.NICONICO); + } + + private void OnClickNicoNama() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.CreateOpenURLWindow(WebViewHelper.UrlType.NICONICO_PUBLISH); + } + + private void OnClickNicoNicoNotificationAgree() + { + _isNicoNicoAgree = UIToggle.current.value; + _parent.SetButtonDisable(!_isNicoNicoAgree); + } + + private void OnClickNicoNicoNotificationAgreeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(_isNicoNicoAgree ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + } + + public void OnClickNicoNicoNotificationOK() + { + if (_isNicoNicoAgree) + { + VideoHostingUtil.SetOptionFlagFromPlayerPrefs(VideoHostingUtil.Option.NicoNicoNotificationAgreement, enable: true); + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.VideoSharing); + VideoHostingUtil.CreateVideoHostingSetting(); + } + } + + public void OnNotificationClose() + { + _parent = null; + } +} diff --git a/SVSim.BattleEngine/Engine/WatchInPlayAction.cs b/SVSim.BattleEngine/Engine/WatchInPlayAction.cs new file mode 100644 index 0000000..24db3e4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/WatchInPlayAction.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; +using Wizard.Battle.Touch; +using Wizard.Battle.View.Vfx; + +public class WatchInPlayAction : InPlayCardReflection +{ + private const float DELAY_BEFORE_START_SKILL_TARGET_SELECT = 0.5f; + + private const float WAIT_TIME_BETWEEN_SELECT_AND_EVOLUTION = 0.25f; + + private const float WAIT_TIME_BETWEEN_CHOICE_AND_EVOLUTION = 0.5f; + + public WatchInPlayAction(BattleManagerBase battleMgr, OperateMgr operateMgr) + : base(battleMgr, operateMgr) + { + } + + protected override VfxBase CreateEvolveVfx(BattleCardBase evolvedCard, List targetCards, bool isPlayer, List choiceId, bool isChoice) + { + if (((targetCards != null && targetCards.Any()) || (choiceId != null && choiceId.Any())) && (isPlayer || GameMgr.GetIns().IsAdmin)) + { + return NullVfx.GetInstance(); + } + return base.CreateEvolveVfx(evolvedCard, targetCards, isPlayer, choiceId, isChoice); + } + + public override void StartSelect(int actingCardIndex, bool isPlayer = true) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(isPlayer), actingCardIndex); + sequentialVfxPlayer.Register(CreateStartSelectVfx(indexToCardBase, isEvolve: true)); + _battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + public override void StartChoiceSelect(int actingCardIndex, bool isPlayer = true) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(isPlayer), actingCardIndex); + SkillBase choiceSkill = GetSelectSkills(indexToCardBase, isEvolve: true).FirstOrDefault(); + sequentialVfxPlayer.Register(new StartEvolutionTargetFocusVfx(indexToCardBase.BattleCardView.GameObject)); + sequentialVfxPlayer.Register(CreateStartChoiceSelectVfx(indexToCardBase, choiceSkill, isEvolve: true, null)); + _battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + public override void StartSelectFusion(int actingCardIndex, bool isPlayer = true) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(isPlayer), actingCardIndex); + sequentialVfxPlayer.Register(new StartEvolutionTargetFocusVfx(indexToCardBase.BattleCardView.GameObject)); + sequentialVfxPlayer.Register(CreateStartFusionSelectVfx(indexToCardBase)); + _battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + public override void CancelSelect(bool isPlayer = true) + { + if (_actingCard != null) + { + base.CancelSelect(isPlayer); + _battleMgr.VfxMgr.RegisterImmediateVfx(CreateStopEvolutionTargetFocusVfx(_actingCard)); + } + } + + public override void CancelChoiceSelect(bool isPlayer = true) + { + if (_actingChoiceCard != null) + { + ChoiceUtility.StopChoiceEffects(_choiceCards); + ChoiceUtility.PlayCancelEvolveChoiceAnimation(_choiceCards, _battleMgr); + base.CancelChoiceSelect(isPlayer); + _battleMgr.VfxMgr.RegisterImmediateVfx(CreateStopEvolutionTargetFocusVfx(_actingChoiceCard)); + } + } + + protected override VfxBase CreateAfterSelectVfx(BattleCardBase actingCard, List selectedChoiceCardIds, bool isPlayer = true, bool isChoiceBrave = false) + { + float waitTime = (selectedChoiceCardIds.IsNotNullOrEmpty() ? 0.5f : 0.25f); + return SequentialVfxPlayer.Create(WaitVfx.Create(waitTime), ParallelVfxPlayer.Create(_operateMgr.EvolutionCard(actingCard, isPlayer, _selectedCards, selectedChoiceCardIds), CreateStopEvolutionTargetFocusVfx(actingCard))); + } + + private VfxBase CreateStopEvolutionTargetFocusVfx(BattleCardBase actingCard) + { + return new StopEvolutionTargetFocasVfx(actingCard.BattleCardView.GameObject); + } +} diff --git a/SVSim.BattleEngine/Engine/WatchPlayCardAction.cs b/SVSim.BattleEngine/Engine/WatchPlayCardAction.cs new file mode 100644 index 0000000..9e0d268 --- /dev/null +++ b/SVSim.BattleEngine/Engine/WatchPlayCardAction.cs @@ -0,0 +1,105 @@ +using System.Collections.Generic; +using System.Linq; +using Wizard.Battle.View.Vfx; + +public class WatchPlayCardAction : PlayHandCardReflection +{ + public WatchPlayCardAction(BattleManagerBase battleMgr, OperateMgr operateMgr, NetworkBattleData networkBattleData) + : base(battleMgr, operateMgr, networkBattleData) + { + } + + protected override void PlayMove(BattleCardBase playedCard, bool isPlayer = false, List choiceId = null, bool isChoice = false) + { + if (isChoice && choiceId != null && (isPlayer || GameMgr.GetIns().IsAdmin)) + { + return; + } + if (!GameMgr.GetIns().IsAdminWatch && !isPlayer) + { + base.PlayMove(playedCard, isPlayer, choiceId, isChoice); + return; + } + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + if (_networkBattleData.GetReceiveData().mutationAfterCardId != 0) + { + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + playedCard.BattleCardView.HideHandCardInfo(); + playedCard.BattleCardView.HideCanPlayEffect(); + })); + } + sequentialVfxPlayer.Register(_operateMgr.InitSetCard(playedCard, isPlayer)); + sequentialVfxPlayer.Register(_operateMgr.PlayCard(playedCard, isPlayer, null, isRecovery: false, choiceId)); + _battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + protected override void PlayActionMove(BattleCardBase receivedCard, List targetCards, bool isPlayer = false, List choiceId = null) + { + if (!isPlayer && !GameMgr.GetIns().IsAdmin) + { + base.PlayActionMove(receivedCard, targetCards, isPlayer, choiceId); + } + } + + protected override void SendEcho(BattleCardBase receivedCard, NetworkBattleDefine.PlayActionType actionType) + { + } + + public override void StartSelect(int actingCardIndex, bool isPlayer = true) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase playedCard = NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(isPlayer), actingCardIndex); + Skill_transform accelerateOrCrystallizeTransformSkill = playedCard.GetAccelerateOrCrystallizeTransformSkill(); + bool isAccelerateSelect = accelerateOrCrystallizeTransformSkill != null; + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + playedCard.BattleCardView.HideHandCardInfo(); + if (!isPlayer && GameMgr.GetIns().IsAdminWatch) + { + _battleMgr.BattleEnemy.UpdateHandCardsPlayability(areArrowsForcedOff: true); + } + })); + sequentialVfxPlayer.Register(_operateMgr.InitSetCard(playedCard, isPlayer, isSelect: true, isRecovery: false, isChoiceSelect: false, isAccelerateSelect)); + sequentialVfxPlayer.Register(CreateStartSelectVfx(playedCard, isEvolve: false, isChoice: false, accelerateOrCrystallizeTransformSkill)); + _battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + public override void StartChoiceSelect(int actingCardIndex, bool isPlayer = true) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase indexToCardBase = NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(isPlayer), actingCardIndex); + Skill_transform accelerateOrCrystallizeTransformSkill = indexToCardBase.GetAccelerateOrCrystallizeTransformSkill(); + BattleCardBase battleCardBase = null; + if (accelerateOrCrystallizeTransformSkill != null) + { + int tokenId = accelerateOrCrystallizeTransformSkill.TransformId + (accelerateOrCrystallizeTransformSkill.SkillPrm.ownerCard.BaseParameter.IsFoil ? 1 : 0); + battleCardBase = _battleMgr.CreateTransformCardRegisterVfx(indexToCardBase, tokenId, isPlayer); + } + SkillBase choiceSkill = GetSelectSkills((battleCardBase != null) ? battleCardBase : indexToCardBase, isEvolve: false).FirstOrDefault(); + sequentialVfxPlayer.Register(CreateStartChoiceSelectVfx(indexToCardBase, choiceSkill, isEvolve: false, battleCardBase)); + _battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + public override void StartSelectFusion(int actingCardIndex, bool isPlayer = true) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + BattleCardBase playedCard = NetworkBattleGenericTool.GetIndexToCardBase(_battleMgr, _battleMgr.GetBattlePlayer(isPlayer), actingCardIndex); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + playedCard.BattleCardView.HideHandCardInfo(); + if (!isPlayer && GameMgr.GetIns().IsAdminWatch) + { + _battleMgr.BattleEnemy.UpdateHandCardsPlayability(areArrowsForcedOff: true); + } + })); + sequentialVfxPlayer.Register((_battleMgr as NetworkWatchBattleMgr).CreateVfxResetPositionByCardBase(playedCard, null)); + sequentialVfxPlayer.Register(CreateStartFusionSelectVfx(playedCard)); + _battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + protected override VfxBase CreateAfterSelectVfx(BattleCardBase actingCard, List selectedChoiceCardIds, bool isPlayer, bool isChoiceBrave) + { + return _operateMgr.PlayCard(actingCard, isPlayer, _selectedCards, isRecovery: false, selectedChoiceCardIds, isChoiceBrave); + } +} diff --git a/SVSim.BattleEngine/Engine/WindowResize.cs b/SVSim.BattleEngine/Engine/WindowResize.cs new file mode 100644 index 0000000..64df0af --- /dev/null +++ b/SVSim.BattleEngine/Engine/WindowResize.cs @@ -0,0 +1,376 @@ +using System; +using System.Runtime.InteropServices; +using Cute; +using UnityEngine; + +public class WindowResize +{ + public delegate IntPtr WndProcDelegate(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam); + + public struct Rect + { + public int Left { get; set; } + + public int Top { get; set; } + + public int Right { get; set; } + + public int Bottom { get; set; } + + public int Width + { + get + { + return Right - Left; + } + set + { + Right = Left + value; + } + } + + public int Height + { + get + { + return Bottom - Top; + } + set + { + Bottom = Top + value; + } + } + + public Rect(int left, int top, int right, int bottom) + { + this = default(Rect); + Left = left; + Top = top; + Right = right; + Bottom = bottom; + } + } + + public struct WindowPos + { + public IntPtr hwnd; + + public IntPtr hwndafter; + + public int x; + + public int y; + + public int cx; + + public int cy; + + public uint flags; + } + + private const int WINDOW_WIDTH_MIN = 128; + + private const int WINDOW_HEIGHT_MIN = 59; + + public const float ASPECT_RATIO_MAX = 2.1666667f; + + public const float ASPECT_RATIO_MIN = 1.333f; + + private static int _windowLastWidth; + + private static int _windowLastHeight; + + private static bool _lastFullscreen; + + private static int? _requestUiUpdateFrame; + + private static int _frameLastWidth; + + private static int _frameLastHeight; + + private const int WM_WINDOWPOSCHANGING = 70; + + private const int WM_SIZING = 532; + + private const int WMSZ_LEFT = 1; + + private const int WMSZ_TOP = 3; + + private const int WMSZ_TOPLEFT = 4; + + private const int WMSZ_TOPRIGHT = 5; + + private const int WMSZ_BOTTOMLEFT = 7; + + private const int SWP_NOSIZE = 1; + + private static WndProcDelegate _wndProc; + + private static IntPtr _oldwndProcPtr; + + private static bool _init; + + private IntPtr WndProcPtr(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam) + { + if (!Screen.fullScreen) + { + switch (msg) + { + case 532u: + { + Rect structure2 = (Rect)Marshal.PtrToStructure(lParam, typeof(Rect)); + if (_windowLastWidth != structure2.Width || _windowLastHeight != structure2.Height) + { + (int, int) newWindowSize2 = GetNewWindowSize(hWnd, structure2.Width, structure2.Height); + int item3 = newWindowSize2.Item1; + int item4 = newWindowSize2.Item2; + int num = (int)wParam; + bool num2 = num == 7 || num == 1 || num == 4; + bool flag = num == 3 || num == 4 || num == 5; + if (num2) + { + structure2.Left = structure2.Right - item3; + } + else + { + structure2.Right = structure2.Left + item3; + } + if (flag) + { + structure2.Top = structure2.Bottom - item4; + } + else + { + structure2.Bottom = structure2.Top + item4; + } + Marshal.StructureToPtr(structure2, lParam, fDeleteOld: true); + } + break; + } + case 70u: + { + WindowPos structure = (WindowPos)Marshal.PtrToStructure(lParam, typeof(WindowPos)); + if ((structure.flags & 1) == 0 && (_windowLastWidth != structure.cx || _windowLastHeight != structure.cy)) + { + (int, int) newWindowSize = GetNewWindowSize(hWnd, structure.cx, structure.cy); + int item = newWindowSize.Item1; + int item2 = newWindowSize.Item2; + structure.cx = item; + structure.cy = item2; + Marshal.StructureToPtr(structure, lParam, fDeleteOld: true); + } + break; + } + } + } + return CallWindowProc(_oldwndProcPtr, hWnd, msg, wParam, lParam); + } + + private (int, int) GetWindowFrameSize(IntPtr hWnd) + { + GetClientRect(hWnd, out var lpRect); + if (lpRect.Right - lpRect.Left == 0 || lpRect.Bottom - lpRect.Top == 0) + { + return (_frameLastWidth, _frameLastHeight); + } + GetWindowRect(hWnd, out var lpRect2); + int item = lpRect2.Right - lpRect2.Left - (lpRect.Right - lpRect.Left); + int item2 = lpRect2.Bottom - lpRect2.Top - (lpRect.Bottom - lpRect.Top); + return (item, item2); + } + + private static (int, int) WindowToClientSize(int windowWidth, int windowHeight, int frameWidth, int frameHeight) + { + return (windowWidth - frameWidth, windowHeight - frameHeight); + } + + private static (int, int) ClientToWindowSize(int clientWidth, int clientHeight, int frameWidth, int frameHeight) + { + return (clientWidth + frameWidth, clientHeight + frameHeight); + } + + private (int, int) GetNewWindowSize(IntPtr hWnd, int width, int height) + { + (int, int) windowFrameSize = GetWindowFrameSize(hWnd); + int item = windowFrameSize.Item1; + int item2 = windowFrameSize.Item2; + _frameLastWidth = item; + _frameLastHeight = item2; + (int, int) tuple = WindowToClientSize(width, height, item, item2); + int item3 = tuple.Item1; + int item4 = tuple.Item2; + Vector3 fixedSize = getFixedSize(item3, item4); + item3 = (int)fixedSize.x; + item4 = (int)fixedSize.y; + UpdateGame(fixedSize.z); + _windowLastWidth = item3; + _windowLastHeight = item4; + return ClientToWindowSize(item3, item4, item, item2); + } + + private void init() + { + if (!_init) + { + IntPtr activeWindow = GetActiveWindow(); + _wndProc = WndProcPtr; + IntPtr functionPointerForDelegate = Marshal.GetFunctionPointerForDelegate(_wndProc); + IntPtr? intPtr = SetWindowLongPtr(activeWindow, -4, functionPointerForDelegate); + if (intPtr.HasValue) + { + _oldwndProcPtr = intPtr.Value; + _init = true; + } + } + } + + public WindowResize() + { + init(); + } + + private static Vector3 getFixedSize(int width, int height) + { + if (height < 59) + { + height = 59; + } + float num = (float)width / (float)height; + if (num < 1.333f) + { + num = 1.333f; + if (width < 128) + { + width = 128; + } + height = (int)((float)width / num); + } + else if (num > 2.1666667f) + { + num = 2.1666667f; + width = (int)((float)height * num); + } + return new Vector3(width, height, num); + } + + public static void SetResolution(int newWidth, int newHeight) + { + Vector3 fixedSize = getFixedSize(newWidth, newHeight); + newWidth = (int)fixedSize.x; + newHeight = (int)fixedSize.y; + float z = fixedSize.z; + if (Toolbox.QualityManager != null) + { + Toolbox.QualityManager.ChangeResolution(newWidth, newHeight, Screen.fullScreen); + } + UpdateGame(z); + _windowLastWidth = Screen.width; + _windowLastHeight = Screen.height; + } + + private static void ResolutionChanged() + { + Vector3 fixedSize = getFixedSize(Screen.width, Screen.height); + int num = (int)fixedSize.x; + int num2 = (int)fixedSize.y; + float z = fixedSize.z; + if (Toolbox.QualityManager != null) + { + if (num != Screen.width || num2 != Screen.height) + { + Toolbox.QualityManager.ChangeResolution(num, num2, Screen.fullScreen); + } + else + { + Toolbox.QualityManager.UpdateFromUnity(); + } + } + UpdateGame(z); + _windowLastWidth = num; + _windowLastHeight = num2; + _lastFullscreen = Screen.fullScreen; + } + + private static void UpdateGame(float ratio) + { + if (GameMgr.GetIns() != null) + { + GameMgr.GetIns().ChangeAspectRatio(ratio); + } + if (UIManager.GetInstance() != null && UIManager.GetInstance().GetCurrentScene() == UIManager.ViewScene.Battle && BattleManagerBase.GetIns() != null) + { + BattleManagerBase.GetIns().ChangeCameraFieldOfView(ratio); + } + _requestUiUpdateFrame = Time.frameCount; + } + + private static void UpdateUI() + { + UILabel[] array = UnityEngine.Object.FindObjectsOfType(); + for (int i = 0; i < array.Length; i++) + { + array[i].WrapOnResize(); + array[i].UpdateNGUIText(); + } + UITable[] array2 = UnityEngine.Object.FindObjectsOfType(); + for (int j = 0; j < array2.Length; j++) + { + array2[j].Reposition(); + } + AspectCameraPerspective[] array3 = UnityEngine.Object.FindObjectsOfType(); + for (int k = 0; k < array3.Length; k++) + { + array3[k].UpdateFov(); + } + } + + public void Update() + { + init(); + if (_requestUiUpdateFrame.HasValue && _requestUiUpdateFrame.Value < Time.frameCount) + { + UpdateUI(); + _requestUiUpdateFrame = null; + } + if (Screen.fullScreen && (_windowLastWidth != Screen.width || _windowLastHeight != Screen.height)) + { + ResolutionChanged(); + } + } + + public void SetSavedResolutionSettings() + { + } + + [DllImport("user32.dll")] + private static extern IntPtr GetActiveWindow(); + + [DllImport("user32.dll")] + private static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam); + + [DllImport("user32.dll", EntryPoint = "SetWindowLong")] + private static extern int SetWindowLong32(IntPtr hWnd, int nIndex, int dwNewLong); + + [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr")] + private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong); + + [DllImport("user32.dll")] + private static extern bool GetWindowRect(IntPtr hwnd, out Rect lpRect); + + [DllImport("user32.dll")] + private static extern bool GetClientRect(IntPtr hwnd, out Rect lpRect); + + public static IntPtr? SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) + { + if (IntPtr.Size == 8) + { + return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); + } + int num = SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()); + if (num == 0) + { + return null; + } + return new IntPtr(num); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Card.InnerOptions/PlayerCardInnerOptions.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Card.InnerOptions/PlayerCardInnerOptions.cs new file mode 100644 index 0000000..4f4b555 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Card.InnerOptions/PlayerCardInnerOptions.cs @@ -0,0 +1,40 @@ +using Wizard.Battle.View; + +namespace Wizard.Battle.Card.InnerOptions; + +public class PlayerCardInnerOptions : CardInnerOptionsBase +{ + public override bool CheckMovable(IBattlePlayerView selfPlayerBattleView, IBattleCardView selfBattleCardView, bool isOnDraw, bool isSkipSelecting, bool isRecording) + { + if (selfPlayerBattleView == null) + { + return false; + } + if (!base.CheckMovable(selfPlayerBattleView, selfBattleCardView, isOnDraw, isSkipSelecting, isRecording)) + { + return false; + } + if (isRecording) + { + return true; + } + BattlePlayerView battlePlayerView = (BattlePlayerView)selfPlayerBattleView; + if (battlePlayerView.IsSelecting && !isSkipSelecting) + { + return false; + } + if (battlePlayerView.IsMoving()) + { + return false; + } + if (isOnDraw) + { + return false; + } + if (selfPlayerBattleView.PlayQueueView.IsCardInQueue(selfBattleCardView)) + { + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualChantFieldBattleCard.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualChantFieldBattleCard.cs new file mode 100644 index 0000000..94f41b3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualChantFieldBattleCard.cs @@ -0,0 +1,31 @@ +using Wizard.Battle.Operation; +using Wizard.Battle.Resource; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Card; + +public class VirtualChantFieldBattleCard : ChantFieldBattleCard, IVirtualBattleCard +{ + public bool UsedRandomSkill { get; set; } + + public VirtualChantFieldBattleCard(BuildInfo buildInfo) + : base(buildInfo) + { + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + return new NullFieldBattleCardView(buildInfo); + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + + public override SkillCreator CreateSkillCreator(BattlePlayerBase selfBattlPlayer, BattlePlayerBase opponentBattlePlayer, IBattleResourceMgr resourceMgr) + { + return new SimulateSkillCreator(this, selfBattlPlayer, opponentBattlePlayer, _buildInfo.ResourceMgr); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualClassBattleCard.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualClassBattleCard.cs new file mode 100644 index 0000000..7b38424 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualClassBattleCard.cs @@ -0,0 +1,37 @@ +using Wizard.Battle.Operation; +using Wizard.Battle.Resource; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Card; + +public class VirtualClassBattleCard : ClassBattleCardBase, IVirtualBattleCard +{ + public override int Index => 0; + + public bool UsedRandomSkill { get; set; } + + public VirtualClassBattleCard(ClassBuildInfo buildInfo) + : base(buildInfo) + { + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + return new NullClassBattleCardView(buildInfo); + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + + protected override void _CacheBattlePlayer() + { + } + + public override SkillCreator CreateSkillCreator(BattlePlayerBase selfBattlPlayer, BattlePlayerBase opponentBattlePlayer, IBattleResourceMgr resourceMgr) + { + return new SimulateSkillCreator(this, selfBattlPlayer, opponentBattlePlayer, _buildInfo.ResourceMgr); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualFieldBattleCard.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualFieldBattleCard.cs new file mode 100644 index 0000000..83de0b1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualFieldBattleCard.cs @@ -0,0 +1,31 @@ +using Wizard.Battle.Operation; +using Wizard.Battle.Resource; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Card; + +public class VirtualFieldBattleCard : FieldBattleCard, IVirtualBattleCard +{ + public bool UsedRandomSkill { get; set; } + + public VirtualFieldBattleCard(BuildInfo buildInfo) + : base(buildInfo) + { + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + return new NullFieldBattleCardView(buildInfo); + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + + public override SkillCreator CreateSkillCreator(BattlePlayerBase selfBattlPlayer, BattlePlayerBase opponentBattlePlayer, IBattleResourceMgr resourceMgr) + { + return new SimulateSkillCreator(this, selfBattlPlayer, opponentBattlePlayer, _buildInfo.ResourceMgr); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualSpellBattleCard.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualSpellBattleCard.cs new file mode 100644 index 0000000..d9a8300 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualSpellBattleCard.cs @@ -0,0 +1,31 @@ +using Wizard.Battle.Operation; +using Wizard.Battle.Resource; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Card; + +public class VirtualSpellBattleCard : SpellBattleCard, IVirtualBattleCard +{ + public bool UsedRandomSkill { get; set; } + + public VirtualSpellBattleCard(BuildInfo buildInfo, bool isChoiceBrave) + : base(buildInfo, isChoiceBrave) + { + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + return new NullBattleCardView(buildInfo); + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + + public override SkillCreator CreateSkillCreator(BattlePlayerBase selfBattlPlayer, BattlePlayerBase opponentBattlePlayer, IBattleResourceMgr resourceMgr) + { + return new SimulateSkillCreator(this, selfBattlPlayer, opponentBattlePlayer, _buildInfo.ResourceMgr); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualUnitBattleCard.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualUnitBattleCard.cs new file mode 100644 index 0000000..a2cb8d3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Card/VirtualUnitBattleCard.cs @@ -0,0 +1,46 @@ +using Wizard.Battle.Operation; +using Wizard.Battle.Resource; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Card; + +public class VirtualUnitBattleCard : UnitBattleCard, IVirtualBattleCard +{ + public bool UsedRandomSkill { get; set; } + + public VirtualUnitBattleCard(BuildInfo buildInfo) + : base(buildInfo) + { + } + + public override VfxBase TurnStart(SkillProcessor skillProcessor) + { + return base.TurnStart(skillProcessor); + } + + protected override IBattleCardView CreateView(BattleCardView.BuildInfo buildInfo, bool isNullView) + { + return new NullBattleCardView(buildInfo); + } + + protected override ICardVfxCreator CreateVfxCreator(bool isPlayer, IBattleCardView battleCardView, bool isNullView) + { + return NullCardVfxCreator.GetInstance(); + } + + public override SkillCreator CreateSkillCreator(BattlePlayerBase selfBattlPlayer, BattlePlayerBase opponentBattlePlayer, IBattleResourceMgr resourceMgr) + { + return new SimulateSkillCreator(this, selfBattlPlayer, opponentBattlePlayer, _buildInfo.ResourceMgr); + } + + public override VfxBase LoadResource(bool isLogging = false) + { + return NullVfx.GetInstance(); + } + + public override VfxBase UnloadResource() + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkOpponentMulliganCtrl.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkOpponentMulliganCtrl.cs new file mode 100644 index 0000000..5867b11 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkOpponentMulliganCtrl.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public class NetworkOpponentMulliganCtrl : OpponentMulliganCtrl +{ + public NetworkOpponentMulliganCtrl(BattlePlayerBase player, MulliganInfoControl mulliganInfo, bool isUseExchangeMark) + : base(player, mulliganInfo, isUseExchangeMark) + { + _mulliganView = new OpponentMulliganView(mulliganInfo, isUseExchangeMark); + _isHideCard = true; + } + + public override VfxBase StartMulliganVfx(SkillProcessor skillProcessor) + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(_battlePlayer.BattleMgr.LoadCardResources(_firstDrawList)); + sequentialVfxPlayer.Register(new EnemyMulliganDrawVfx(_firstDrawList, GetMulliganInfo())); + _battlePlayer.CallRecordingMulliganStart(_firstDrawList); + return sequentialVfxPlayer; + } + + protected override IDictionary _MoveNewCardToHand(IList AbandonCards) + { + return NetworkMoveNewCardToHand(AbandonCards); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkPlayerMulliganCtrl.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkPlayerMulliganCtrl.cs new file mode 100644 index 0000000..bc6a917 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Mulligan/NetworkPlayerMulliganCtrl.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Mulligan; + +public class NetworkPlayerMulliganCtrl : PlayerMulliganCtrl +{ + public NetworkPlayerMulliganCtrl(BattlePlayerBase player, MulliganInfoControl mulliganInfo, IPlayerView view) + : base(player, mulliganInfo, view) + { + _playerMulliganView = new PlayerMulliganView(mulliganInfo, view); + _mulliganView = _playerMulliganView; + m_AbandonList = new List(); + } + + public override VfxBase StartMulliganVfx(SkillProcessor skillProcessor) + { + DrawFirstMulliganCard(); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(new PlayerMulliganDrawVfx(_firstDrawList, GetMulliganInfo())); + sequentialVfxPlayer.Register(_playerMulliganView.SortFirstDrawsToKeepZone(_firstDrawList)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + for (int i = 0; i < _firstDrawList.Count; i++) + { + _firstDrawList[i].SetOnDraw(draw: false); + } + _isSetOnCard = true; + })); + _battlePlayer.CallRecordingMulliganStart(_firstDrawList); + return sequentialVfxPlayer; + } + + protected override IDictionary _MoveNewCardToHand(IList AbandonCards) + { + return NetworkMoveNewCardToHand(AbandonCards); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/AttackOperationCommand.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/AttackOperationCommand.cs new file mode 100644 index 0000000..1156d22 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/AttackOperationCommand.cs @@ -0,0 +1,41 @@ +using System; +using System.Linq; +using LitJson; +using Wizard.AutoTest; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Operation; + +public class AttackOperationCommand : SkillOperationCommandBase +{ + private readonly AutoTestBattleMgr.CardInfo _targetCardInfo; + + public AttackOperationCommand(JsonData actionJsonData) + : base(actionJsonData) + { + _targetCardInfo = new AutoTestBattleMgr.CardInfo(actionJsonData["target"].ToString()); + } + + public override void Operation(BattleManagerBase battleMgr) + { + BattlePlayerPair battlePlayerPair = battleMgr.GetBattlePlayerPair(_cardInfo.IsPlayer); + BattleCardBase battleCardBase = battlePlayerPair.Self.InPlayCards.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index); + BattleCardBase battleCardBase2 = battlePlayerPair.Opponent.ClassAndInPlayCardList.SingleOrDefault((BattleCardBase c) => c.Index == _targetCardInfo.Index); + if (battleCardBase == null) + { + throw new Exception("場に " + _cardInfo.Name + " が見つかりませんでした"); + } + if (battleCardBase2 == null) + { + throw new Exception("場に " + _targetCardInfo.Name + " が見つかりませんでした"); + } + SetupSkillSummon(); + VfxBase vfx = battleMgr.OperateMgr.Attack(battleCardBase, battleCardBase2, _cardInfo.IsPlayer); + battleMgr.VfxMgr.RegisterSequentialVfx(vfx); + } + + public override string ToString() + { + return "Operation attack " + _cardInfo.Name + " to " + _targetCardInfo.Name; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/ChangeAIOperationCommand.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/ChangeAIOperationCommand.cs new file mode 100644 index 0000000..9b09f1e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/ChangeAIOperationCommand.cs @@ -0,0 +1,20 @@ +using LitJson; + +namespace Wizard.Battle.Operation; + +public class ChangeAIOperationCommand : IOperationCommand +{ + public string Logic { get; private set; } + + public int QueueCount { get; private set; } + + public ChangeAIOperationCommand(JsonData actionJsonData) + { + Logic = actionJsonData["logic"].ToString(); + QueueCount = actionJsonData["queue_count"].ToInt(); + } + + public void Operation(BattleManagerBase battleMgr) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/EvolveOperationCommand.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/EvolveOperationCommand.cs new file mode 100644 index 0000000..f0d874e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/EvolveOperationCommand.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using LitJson; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Operation; + +public class EvolveOperationCommand : SkillOperationCommandBase +{ + public EvolveOperationCommand(JsonData actionJsonData) + : base(actionJsonData) + { + } + + public override void Operation(BattleManagerBase battleMgr) + { + BattleCardBase battleCardBase = battleMgr.GetBattlePlayer(_cardInfo.IsPlayer).InPlayCards.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index); + if (battleCardBase == null) + { + throw new Exception("場に " + _cardInfo.Name + " が見つかりませんでした"); + } + SetupSkillSummon(); + VfxWith> skillSelectedCardsWithVfx = GetSkillSelectedCardsWithVfx(battleCardBase, isEvolution: true); + VfxBase vfx = battleMgr.OperateMgr.EvolutionCard(battleCardBase, _cardInfo.IsPlayer, skillSelectedCardsWithVfx.Value); + battleMgr.VfxMgr.RegisterSequentialVfx(vfx); + } + + public override string ToString() + { + return "Operation evolve " + _cardInfo.Name; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/FusionOperationCommand.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/FusionOperationCommand.cs new file mode 100644 index 0000000..2c4cb94 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/FusionOperationCommand.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; +using Wizard.AutoTest; +using Wizard.Battle.Recovery; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Operation; + +public class FusionOperationCommand : SkillOperationCommandBase +{ + public FusionOperationCommand(JsonData actionJsonData) + : base(actionJsonData) + { + } + + protected virtual BattleCardBase ReplaceCardData(BattleManagerBase battleMgr, BattleCardBase fusionCard) + { + return fusionCard; + } + + public override void Operation(BattleManagerBase battleMgr) + { + BattleCardBase battleCardBase = battleMgr.GetBattlePlayer(_cardInfo.IsPlayer).HandCardList.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index); + if (battleCardBase == null) + { + if (!(UIManager.GetInstance().NowOpenDialog != null)) + { + LocalLog.AccumulateTraceLog("Card not found in hand :" + _cardInfo.Index + " " + _cardInfo.Name); + RecoveryManagerBase.OpenRecoveryFailedDialog(); + } + return; + } + battleCardBase = ReplaceCardData(battleMgr, battleCardBase); + List list = new List(); + foreach (SkillTargetInfo skillTargetInfo in _skillTargetInfoList) + { + AutoTestBattleMgr.CardInfo targetCardInfo = skillTargetInfo.TargetCard; + BattleCardBase item = battleMgr.GetBattlePlayer(targetCardInfo.IsPlayer).AllCards.Single((BattleCardBase c) => c.Index == targetCardInfo.Index); + list.Add(item); + } + VfxBase vfx = battleMgr.OperateMgr.FusionCard(battleCardBase, _cardInfo.IsPlayer, list); + battleMgr.VfxMgr.RegisterSequentialVfx(vfx); + } + + public override string ToString() + { + return "Operation comp_fusion " + _cardInfo.Name; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/PlayOperationCommand.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/PlayOperationCommand.cs new file mode 100644 index 0000000..43e01fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/PlayOperationCommand.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; +using UnityEngine; +using Wizard.Battle.Recovery; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Operation; + +public class PlayOperationCommand : SkillOperationCommandBase +{ + public PlayOperationCommand(JsonData actionJsonData) + : base(actionJsonData) + { + } + + public override void Operation(BattleManagerBase battleMgr) + { + BattlePlayerBase battlePlayer = battleMgr.GetBattlePlayer(_cardInfo.IsPlayer); + BattleCardBase playCard = battlePlayer.HandCardList.SingleOrDefault((BattleCardBase c) => c.Index == _cardInfo.Index); + bool isChoiceBrave = false; + if (playCard == null && _cardInfo.Index == 0) + { + playCard = battlePlayer.Class; + isChoiceBrave = true; + } + if (playCard == null) + { + if (!(UIManager.GetInstance().NowOpenDialog != null)) + { + UnityEngine.Debug.LogError("手札に " + _cardInfo.Name + " が見つかりませんでした"); + RecoveryManagerBase.OpenRecoveryFailedDialog(); + } + return; + } + SetupSkillSummon(); + VfxWith> skillSelectedCardsWithVfx = GetSkillSelectedCardsWithVfx(playCard, isEvolution: false, (bool isTargetSelectSkill) => battleMgr.OperateMgr.InitSetCard(playCard, _cardInfo.IsPlayer, isTargetSelectSkill, isRecovery: true)); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(skillSelectedCardsWithVfx.Vfx); + sequentialVfxPlayer.Register(battleMgr.OperateMgr.PlayCard(playCard, _cardInfo.IsPlayer, skillSelectedCardsWithVfx.Value, isRecovery: true, null, isChoiceBrave)); + battleMgr.VfxMgr.RegisterSequentialVfx(sequentialVfxPlayer); + } + + public override string ToString() + { + return "Operation play " + _cardInfo.Name; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SkillOperationCommandBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SkillOperationCommandBase.cs new file mode 100644 index 0000000..dc975f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SkillOperationCommandBase.cs @@ -0,0 +1,111 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using LitJson; +using Wizard.AutoTest; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Operation; + +public abstract class SkillOperationCommandBase : IOperationCommand +{ + protected AutoTestBattleMgr.CardInfo _cardInfo; + + protected readonly List _skillTargetInfoList = new List(); + + public SkillOperationCommandBase(JsonData actionJsonData) + { + _cardInfo = parseSkillInfo(actionJsonData); + if (!actionJsonData.HasKey("reaction")) + { + return; + } + JsonData jsonData = actionJsonData["reaction"]; + if (jsonData.IsObject) + { + parseSkillInfo(jsonData); + return; + } + foreach (JsonData item in jsonData.ToJsonDataCollection("reaction")) + { + parseSkillInfo(item); + } + } + + private AutoTestBattleMgr.CardInfo parseSkillInfo(JsonData jsonData) + { + string cardName = jsonData["index"].ToString(); + int cardId = jsonData.ToIntOrDefault("id", 0); + int cost = jsonData.ToIntOrDefault("cost", -1); + AutoTestBattleMgr.CardInfo cardInfo = new AutoTestBattleMgr.CardInfo(cardName, cardId, cost); + IEnumerable enumerable = jsonData.ToJsonDataCollection("skill_target"); + if (enumerable != null) + { + foreach (JsonData item in enumerable) + { + _skillTargetInfoList.Add(new SkillTargetInfo(cardInfo, item.ToString())); + } + } + return cardInfo; + } + + protected void SetupSkillSummon() + { + } + + public abstract void Operation(BattleManagerBase battleMgr); + + protected VfxWith> GetSkillSelectedCardsWithVfx(BattleCardBase card, bool isEvolution, Func func = null) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + List list = card.GetSelectTypeSkill(isEvolution).ToList(); + SkillCollectionBase source = (isEvolution ? card.EvolutionSkills : card.NormalSkills); + VfxBase vfx = NullVfx.GetInstance(); + if (list.Count == 0 && !isEvolution && source.Any(delegate(SkillBase s) + { + if (!(s is Skill_pp_fixeduse skill_pp_fixeduse)) + { + return false; + } + return skill_pp_fixeduse.IsMutationFixedUseCost && s.CheckCondition(new BattlePlayerReadOnlyInfoPair(s.SkillPrm.selfBattlePlayer, s.SkillPrm.opponentBattlePlayer), new SkillConditionCheckerOption(), isPrePlay: true); + }) && source.Any((SkillBase s) => s is Skill_transform)) + { + Skill_transform accelerateOrCrystallizeTransformSkill = card.GetAccelerateOrCrystallizeTransformSkill(); + if (accelerateOrCrystallizeTransformSkill != null) + { + list = ins.CreateTransformCardRegisterVfx(accelerateOrCrystallizeTransformSkill.SkillPrm.ownerCard, accelerateOrCrystallizeTransformSkill.TransformId, accelerateOrCrystallizeTransformSkill.SkillPrm.ownerCard.IsPlayer).GetSelectTypeSkill(isEvolution).ToList(); + } + } + bool flag = list.Count > 0 && _skillTargetInfoList.Any(); + if (func != null) + { + vfx = func.Call(flag); + } + IEnumerable enumerable = list.Where((SkillBase s) => s.IsChoiceType); + bool flag2 = enumerable != null && enumerable.Count() > 0; + int num = 0; + foreach (SkillBase item3 in enumerable) + { + num = ((!(item3.ApplySelectFilter is SkillChoiceSelectFilter)) ? (num + 1) : (num + ((SkillChoiceSelectFilter)item3.ApplySelectFilter).Count)); + } + List list2 = new List(); + if (flag) + { + foreach (SkillTargetInfo skillTargetInfo in _skillTargetInfoList) + { + if (flag2 && num > 0) + { + BattleCardBase item = ins.CreateTransformCardRegisterVfx(card, skillTargetInfo.TargetCard.Index, _cardInfo.IsPlayer); + list2.Add(item); + num--; + continue; + } + AutoTestBattleMgr.CardInfo targetCardInfo = skillTargetInfo.TargetCard; + BattleCardBase item2 = ins.GetBattlePlayer(targetCardInfo.IsPlayer).AllCards.Single((BattleCardBase c) => c.Index == targetCardInfo.Index); + list2.Add(item2); + } + } + return new VfxWith>(vfx, list2); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SkillTargetInfo.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SkillTargetInfo.cs new file mode 100644 index 0000000..aaaf069 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Operation/SkillTargetInfo.cs @@ -0,0 +1,16 @@ +using Wizard.AutoTest; + +namespace Wizard.Battle.Operation; + +public class SkillTargetInfo +{ + public AutoTestBattleMgr.CardInfo OwnerInfo { get; private set; } + + public AutoTestBattleMgr.CardInfo TargetCard { get; private set; } + + public SkillTargetInfo(AutoTestBattleMgr.CardInfo ownerInfo, string targetTest) + { + OwnerInfo = ownerInfo; + TargetCard = new AutoTestBattleMgr.CardInfo(targetTest); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/ResultPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/ResultPhase.cs new file mode 100644 index 0000000..4ff7eca --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/ResultPhase.cs @@ -0,0 +1,87 @@ +using System; +using Cute; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Phase; + +public class ResultPhase : IResultPhase, IPhase +{ + private readonly BattleManagerBase _battleMgr; + + private readonly bool _winnerIsPlayer; + + public event Action OnSetupEnd; + + public ResultPhase(BattleManagerBase battleMgr, bool winnerIsPlayer) + { + _battleMgr = battleMgr; + _winnerIsPlayer = winnerIsPlayer; + } + + public virtual VfxBase Setup() + { + _battleMgr.TurnPanelControl.GameObject.SetActive(value: false); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (dataMgr.m_BattleType == DataMgr.BattleType.BossRushQuest && !_battleMgr.BattleResultControl.AlreadyResultRecovery) + { + _battleMgr.BattleResultControl.AlreadyResultRecovery = true; + ClassBattleCardBase classCard = _battleMgr.BattlePlayer.Class as ClassBattleCardBase; + VfxBase vfx = (classCard.SkillApplyInformation as ClassSkillApplyInformation).GiveCombatValueModifier(null, new MaxLifeSetModifier(classCard.BossRushStartLife), null); + sequentialVfxPlayer.Register(vfx); + if (_winnerIsPlayer && dataMgr.BossRushBattleData != null && dataMgr.BossRushBattleData.RecoveryPointWhenFinish > 0) + { + EffectBattle effectBattle = null; + SkillBase.WaitEffectLoadVfx loadingVfx = new SkillBase.WaitEffectLoadVfx("btl_magic_cure_2", EffectMgr.EngineType.SHURIKEN, "se_btl_magic_cure_2", classCard.ResourceMgr, delegate(EffectBattle eb) + { + effectBattle = eb; + }); + DelaySetupVfx mainVfx = new DelaySetupVfx(() => new SkillEffectBattleVfx(effectBattle, classCard.BattleCardView, classCard.ResourceMgr, () => classCard.BattleCardView.GameObject.transform.position, () => classCard.BattleCardView.CardWrapObject.transform.position, 0f, 0f, EffectMgr.MoveType.DIRECT, EffectMgr.TargetType.SINGLE, isPlayer: true)); + VfxWithLoading vfxWithLoading = VfxWithLoading.Create(loadingVfx, mainVfx); + BattleCardBase.HealParam healParam = new BattleCardBase.HealParam(dataMgr.BossRushBattleData.RecoveryPointWhenFinish, classCard, classCard); + BattleCardBase.HealResult healResult = classCard.ApplyHealing(healParam, null); + classCard.SkillApplyInformation.AddSkillHealValue(healResult.HealAmount); + VfxWithLoadingSequential vfxWithLoadingSequential = VfxWithLoadingSequential.Create(healResult.PrehealVfxVfx, vfxWithLoading.MainVfx, healResult.HealVfx, healResult.PosthealVfxVfx); + vfxWithLoadingSequential.RegisterToLoadingVfx(vfxWithLoading.LoadingVfx); + sequentialVfxPlayer.Register(vfxWithLoadingSequential); + } + } + sequentialVfxPlayer.Register(WaitVfx.Create(1f)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _battleMgr.MenuButtonObject.SetActive(value: false); + if (!_battleMgr.BattleResultControl.IsResultOn) + { + _battleMgr.BattlePlayer.PlayerBattleView.AllClear(); + _battleMgr.BackGround.SetShaderGlobalColorBG.ChangeGlobalShaderColorFadeIn(); + _battleMgr.isStorySuccessful = (_winnerIsPlayer ? 1 : 0); + _battleMgr.DetailMgr.DetailPanelControl.Hide(); + _battleMgr.BattlePlayer.PlayerBattleView.TurnEndButtonUI.HideBtn(); + _battleMgr.BattleResultControl.StartUI(_winnerIsPlayer, _battleMgr.Camera); + _battleMgr.BattlePlayer.StatusPanelControl.HideUI(); + _battleMgr.BattleEnemy.StatusPanelControl.HideUI(); + _battleMgr.BattlePlayer.PlayerBattleView.TurnEndButtonUI.HideAnimation(); + _battleMgr.BattlePlayer.PlayerBattleView.HideChoiceBraveButton(); + _battleMgr.BattleEnemy.BattleEnemyView.HideChoiceBraveButton(); + GameMgr.GetIns().GetSoundMgr().StopBGM(null, 1f); + this.OnSetupEnd.Call(); + } + })); + sequentialVfxPlayer.Register(ParallelVfxPlayer.Create(_battleMgr.BattlePlayer.BattleView.HandView.HandFocus(), _battleMgr.BattleEnemy.BattleView.HandView.HandFocus())); + return sequentialVfxPlayer; + } + + public VfxWith Update(float dt) + { + return new VfxWith(NullVfx.GetInstance(), null); + } + + public VfxBase Teardown() + { + return NullVfx.GetInstance(); + } + + public void Pause() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/SingleMulliganPhase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/SingleMulliganPhase.cs new file mode 100644 index 0000000..a41d22e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Phase/SingleMulliganPhase.cs @@ -0,0 +1,12 @@ +using Wizard.Battle.Mulligan; + +namespace Wizard.Battle.Phase; + +public class SingleMulliganPhase : MulliganPhaseBase +{ + public SingleMulliganPhase(BattleManagerBase battleMgr) + : base(battleMgr) + { + Initialize(new SingleMulliganMgr()); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/PlayerHighRankSpineClassCharacter.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/PlayerHighRankSpineClassCharacter.cs new file mode 100644 index 0000000..7d99e41 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.ClassCharacter/PlayerHighRankSpineClassCharacter.cs @@ -0,0 +1,120 @@ +using UnityEngine; + +namespace Wizard.Battle.Player.ClassCharacter; + +internal class PlayerHighRankSpineClassCharacter : HighRankSpineClassCharacter +{ + protected readonly Vector3 WIDGET_POSITION = new Vector3(0f, -460f, 30f); + + protected readonly int WIDGET_OFFSET_BOTTOM = 71; + + protected readonly int WIDGET_OFFSET_TOP = 171; + + protected readonly Vector3 PP_PANEL_POSITION = new Vector3(0f, -34.22f, -29.25f); + + protected override string GetTagName() + { + return "Player"; + } + + protected override void SetUpAnchor(GameObject o) + { + o.transform.localPosition = WIDGET_POSITION; + UIWidget uIWidget = o.AddComponent(); + uIWidget.bottomAnchor.relative = 0f; + uIWidget.bottomAnchor.absolute = WIDGET_OFFSET_BOTTOM; + Transform transform = BattleManagerBase.GetIns().Battle3DContainer.transform; + uIWidget.bottomAnchor.target = transform; + uIWidget.topAnchor.target = transform; + uIWidget.topAnchor.relative = 0f; + uIWidget.topAnchor.absolute = WIDGET_OFFSET_TOP; + } + + protected override void AttachOtherUI(GameObject o) + { + BattleManagerBase.GetIns().BattlePlayer.BattleView.EpPanel.transform.parent = o.transform; + } + + public override Vector3 GetSpinePosition() + { + return new Vector3(0f, -0.02f, -0.27f); + } + + protected override string GetTextureName() + { + return "mt_Encampment_Chara_1"; + } + + public override Vector3 GetMaskImagePosition() + { + return new Vector3(0f, 0.12f, 0f); + } + + protected override Vector3 GetShieldPosition() + { + return new Vector3(2f, 1.7f, 0f); + } + + protected override Vector3 GetLifeIconPosition() + { + return new Vector3(0f, 0f, 0.1f); + } + + public override Quaternion GetMaskImageRotation() + { + return Quaternion.identity; + } + + public override Vector3 ConvertSpineScale(Vector3 originalScale) + { + return originalScale * 1.003125f; + } + + public override int GetSpineSortingOrder(bool isBack = false) + { + if (!isBack) + { + return -2; + } + return -10; + } + + public override int GetMaskSortingOrder(bool isBack = false) + { + if (!isBack) + { + return -2; + } + return -10; + } + + protected override int GetEmoteLabelDepth() + { + return 42; + } + + protected override int GetCharaId() + { + return GameMgr.GetIns().GetDataMgr().GetPlayerCharaId(); + } + + public override int GetSkinId() + { + return GameMgr.GetIns().GetDataMgr().GetPlayerSkinId(); + } + + public override int GetStencil() + { + return 3; + } + + protected override Vector3 GetPosition() + { + return Global.CLASS_BATTLE_POSITION_PLAYER; + } + + protected override Quaternion ConvertBackPanelRotation(Quaternion originalRotation) + { + return originalRotation; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/EnemyEmotionBase.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/EnemyEmotionBase.cs new file mode 100644 index 0000000..143bdeb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/EnemyEmotionBase.cs @@ -0,0 +1,50 @@ +using Wizard.Battle.Player.ClassCharacter; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Player.Emotion; + +public class EnemyEmotionBase : EmotionBase +{ + public EnemyEmotionBase(string emotionId, IClassCharacter classCharacter) + : base(emotionId, classCharacter) + { + } + + public override VfxBase PlayEmotion(ClassCharaPrm.MotionType motionType, ClassCharaPrm.FaceType faceType, string voiceId, string text) + { + if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE)) + { + return NullVfx.GetInstance(); + } + return base.PlayEmotion(motionType, faceType, voiceId, text); + } + + public override VfxBase PlayEmotion(ClassCharaPrm.MotionType motionType, ClassCharaPrm.FaceType faceType, string voiceId, string text, float hideTextTime, bool forcePlay = false) + { + ClassCharaPrm.MotionType motionType2 = motionType; + switch (motionType) + { + case ClassCharaPrm.MotionType.extra: + motionType2 = ClassCharaPrm.MotionType.extra_2; + break; + case ClassCharaPrm.MotionType.extra_1_a: + motionType2 = ClassCharaPrm.MotionType.extra_2_a; + break; + case ClassCharaPrm.MotionType.extra_1_b: + motionType2 = ClassCharaPrm.MotionType.extra_2_b; + break; + case ClassCharaPrm.MotionType.extra_1_c: + motionType2 = ClassCharaPrm.MotionType.extra_2_c; + break; + } + if (forcePlay) + { + return base.PlayEmotion(motionType2, faceType, voiceId, text, hideTextTime, forcePlay); + } + if (!PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.SHOW_OTHER_PLAYER_EMOTE)) + { + return NullVfx.GetInstance(); + } + return base.PlayEmotion(motionType2, faceType, voiceId, text, hideTextTime, forcePlay); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NetworkOpponentEmotion.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NetworkOpponentEmotion.cs new file mode 100644 index 0000000..024ad83 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NetworkOpponentEmotion.cs @@ -0,0 +1,11 @@ +using Wizard.Battle.Player.ClassCharacter; + +namespace Wizard.Battle.Player.Emotion; + +public class NetworkOpponentEmotion : EnemyEmotionBase +{ + public NetworkOpponentEmotion(string emotionId, IClassCharacter classCharacter) + : base(emotionId, classCharacter) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NullEmotion.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NullEmotion.cs new file mode 100644 index 0000000..cc02317 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NullEmotion.cs @@ -0,0 +1,29 @@ +using System; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Player.Emotion; + +public class NullEmotion : IEmotion +{ + public Vector3 LeaderPosition => Vector3.zero; + + public bool Enable { get; set; } + + public event Func OnPlay; + + public VfxBase PlayEmotion(ClassCharaPrm.EmotionType etype, float hideTextTime) + { + return NullVfx.GetInstance(); + } + + public VfxBase PlayEmotion(ClassCharaPrm.MotionType motionType, ClassCharaPrm.FaceType faceType, string voiceId, string text) + { + return NullVfx.GetInstance(); + } + + public VfxBase ReceiveOpponentEmotion(ClassCharaPrm.EmotionType emotionType) + { + return NullVfx.GetInstance(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NullPlayerEmotion.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NullPlayerEmotion.cs new file mode 100644 index 0000000..2926577 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Player.Emotion/NullPlayerEmotion.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Player.Emotion; + +public class NullPlayerEmotion : IPlayerEmotion, IEmotion +{ + public Vector3 LeaderPosition => Vector3.zero; + + public IEnumerable IconObjects => null; + + public bool Enable { get; set; } + + public event Func OnPlay; + + public VfxBase PlayEmotion(ClassCharaPrm.EmotionType emoteType, float hideTextTime) + { + return NullVfx.GetInstance(); + } + + public VfxBase PlayEmotion(ClassCharaPrm.MotionType motionType, ClassCharaPrm.FaceType faceType, string voiceId, string text) + { + return NullVfx.GetInstance(); + } + + public VfxBase ReceiveOpponentEmotion(ClassCharaPrm.EmotionType emoteType) + { + return NullVfx.GetInstance(); + } + + public VfxBase LoadResource() + { + return NullVfx.GetInstance(); + } + + public VfxBase ShowButtons() + { + return NullVfx.GetInstance(); + } + + public VfxBase HideButtons() + { + return NullVfx.GetInstance(); + } + + public VfxBase HideButtons(GameObject iconObject) + { + return NullVfx.GetInstance(); + } + + public void CancelShowButtons() + { + } + + public void ResetPlayCount() + { + } + + public void AddPlayCount() + { + } + + public void FocusIcon(GameObject go) + { + } + + public void UnfocusAllIcons() + { + } + + public VfxBase PlayEmotionFromIconObject(GameObject iconObject) + { + return NullVfx.GetInstance(); + } + + public string GetVoiceTextFromIconObject(GameObject iconObject) + { + return string.Empty; + } + + public bool IsContainsEmotionType(ClassCharaPrm.EmotionType type) + { + return false; + } + + public void DebugLogNotHiddenEmoteButton(TouchControl touchControl, VfxMgr emotionVfxMgr, SequentialVfxPlayer currentVfx) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/NullRecoveryManager.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/NullRecoveryManager.cs new file mode 100644 index 0000000..f50ba67 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/NullRecoveryManager.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Recovery; + +public class NullRecoveryManager : IRecoveryManager +{ + public DataMgr.BattleType BattleType => DataMgr.BattleType.None; + + public bool? DidPlayerGoFirst => null; + + public int RandomSeed => 0; + + public bool HasMulliganInfo => false; + + public int BackGroundId => -1; + + public string BgmId => "NONE"; + + public long RecordTime => 0L; + + public int IdxChangeSeed => -1; + + public event Action OnStartRecovery; + + public event Action OnEndDataRecovery; + + public event Action OnEndRecovery; + + public void Setup() + { + this.OnStartRecovery.Call(); + this.OnEndDataRecovery.Call(); + this.OnEndRecovery.Call(); + } + + public VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func startCoroutine) + { + return NullVfx.GetInstance(); + } + + public VfxBase UpdateRecovery() + { + return NullVfx.GetInstance(); + } + + public void RecoveryBeforeMulligan() + { + } + + public VfxBase RecoveryMulligan(BattlePlayer battlePlayer, BattleEnemy battleEnemy) + { + return NullVfx.GetInstance(); + } + + public string RecoveryPopSkillTargetCardName() + { + return string.Empty; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/NullRecoveryRecordManager.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/NullRecoveryRecordManager.cs new file mode 100644 index 0000000..d991088 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/NullRecoveryRecordManager.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace Wizard.Battle.Recovery; + +public class NullRecoveryRecordManager : IRecoveryRecordManager +{ + public void SetupRecording(BattleManagerBase battleMgr, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId = "NONE") + { + } + + public void RecordSkillTarget(IEnumerable targetCards) + { + } + + public void SetupMulliganStartTimeRecorderEvent(BattleManagerBase battleMgr) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/SingleBattleRecoveryManager.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/SingleBattleRecoveryManager.cs new file mode 100644 index 0000000..873d01f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/SingleBattleRecoveryManager.cs @@ -0,0 +1,179 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.Battle.Mulligan; +using Wizard.Battle.Operation; +using Wizard.Battle.View; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Recovery; + +public class SingleBattleRecoveryManager : RecoveryManagerBase +{ + protected BattlePlayer _battlePlayer; + + protected BattleEnemy _battleEnemy; + + protected IEnumerable _commands; + + protected bool _isBeforeFramePlayerTurn = true; + + private EnemyAI ai; + + public SingleBattleRecoveryManager(string filePath) + : base(filePath) + { + } + + protected override List CreateEnemyDeckIDList(BattleConditionEnemyInfo enemyInfo) + { + return enemyInfo.DeckCardInfos.Select((DeckCardInfo i) => i.CardId.Value).ToList(); + } + + public override VfxBase Recovery(BattlePlayer battlePlayer, BattleEnemy battleEnemy, Func startCoroutine) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + ins.IsPreRecovery = true; + _battlePlayer = battlePlayer; + _battleEnemy = battleEnemy; + ai = BattleManagerBase.GetIns().EnemyAI as EnemyAI; + _ = ai; + _battleEnemy.EnableEnemyAI = false; + _battlePlayer.Emotion.Enable = false; + _battleEnemy.Emotion.Enable = false; + BattleManagerBase.GetIns().SetupEvolCount(_operationInfo.SetupInfo.DidPlayerGoFirst); + SingleMulliganMgr singleMulliganMgr = new SingleMulliganMgr(); + MulliganInfoControl component = GameMgr.GetIns().GetGameObjMgr().AddUIContainerChildPrefab("Prefab/UI/MulliganInfo") + .GetComponent(); + singleMulliganMgr.InitMulligan(component, battlePlayer.PlayerBattleView); + StartRecoveryEvent.Call(); + if (!base.HasMulliganInfo) + { + EndDataRecoveryEvent.Call(); + EndRecoveryEvent.Call(); + return NullVfx.GetInstance(); + } + SkillProcessor skillProcessor = new SkillProcessor(); + singleMulliganMgr.MulliganStartDraw(_operationInfo.SetupInfo.DidPlayerGoFirst, skillProcessor); + foreach (int playerMulliganReplaceCard in _operationInfo.SetupInfo.PlayerMulliganReplaceCards) + { + int cardIndex = playerMulliganReplaceCard; + BattleCardBase battleCardBase = battlePlayer.HandCardList.SingleOrDefault((BattleCardBase c) => c.Index == cardIndex); + if (battleCardBase != null) + { + singleMulliganMgr.AbandonList.Add(battleCardBase); + } + } + singleMulliganMgr.Submit(BattleManagerBase.GetIns()); + singleMulliganMgr.GetMulliganInfo().SetPlayerReady(); + _commands = _operationInfo.ActionCommands; + _needUpdate = true; + ins.IsPreRecovery = false; + ins.IsRecovery = true; + return NullVfx.GetInstance(); + } + + public override VfxBase UpdateRecovery() + { + if (!_needUpdate) + { + return NullVfx.GetInstance(); + } + BattleManagerBase ins = BattleManagerBase.GetIns(); + if (_isBeforeFramePlayerTurn) + { + _ = _battleEnemy.IsSelfTurn; + } + if (_battleEnemy.IsSelfTurn) + { + foreach (BattleCardBase handCard in _battleEnemy.HandCardList) + { + handCard.SetOnDraw(draw: false); + } + } + _isBeforeFramePlayerTurn = _battlePlayer.IsSelfTurn; + IOperationCommand operationCommand = _commands.FirstOrDefault(); + if (operationCommand != null) + { + if (ai != null) + { + ai.UpdateAICurrentVirtualField(); + } + operationCommand.Operation(ins); + } + _commands = _commands.Skip(1); + if (_commands.Any() || _commands is TurnEndOperationCommand) + { + return NullVfx.GetInstance(); + } + if (ins is SingleBattleMgr) + { + ((SingleBattleMgr)ins).LifeZeroActivateLeonSkillIfNeeded(); + } + if (ai != null) + { + ai.UpdateAICurrentVirtualField(); + } + EndDataRecovery(); + RecoveryTurnStartPanel(); + _battlePlayer.PlayerBattleView.ClearPlayQueue(); + if (_battlePlayer.IsSelfTurn) + { + _battlePlayer.TurnStartEffectEnd(); + _battlePlayer._isPlayerActive = true; + } + _battleEnemy.BattleEnemyView.ClearPlayQueue(); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(InstantVfx.Create(delegate + { + GameMgr.GetIns().GetBattleCtrl().StartCoroutine(FontChanger.FontChange(null)); + }), _battlePlayer.BattleView.Recovery(_operationInfo.SetupInfo.DidPlayerGoFirst, _battlePlayer.HandCardList.Count > 0), _battleEnemy.BattleView.Recovery(!_operationInfo.SetupInfo.DidPlayerGoFirst), _battlePlayer.Recovery(), _battleEnemy.Recovery()); + string path = GameMgr.GetIns().GetDataMgr().GetPlayerSkinId() + .ToString("00"); + string path2 = GameMgr.GetIns().GetDataMgr().GetEnemySkinId() + .ToString("00"); + parallelVfxPlayer.Register(new WaitLoadResourceVfx(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.ClassCharaBase))); + parallelVfxPlayer.Register(new WaitLoadResourceVfx(Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.ClassCharaBase))); + IBattlePlayerView battlePlayerView = (_battleEnemy.IsSelfTurn ? _battleEnemy.BattleView : _battlePlayer.BattleView); + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + sequentialVfxPlayer.Register(parallelVfxPlayer); + sequentialVfxPlayer.Register(HandViewBase.CreateHideCardMeshesVfx(_battleEnemy.HandCardList)); + sequentialVfxPlayer.Register(InstantVfx.Create(delegate + { + _battleEnemy.EnableEnemyAI = true; + _battlePlayer.Emotion.Enable = true; + _battleEnemy.Emotion.Enable = true; + ResetLeaderAnimation(_battlePlayer, _battleEnemy); + _battlePlayer.UpdateHandCardsPlayability(); + Dump(_battlePlayer, _battleEnemy); + EndRecoveryEvent.Call(); + })); + sequentialVfxPlayer.Register(battlePlayerView.RecoveryTurnStart()); + ins.IsRecovery = false; + return sequentialVfxPlayer; + } + + public SetupConditionInfo GetSetupConditionInfo() + { + if (_operationInfo == null) + { + return null; + } + return _operationInfo.SetupInfo; + } + + public void CreateRecoveryFileFromTempFile() + { + if (SingleBattleRecoveryRecordManager.IsExistsTempSingleRecoveryFile()) + { + string recordDirectoryPath = OperationRecorderBase.RecordDirectoryPath; + string sourceFileName = recordDirectoryPath + "temp_recovery_single.json"; + string destFileName = recordDirectoryPath + "recovery_single.json"; + File.Copy(sourceFileName, destFileName, overwrite: true); + SingleBattleRecoveryRecordManager.DeleteTempRecoveryFile(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/SingleBattleRecoveryRecordManager.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/SingleBattleRecoveryRecordManager.cs new file mode 100644 index 0000000..f87211e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Recovery/SingleBattleRecoveryRecordManager.cs @@ -0,0 +1,146 @@ +using System.IO; + +namespace Wizard.Battle.Recovery; + +public class SingleBattleRecoveryRecordManager : RecoveryRecordManagerBase +{ + public const string TEMP_RECOVERY_SINGLE_FILE_NAME = "temp_recovery_single.json"; + + protected override string DefaultRecoveryFileName => "recovery_single.json"; + + public SingleBattleRecoveryRecordManager() + { + } + + public SingleBattleRecoveryRecordManager(string filePath) + : base(filePath) + { + } + + public override void SetupRecording(BattleManagerBase battleMgr, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId = "NONE") + { + base.SetupRecording(battleMgr, battleType, randomSeed, backGroundId, bgmId); + RecordSingleBattleSettings(_recorder, battleType, randomSeed, backGroundId, bgmId); + } + + protected override OperationRecorderBase CreateOperationRecorder() + { + if (RecoveryRecordManagerBase.IsExistsSingleRecoveryFile()) + { + string tempFilePath = OperationRecorderBase.RecordDirectoryPath + "temp_recovery_single.json"; + RecoveryRecordManagerBase.DeleteRecoveryFile(); + return new SingleBattleOperationRecorder(_recoveryFilePath, tempFilePath); + } + return new SingleBattleOperationRecorder(_recoveryFilePath); + } + + public static void DeleteTempRecoveryFile() + { + if (File.Exists(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_single.json")) + { + File.Delete(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_single.json"); + } + } + + public void ClearRecoderTempFilePath() + { + ((SingleBattleOperationRecorder)_recorder).ClearTempRecoveryFilePath(); + } + + protected override void SetupRecorderEvents(OperationRecorderBase operationRecorder, BattleManagerBase battleMgr) + { + base.SetupRecorderEvents(operationRecorder, battleMgr); + battleMgr.OperateMgr.OnTurnEnd += operationRecorder.RecordTurnEnd; + } + + protected void RecordSingleBattleSettings(OperationRecorderBase operationRecorder, DataMgr.BattleType battleType, int randomSeed, int backGroundId, string bgmId) + { + DataMgr dataMgr = _gameMgr.GetDataMgr(); + operationRecorder.RecordBattleType(battleType); + operationRecorder.RecordRandomSeed(randomSeed); + operationRecorder.RecordBackGroundId(backGroundId); + operationRecorder.RecordBgmId(bgmId); + operationRecorder.RecordClass("player", dataMgr.GetPlayerClassId()); + operationRecorder.RecordSubClass("player", dataMgr.GetPlayerSubClassId()); + if (dataMgr.TryGetPlayerMyRotationInfo(out var myRotationInfo)) + { + operationRecorder.RecordMyRotationId("player", myRotationInfo.Id); + } + operationRecorder.RecordClass("enemy", dataMgr.GetEnemyClassId()); + operationRecorder.RecordSubClass("enemy", dataMgr.GetEnemySubClassId()); + if (dataMgr.TryGetEnemyMyRotationInfo(out var myRotationInfo2)) + { + operationRecorder.RecordMyRotationId("enemy", myRotationInfo2.Id); + } + operationRecorder.RecordChara("player", dataMgr.GetPlayerCharaId()); + operationRecorder.RecordChara("enemy", dataMgr.GetEnemyCharaId()); + operationRecorder.RecordSleeve("player", dataMgr.GetPlayerSleeveId()); + operationRecorder.RecordSleeve("enemy", dataMgr.GetEnemySleeveId()); + operationRecorder.RecordDeck("player", 'p', dataMgr.GetCurrentDeckData()); + operationRecorder.RecordDeck("enemy", 'e', dataMgr.GetCurrentEnemyDeckData()); + operationRecorder.RecordEnemyAIDifficulty(dataMgr.m_EnemyAIDifficulty); + operationRecorder.RecordEnemyAILogicLevel(dataMgr.m_EnemyAILogicLevel); + operationRecorder.RecordEnemyAIMaxLife(dataMgr.m_EnemyAIMaxLife); + operationRecorder.RecordEnemyAIDeckId(dataMgr.m_EnemyAIDeckId); + operationRecorder.RecordEnemyAIStyleId(dataMgr.m_EnemyAIStyleId); + operationRecorder.RecordEnemyAIEmoteId(dataMgr.m_EnemyAIEmoteId); + operationRecorder.RecordEnemyAIUseInnerEmote(dataMgr.m_EnemyAIUseInnerEmote); + operationRecorder.RecordPracticeDifficultyDegreeId(dataMgr.PracticeDifficultyDegreeId); + operationRecorder.RecordIsPreBuildDeck(dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.BuildDeck)); + operationRecorder.RecordIsTrialDeck(dataMgr.IsLastSelectDeckAttributeType(DeckAttributeType.TrialDeck)); + operationRecorder.RecordIsDefaultDeck(dataMgr.GetSelectDefDeck()); + operationRecorder.RecordMissionNecessaryInformation(dataMgr.MissionNecessaryInformation); + switch (battleType) + { + case DataMgr.BattleType.Quest: + operationRecorder.RecordQuestStageId(dataMgr.QuestBattleData.QuestStageId); + operationRecorder.RecordQuestEnemyAiId(dataMgr.QuestBattleData.EnemyAiId); + operationRecorder.RecordQuestEnemyEmblemId(dataMgr.QuestBattleData.EmblemId); + operationRecorder.RecordQuestEnemyDegreeId(dataMgr.QuestBattleData.DegreeId); + operationRecorder.RecordQuestEnemyEmotionOverride(dataMgr.QuestBattleData.EnemyEmotionOverride); + operationRecorder.RecordQuestPlayerEmotionOverride(dataMgr.QuestBattleData.PlayerEmotionOverride); + operationRecorder.RecordQuestIsExtra(dataMgr.QuestBattleData.IsExtra); + operationRecorder.RecordQuestIsMockBattle(dataMgr.QuestBattleData.IsMockBattle); + operationRecorder.RecordQuestExtraDeckScheduleId(dataMgr.QuestBattleData.ExtraDeckScheduleId); + break; + case DataMgr.BattleType.BossRushQuest: + operationRecorder.RecordQuestStageId(dataMgr.BossRushBattleData.QuestStageId); + operationRecorder.RecordQuestEnemyAiId(dataMgr.BossRushBattleData.EnemyAiId); + operationRecorder.RecordQuestEnemyEmblemId(dataMgr.BossRushBattleData.EmblemId); + operationRecorder.RecordQuestEnemyDegreeId(dataMgr.BossRushBattleData.DegreeId); + operationRecorder.RecordQuestRecoveryPoint(dataMgr.BossRushBattleData.RecoveryPointWhenFinish); + operationRecorder.RecordQuestPlayerSkillList(dataMgr.BossRushBattleData.PlayerSkillList); + operationRecorder.RecordQuestEnemySkill(dataMgr.BossRushBattleData.EnemySkill); + operationRecorder.RecordQuestMaxBattleCount(dataMgr.BossRushBattleData.MaxBattleCount); + operationRecorder.RecordQuestCurrentWinCount(dataMgr.BossRushBattleData.CurrentWinCount); + break; + case DataMgr.BattleType.SecretBossQuest: + operationRecorder.RecordQuestStageId(dataMgr.BossRushBattleData.QuestStageId); + operationRecorder.RecordQuestEnemyAiId(dataMgr.BossRushBattleData.EnemyAiId); + operationRecorder.RecordQuestEnemyEmblemId(dataMgr.BossRushBattleData.EmblemId); + operationRecorder.RecordQuestEnemyDegreeId(dataMgr.BossRushBattleData.DegreeId); + operationRecorder.RecordQuestPlayerSkillList(dataMgr.BossRushBattleData.PlayerSkillList); + operationRecorder.RecordQuestEnemySkill(dataMgr.BossRushBattleData.EnemySkill); + break; + case DataMgr.BattleType.Practice: + operationRecorder.RecordPractice3DFieldId(dataMgr.GetSoroPlay3DFieldID()); + break; + case DataMgr.BattleType.Story: + operationRecorder.RecordStoryData(); + break; + } + } + + public void RecordChangeAI(string logicName, int operationQueueCount) + { + if (_recorder is SingleBattleOperationRecorder singleBattleOperationRecorder) + { + singleBattleOperationRecorder.RecordChangeAI(logicName, operationQueueCount); + } + } + + public static bool IsExistsTempSingleRecoveryFile() + { + return File.Exists(OperationRecorderBase.RecordDirectoryPath + "temp_recovery_single.json"); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Resource/BattleResourceMgr.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Resource/BattleResourceMgr.cs new file mode 100644 index 0000000..1ebdaef --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Resource/BattleResourceMgr.cs @@ -0,0 +1,557 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CriWare; +using Cute; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Resource; + +public class BattleResourceMgr : IBattleResourceMgr +{ + private class CardImageMaterialInfo + { + public Material material; + + public int refCount; + } + + private class EffectBattleInfo + { + public GameObject assetObject; + + public string sePath; + + public int refCount; + } + + private class WaitLoadLoalResourceVfx : VfxBase + { + private readonly string _path; + + private readonly Dictionary _containerDictionary; + + private readonly ResourceRequest _loadRequest; + + private readonly bool _isAddUIContainer; + + private readonly float _startTime; + + private bool _recordedLog; + + private const float ACCUMULATE_TRACE_LOG_TIME = 10f; + + public WaitLoadLoalResourceVfx(string path, Dictionary containerDictionary, bool isAddUIContainer) + { + _path = path; + _containerDictionary = containerDictionary; + _isAddUIContainer = isAddUIContainer; + if (_containerDictionary.ContainsKey(_path)) + { + IsEnd = true; + return; + } + _loadRequest = Resources.LoadAsync(path); + _startTime = Time.time; + } + + public override void Update(float dt, List effectVfxList) + { + base.Update(dt, effectVfxList); + if (_containerDictionary.ContainsKey(_path)) + { + IsEnd = true; + return; + } + if (!_recordedLog && (!_loadRequest.isDone || !IsEnd) && Time.time - _startTime > 10f) + { + _recordedLog = true; + LocalLog.AccumulateTraceLog("#722663_" + _path); + } + if (_loadRequest.isDone && !IsEnd) + { + GameObject gameObject = null; + gameObject = ((!_isAddUIContainer) ? GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent((GameObject)_loadRequest.asset, GameMgr.GetIns().GetGameObjMgr().GetSubUIContainer()) : GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent((GameObject)_loadRequest.asset, BattleManagerBase.GetIns().BtlUIContainer)); + UIManager.GetInstance().AttachAtlas(new List { gameObject }); + gameObject.SetActive(value: false); + _containerDictionary.Add(_path, gameObject); + IsEnd = true; + } + } + } + + private static readonly int RARITY_COUNT = 5; + + private readonly Dictionary m_cardImageMaterialInfoDictionary = new Dictionary(); + + private readonly Dictionary _effectBattleInfoDictionary = new Dictionary(); + + private readonly Dictionary m_shardObjectDictionary = new Dictionary(); + + private Material _playerSleeveMaterial; + + private Material _enemySleeveMaterial; + + private readonly Material[] _handStandardCardFrameMaterials = new Material[RARITY_COUNT]; + + private readonly Material[] _handSpellCardFrameMaterials = new Material[RARITY_COUNT]; + + private readonly Material[] _inPlayStandardCardFrameMaterials = new Material[RARITY_COUNT]; + + private readonly Material[] _choiceBraveCardFrameMaterials = new Material[RARITY_COUNT]; + + private Mesh _choiceBraveCardMesh = new Mesh(); + + private Mesh _choiceBraveCardLowMesh = new Mesh(); + + public VfxBase LoadSleeveMaterial(long sleeveId, bool isPlayer) + { + return InstantVfx.Create(delegate + { + Material material = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(sleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveMaterial, isfetch: true)) as Material; + material.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(sleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true)); + material.shader = Shader.Find(material.shader.name); + material.SetFloat("_CullMode", 2f); + material.SetFloat("_ZWriteMode", 1f); + if (isPlayer) + { + _playerSleeveMaterial = material; + } + else + { + _enemySleeveMaterial = material; + } + }); + } + + public Material GetSleeveMaterial(bool isPlayer) + { + if (!isPlayer) + { + return _enemySleeveMaterial; + } + return _playerSleeveMaterial; + } + + public virtual VfxBase LoadAsset(string path, ResourcesManager.AssetLoadPathType pathType, Action action) + { + return new WaitLoadResourceVfx(Toolbox.ResourcesManager.GetAssetTypePath(path, pathType), action); + } + + public virtual VfxBase LoadAsset(string fullPath, Action action) + { + return new WaitLoadResourceVfx(fullPath, action); + } + + public VfxBase LoadCardImageMaterial(int cardId, bool isEvolution, bool isFollower) + { + return InstantVfx.Create(delegate + { + string text = CalcCardImageMaterialPath(cardId, isEvolution, isFollower); + if (m_cardImageMaterialInfoDictionary.ContainsKey(text)) + { + m_cardImageMaterialInfoDictionary[text].refCount++; + } + else + { + Material material = Toolbox.ResourcesManager.LoadObject(text); + material.shader = Shader.Find(material.shader.name); + CardImageMaterialInfo value = new CardImageMaterialInfo + { + material = material, + refCount = 1 + }; + m_cardImageMaterialInfoDictionary.Add(text, value); + } + }); + } + + public Material GetCardImageMaterial(int cardId, bool isEvolution, bool isFollower) + { + string key = CalcCardImageMaterialPath(cardId, isEvolution, isFollower); + if (!m_cardImageMaterialInfoDictionary.ContainsKey(key)) + { + return null; + } + CardImageMaterialInfo cardImageMaterialInfo = m_cardImageMaterialInfoDictionary[key]; + cardImageMaterialInfo.refCount++; + return cardImageMaterialInfo.material; + } + + public VfxBase UnloadCardImageMaterial(int cardId, bool isEvolution, bool isFollower) + { + string path = CalcCardImageMaterialPath(cardId, isEvolution, isFollower); + if (!m_cardImageMaterialInfoDictionary.ContainsKey(path)) + { + return NullVfx.GetInstance(); + } + return InstantVfx.Create(delegate + { + CardImageMaterialInfo cardImageMaterialInfo = m_cardImageMaterialInfoDictionary[path]; + cardImageMaterialInfo.refCount--; + if (cardImageMaterialInfo.refCount <= 0) + { + Toolbox.ResourcesManager.RemoveAsset(path); + } + }); + } + + private static string CalcCardImageMaterialPath(int cardId, bool isEvolution, bool isFollower) + { + CardMaster instanceForBattle = CardMaster.GetInstanceForBattle(); + CardParameter cardParameterFromId = instanceForBattle.GetCardParameterFromId(cardId); + bool flag = CardMaster.IsMutationCardCheck(cardParameterFromId.BaseCardId); + ResourcesManager.AssetLoadPathType type = (isFollower ? ResourcesManager.AssetLoadPathType.UnitCardMaterial : ResourcesManager.AssetLoadPathType.SpellCardMaterial); + if (flag) + { + type = ((instanceForBattle.GetCardParameterFromId(cardParameterFromId.ResourceCardId).CharType == CardBasePrm.CharaType.NORMAL) ? ResourcesManager.AssetLoadPathType.UnitCardMaterial : ResourcesManager.AssetLoadPathType.SpellCardMaterial); + } + string path = ((cardParameterFromId.ResourceCardId / 1000000000 == 1) ? (cardParameterFromId.ResourceCardId + "_M") : (cardParameterFromId.ResourceCardId + ((isEvolution && !flag) ? "1_M" : "0_M"))); + return Toolbox.ResourcesManager.GetAssetTypePath(path, type, isfetch: true); + } + + public virtual VfxBase LoadEffectBattle(string objectFullPath, string objectPath, string sePath) + { + if (_effectBattleInfoDictionary.ContainsKey(objectPath)) + { + _effectBattleInfoDictionary[objectPath].refCount++; + return NullVfx.GetInstance(); + } + EffectBattleInfo effectBattleInfo = new EffectBattleInfo(); + effectBattleInfo.sePath = sePath; + effectBattleInfo.refCount = 1; + _effectBattleInfoDictionary.Add(objectPath, effectBattleInfo); + List list = new List(); + if (!string.IsNullOrEmpty(objectPath)) + { + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(objectPath, ResourcesManager.AssetLoadPathType.Effect2D)); + } + if (!string.IsNullOrEmpty(sePath)) + { + list.Add("s/" + sePath + ".acb"); + } + return new WaitLoadResourceVfx(list, delegate + { + if (_effectBattleInfoDictionary != null && _effectBattleInfoDictionary.ContainsKey(objectPath)) + { + if (_effectBattleInfoDictionary[objectPath].assetObject == null) + { + _effectBattleInfoDictionary[objectPath].assetObject = Toolbox.ResourcesManager.LoadObject(objectFullPath); + } + else + { + _effectBattleInfoDictionary[objectPath].refCount++; + } + } + }); + } + + public void AddEffectBattleInfoDictionary(string objectPath, string sePath) + { + if (!_effectBattleInfoDictionary.ContainsKey(objectPath)) + { + EffectBattleInfo effectBattleInfo = new EffectBattleInfo(); + effectBattleInfo.sePath = sePath; + effectBattleInfo.refCount = 1; + _effectBattleInfoDictionary.Add(objectPath, effectBattleInfo); + } + } + + public void SetEffectBattleInfoDictionary(string objectPath, string objectFullPath) + { + if (_effectBattleInfoDictionary != null && _effectBattleInfoDictionary.ContainsKey(objectPath)) + { + if (_effectBattleInfoDictionary[objectPath].assetObject == null) + { + _effectBattleInfoDictionary[objectPath].assetObject = Toolbox.ResourcesManager.LoadObject(objectFullPath); + } + else + { + _effectBattleInfoDictionary[objectPath].refCount++; + } + } + } + + public VfxBase DecrementEffectBattleRefCount(string objectPath) + { + if (!_effectBattleInfoDictionary.ContainsKey(objectPath)) + { + return NullVfx.GetInstance(); + } + return InstantVfx.Create(delegate + { + EffectBattleInfo effectBattleInfo = _effectBattleInfoDictionary[objectPath]; + if (--effectBattleInfo.refCount < 0) + { + effectBattleInfo.refCount = 0; + } + }); + } + + public void UnloadEffectBattle() + { + string[] array = _effectBattleInfoDictionary.Keys.Where((string key) => _effectBattleInfoDictionary[key].refCount <= 0).ToArray(); + foreach (string text in array) + { + Toolbox.ResourcesManager.RemoveAsset(Toolbox.ResourcesManager.GetAssetTypePath(text, ResourcesManager.AssetLoadPathType.Effect2D)); + _effectBattleInfoDictionary.Remove(text); + } + } + + public virtual VfxBase LoadAndCreateEffectBattleInstance(string objectPath, EffectMgr.EngineType engineType, string sePath, Action loadEndCallback) + { + if (string.IsNullOrEmpty(objectPath) || objectPath == "NONE") + { + loadEndCallback.Call(null); + return NullVfx.GetInstance(); + } + VfxBase instance = NullVfx.GetInstance(); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(objectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true); + instance = LoadEffectBattle(assetTypePath, objectPath, sePath); + return SequentialVfxPlayer.Create(instance, InstantVfx.Create(delegate + { + if (!_effectBattleInfoDictionary.ContainsKey(objectPath)) + { + loadEndCallback.Call(null); + } + else + { + EffectBattleInfo effectBattleInfo = _effectBattleInfoDictionary[objectPath]; + if (effectBattleInfo.assetObject == null) + { + loadEndCallback.Call(null); + } + else + { + GameObject gameObject = UnityEngine.Object.Instantiate(effectBattleInfo.assetObject); + EffectBattle effectBattle = gameObject.AddComponent(); + effectBattle.engineType = engineType; + effectBattle.ECriAtomSource = gameObject.AddComponent(); + effectBattle.ECriAtomSource.cueName = effectBattleInfo.sePath; + effectBattle.ECriAtomSource.playOnStart = false; + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(gameObject, delegate + { + loadEndCallback.Call(effectBattle); + }, isBattle: true); + } + } + })); + } + + public void DestroyEffectBattleInstance(EffectBattle effectBattle) + { + UnityEngine.Object.Destroy(effectBattle.gameObject); + } + + public VfxBase LoadRerityMaterial(bool isHand, bool isSpell, int rarity, bool isChoiceBraveCard) + { + return InstantVfx.Create(delegate + { + Material material = Toolbox.ResourcesManager.LoadObject(CalcRerityMaterialPath(isHand, isSpell, rarity, isChoiceBraveCard)); + if (isSpell) + { + if (isChoiceBraveCard) + { + _choiceBraveCardFrameMaterials[rarity] = material; + } + else + { + _handSpellCardFrameMaterials[rarity] = material; + } + } + else if (isHand) + { + _handStandardCardFrameMaterials[rarity] = material; + } + else + { + _inPlayStandardCardFrameMaterials[rarity] = material; + } + }); + } + + public Material GetRerityMaterial(bool isHand, bool isSpell, int rarity, bool isChoiceBraveCard) + { + if (isSpell) + { + if (isChoiceBraveCard) + { + return _choiceBraveCardFrameMaterials[rarity]; + } + return _handSpellCardFrameMaterials[rarity]; + } + if (isHand) + { + return _handStandardCardFrameMaterials[rarity]; + } + return _inPlayStandardCardFrameMaterials[rarity]; + } + + public void LoadChoiceBraveCardMesh() + { + _choiceBraveCardMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_card_heroskill", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true)); + _choiceBraveCardLowMesh = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("md_card_heroskill_low", ResourcesManager.AssetLoadPathType.CardFrameMesh, isfetch: true)); + } + + public Mesh GetChoiceBraveCardMesh(bool isLow) + { + if (isLow) + { + return _choiceBraveCardLowMesh; + } + return _choiceBraveCardMesh; + } + + private string CalcRerityMaterialPath(bool isHand, bool isSpell, int rarity, bool isChoiceBraveCard) + { + string path; + if (isSpell) + { + if (isChoiceBraveCard) + { + switch (rarity) + { + case 0: + path = "CardFrame_HS_Bronze"; + break; + case 1: + path = "CardFrame_HS_Bronze"; + break; + case 2: + path = "CardFrame_HS_Silver"; + break; + case 3: + path = "CardFrame_HS_Gold"; + break; + case 4: + path = "CardFrame_HS_Legend"; + break; + default: + return ""; + } + } + else + { + switch (rarity) + { + case 0: + path = "CardFrame_S_Bronze"; + break; + case 1: + path = "CardFrame_S_Bronze"; + break; + case 2: + path = "CardFrame_S_Silver"; + break; + case 3: + path = "CardFrame_S_Gold"; + break; + case 4: + path = "CardFrame_S_Legend"; + break; + default: + return ""; + } + } + } + else if (isHand) + { + switch (rarity) + { + case 0: + path = "CardFrame_SF_Bronze"; + break; + case 1: + path = "CardFrame_SF_Bronze"; + break; + case 2: + path = "CardFrame_SF_Silver"; + break; + case 3: + path = "CardFrame_SF_Gold"; + break; + case 4: + path = "CardFrame_SF_Legend"; + break; + default: + return ""; + } + } + else + { + switch (rarity) + { + case 0: + path = "CardFrame_BTL_Bronze"; + break; + case 1: + path = "CardFrame_BTL_Bronze"; + break; + case 2: + path = "CardFrame_BTL_Silver"; + break; + case 3: + path = "CardFrame_BTL_Gold"; + break; + case 4: + path = "CardFrame_BTL_Legend"; + break; + default: + return ""; + } + } + return Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.CardFrameMaterial, isfetch: true); + } + + public VfxBase LoadShardObject(string path, bool isAddUIContainer) + { + if (m_shardObjectDictionary.ContainsKey(path)) + { + return NullVfx.GetInstance(); + } + return new WaitLoadLoalResourceVfx(path, m_shardObjectDictionary, isAddUIContainer); + } + + public GameObject GetSharedObject(string path) + { + if (!m_shardObjectDictionary.ContainsKey(path)) + { + return null; + } + return m_shardObjectDictionary[path]; + } + + public GameObject InstantiateSharedObject(string path) + { + if (!m_shardObjectDictionary.ContainsKey(path)) + { + return null; + } + GameObject gobj = m_shardObjectDictionary[path]; + GameObject gameObject = GameMgr.GetIns().GetPrefabMgr().CloneObjectToParent(gobj, BattleManagerBase.GetIns().Battle3DContainer); + UIManager.GetInstance().AttachAtlas(new List { gameObject }); + return gameObject; + } + + public void Dispose() + { + foreach (KeyValuePair item in _effectBattleInfoDictionary) + { + Toolbox.ResourcesManager.RemoveAsset(Toolbox.ResourcesManager.GetAssetTypePath(item.Key, ResourcesManager.AssetLoadPathType.Effect2D)); + } + _effectBattleInfoDictionary.Clear(); + foreach (KeyValuePair item2 in m_shardObjectDictionary) + { + Toolbox.ResourcesManager.RemoveAsset(item2.Key); + } + m_shardObjectDictionary.Clear(); + for (int i = 0; i < RARITY_COUNT; i++) + { + _handSpellCardFrameMaterials[i] = null; + _handStandardCardFrameMaterials[i] = null; + _inPlayStandardCardFrameMaterials[i] = null; + } + Resources.UnloadUnusedAssets(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle.Resource/NullBattleResourceMgr.cs b/SVSim.BattleEngine/Engine/Wizard.Battle.Resource/NullBattleResourceMgr.cs new file mode 100644 index 0000000..c4bd322 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle.Resource/NullBattleResourceMgr.cs @@ -0,0 +1,128 @@ +using System; +using Cute; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard.Battle.Resource; + +public class NullBattleResourceMgr : IBattleResourceMgr +{ + private static NullBattleResourceMgr m_instance; + + public static NullBattleResourceMgr GetInstance() + { + if (m_instance == null) + { + m_instance = new NullBattleResourceMgr(); + } + return m_instance; + } + + private NullBattleResourceMgr() + { + } + + public VfxBase LoadSleeveMaterial(long sleeveId, bool isPlayer) + { + return NullVfx.GetInstance(); + } + + public Material GetSleeveMaterial(bool isPlayer) + { + return null; + } + + public VfxBase LoadAsset(string path, ResourcesManager.AssetLoadPathType pathType, Action action) + { + return NullVfx.GetInstance(); + } + + public VfxBase LoadAsset(string fullPath, Action action) + { + return NullVfx.GetInstance(); + } + + public VfxBase LoadCardImageMaterial(int cardId, bool isEvolution, bool isFollower) + { + return NullVfx.GetInstance(); + } + + public Material GetCardImageMaterial(int cardId, bool isEvolution, bool isFollower) + { + return null; + } + + public VfxBase UnloadCardImageMaterial(int cardId, bool isEvolution, bool isFollower) + { + return NullVfx.GetInstance(); + } + + public VfxBase LoadEffectBattle(string objectFullPath, string objectPath, string sePath) + { + return NullVfx.GetInstance(); + } + + public void AddEffectBattleInfoDictionary(string objectPath, string sePath) + { + } + + public void SetEffectBattleInfoDictionary(string objectPath, string objectFullPath) + { + } + + public VfxBase DecrementEffectBattleRefCount(string objectPath) + { + return NullVfx.GetInstance(); + } + + public void UnloadEffectBattle() + { + } + + public VfxBase LoadAndCreateEffectBattleInstance(string objectPath, EffectMgr.EngineType engineType, string sePath, Action loadEndCallback) + { + return NullVfx.GetInstance(); + } + + public void DestroyEffectBattleInstance(EffectBattle effectBattle) + { + } + + public VfxBase LoadRerityMaterial(bool isHand, bool isSpell, int rarity, bool isChoiceBraveCard) + { + return NullVfx.GetInstance(); + } + + public Material GetRerityMaterial(bool isHand, bool isSpell, int rarity, bool isChoiceBraveCard) + { + return null; + } + + public void LoadChoiceBraveCardMesh() + { + } + + public Mesh GetChoiceBraveCardMesh(bool isLow) + { + return null; + } + + public VfxBase LoadShardObject(string path, bool isAddUIContainer) + { + return NullVfx.GetInstance(); + } + + public GameObject GetSharedObject(string path) + { + return null; + } + + public GameObject InstantiateSharedObject(string path) + { + return null; + } + + public void Dispose() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Battle/EnemyAIInnerOptionsBuilder.cs b/SVSim.BattleEngine/Engine/Wizard.Battle/EnemyAIInnerOptionsBuilder.cs new file mode 100644 index 0000000..3b3cee8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Battle/EnemyAIInnerOptionsBuilder.cs @@ -0,0 +1,23 @@ +using Wizard.Battle.Card.InnerOptions; +using Wizard.Battle.Player.Emotion; +using Wizard.Battle.View; + +namespace Wizard.Battle; + +public class EnemyAIInnerOptionsBuilder : IInnerOptionsBuilder +{ + public IPlayerEmotion CreatePlayerEmotion(IClassBattleCardView classCardView) + { + return new NullPlayerEmotion(); + } + + public IEmotion CreateEnemyEmotion(IClassBattleCardView classCardView) + { + return new EnemyAIEmotion(GameMgr.GetIns().GetDataMgr().GetEnemyEmotionId(), classCardView.ClassCharacter, BattleManagerBase.GetIns().EnemyAI); + } + + public CardInnerOptionsBase CreateCardOptions() + { + return new CardInnerOptionsBase(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.BattleMgr/RecoveryNetworkBattleMgrContentsCreator.cs b/SVSim.BattleEngine/Engine/Wizard.BattleMgr/RecoveryNetworkBattleMgrContentsCreator.cs new file mode 100644 index 0000000..f27429f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.BattleMgr/RecoveryNetworkBattleMgrContentsCreator.cs @@ -0,0 +1,68 @@ +using Wizard.Battle.Phase; +using Wizard.Battle.Recovery; +using Wizard.Battle.Replay; +using Wizard.Battle.Resource; +using Wizard.Battle.View.Vfx; + +namespace Wizard.BattleMgr; + +public class RecoveryNetworkBattleMgrContentsCreator : IBattleMgrContentsCreator +{ + public int RandomSeed => Data.BattleRecoveryInfo.seed; + + public IRecoveryManager RecoveryManager { get; protected set; } + + public IRecoveryRecordManager RecoveryRecordManager { get; private set; } + + public IReplayRecordManager ReplayRecordManager { get; private set; } + + public RecoveryController RecoveryControllerInstance { get; private set; } + + public RecoveryNetworkBattleMgrContentsCreator() + { + RecoveryManager = new NetworkBattleRecoveryManager(); + RecoveryRecordManager = new NullRecoveryRecordManager(); + ReplayRecordManager = new ReplayRecordManager(); + RecoveryControllerInstance = new RecoveryController(GameMgr.GetIns().IsAINetwork ? new RecoveryOperationInfo(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json") : null); + RecoveryControllerInstance.OnFinishRecoveryLogSync += delegate + { + if (GameMgr.GetIns().IsAINetwork) + { + RecoveryRecordManager = new AINetworkBattleRecoveryRecordManager("recovery_ai_network.json"); + BattleManagerBase.GetIns().StartRecoveryRecording(); + } + else + { + RecoveryRecordManager = new NetworkBattleRecoveryRecordManager(); + ToolboxGame.RealTimeNetworkAgent.StartRecoveryRecording(); + } + }; + } + + public IBattleResourceMgr CreateResourceMgr() + { + if (RecoveryControllerInstance.IsMariganFinished || (GameMgr.GetIns().IsAINetwork && RecoveryControllerInstance.AIBattleRecoveryData.SetupInfo.HasMulliganInfo)) + { + RecoveryBattleResourceMgr recoveryBattleResourceMgr = new RecoveryBattleResourceMgr(); + RecoveryControllerInstance.OnFinishRecoveringData += recoveryBattleResourceMgr.EnableLoadResouce; + return recoveryBattleResourceMgr; + } + return new BattleResourceMgr(); + } + + public VfxMgr CreateVfxMgr() + { + return new VfxMgr(); + } + + public IPhaseCreator CreatePhaseCreator(BattleManagerBase battleMgr) + { + battleMgr.IsRecovery = true; + NetworkBattleManagerBase battleMgr2 = (NetworkBattleManagerBase)battleMgr; + if (RecoveryControllerInstance.IsMariganFinished || (GameMgr.GetIns().IsAINetwork && RecoveryControllerInstance.AIBattleRecoveryData.SetupInfo.HasMulliganInfo)) + { + return new RecoveryNetworkBattleMainPhaseCreator(battleMgr2); + } + return new RecoveryNetworkBattleMulliganPhaseCreator(battleMgr2); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoPage.cs b/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoPage.cs new file mode 100644 index 0000000..d195d28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Bingo/BingoPage.cs @@ -0,0 +1,1245 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard.Bingo; + +public class BingoPage : UIBase +{ + public struct BallPosData + { + public Vector3 Line1LeftPos { get; private set; } + + public Vector3 Line2LeftPos { get; private set; } + + public Vector3 Line3LeftPos { get; private set; } + + public int Line1Num { get; private set; } + + public int Line2Num { get; private set; } + + public int Line3Num { get; private set; } + + public float Line1Space { get; private set; } + + public float Line2Space { get; private set; } + + public float Line3Space { get; private set; } + + public BallPosData(Vector3 line1LeftPos, Vector3 line2LeftPos, Vector3 line3LeftPos, int line1Num, int line2Num, int line3Num, float line1Space, float line2Space, float line3Space) + { + Line1LeftPos = line1LeftPos; + Line2LeftPos = line2LeftPos; + Line3LeftPos = line3LeftPos; + Line1Num = line1Num; + Line2Num = line2Num; + Line3Num = line3Num; + Line1Space = line1Space; + Line2Space = line2Space; + Line3Space = line3Space; + } + } + + public const float EFFECT_DURATION_TOTAL = 1f; + + public const float BALL_FALL_TIME = 0.7f; + + private const int MAX_BINGO_GACHA_NUM = 10; + + private const float BLOCK_LIGHT_DELAY = 0.06f; + + private const float THREE_ROWS_SIZE = 90f; + + private const float FIVE_ROWS_SIZE = 54f; + + public const string BALL_FALL_EFFECT = "cmn_bingo_ball_1"; + + public const string BALL_LIGHT_EFFECT = "cmn_bingo_ball_2"; + + public const string BINGO_EFFECT = "cmn_bingo_cmp_1"; + + private const string TREASUREBOX_SPRITE_NAME = "box_2pick_0{0}_close"; + + private const string TREASUREBOX_SE_NAME = "se_bng_box_open_0{0}"; + + private const string TREASUREBOX_EFFECT_NAME = "cmn_arena_treasure_gp_{0}"; + + private const string BINGO_LINES_TEXUTRE_NAME = "bingo_lines"; + + private const string BINGO_STAMP_TEXUTRE_NAME = "bingo_square_stamp"; + + private const string BINGO_SHEET_NAME = "bingosheet"; + + private const int BINGO_CHARA_STANDING_PIC_CHARA_ID = 3304; + + private float _fiveFiveBlockScale = 0.6f; + + private float _bingoBlockGridSizeCoef = 1.0889f; + + private const float LOGIN_ANIMATION_WAIT_TIME = 1.25f; + + private const int DIALOG_RIBBON_ANCHOR_BOTTOM = -5; + + private const int DIALOG_RIBBON_ANCHOR_TOP = 15; + + [SerializeField] + private UIGrid _gridBingBlockGrid; + + [SerializeField] + private GameObject _originBingoSheetBlock; + + [SerializeField] + private GachaLayoutPurchaseButton _bingoTicketAreaLayout; + + [SerializeField] + private BingoSelectBuyNumPopup _prefabDialogSelectBuyNumber; + + [SerializeField] + private UIButton _questMissionButton; + + [SerializeField] + private UIButton _rewardsButton; + + [SerializeField] + private UIButton _detailsButton; + + [SerializeField] + private GameObject _missionDialogPrefab; + + [SerializeField] + private GameObject _allRewardsDialogPrefab; + + [SerializeField] + private TweenAlpha _fadeDarkBgTweenAlpha; + + [SerializeField] + private BoxCollider _notTouchMypageCollider; + + [SerializeField] + private UIGrid _bingoRewardsGrid; + + [SerializeField] + private UIScrollView _bingoRewardsScrollPanel; + + [SerializeField] + private GameObject _bingoMissionItemPrefab; + + [SerializeField] + private BingoBall _originBingoBall; + + [SerializeField] + private UILabel _labelPeriod; + + [SerializeField] + private UILabel _labelSheetNum; + + [SerializeField] + private GameObject _bingoBalls; + + [SerializeField] + private RewardBase _rewardBase; + + [SerializeField] + private TweenAnimationGroup _bingoAnimation; + + [SerializeField] + private TweenAnimationGroup _bingoLineAnimation; + + [SerializeField] + private UISpriteAtlasOverwriter _spriteAtlasOverwriter; + + [SerializeField] + private UITexture _bgCharaTexture; + + [SerializeField] + private UITexture _animationLinesTexture; + + [SerializeField] + private UIButton _skipButton; + + [SerializeField] + private UIButton _hiddenFullScreenButton; + + [SerializeField] + private GameObject _dustEffectContainer; + + [SerializeField] + private GameObject _bingoTicketButtonEffect; + + [SerializeField] + private UITexture _bingoSheet; + + [SerializeField] + private GameObject _bingoAnimationFadeDarkBg; + + [SerializeField] + private TweenAlpha _bingoAnimationFadeDarkTweenAlpha; + + [SerializeField] + private SpineDisplay _spineDisplayLogin; + + [SerializeField] + private SpineDisplay _spineDisplayPurchase; + + [SerializeField] + private UITexture _spineTexture; + + [SerializeField] + private Camera _uiSpineCamera; + + private List _bingoSheetBlockList; + + private BingoInfoTask.BingoInfoData _bingoInfoData; + + private BingoDrawTask.BingoDrawTaskData _bingoLoginDrawData; + + private BingoDrawTask.BingoDrawTaskData _bingoDrawTaskData; + + private ResourceHandler _resourceHandler; + + private GameObject _boxOpenEffectObj; + + private GameObject _treasureEffectObj; + + private bool _isPlayBoxOpenEffect; + + private List _loadedResourceList = new List(); + + private List _inProcessCoroutines = new List(); + + private List _inProcessTweenAnimationGroup = new List(); + + private const string BINGO_LOGIN_ANIMATION = "spine_bingo_01"; + + private const string BINGO_PURCHASE_ANIMATION = "spine_bingo_02"; + + private static readonly KeyValuePair FirstTipsSaveKey = PlayerPrefsWrapper.FIRST_TIPS_BINGO_ID; + + private List _bingoSeList = new List + { + "se_sys_bng_ballfall_01", "se_sys_bng_number_open_01", "se_sys_bng_stamp_01", "se_sys_bng_line_01", "se_sys_bng_line_02", "se_sys_bng_line_03", "se_sys_bng_line_04", "se_sys_bng_line_05", "se_sys_bng_line_06", "se_sys_bng_line_07", + "se_sys_bng_line_08", "se_sys_bng_line_09", "se_sys_bng_line_10", "se_sys_bng_line_11", "se_sys_bng_line_12", "se_sys_bng_bingo_01", "se_sys_bng_number_open_pre_01", "se_bng_appear_01", "se_bng_lottery_01", "se_bng_lottery_voice_01", + "se_bng_box_open_01", "se_bng_box_open_05", "se_bng_box_open_06" + }; + + private const float BALL_SPACE = 40f; + + private Dictionary _ballPosDataDic; + + private List _bingoBallList; + + private List GetOpenedBingoBlock => _bingoInfoData.SquareDataList.Where((BingoInfoTask.SquareData squareData) => squareData.IsOpen).ToList(); + + private int GetDisplayIdBySquareId(int squareId) + { + return _bingoInfoData.SquareDataList.Where((BingoInfoTask.SquareData squareData) => squareData.SquareId == squareId).FirstOrDefault().DisplayId; + } + + private bool IsGetSomeRewards() + { + if (_bingoDrawTaskData == null || (_bingoDrawTaskData.LineRewardData.Count <= 0 && _bingoDrawTaskData.TreasureBoxReawrdList.Count <= 0)) + { + if (_bingoLoginDrawData != null) + { + if (_bingoLoginDrawData.LineRewardData.Count <= 0) + { + return _bingoLoginDrawData.TreasureBoxReawrdList.Count > 0; + } + return true; + } + return false; + } + return true; + } + + public static void ChangeSceneBingoPage() + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Bingo); + } + + public override void onFirstStart() + { + base.IsShowFooterMenu = true; + _resourceHandler = base.gameObject.AddMissingComponent(); + base.onFirstStart(); + } + + protected override void onOpen() + { + base.onOpen(); + CreateTopBar(); + InitFooter(); + InitSpriteAtlasOverwriter(); + AddSeCueSheet(); + BingoInfoTask task = new BingoInfoTask(); + task.SetParameter(isDisplayUpdate: false); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _bingoInfoData = task.Result; + _bingoLoginDrawData = task.BingoLoginDrawResult; + Init(); + })); + } + + protected override void onClose() + { + base.onClose(); + UnloadResources(); + _notTouchMypageCollider.enabled = false; + UIManager.GetInstance()._Footer.CancelOverwriteLabelColors(); + UnityEngine.Object.Destroy(_fadeDarkBgTweenAlpha.transform.parent.gameObject); + } + + private void CreateBallPosDataDic() + { + float num = 0f - _originBingoBall.GetBallMovement().x; + float num2 = 0f - _originBingoBall.GetBallMovement().y; + _ballPosDataDic = new Dictionary + { + { + 1, + new BallPosData(new Vector3(num, num2, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), 1, 0, 0, 0f, 0f, 0f) + }, + { + 2, + new BallPosData(new Vector3(num - 80f, num2, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), 2, 0, 0, 160f, 0f, 0f) + }, + { + 3, + new BallPosData(new Vector3(num - 160f, num2, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), 3, 0, 0, 160f, 0f, 0f) + }, + { + 4, + new BallPosData(new Vector3(num - 240f, num2, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), 4, 0, 0, 160f, 0f, 0f) + }, + { + 5, + new BallPosData(new Vector3(num - 320f, num2, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), 5, 0, 0, 160f, 0f, 0f) + }, + { + 6, + new BallPosData(new Vector3(num - 160f, num2 + 80f, 0f), new Vector3(num - 160f, num2 - 80f, 0f), new Vector3(0f, 0f, 0f), 3, 3, 0, 160f, 160f, 0f) + }, + { + 7, + new BallPosData(new Vector3(num - 80f, num2 + 160f, 0f), new Vector3(num - 160f, num2, 0f), new Vector3(num - 80f, num2 - 160f, 0f), 2, 3, 2, 160f, 160f, 160f) + }, + { + 8, + new BallPosData(new Vector3(num - 160f, num2 + 160f, 0f), new Vector3(num - 80f, num2, 0f), new Vector3(num - 160f, num2 - 160f, 0f), 3, 2, 3, 160f, 160f, 160f) + }, + { + 9, + new BallPosData(new Vector3(num - 160f, num2 + 160f, 0f), new Vector3(num - 160f, num2, 0f), new Vector3(num - 160f, num2 - 160f, 0f), 3, 3, 3, 160f, 160f, 160f) + }, + { + 10, + new BallPosData(new Vector3(num - 160f, num2 + 160f, 0f), new Vector3(num - 240f, num2, 0f), new Vector3(num - 160f, num2 - 160f, 0f), 3, 4, 3, 160f, 160f, 160f) + } + }; + } + + private void Init() + { + if (_bingoInfoData == null) + { + return; + } + CreateBallPosDataDic(); + _fadeDarkBgTweenAlpha.gameObject.transform.parent.transform.parent = UIManager.GetInstance().transform; + _fadeDarkBgTweenAlpha.gameObject.transform.parent.gameObject.SetLayer(LayerMask.NameToLayer("MyPage"), isSetChildren: true); + _fadeDarkBgTweenAlpha.gameObject.transform.parent.gameObject.GetComponent().depth = 31; + _notTouchMypageCollider.enabled = false; + _skipButton.GetComponent().uiCamera = UIManager.GetInstance().MyPageUICameraObj.GetComponent(); + UpdatePeriodInfo(); + _bingoSheetBlockList = new List(); + _bingoBallList = new List(); + StartCoroutine(LoadResources(delegate + { + SetTextures(); + UpdateBingoSheet(); + UpdatePurchaseArea(); + UpdateSideBarRewards(isFirstOpen: true); + UpdateBingoSheetNum(); + UpdateBuyButton(); + _spineDisplayPurchase.Initialize("spine_bingo_02", _spineTexture, _uiSpineCamera); + _spineDisplayLogin.Initialize("spine_bingo_01", _spineTexture, _uiSpineCamera); + _spineDisplayPurchase.gameObject.SetActive(value: false); + _spineDisplayLogin.gameObject.SetActive(value: false); + _spineTexture.gameObject.SetActive(value: false); + UIManager.GetInstance().OnReadyViewScene(isFadein: true, delegate + { + if (_bingoLoginDrawData != null) + { + BingoLoginBonusStart(); + } + else + { + DisplayFirstTips(_bingoInfoData.CampaignId, _bingoInfoData.IsMissionActivePeriod); + } + }); + })); + CreateButtons(); + } + + private void CreateTopBar() + { + string titleMsg = Data.SystemText.Get("Bingo_0023"); + TopBar topBar = UIManager.GetInstance().CreateTopBar(base.gameObject, titleMsg, UIManager.ViewScene.MyPage, MoneyDraw: false); + topBar.gameObject.layer = LayerMask.NameToLayer("MyPage"); + topBar.OverwriteBackLabelColors(eColorCodeId.QuestBackButtonGradientTop, eColorCodeId.QuestBackButtonGradientBottom); + } + + private void InitFooter() + { + UIManager.GetInstance()._Footer.OverwriteLabelColors(eColorCodeId.QuestFooterGradientTop, eColorCodeId.QuestFooterGradientBottom, eColorCodeId.QuestFooterOutline); + UIManager.GetInstance()._Footer.UpdateCurrentIndex(0); + } + + private void InitSpriteAtlasOverwriter() + { + UIAtlas component = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("dummy", ResourcesManager.AssetLoadPathType.QuestAtlas, isfetch: true)).GetComponent(); + UISpriteAtlasOverwriter.TargetObject[] targetObjects = new UISpriteAtlasOverwriter.TargetObject[2] + { + new UISpriteAtlasOverwriter.TargetObject(UIManager.GetInstance().UIManagerRoot.gameObject, includeChildren: true), + new UISpriteAtlasOverwriter.TargetObject(UIManager.GetInstance().UIRootSystem.gameObject, includeChildren: true) + }; + _spriteAtlasOverwriter.Init(component, targetObjects); + } + + private void AddSeCueSheet() + { + foreach (string bingoSe in _bingoSeList) + { + Toolbox.AudioManager.AddCueSheet(bingoSe, bingoSe + ".acb", "s/"); + } + } + + private void CreateButtons() + { + _questMissionButton.onClick.Clear(); + _questMissionButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (_bingoInfoData.IsMissionActivePeriod) + { + BingoMissionDialog.Create(_missionDialogPrefab, _bingoInfoData); + } + else + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetTitleLabel(systemText.Get("Bingo_0005")); + dialogBase.SetText(systemText.Get("Bingo_0033")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + } + })); + _detailsButton.onClick.Clear(); + _detailsButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + OnClickDetailsButton(); + })); + _rewardsButton.onClick.Clear(); + _rewardsButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + BingoRewardsDialog.Create(_allRewardsDialogPrefab, _bingoInfoData); + })); + _skipButton.onClick.Clear(); + _skipButton.gameObject.SetActive(value: false); + _skipButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + SkipBingoAnimationsAndEffects(); + _skipButton.gameObject.SetActive(value: false); + })); + _hiddenFullScreenButton.onClick.Clear(); + _hiddenFullScreenButton.gameObject.SetActive(value: false); + } + + private void OnClickDetailsButton() + { + if (_bingoInfoData.NotificationId == "") + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(systemText.Get("Bingo_0007")); + dialogBase.SetText(systemText.Get("Quest_0034")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + SetExceptionDialog(dialogBase); + } + else + { + UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(_bingoInfoData.NotificationId, delegate(DialogBase dialog) + { + SetExceptionDialog(dialog); + }); + } + } + + private void SetExceptionDialog(DialogBase dialog) + { + List exceptionObjects = new List + { + new UISpriteAtlasOverwriter.TargetObject(dialog.gameObject, includeChildren: true) + }; + _spriteAtlasOverwriter.AddExceptionObjects(exceptionObjects); + } + + private void UpdateBingoSheet() + { + _gridBingBlockGrid.transform.DestroyChildren(); + _bingoSheetBlockList.Clear(); + _originBingoSheetBlock.SetActive(value: false); + List squareDataList = _bingoInfoData.SquareDataList; + int num = (int)Mathf.Sqrt(_bingoInfoData.MaxSquareNum); + float blockScale = ((num == 5) ? _fiveFiveBlockScale : 1f); + int num2 = ((num == 3) ? 90 : 54); + for (int i = 0; i < _bingoInfoData.MaxSquareNum; i++) + { + BingoSheetBlock component = NGUITools.AddChild(_gridBingBlockGrid.gameObject, _originBingoSheetBlock).GetComponent(); + component.gameObject.SetActive(value: true); + component.SetNumLabel(squareDataList[i].DisplayId, num); + component.SetBlockScale(blockScale); + component.SetPartsVisible(blockVisible: true, squareDataList[i].TreasureBoxGradeId, squareDataList[i].IsOpen); + _bingoSheetBlockList.Add(component); + } + _originBingoSheetBlock.gameObject.SetActive(value: false); + _gridBingBlockGrid.maxPerLine = num; + _gridBingBlockGrid.cellHeight = (float)num2 * _bingoBlockGridSizeCoef; + _gridBingBlockGrid.cellWidth = (float)num2 * _bingoBlockGridSizeCoef; + _gridBingBlockGrid.repositionNow = true; + } + + private void UpdateBingoSheetNum() + { + _labelSheetNum.text = Data.SystemText.Get("Bingo_0002", _bingoInfoData.SheetNum.ToString(), _bingoInfoData.MaxSheetNum.ToString(), GetOpenedBingoBlock.Count.ToString(), _bingoInfoData.MaxSquareNum.ToString()); + } + + private void UpdatePurchaseArea(int preCalculatedNum = -1) + { + if (preCalculatedNum >= 0) + { + _bingoTicketAreaLayout.SetHaveItemLabel(preCalculatedNum); + } + else + { + _bingoTicketAreaLayout.SetHaveItemLabel(_bingoInfoData.BingoTicketNum); + } + _bingoTicketAreaLayout.SetOnClickPurchaseButton(OnClickPurchaseButton); + } + + private void UpdateSideBarRewards(bool isFirstOpen = false) + { + List currentLineRewardList = _bingoInfoData.CurrentLineRewardList; + _bingoRewardsGrid.transform.DestroyChildren(); + for (int i = 0; i < currentLineRewardList.Count; i++) + { + bool flag = i + 1 == currentLineRewardList.Count; + AchievementWindowBase component = NGUITools.AddChild(_bingoRewardsGrid.gameObject, _bingoMissionItemPrefab).GetComponent(); + component.gameObject.SetActive(value: true); + component.SetBingoSideBarRewards(currentLineRewardList[i].LineNum, currentLineRewardList[i].Reward, currentLineRewardList[i].IsCleared, !flag, _resourceHandler); + } + _bingoRewardsGrid.Reposition(); + if (GetOpenedBingoBlock.Count == 0 || isFirstOpen) + { + _bingoRewardsScrollPanel.ResetPosition(); + } + } + + private void SkipBingoAnimationsAndEffects() + { + if (_inProcessCoroutines.Count > 0) + { + foreach (Coroutine inProcessCoroutine in _inProcessCoroutines) + { + if (inProcessCoroutine != null) + { + UIManager.GetInstance().StopCoroutine(inProcessCoroutine); + } + } + } + foreach (BingoBall bingoBall in _bingoBallList) + { + bingoBall.StopCoroutine(); + } + _spineTexture.gameObject.SetActive(value: false); + _spineDisplayPurchase.StartMotion("NONE"); + _spineDisplayLogin.StartMotion("NONE"); + _spineDisplayPurchase.gameObject.SetActive(value: false); + _spineDisplayLogin.gameObject.SetActive(value: false); + iTween.Stop(base.gameObject, includechildren: true); + _bingoBalls.transform.DestroyChildren(); + _dustEffectContainer.transform.DestroyChildren(); + TweenAlpha.Begin(_fadeDarkBgTweenAlpha.gameObject, 0f, 0f); + _notTouchMypageCollider.enabled = false; + if (_inProcessTweenAnimationGroup.Count > 0) + { + foreach (TweenAnimationGroup item in _inProcessTweenAnimationGroup) + { + item.StopAllCoroutines(); + UnityEngine.Object.Destroy(item.gameObject); + } + _inProcessTweenAnimationGroup.Clear(); + } + foreach (BingoSheetBlock bingoSheetBlock in _bingoSheetBlockList) + { + bingoSheetBlock.CancelAnimations(); + } + _hiddenFullScreenButton.onClick.Clear(); + _hiddenFullScreenButton.gameObject.SetActive(value: false); + _bingoAnimationFadeDarkBg.SetActive(value: false); + if (_boxOpenEffectObj != null) + { + UnityEngine.Object.Destroy(_boxOpenEffectObj); + } + if (_treasureEffectObj != null) + { + UnityEngine.Object.Destroy(_treasureEffectObj); + } + _isPlayBoxOpenEffect = false; + if (IsGetSomeRewards()) + { + ShowAllRewardsDialog(); + return; + } + BingoInfoUpdate(delegate + { + EnableTouchAndBackKey(); + DisplayFirstTips(_bingoInfoData.CampaignId, _bingoInfoData.IsMissionActivePeriod); + }); + } + + private IEnumerator LoadResources(Action callBack) + { + List loadList = new List(); + string[] array = new string[3] { "cmn_bingo_ball_1", "cmn_bingo_ball_2", "cmn_bingo_cmp_1" }; + foreach (string path in array) + { + loadList.Add(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.Effect2D)); + } + loadList.Add(Toolbox.ResourcesManager.GetAssetTypePath(3304.ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaBase)); + array = new string[3] { "bingo_lines", "bingo_square_stamp", "bingosheet" }; + foreach (string path2 in array) + { + loadList.Add(Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.Bingo)); + } + loadList.AddRange(_spineDisplayPurchase.GetLoadPath("spine_bingo_02", fetch: false)); + loadList.AddRange(_spineDisplayLogin.GetLoadPath("spine_bingo_01", fetch: false)); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null)); + _loadedResourceList.AddRange(loadList); + callBack.Call(); + } + + private void UnloadResources() + { + _resourceHandler.UnloadAll(); + if (_loadedResourceList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + } + + private void OnClickPurchaseButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + CreateSelectBuyNumDialog(); + } + + private void CreateSelectBuyNumDialog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Bingo_0014")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.NONE); + dialogBase.SetReturnMsg(null, ""); + dialogBase.SetPanelDepth(100); + int ablePackNumByGachaInfo = GetAblePackNumByGachaInfo(); + BingoSelectBuyNumPopup bingoSelectBuyNumPopup = UnityEngine.Object.Instantiate(_prefabDialogSelectBuyNumber); + bingoSelectBuyNumPopup.gameObject.SetActive(value: true); + dialogBase.SetObj(bingoSelectBuyNumPopup.gameObject); + bingoSelectBuyNumPopup.Init(dialogBase, ablePackNumByGachaInfo, GetOpenedBingoBlock.Count, _bingoInfoData, BingoPurchase); + } + + private static void DisplayFirstTips(int id, bool isMissionActivePeriod) + { + if (isMissionActivePeriod && PlayerPrefsWrapper.GetValue(FirstTipsSaveKey) != id) + { + UIManager.GetInstance().StartFirstTips(FirstTips.TipsType.Bingo, delegate + { + PlayerPrefsWrapper.SetValue(FirstTipsSaveKey, id); + }); + } + } + + private int GetAblePackNumByGachaInfo() + { + int count = GetOpenedBingoBlock.Count; + return Mathf.Clamp(_bingoInfoData.BingoTicketNum / _bingoInfoData.BingoDrawCost, 0, Mathf.Min(10, _bingoInfoData.MaxSquareNum - count)); + } + + private void BingoPurchase(int buyNum) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + BingoDrawTask task = new BingoDrawTask(); + task.SetParameter(buyNum, Certification.ViewerId); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _bingoDrawTaskData = task.Result; + FadeInDark(task.Result); + })); + } + + private void BingoLoginBonusStart() + { + FadeInDark(_bingoLoginDrawData); + } + + private void FadeInDark(BingoDrawTask.BingoDrawTaskData result) + { + UIManager.GetInstance().OpenNotTouch(); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false; + _notTouchMypageCollider.enabled = true; + if (!result.IsBingoLoginBonus) + { + UpdatePurchaseArea(_bingoInfoData.BingoTicketNum - result.HitSquareIdList.Count); + } + _fadeDarkBgTweenAlpha.from = 0f; + _fadeDarkBgTweenAlpha.SetOnFinished(delegate + { + _skipButton.gameObject.SetActive(value: true); + _skipButton.gameObject.SetLayer(LayerMask.NameToLayer("SystemUI"), isSetChildren: true); + if (result.IsBingoLoginBonus) + { + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayBingoLoginBonusAnimation(result))); + } + else + { + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayPurchaseAnimation(result))); + } + }); + TweenAlpha.Begin(_fadeDarkBgTweenAlpha.gameObject, 0.6f, 1f); + } + + private IEnumerator PlayPurchaseAnimation(BingoDrawTask.BingoDrawTaskData result) + { + _spineDisplayPurchase.gameObject.SetActive(value: true); + _spineDisplayPurchase.StartMotion(ClassCharaPrm.MotionType.extra.ToString()); + yield return null; + _spineTexture.gameObject.SetActive(value: true); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_bng_lottery_01", "se_bng_lottery_01", 0f, 0L); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_bng_lottery_voice_01", "se_bng_lottery_voice_01", 0f, 0L); + while (_spineDisplayPurchase.IsPlaying()) + { + yield return null; + } + _spineDisplayPurchase.gameObject.SetActive(value: false); + _spineTexture.gameObject.SetActive(value: false); + BingoMovement(result, delegate + { + EnableTouchAndBackKey(); + DisplayFirstTips(_bingoInfoData.CampaignId, _bingoInfoData.IsMissionActivePeriod); + }); + } + + private IEnumerator PlayBingoLoginBonusAnimation(BingoDrawTask.BingoDrawTaskData result) + { + _spineDisplayLogin.gameObject.SetActive(value: true); + _spineDisplayLogin.StartMotion("anime"); + yield return null; + _spineTexture.gameObject.SetActive(value: true); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_bng_appear_01", "se_bng_appear_01", 0f, 0L); + yield return new WaitForSeconds(1.25f); + _spineDisplayLogin.gameObject.SetActive(value: false); + _spineTexture.gameObject.SetActive(value: false); + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(FadeOutDark(0.3f, result, delegate + { + EnableTouchAndBackKey(); + DisplayFirstTips(_bingoInfoData.CampaignId, _bingoInfoData.IsMissionActivePeriod); + }))); + } + + private void EnableTouchAndBackKey() + { + UIManager.GetInstance().offNotTouch(); + _notTouchMypageCollider.enabled = false; + _inProcessCoroutines.Clear(); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true; + } + + private IEnumerator FadeOutDark(float delay, BingoDrawTask.BingoDrawTaskData result, Action onBingoFinish) + { + yield return new WaitForSeconds(delay); + _bingoBalls.transform.DestroyChildren(); + _fadeDarkBgTweenAlpha.from = 1f; + _fadeDarkBgTweenAlpha.SetOnFinished(delegate + { + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayStamp(result, onBingoFinish))); + }); + TweenAlpha.Begin(_fadeDarkBgTweenAlpha.gameObject, 0.6f, 0f); + } + + private void BingoMovement(BingoDrawTask.BingoDrawTaskData result, Action onBingoFinish) + { + _bingoBallList.Clear(); + int count = result.HitSquareIdList.Count; + _bingoBalls.transform.DestroyChildren(); + _ballPosDataDic.TryGetValue(count, out var value); + for (int i = 0; i < value.Line1Num; i++) + { + BingoBall component = NGUITools.AddChild(_bingoBalls, _originBingoBall.gameObject).GetComponent(); + component.gameObject.transform.localPosition = new Vector3(value.Line1LeftPos.x + (float)i * value.Line1Space, value.Line1LeftPos.y, 0f); + component.SetBallSprite(isFront: false); + _bingoBallList.Add(component); + } + for (int j = 0; j < value.Line2Num; j++) + { + BingoBall component2 = NGUITools.AddChild(_bingoBalls, _originBingoBall.gameObject).GetComponent(); + component2.gameObject.transform.localPosition = new Vector3(value.Line2LeftPos.x + (float)j * value.Line2Space, value.Line2LeftPos.y, 0f); + component2.SetBallSprite(isFront: false); + _bingoBallList.Add(component2); + } + for (int k = 0; k < value.Line3Num; k++) + { + BingoBall component3 = NGUITools.AddChild(_bingoBalls, _originBingoBall.gameObject).GetComponent(); + component3.gameObject.transform.localPosition = new Vector3(value.Line3LeftPos.x + (float)k * value.Line3Space, value.Line3LeftPos.y, 0f); + component3.SetBallSprite(isFront: false); + _bingoBallList.Add(component3); + } + for (int l = 0; l < _bingoBallList.Count; l++) + { + _bingoBallList[l].SetBallNum(GetDisplayIdBySquareId(result.HitSquareIdList[l])); + float num = 0f - _originBingoBall.GetBallMovement().y; + float y = _bingoBallList[l].transform.parent.transform.TransformPoint(new Vector3(_bingoBallList[l].transform.localPosition.x, _bingoBallList[l].transform.localPosition.y - num, 0f)).y; + float num2 = 1f / (float)_bingoBallList.Count * (float)l; + _bingoBallList[l].PlayTweenAnimation(_bingoBallList[l].transform.localPosition, num2); + _loadedResourceList.AddRange(_bingoBallList[l].PlayDustEffect("cmn_bingo_ball_1", _dustEffectContainer, 0.7f, y, num2)); + } + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(PlayBallEffect(_bingoBallList, 1.7f, result, onBingoFinish))); + } + + private IEnumerator PlayBallEffect(List bingoBalls, float delay, BingoDrawTask.BingoDrawTaskData result, Action onBingoFinish) + { + yield return new WaitForSeconds(delay - 0.4f); + foreach (BingoBall bingoBall in bingoBalls) + { + _loadedResourceList.AddRange(bingoBall.PlayEffect("cmn_bingo_ball_2", isOnBottom: false)); + } + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_bng_number_open_pre_01", "se_sys_bng_number_open_pre_01", 0f, 0L); + yield return new WaitForSeconds(0.4f); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_bng_number_open_01", "se_sys_bng_number_open_01", 0f, 0L); + foreach (BingoBall bingoBall2 in bingoBalls) + { + bingoBall2.SetBallSprite(isFront: true); + bingoBall2.SetNumSprite(); + } + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(FadeOutDark(3f, result, onBingoFinish))); + } + + private IEnumerator PlayStamp(BingoDrawTask.BingoDrawTaskData result, Action onBingoFinish) + { + float num = 0.05f; + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_bng_stamp_01", "se_sys_bng_stamp_01", 0f, 0L); + for (int i = 0; i < result.HitSquareIdList.Count; i++) + { + int index = result.HitSquareIdList[i] - 1; + BingoSheetBlock bingoSheetBlock = _bingoSheetBlockList[index]; + bingoSheetBlock.ResetStampTexture(); + bingoSheetBlock.SetStampVisible(visible: true); + bingoSheetBlock.StampDown(num); + num += 0.03f; + } + float num2 = num; + int num3 = (((int)Mathf.Sqrt(_bingoInfoData.MaxSquareNum) == 3) ? 10 : 8); + for (int j = 0; j < result.CompletedLineConditionList.Count; j++) + { + List list = result.CompletedLineConditionList[j].OrderBy((int a) => a).ToList(); + num2 += (float)(list.Count + num3) * 0.06f; + for (int num4 = 0; num4 < list.Count; num4++) + { + if (num4 == 0) + { + _bingoSheetBlockList[list[num4] - 1].PlaySe(j, num2 - (float)(list.Count - num4) * 0.06f); + } + _bingoSheetBlockList[list[num4] - 1].LightOn(num2 - (float)(list.Count - num4) * 0.06f); + } + } + yield return new WaitForSeconds(Mathf.Max(num2, num) + 0.15f); + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(ShowBingoAnimationAndEffects(result, onBingoFinish))); + } + + private IEnumerator ShowBingoAnimationAndEffects(BingoDrawTask.BingoDrawTaskData result, Action onBingoFinish) + { + if (result.CompletedLineConditionList.Count <= 0) + { + ShowLineRewardsDialog(result, onBingoFinish); + yield break; + } + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_bng_bingo_01", "se_sys_bng_bingo_01", 0f, 0L); + TweenAnimationGroup component = NGUITools.AddChild(_bingoAnimationFadeDarkBg, _bingoAnimation.gameObject).GetComponent(); + UIManager.GetInstance().AttachAtlas(component.gameObject); + component.Play(null); + _inProcessTweenAnimationGroup.Add(component); + GameObject bingoEffectObj = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("cmn_bingo_cmp_1", ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + bingoEffectObj.transform.parent = component.gameObject.transform; + bingoEffectObj.transform.localPosition = Vector3.zero; + _loadedResourceList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(bingoEffectObj, delegate + { + bingoEffectObj.SetActive(value: true); + })); + _bingoAnimationFadeDarkTweenAlpha.ResetToBeginning(); + _bingoAnimationFadeDarkBg.SetActive(value: true); + _bingoAnimationFadeDarkTweenAlpha.PlayForward(); + yield return new WaitForSeconds(0.32f); + if (result.CompletedLineConditionList.Count > 1) + { + TweenAnimationGroup component2 = NGUITools.AddChild(_bingoAnimationFadeDarkBg, _bingoLineAnimation.gameObject).GetComponent(); + component2.gameObject.SetActive(value: true); + UIManager.GetInstance().AttachAtlas(component2.gameObject); + component2.GetChildObject(0).GetComponentInChildren().spriteName = $"bingo_lines_{result.CompletedLineConditionList.Count.ToString()}"; + component2.Play(null); + _inProcessTweenAnimationGroup.Add(component2); + } + yield return new WaitForSeconds(2f); + _hiddenFullScreenButton.onClick.Clear(); + _hiddenFullScreenButton.onClick.Add(new EventDelegate(delegate + { + foreach (TweenAnimationGroup item in _inProcessTweenAnimationGroup) + { + UnityEngine.Object.Destroy(item.gameObject); + } + _inProcessTweenAnimationGroup.Clear(); + ShowLineRewardsDialog(result, onBingoFinish); + _hiddenFullScreenButton.gameObject.SetActive(value: false); + _bingoAnimationFadeDarkBg.SetActive(value: false); + })); + _hiddenFullScreenButton.gameObject.SetActive(value: true); + } + + public void ShowLineRewardsDialog(BingoDrawTask.BingoDrawTaskData result, Action onBingoFinish) + { + if (result.LineRewardData.Count > 0) + { + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.ResetBackViewAlpha(); + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(34, isSetBackViewDepthImmediately: true); + dialogBase.SetTitleLabel(Data.SystemText.Get("Bingo_0022")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _skipButton.gameObject.SetActive(value: false); + dialogBase.OnClose = delegate + { + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(RunOpenBoxEffect(Data.SystemText.Get("Bingo_0020"), result, delegate + { + ShowTreatureBoxRewardsDialog(result, onBingoFinish); + }))); + }; + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, _rewardBase.gameObject).GetComponent(); + for (int num = 0; num < result.LineRewardData.Count; num++) + { + component.AddReward(result.LineRewardData[num]); + } + component.EndCreate(); + } + else + { + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(RunOpenBoxEffect(Data.SystemText.Get("Bingo_0020"), result, delegate + { + ShowTreatureBoxRewardsDialog(result, onBingoFinish); + }))); + } + } + + public void ShowTreatureBoxRewardsDialog(BingoDrawTask.BingoDrawTaskData result, Action onBingoFinish) + { + HideBoxEffect(); + if (result.TreasureBoxReawrdList.Count > 0) + { + _skipButton.gameObject.SetActive(value: true); + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(34); + dialogBase.SetTitleLabel(Data.SystemText.Get("Bingo_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _skipButton.gameObject.SetActive(value: false); + dialogBase.OnClose = delegate + { + BingoInfoUpdate(onBingoFinish); + }; + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, _rewardBase.gameObject).GetComponent(); + for (int num = 0; num < result.TreasureBoxReawrdList.Count; num++) + { + component.AddReward(result.TreasureBoxReawrdList[num]); + } + component.EndCreate(); + } + else + { + BingoInfoUpdate(onBingoFinish); + } + } + + private void BingoInfoUpdate(Action onBingoFinish) + { + _skipButton.gameObject.SetActive(value: false); + BingoInfoTask task = new BingoInfoTask(); + task.SetParameter(isDisplayUpdate: true); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + if (task.CanGiveDailyLoginBonus) + { + CreateLoginBonusDialog(); + } + else + { + _bingoInfoData = task.Result; + UpdateBingoSheet(); + UpdatePurchaseArea(); + UpdateSideBarRewards(); + UpdateBingoSheetNum(); + UpdateBuyButton(); + onBingoFinish.Call(); + _bingoDrawTaskData = null; + _bingoLoginDrawData = null; + } + })); + } + + private void CreateLoginBonusDialog() + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Dia_LoginBonus_001_Title")); + dialogBase.SetText(systemText.Get("Dia_LoginBonus_001_Body")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BackToTitleBtn); + dialogBase.SetPanelDepth(10); + dialogBase.SetFadeButtonEnabled(flag: false); + } + + private void UpdateBuyButton() + { + bool flag = false; + flag |= _bingoInfoData.MaxSheetNum == _bingoInfoData.SheetNum && _bingoInfoData.SquareDataList.Where((BingoInfoTask.SquareData b) => !b.IsOpen).ToList().Count == 0; + flag |= _bingoInfoData.BingoTicketNum == 0; + _bingoTicketAreaLayout.SetToGrayPurchaseButton(flag); + _bingoTicketButtonEffect.SetActive(!flag); + } + + private void UpdatePeriodInfo() + { + string text = ""; + if (_bingoInfoData.IsMissionActivePeriod) + { + text = ConvertTime.ToLocal(_bingoInfoData.StartTime, _bingoInfoData.MissionEndTime); + _labelPeriod.text = Data.SystemText.Get("Bingo_0001", text); + } + else + { + text = ConvertTime.ToLocal(_bingoInfoData.StartTime, _bingoInfoData.EndTime); + _labelPeriod.text = Data.SystemText.Get("Bingo_0032", text); + } + } + + private void SetTextures() + { + _bgCharaTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(3304.ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true)) as Texture; + _animationLinesTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("bingo_lines", ResourcesManager.AssetLoadPathType.Bingo, isfetch: true)) as Texture; + _originBingoSheetBlock.GetComponent().SetStampTexture(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("bingo_square_stamp", ResourcesManager.AssetLoadPathType.Bingo, isfetch: true)) as Texture); + _bingoSheet.mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("bingosheet", ResourcesManager.AssetLoadPathType.Bingo, isfetch: true)) as Texture; + } + + private IEnumerator RunOpenBoxEffect(string message, BingoDrawTask.BingoDrawTaskData result, Action endAction) + { + if (result.TreasureBoxReawrdList.Count <= 0) + { + endAction.Call(); + yield break; + } + _isPlayBoxOpenEffect = true; + int maxGrade = result.TreasureBoxReawrdList.Max((ReceivedReward d) => d._gradeId).Value; + UIManager.GetInstance().OpenNotTouch(); + _notTouchMypageCollider.enabled = true; + _boxOpenEffectObj = NGUITools.AddChild(base.gameObject, Resources.Load("UI/layoutParts/RankWinnerRewardResultPanel") as GameObject); + NguiObjs component = _boxOpenEffectObj.GetComponent(); + UISprite bg = component.sprites[0]; + UISprite window = component.sprites[1]; + UISprite box = component.sprites[2]; + box.atlas = UIManager.GetInstance().GetAtlasList().FirstOrDefault((UIAtlas s) => s.name == "Bingo"); + UILabel label = component.labels[0]; + label.text = message; + UIPanel panel = _boxOpenEffectObj.GetComponent(); + panel.alpha = 0f; + box.spriteName = $"box_2pick_0{maxGrade - 1}_close"; + string loadEffectName = $"cmn_arena_treasure_gp_{maxGrade}"; + List loadList = new List { Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D) }; + yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null)); + _loadedResourceList.AddRange(loadList); + _treasureEffectObj = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + _treasureEffectObj.transform.parent = _boxOpenEffectObj.transform; + _loadedResourceList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_treasureEffectObj, null)); + _boxOpenEffectObj.SetLayer(LayerMask.NameToLayer("MyPage"), isSetChildren: true); + bg.alpha = 0f; + box.alpha = 0f; + label.alpha = 0f; + panel.alpha = 1f; + TweenAlpha.Begin(bg.gameObject, 0.5f, 0.65f); + TweenAlpha.Begin(label.gameObject, 0.5f, 1f); + TweenAlpha.Begin(box.gameObject, 0.5f, 1f); + label.transform.localPosition = new Vector3(100f, 0f, 0f); + window.transform.localScale = new Vector3(1f, 0.01f, 1f); + box.transform.localPosition = new Vector3(180f, 0f, 0f); + iTween.MoveTo(label.gameObject, iTween.Hash("x", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(window.gameObject, iTween.Hash("y", 1f, "time", 0.5f, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.MoveTo(box.gameObject, iTween.Hash("y", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0.8f); + TweenAlpha.Begin(label.gameObject, 0.5f, 0f); + iTween.MoveTo(box.gameObject, iTween.Hash("x", 0f, "time", 0.7f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + string text = $"se_bng_box_open_0{maxGrade}"; + GameMgr.GetIns().GetSoundMgr().PlaySeByStr(text, text, 0f, 0L); + yield return new WaitForSeconds(1f); + _treasureEffectObj.transform.localPosition = box.transform.localPosition; + _treasureEffectObj.transform.localScale = Vector3.one * 320f * 1.75f; + _treasureEffectObj.SetActive(value: true); + box.gameObject.SetActive(value: false); + yield return new WaitForSeconds(1.2f); + endAction.Call(); + UIManager.GetInstance().offNotTouch(); + _notTouchMypageCollider.enabled = false; + } + + private void HideBoxEffect() + { + if (_isPlayBoxOpenEffect) + { + _inProcessCoroutines.Add(UIManager.GetInstance().StartCoroutine(RunHideBoxEffect())); + } + } + + private IEnumerator RunHideBoxEffect() + { + NguiObjs component = _boxOpenEffectObj.GetComponent(); + UISprite uISprite = component.sprites[0]; + UISprite obj = component.sprites[1]; + TweenAlpha.Begin(uISprite.gameObject, 0.3f, 0f); + TweenAlpha.Begin(obj.gameObject, 0.3f, 0f); + _treasureEffectObj.SetActive(value: false); + yield return new WaitForSeconds(0.3f); + _boxOpenEffectObj.SetActive(value: false); + UnityEngine.Object.Destroy(_boxOpenEffectObj); + _isPlayBoxOpenEffect = false; + } + + private void ShowAllRewardsDialog() + { + UIManager.GetInstance().createInSceneCenterLoading(); + BingoDrawTask.BingoDrawTaskData bingoDrawTaskData = ((_bingoDrawTaskData == null) ? _bingoLoginDrawData : _bingoDrawTaskData); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(34); + dialogBase.SetTitleLabel(Data.SystemText.Get("Bingo_0024")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.OnClose = delegate + { + BingoInfoUpdate(delegate + { + EnableTouchAndBackKey(); + DisplayFirstTips(_bingoInfoData.CampaignId, _bingoInfoData.IsMissionActivePeriod); + }); + }; + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, _rewardBase.gameObject).GetComponent(); + for (int num = 0; num < bingoDrawTaskData.LineRewardData.Count; num++) + { + component.AddReward(bingoDrawTaskData.LineRewardData[num]); + } + for (int num2 = 0; num2 < bingoDrawTaskData.TreasureBoxReawrdList.Count; num2++) + { + component.AddReward(bingoDrawTaskData.TreasureBoxReawrdList[num2]); + } + component.EndCreate(); + } + + private List GetBingoLineBlocks(int beginSquareId, int endSquareID, int squareNum) + { + List list = new List(); + Vector2 vector = new Vector2(beginSquareId / squareNum, beginSquareId % squareNum); + Vector2 vector2 = new Vector2(endSquareID / squareNum, endSquareID % squareNum); + if (vector.x == vector2.x) + { + for (int i = (int)vector.y; i <= endSquareID; i++) + { + list.Add(i); + } + return list; + } + if (vector.y == vector2.y) + { + for (int j = (int)vector.y; j <= endSquareID; j += squareNum) + { + list.Add(j); + } + return list; + } + if (vector.x == 0f) + { + for (int k = 0; k < squareNum * squareNum; k += squareNum + 1) + { + list.Add(k); + } + } + else + { + for (int l = squareNum - 1; l < squareNum * squareNum; l += squareNum - 1) + { + list.Add(l); + } + } + return list; + } + + public void LateUpdate() + { + AllLabelColorChanger.ChangeAllLabel(base.gameObject); + FixDialogRibbon(); + } + + public static void FixDialogRibbon() + { + DialogBase nowOpenDialog = UIManager.GetInstance().NowOpenDialog; + if (!(nowOpenDialog != null)) + { + return; + } + Transform transform = nowOpenDialog.transform.Find("Anchor/WindowBase/WindowTop"); + if (transform != null) + { + UISprite component = transform.GetComponent(); + if (component != null && component.atlas.name == "Quest") + { + component.bottomAnchor.absolute = -5; + component.topAnchor.absolute = 15; + } + } + Transform transform2 = nowOpenDialog.transform.Find("StoryRewardPanel(Clone)/CardDetailRoot/CardDetail(Clone)/DialogParts/Frame/Top"); + if (transform2 != null) + { + UISprite component2 = transform2.GetComponent(); + if (component2 != null && component2.atlas.name == "Quest") + { + component2.bottomAnchor.absolute = -5; + component2.topAnchor.absolute = 15; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/DefaultFirstDisplayPageIndexGetter.cs b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/DefaultFirstDisplayPageIndexGetter.cs new file mode 100644 index 0000000..742dec8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.DeckSelect.FirstDisplayPageIndexGetter/DefaultFirstDisplayPageIndexGetter.cs @@ -0,0 +1,84 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard.DeckSelect.FirstDisplayPageIndexGetter; + +public class DefaultFirstDisplayPageIndexGetter : FirstDisplayPageIndexGetterBase +{ + protected override int DerivedGet(List pageList, Format viewFormat, bool canUseNonPossessionCard) + { + int lastSelectDeckId = 0; + Format format = viewFormat; + if (viewFormat == Format.Max || viewFormat == Format.All) + { + format = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT); + } + switch (format) + { + case Format.Rotation: + lastSelectDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_ROTATION); + break; + case Format.Unlimited: + lastSelectDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_UNLIMITED); + break; + case Format.PreRotation: + lastSelectDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_PRE_ROTATION); + break; + case Format.Crossover: + lastSelectDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_CROSSOVER); + break; + case Format.MyRotation: + lastSelectDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_MY_ROTATION); + break; + case Format.Avatar: + lastSelectDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_ID_AVATAR); + break; + case Format.Max: + lastSelectDeckId = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_BATTLE_DECK_ID); + break; + default: + format = Format.Max; + break; + } + for (int i = 0; i < pageList.Count; i++) + { + DeckSelectUI.PageData pageData = pageList[i]; + if (pageData.Format == format && pageData.DeckViewList.FirstOrDefault((DeckUI.DeckViewData deckView) => deckView.Deck.GetDeckID() == lastSelectDeckId) != null) + { + return i; + } + } + if (TryGetPageIndexByAttribute(DeckAttributeType.CustomDeck, pageList, canUseNonPossessionCard, out var pageIndex)) + { + return pageIndex; + } + if (TryGetPageIndexByAttribute(DeckAttributeType.TrialDeck, pageList, canUseNonPossessionCard, out pageIndex)) + { + return pageIndex; + } + if (TryGetPageIndexByAttribute(DeckAttributeType.DefaultDeck, pageList, canUseNonPossessionCard, out pageIndex)) + { + return pageIndex; + } + if (TryGetPageIndexByAttribute(DeckAttributeType.SampleDeck, pageList, canUseNonPossessionCard, out pageIndex)) + { + return pageIndex; + } + return 0; + } + + private static bool TryGetPageIndexByAttribute(DeckAttributeType attribute, List pageList, bool canUseNonPossessionCard, out int pageIndex) + { + for (int i = 0; i < pageList.Count; i++) + { + DeckSelectUI.PageData pageData = pageList[i]; + if (pageData.AttributeType == attribute && pageData.DeckViewList.FirstOrDefault((DeckUI.DeckViewData deckView) => deckView.Deck.IsUsable(canUseNonPossessionCard)) != null) + { + pageIndex = i; + return true; + } + } + pageIndex = 0; + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/DoubleChanceData.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/DoubleChanceData.cs new file mode 100644 index 0000000..2209f3e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/DoubleChanceData.cs @@ -0,0 +1,16 @@ +using LitJson; + +namespace Wizard.Lottery; + +public class DoubleChanceData +{ + public int RequireNum { get; private set; } + + public LotteryRewardData RewardData { get; private set; } + + public DoubleChanceData(JsonData data) + { + RequireNum = data["require_num"].ToInt(); + RewardData = new LotteryRewardData(data); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryInfoTask.cs new file mode 100644 index 0000000..b05486e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryInfoTask.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Lottery; + +public class LotteryInfoTask : BaseTask +{ + public class LotteryInfoData + { + public List LotteryRewardList; + + public List LotteryMissionList; + + public List MissionRewardList; + + public LotteryRewardData BigChanceReward; + + public int CampaignId { get; private set; } + + public string InfoUrl { get; private set; } + + public DateTime StartTime { get; private set; } + + public DateTime OpenTime { get; private set; } + + public DateTime EndTime { get; private set; } + + public DateTime CloseTime { get; private set; } + + public DateTime BigChanceOpenTime { get; private set; } + + public DoubleChanceData DoubleChanceReward { get; private set; } + + public LotteryMissionData BigChanceMission { get; private set; } + + public string BannerFileName { get; private set; } + + public string BackGroundFileName { get; private set; } + + public string AnnounceId { get; private set; } + + public LotteryInfoData(JsonData responseData) + { + JsonData jsonData = responseData["data"]; + CampaignId = jsonData["campaign_id"].ToInt(); + InfoUrl = jsonData["info_url"].ToString(); + StartTime = DateTime.Parse(jsonData["start_time"].ToString()); + OpenTime = DateTime.Parse(jsonData["open_time"].ToString()); + EndTime = DateTime.Parse(jsonData["end_time"].ToString()); + CloseTime = DateTime.Parse(jsonData["close_time"].ToString()); + LotteryRewardList = new List(); + BannerFileName = jsonData["campaign_banner"].ToString(); + BackGroundFileName = jsonData["campaign_bg_image"].ToString(); + JsonData jsonData2 = jsonData["lottery_reward_list"]; + for (int i = 0; i < jsonData2.Count; i++) + { + LotteryRewardData item = new LotteryRewardData(jsonData2[i]); + LotteryRewardList.Add(item); + } + if (jsonData.Keys.Contains("double_chance")) + { + JsonData data = jsonData["double_chance"]; + DoubleChanceReward = new DoubleChanceData(data); + } + if (jsonData.TryGetValue("big_chance", out var value) && jsonData.TryGetValue("big_chance_reward", out var value2)) + { + BigChanceMission = new LotteryMissionData(value, responseData["data_headers"]["servertime"].ToDouble()); + BigChanceReward = new LotteryRewardData(value2); + BigChanceOpenTime = DateTime.Parse(value["open_time"].ToString()); + } + if (jsonData.TryGetValue("append_lottery_reward_list", out var value3)) + { + JsonData jsonData3 = jsonData["append_mission_info_list"]; + Dictionary dictionary = new Dictionary(); + LotteryMissionList = new List(); + for (int j = 0; j < jsonData3.Count; j++) + { + LotteryMissionData lotteryMissionData = new LotteryMissionData(jsonData3[j], responseData["data_headers"]["servertime"].ToDouble()); + LotteryMissionList.Add(lotteryMissionData); + dictionary.Add(lotteryMissionData.MissionId, lotteryMissionData); + } + MissionRewardList = new List(); + for (int k = 0; k < value3.Count; k++) + { + LotteryRewardData lotteryRewardData = new LotteryRewardData(value3[k]); + MissionRewardList.Add(lotteryRewardData); + lotteryRewardData.MissionData = dictionary[lotteryRewardData.MissionId]; + } + } + if (jsonData.TryGetValue("announce_id", out var value4)) + { + AnnounceId = value4.ToString(); + } + } + } + + public class LotteryInfoTaskParam : BaseParam + { + public int campaign_id; + } + + public LotteryInfoData Result { get; private set; } + + public LotteryInfoTask() + { + base.type = ApiType.Type.LotteryInfo; + } + + public void SetParameter(int campaign_id) + { + LotteryInfoTaskParam lotteryInfoTaskParam = new LotteryInfoTaskParam(); + lotteryInfoTaskParam.campaign_id = campaign_id; + base.Params = lotteryInfoTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Result = new LotteryInfoData(base.ResponseData); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryPage.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryPage.cs new file mode 100644 index 0000000..6fb76b2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryPage.cs @@ -0,0 +1,859 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Bingo; + +namespace Wizard.Lottery; + +public class LotteryPage : UIBase +{ + private enum BoxType + { + NORMAL, + DOUBLE_CHANCE, + MISSION, + BIG_CHANCE + } + + public struct LayoutData + { + public Vector3 BackGroundPosition { get; private set; } + + public int BackGroundWidth { get; private set; } + + public Vector3 GridPosition { get; private set; } + + public Vector2 GridInterval { get; private set; } + + public bool EnableCategoryLabel { get; private set; } + + public Vector2 MissionBoxBackgroundInterval { get; private set; } + + public Vector2 MisshonBoxBackgroundPosition { get; private set; } + + public bool UseDefaultTreasureBox { get; private set; } + + public bool UseDefaultTodayEffect { get; private set; } + + public LayoutData(Vector3 backgroundPosition, int backGroundWidth, Vector3 gridPosition, Vector2 gridInterval, Vector2 missionBoxBackgroundInterval, Vector2 misshonBoxBackgroundPosition, bool enableCategoryLabel, bool useDefaultTreasureBox, bool useDefaultTodayEffect) + { + BackGroundPosition = backgroundPosition; + BackGroundWidth = backGroundWidth; + GridPosition = gridPosition; + GridInterval = gridInterval; + EnableCategoryLabel = enableCategoryLabel; + UseDefaultTreasureBox = useDefaultTreasureBox; + UseDefaultTodayEffect = useDefaultTodayEffect; + MissionBoxBackgroundInterval = missionBoxBackgroundInterval; + MisshonBoxBackgroundPosition = misshonBoxBackgroundPosition; + } + } + + private readonly Vector3[] MISSION_TREASURE_BOX_POSITION = new Vector3[4] + { + new Vector3(-88f, 46f, 0f), + new Vector3(90f, 46f, 0f), + new Vector3(-88f, -73f, 0f), + new Vector3(90f, -73f, 0f) + }; + + private readonly Vector3[] MISSION_TREASURE_BOX_POSITION_WITH_BIG_CHANCE = new Vector3[3] + { + new Vector3(-160f, -14f, 0f), + new Vector3(0f, -14f, 0f), + new Vector3(160f, -14f, 0f) + }; + + private readonly Vector3[] MISSION_TREASURE_BOX_POSITION_6TH_ANNIVERSARY = new Vector3[10] + { + new Vector3(-276f, 54f, 0f), + new Vector3(-138f, 54f, 0f), + new Vector3(0f, 54f, 0f), + new Vector3(138f, 54f, 0f), + new Vector3(276f, 54f, 0f), + new Vector3(-276f, -72f, 0f), + new Vector3(-138f, -72f, 0f), + new Vector3(0f, -72f, 0f), + new Vector3(138f, -72f, 0f), + new Vector3(276f, -72f, 0f) + }; + + private readonly string[] MISSION_TREASURE_BOX_CATEGORY_TEXT = new string[4] { "Story_0052", "Mission_0079", "MyPage_0009", "MyPage_0011" }; + + private readonly string[] MISSION_BIGCHANCE_TREASURE_BOX_CATEGORY_TEXT = new string[3] { "Mission_0093", "Mission_0094", "Mission_0095" }; + + private readonly string[] MISSION_6TH_ANNIVERSARY_TEXT = new string[10] { "Mission_0099", "Mission_0100", "Mission_0101", "Mission_0102", "Mission_0103", "Mission_0104", "Mission_0105", "Mission_0106", "Mission_0107", "Mission_0108" }; + + private const int SIXTH_ANNIVERSARY_ID = 11; + + private const int SEVENTH_ANNIVERSARY_ID = 13; + + private const int END_OF_YEAR_CAMPAIGN_ID = 14; + + private const int EIGHT_ANNIVERSARY_ID = 15; + + public const string TEXTURE_NAME_RECEIVED_LOTTERY_BOX = "thumbnail_lottery"; + + public const string TEXTURE_NAME_BLANK = "thumbnail_blank"; + + private const string TEXTURE_NAME_W_CHANCE_TITLE = "lottery_w_chance"; + + private const string TEXTURE_NAME_BIG_CHANCE_TITLE = "campaign_title_03"; + + private const string TODAY_EFFECT_DEFAULT = "cmn_login_icon_3"; + + private const string TODAY_EFFECT_SMALL = "cmn_campaign_icon_1"; + + public const string TEXTURE_LOTTERY_TICKET = "box_lottery_01_close"; + + public const string TEXTURE_LOTTERY_TICKET2 = "box_lottery_02_close"; + + public const string SE_BOX_OPEN_LOTTERY_TICKET_01 = "se_sys_box_open_lottery_ticket_01"; + + private Dictionary LAYOUT_SETTING = new Dictionary + { + { + 10, + new LayoutData(new Vector3(-184f, -50f, 0f), 912, new Vector3(0f, 0f, 0f), new Vector2(147f, 121f), new Vector2(349f, 254f), new Vector2(138f, -50f), enableCategoryLabel: false, useDefaultTreasureBox: true, useDefaultTodayEffect: true) + }, + { + 12, + new LayoutData(new Vector3(-184f, -50f, 0f), 912, new Vector3(0f, 0f, 0f), new Vector2(147f, 121f), new Vector2(349f, 254f), new Vector2(138f, -50f), enableCategoryLabel: false, useDefaultTreasureBox: false, useDefaultTodayEffect: true) + }, + { + 14, + new LayoutData(new Vector3(-177f, -50f, 0f), 1059, new Vector3(5f, -5f, 0f), new Vector2(145f, 118f), new Vector2(349f, 254f), new Vector2(138f, -50f), enableCategoryLabel: false, useDefaultTreasureBox: true, useDefaultTodayEffect: true) + }, + { + 0, + new LayoutData(new Vector3(0f, 0f, 0f), 623, new Vector3(0f, 0f, 0f), new Vector2(0f, 0f), new Vector2(912f, 285f), new Vector2(-180f, -55f), enableCategoryLabel: true, useDefaultTreasureBox: true, useDefaultTodayEffect: false) + } + }; + + private Dictionary LAYOUT_SETTING_BIG_CHANCE = new Dictionary { + { + 10, + new LayoutData(new Vector3(-431f, -50f, 0f), 610, new Vector3(0f, -14f, 0f), new Vector2(110f, 118f), new Vector2(488f, 133f), new Vector2(130f, 10f), enableCategoryLabel: true, useDefaultTreasureBox: true, useDefaultTodayEffect: false) + } }; + + [SerializeField] + private UITexture _textureTopImage; + + [SerializeField] + private UILabel _labelCampaignPeriod; + + [SerializeField] + private UITexture _backGround; + + [SerializeField] + private GameObject _originalTreasureBox; + + [SerializeField] + private GameObject _originalTreasureBox2; + + [SerializeField] + private UIGrid _gridTreasureBox; + + [SerializeField] + private LotterySpecialRewardDialog _prefabSpecialRewardDialog; + + [SerializeField] + private LotteryTreasureBox _doubleChanceTreasureBox; + + [SerializeField] + private LotteryTreasureBox _bigChanceTreasureBox; + + [SerializeField] + private UITexture _textureWChanceTitle; + + [SerializeField] + private UISprite _treasureBoxBackGround; + + [SerializeField] + private GameObject _missionListRoot; + + [SerializeField] + private GameObject _missionListParent; + + [SerializeField] + private GameObject _missionListTreasureBoxOriginal; + + [SerializeField] + private UIButton _missionFactorButton; + + [SerializeField] + private UISprite _missionBoxBackGround; + + [SerializeField] + private GameObject _missionDialogPrefab; + + [SerializeField] + private GameObject _rewardSiteButton; + + [SerializeField] + private GameObject _categoryLabel; + + [SerializeField] + private GameObject _itemListRoot; + + [SerializeField] + private GameObject _clickProtectCollider; + + private List _loadedResourceList = new List(); + + private Dictionary GRID_PER_LINE = new Dictionary + { + { 8, 4 }, + { 10, 5 }, + { 12, 6 }, + { 14, 7 }, + { 0, 0 } + }; + + private GameObject _boxOpenEffectObj; + + private GameObject _treasureEffectObj; + + private string _infoSiteUrl = string.Empty; + + private GameObject _effectCurrentBox; + + private bool _isPlayBoxOpenEffect; + + private static int _lotteryNo; + + private bool _isBigChance; + + private DateTime _bigChanceOpenTime; + + private readonly bool IS_ONE_MILLION_CAMPAIGN; + + public static void ChangeSceneLotteryPage(int no) + { + _lotteryNo = no; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.LotteryPage); + } + + private static bool Is6thAnniversary() + { + return _lotteryNo == 11; + } + + private static bool Is7thAnniversary() + { + return _lotteryNo == 13; + } + + private static bool Is8thAnniversary() + { + return _lotteryNo == 15; + } + + public override void onFirstStart() + { + base.IsShowFooterMenu = true; + base.onFirstStart(); + } + + public void OnClickInfoSiteBtn() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.ShowDialogUrl(Data.SystemText.Get("Mission_0049"), _infoSiteUrl); + } + + protected override void onOpen() + { + base.onOpen(); + _clickProtectCollider.SetActive(value: false); + string titleMsg = Data.SystemText.Get("Mission_0048"); + UIManager.GetInstance().CreateTopBar(base.gameObject, titleMsg, UIManager.ViewScene.MyPage).gameObject.layer = LayerMask.NameToLayer("MyPage"); + InitFooter(); + LotteryInfoTask task = new LotteryInfoTask(); + task.SetParameter(_lotteryNo); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Init(task.Result); + })); + } + + protected override void onClose() + { + base.onClose(); + UnloadResources(); + UIManager.GetInstance()._Footer.CancelOverwriteLabelColors(); + } + + private void Init(LotteryInfoTask.LotteryInfoData lotteryData) + { + _isBigChance = lotteryData.BigChanceMission != null && lotteryData.BigChanceReward != null; + _bigChanceOpenTime = lotteryData.BigChanceOpenTime; + string text = ConvertTime.ToLocal(lotteryData.StartTime, lotteryData.EndTime); + string text2 = ConvertTime.ToLocal(lotteryData.CloseTime); + if (Is6thAnniversary() || Is7thAnniversary() || Is8thAnniversary() || _lotteryNo == 14) + { + string text3 = ConvertTime.ToLocal(lotteryData.EndTime); + string text4 = ConvertTime.ToLocal(lotteryData.OpenTime); + string text5 = ConvertTime.ToLocal(lotteryData.CloseTime); + _labelCampaignPeriod.text = Data.SystemText.Get("Mission_0097", text3, text4, text5); + } + else + { + _labelCampaignPeriod.text = Data.SystemText.Get("Mission_0057", text, text2); + } + if (lotteryData.MissionRewardList != null && lotteryData.MissionRewardList.Count > 0) + { + _missionFactorButton.onClick.Add(new EventDelegate(delegate + { + OnClickMissionFactorButton(lotteryData); + })); + } + else + { + _missionFactorButton.gameObject.SetActive(value: false); + Vector3 localPosition = _rewardSiteButton.transform.localPosition; + localPosition.y = 0f; + _rewardSiteButton.transform.localPosition = localPosition; + } + _infoSiteUrl = lotteryData.InfoUrl; + _gridTreasureBox.maxPerLine = GRID_PER_LINE[lotteryData.LotteryRewardList.Count]; + bool useDefaultTreasureBox = true; + Dictionary dictionary = LAYOUT_SETTING; + if (_isBigChance) + { + dictionary = LAYOUT_SETTING_BIG_CHANCE; + } + if (dictionary.TryGetValue(lotteryData.LotteryRewardList.Count, out var value)) + { + _treasureBoxBackGround.width = value.BackGroundWidth; + _treasureBoxBackGround.transform.localPosition = value.BackGroundPosition; + _gridTreasureBox.transform.localPosition = value.GridPosition; + _gridTreasureBox.cellWidth = value.GridInterval.x; + _gridTreasureBox.cellHeight = value.GridInterval.y; + _categoryLabel.SetActive(value.EnableCategoryLabel); + useDefaultTreasureBox = value.UseDefaultTreasureBox; + _missionBoxBackGround.width = (int)value.MissionBoxBackgroundInterval.x; + _missionBoxBackGround.height = (int)value.MissionBoxBackgroundInterval.y; + _missionBoxBackGround.transform.localPosition = value.MisshonBoxBackgroundPosition; + } + StartCoroutine(LoadResources(lotteryData, delegate + { + CreateTreasureBoxGrid(lotteryData.LotteryRewardList, useDefaultTreasureBox); + if (lotteryData.DoubleChanceReward != null) + { + CreateDoubleChanceTreasureBox(lotteryData.DoubleChanceReward); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("lottery_w_chance", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + _textureWChanceTitle.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture; + } + else + { + _doubleChanceTreasureBox.gameObject.SetActive(value: false); + } + if (_isBigChance) + { + CreateBigChanceTreasureBox(lotteryData.BigChanceMission, lotteryData.BigChanceReward); + } + else + { + _bigChanceTreasureBox.gameObject.SetActive(value: false); + } + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(lotteryData.BannerFileName, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + _textureTopImage.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2) as Texture; + string assetTypePath3 = Toolbox.ResourcesManager.GetAssetTypePath(lotteryData.BackGroundFileName, ResourcesManager.AssetLoadPathType.Background, isfetch: true); + _backGround.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath3) as Texture; + InitializeMissionList(lotteryData); + UIManager.GetInstance().OnReadyViewScene(isFadein: true); + })); + AddSeCueSheet(); + UIButton component = _rewardSiteButton.GetComponent(); + component.onClick.Clear(); + component.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + OpenDetail(lotteryData); + })); + } + + private void InitializeMissionList(LotteryInfoTask.LotteryInfoData lotteryData) + { + if (lotteryData.MissionRewardList == null || lotteryData.MissionRewardList.Count == 0) + { + _missionListRoot.SetActive(value: false); + return; + } + for (int i = 0; i < lotteryData.MissionRewardList.Count; i++) + { + LotteryRewardData data = lotteryData.MissionRewardList[i]; + string categoryText = (_isBigChance ? Data.SystemText.Get(MISSION_BIGCHANCE_TREASURE_BOX_CATEGORY_TEXT[i]) : (Is6thAnniversary() ? Data.SystemText.Get(MISSION_6TH_ANNIVERSARY_TEXT[i]) : Data.SystemText.Get(MISSION_TREASURE_BOX_CATEGORY_TEXT[i]))); + GameObject gameObject = NGUITools.AddChild(_missionListParent.gameObject, _missionListTreasureBoxOriginal); + gameObject.transform.localPosition = (_isBigChance ? MISSION_TREASURE_BOX_POSITION_WITH_BIG_CHANCE[i] : (Is6thAnniversary() ? MISSION_TREASURE_BOX_POSITION_6TH_ANNIVERSARY[i] : MISSION_TREASURE_BOX_POSITION[i])); + LotteryMissionTreasureBox box = gameObject.GetComponent(); + box.Initialize(data, categoryText, delegate + { + OnClickTreasureBox(box, BoxType.MISSION); + }); + if (Is6thAnniversary()) + { + box.SetCategoryLabelLineWitdh(95); + } + } + _missionListTreasureBoxOriginal.SetActive(value: false); + } + + private IEnumerator LoadResources(LotteryInfoTask.LotteryInfoData lotteryInfoData, Action callBack) + { + ResourcesManager resMgr = Toolbox.ResourcesManager; + List assetList = new List(); + for (int i = 0; i < lotteryInfoData.LotteryRewardList.Count; i++) + { + if (lotteryInfoData.LotteryRewardList[i].NormalGotRewardList.Count > 0) + { + LotteryRewardData.NormalGotRewardData normalGotRewardData = lotteryInfoData.LotteryRewardList[i].NormalGotRewardList[0]; + string assetTypePath = resMgr.GetAssetTypePath(normalGotRewardData.TextureName, ResourcesManager.AssetLoadPathType.Item); + if (!assetList.Contains(assetTypePath) && !_loadedResourceList.Contains(assetTypePath)) + { + assetList.Add(assetTypePath); + } + } + } + if (lotteryInfoData.DoubleChanceReward != null) + { + List normalGotRewardList = lotteryInfoData.DoubleChanceReward.RewardData.NormalGotRewardList; + if (normalGotRewardList.Count > 0) + { + string assetTypePath2 = resMgr.GetAssetTypePath(normalGotRewardList[0].TextureName, ResourcesManager.AssetLoadPathType.Item); + if (!assetList.Contains(assetTypePath2) && !_loadedResourceList.Contains(assetTypePath2)) + { + assetList.Add(assetTypePath2); + } + } + assetList.Add(resMgr.GetAssetTypePath("lottery_w_chance", ResourcesManager.AssetLoadPathType.Lottery)); + } + if (lotteryInfoData.BigChanceReward != null) + { + List normalGotRewardList2 = lotteryInfoData.BigChanceReward.NormalGotRewardList; + if (normalGotRewardList2.Count > 0) + { + string assetTypePath3 = resMgr.GetAssetTypePath(normalGotRewardList2[0].TextureName, ResourcesManager.AssetLoadPathType.Item); + if (!assetList.Contains(assetTypePath3) && !_loadedResourceList.Contains(assetTypePath3)) + { + assetList.Add(assetTypePath3); + } + } + assetList.Add(resMgr.GetAssetTypePath("campaign_title_03", ResourcesManager.AssetLoadPathType.Arena)); + } + if (lotteryInfoData.LotteryMissionList != null) + { + foreach (LotteryMissionData lotteryMission in lotteryInfoData.LotteryMissionList) + { + string userGoodsImageName = UserGoods.GetUserGoodsImageName(lotteryMission.UserGoodsType, lotteryMission.ItemId); + string assetTypePath4 = resMgr.GetAssetTypePath(userGoodsImageName, ResourcesManager.AssetLoadPathType.Item); + assetList.Add(assetTypePath4); + } + } + for (int j = 0; j < lotteryInfoData.MissionRewardList.Count; j++) + { + if (lotteryInfoData.MissionRewardList[j].NormalGotRewardList.Count > 0) + { + LotteryRewardData.NormalGotRewardData normalGotRewardData2 = lotteryInfoData.MissionRewardList[j].NormalGotRewardList[0]; + string assetTypePath5 = resMgr.GetAssetTypePath(normalGotRewardData2.TextureName, ResourcesManager.AssetLoadPathType.Item); + if (!assetList.Contains(assetTypePath5) && !_loadedResourceList.Contains(assetTypePath5)) + { + assetList.Add(assetTypePath5); + } + } + } + assetList.Add(resMgr.GetAssetTypePath(lotteryInfoData.BannerFileName, ResourcesManager.AssetLoadPathType.Lottery)); + assetList.Add(resMgr.GetAssetTypePath("thumbnail_lottery", ResourcesManager.AssetLoadPathType.Lottery)); + assetList.Add(resMgr.GetAssetTypePath("thumbnail_blank", ResourcesManager.AssetLoadPathType.Lottery)); + assetList.Add(resMgr.GetAssetTypePath(lotteryInfoData.BackGroundFileName, ResourcesManager.AssetLoadPathType.Background)); + assetList.Add(resMgr.GetAssetTypePath("box_lottery_01_close", ResourcesManager.AssetLoadPathType.Lottery)); + assetList.Add(resMgr.GetAssetTypePath("box_lottery_02_close", ResourcesManager.AssetLoadPathType.Lottery)); + string effectPath = "cmn_login_icon_3"; + Dictionary dictionary = LAYOUT_SETTING; + if (_isBigChance) + { + dictionary = LAYOUT_SETTING_BIG_CHANCE; + } + if (dictionary.TryGetValue(lotteryInfoData.LotteryRewardList.Count, out var value) && !value.UseDefaultTodayEffect) + { + effectPath = "cmn_campaign_icon_1"; + } + assetList.Add(resMgr.GetAssetTypePath(effectPath, ResourcesManager.AssetLoadPathType.Effect2D)); + if (assetList.Count > 0) + { + yield return StartCoroutine(resMgr.LoadAssetGroupAsync(assetList, null)); + _loadedResourceList.AddRange(assetList); + } + _effectCurrentBox = UnityEngine.Object.Instantiate(resMgr.LoadObject(resMgr.GetAssetTypePath(effectPath, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true))) as GameObject; + _loadedResourceList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_effectCurrentBox, delegate + { + _effectCurrentBox.gameObject.SetActive(value: false); + callBack.Call(); + })); + } + + private void UnloadResources() + { + if (_loadedResourceList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + } + + private void CreateTreasureBoxGrid(List rewardDataList, bool useDefaultTeasureBox) + { + GameObject prefab = (useDefaultTeasureBox ? _originalTreasureBox : _originalTreasureBox2); + for (int i = 0; i < rewardDataList.Count; i++) + { + LotteryRewardData lotteryRewardData = rewardDataList[i]; + LotteryTreasureBox treasureBox = NGUITools.AddChild(_gridTreasureBox.gameObject, prefab).GetComponent(); + string infoText = Data.SystemText.Get("Mission_0056", (i + 1).ToString()); + treasureBox.SetData(lotteryRewardData, infoText, delegate + { + OnClickTreasureBox(treasureBox, BoxType.NORMAL); + }); + if (lotteryRewardData.IsCurrent) + { + PlayCurrentRewardEffect(treasureBox.gameObject); + } + } + if (rewardDataList.Count <= 0) + { + _itemListRoot.SetActive(value: false); + } + _originalTreasureBox.gameObject.SetActive(value: false); + _originalTreasureBox2.gameObject.SetActive(value: false); + _gridTreasureBox.repositionNow = true; + } + + private void CreateDoubleChanceTreasureBox(DoubleChanceData doubleChanceData) + { + string infoText = Data.SystemText.Get("Mission_0058", doubleChanceData.RequireNum.ToString()); + _doubleChanceTreasureBox.SetData(doubleChanceData.RewardData, infoText, delegate + { + OnClickTreasureBox(_doubleChanceTreasureBox, BoxType.DOUBLE_CHANCE); + }); + } + + private void CreateBigChanceTreasureBox(LotteryMissionData bigChanceMissionData, LotteryRewardData bigChanceReward) + { + string infoText = ""; + if (bigChanceReward.state == LotteryRewardData.eLotteryRewardState.Unapplied) + { + infoText = Data.SystemText.Get("Mission_0088", bigChanceMissionData.MissionCurrent.ToString(), bigChanceMissionData.MissionMax.ToString()); + } + else if (bigChanceReward.state == LotteryRewardData.eLotteryRewardState.Applied || bigChanceReward.state == LotteryRewardData.eLotteryRewardState.WaitResult) + { + string text = ConvertTime.ToLocal(_bigChanceOpenTime); + infoText = Data.SystemText.Get("Mission_0090", text); + } + _bigChanceTreasureBox.SetData(bigChanceReward, infoText, delegate + { + OnClickTreasureBox(_bigChanceTreasureBox, BoxType.BIG_CHANCE); + }); + } + + private void PlayCurrentRewardEffect(GameObject boxObj) + { + _effectCurrentBox.transform.parent = boxObj.transform; + _effectCurrentBox.transform.localPosition = Vector3.zero; + _effectCurrentBox.gameObject.SetActive(value: true); + } + + private void OnClickTreasureBox(LotteryTreasureBox treasureBox, BoxType boxType) + { + if (_isPlayBoxOpenEffect) + { + return; + } + LotteryRewardData lotteryRewardData = treasureBox.LotteryRewardData; + if (lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_LOTTERY_BOX_TOUCH); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + switch (boxType) + { + case BoxType.NORMAL: + case BoxType.MISSION: + { + LotteryReceiveTask task3 = new LotteryReceiveTask(); + task3.SetParameter(lotteryRewardData.MissionId); + StartCoroutine(Toolbox.NetworkManager.Connect(task3, delegate + { + OnSuccessLotteryReceive(treasureBox, task3.Result); + })); + break; + } + case BoxType.DOUBLE_CHANCE: + { + LotteryReceiveDoubleChanceTask task2 = new LotteryReceiveDoubleChanceTask(); + task2.SetParameter(_lotteryNo, lotteryRewardData.MissionId); + StartCoroutine(Toolbox.NetworkManager.Connect(task2, delegate + { + OnSuccessLotteryReceive(treasureBox, task2.Result); + })); + break; + } + case BoxType.BIG_CHANCE: + { + LotteryReceiveBigChanceTask task = new LotteryReceiveBigChanceTask(); + task.SetParameter(_lotteryNo, lotteryRewardData.MissionId); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + OnSuccessLotteryReceive(treasureBox, task.Result); + })); + break; + } + } + } + else if (lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.Received && lotteryRewardData.IsSpecial) + { + ShowReceivedDialog(lotteryRewardData); + } + } + + private void OnSuccessLotteryReceive(LotteryTreasureBox treasureBox, LotteryRewardData receiveRewardData) + { + SetProtectColliderEnable(enableProtect: true); + List assetList = new List(); + List normalGotRewardList = receiveRewardData.NormalGotRewardList; + for (int i = 0; i < normalGotRewardList.Count; i++) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(normalGotRewardList[i].TextureName, ResourcesManager.AssetLoadPathType.Item); + if (!assetList.Contains(assetTypePath) && !_loadedResourceList.Contains(assetTypePath)) + { + assetList.Add(assetTypePath); + } + } + bool isBigChanceTreasureBox = treasureBox as LotteryBigChanceTreasureBox != null; + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(assetList, delegate + { + _loadedResourceList.AddRange(assetList); + StartCoroutine(RunOpenBoxEffect(receiveRewardData.DialogMessage, isBigChanceTreasureBox, delegate + { + receiveRewardData.UpdateHaveUserGoodsByNormalRwardList(); + treasureBox.UpdateData(receiveRewardData); + ShowReceivedDialog(receiveRewardData); + })); + })); + } + + private void SetProtectColliderEnable(bool enableProtect) + { + _clickProtectCollider.SetActive(enableProtect); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = !enableProtect; + } + + private void ShowReceivedDialog(LotteryRewardData lotteryRewardData) + { + SetProtectColliderEnable(enableProtect: false); + if (lotteryRewardData.IsSpecial && IS_ONE_MILLION_CAMPAIGN) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(lotteryRewardData.DialogMessage); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.OnClose = HideBoxEffect; + GameObject gameObject = UnityEngine.Object.Instantiate(_prefabSpecialRewardDialog.gameObject); + dialogBase.SetObj(gameObject); + gameObject.GetComponent().Init(lotteryRewardData); + return; + } + DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose(); + dialogBase2.SetSize(DialogBase.Size.M); + dialogBase2.SetTitleLabel(lotteryRewardData.DialogMessage); + dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase2.SetLayer("Loading"); + dialogBase2.OnClose = HideBoxEffect; + GameObject gameObject2 = UnityEngine.Object.Instantiate(UIManager.GetInstance().GetRewardDialogPrefab().gameObject); + dialogBase2.SetObj(gameObject2); + RewardBase component = gameObject2.GetComponent(); + for (int i = 0; i < lotteryRewardData.NormalGotRewardList.Count; i++) + { + LotteryRewardData.NormalGotRewardData normalGotRewardData = lotteryRewardData.NormalGotRewardList[i]; + NguiObjs nguiObjs = component.AddReward(normalGotRewardData.RewardType, normalGotRewardData.RewardId, normalGotRewardData.RewardGotNum); + if (lotteryRewardData.LotteryId > 0 && lotteryRewardData.Description.IsNotNullOrEmpty()) + { + nguiObjs.labels[0].text = lotteryRewardData.Description; + } + } + component.EndCreate(); + if (!string.IsNullOrEmpty(lotteryRewardData.PrizeMessage)) + { + component.SetTitleLabel(isEnabled: true, lotteryRewardData.PrizeMessage); + } + else + { + component.SetTitleLabel(isEnabled: false, ""); + } + } + + private IEnumerator RunOpenBoxEffect(string message, bool isBigChanceTreasureBox, Action endAction) + { + _isPlayBoxOpenEffect = true; + UIManager.GetInstance().OpenNotTouch(); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false; + _boxOpenEffectObj = NGUITools.AddChild(base.gameObject, Resources.Load("UI/layoutParts/RankWinnerRewardResultPanel") as GameObject); + NguiObjs component = _boxOpenEffectObj.GetComponent(); + UISprite bg = component.sprites[0]; + UISprite window = component.sprites[1]; + UISprite uISprite = component.sprites[2]; + UIWidget box = uISprite; + if (isBigChanceTreasureBox) + { + uISprite.spriteName = "box_2pick_06_close"; + UIManager.GetInstance().AttachAtlas(uISprite.gameObject); + } + else + { + uISprite.gameObject.SetActive(value: false); + UITexture uITexture = component.textures[0]; + uITexture.gameObject.SetActive(value: true); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("box_lottery_02_close", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + uITexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture; + box = uITexture; + } + UILabel label = component.labels[0]; + label.text = message; + UIPanel panel = _boxOpenEffectObj.GetComponent(); + panel.alpha = 0f; + string loadEffectName = (isBigChanceTreasureBox ? "cmn_arena_treasure_7" : "cmn_arena_treasure_6"); + List loadList = new List { Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D) }; + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null)); + _loadedResourceList.AddRange(loadList); + _treasureEffectObj = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + _treasureEffectObj.transform.parent = _boxOpenEffectObj.transform; + _loadedResourceList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_treasureEffectObj, null)); + _boxOpenEffectObj.SetLayer(LayerMask.NameToLayer("MyPage"), isSetChildren: true); + bg.alpha = 0f; + box.alpha = 0f; + label.alpha = 0f; + panel.alpha = 1f; + TweenAlpha.Begin(bg.gameObject, 0.5f, 0.65f); + TweenAlpha.Begin(label.gameObject, 0.5f, 1f); + TweenAlpha.Begin(box.gameObject, 0.5f, 1f); + label.transform.localPosition = new Vector3(100f, 0f, 0f); + window.transform.localScale = new Vector3(1f, 0.01f, 1f); + box.transform.localPosition = new Vector3(180f, 0f, 0f); + iTween.MoveTo(label.gameObject, iTween.Hash("x", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(window.gameObject, iTween.Hash("y", 1f, "time", 0.5f, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.MoveTo(box.gameObject, iTween.Hash("y", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0.8f); + TweenAlpha.Begin(label.gameObject, 0.5f, 0f); + iTween.MoveTo(box.gameObject, iTween.Hash("x", 0f, "time", 0.7f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + GameMgr.GetIns().GetSoundMgr().PlaySeByStr("se_sys_box_open_lottery_ticket_01", "se_sys_box_open_lottery_ticket_01", 0f, 0L); + yield return new WaitForSeconds(1f); + _treasureEffectObj.transform.localPosition = box.transform.localPosition; + _treasureEffectObj.transform.localScale = Vector3.one * 320f * 1.75f; + _treasureEffectObj.SetActive(value: true); + box.gameObject.SetActive(value: false); + yield return new WaitForSeconds(1.2f); + endAction.Call(); + UIManager.GetInstance().offNotTouch(); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true; + } + + private void HideBoxEffect() + { + if (_isPlayBoxOpenEffect) + { + StartCoroutine(RunHideBoxEffect()); + } + } + + private IEnumerator RunHideBoxEffect() + { + NguiObjs component = _boxOpenEffectObj.GetComponent(); + UISprite uISprite = component.sprites[0]; + UISprite obj = component.sprites[1]; + TweenAlpha.Begin(uISprite.gameObject, 0.3f, 0f); + TweenAlpha.Begin(obj.gameObject, 0.3f, 0f); + _treasureEffectObj.SetActive(value: false); + yield return new WaitForSeconds(0.3f); + _boxOpenEffectObj.SetActive(value: false); + UnityEngine.Object.Destroy(_boxOpenEffectObj); + _isPlayBoxOpenEffect = false; + } + + private void OnClickMissionFactorButton(LotteryInfoTask.LotteryInfoData lotteryData) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + LotteryMissionDialog.Create(_missionDialogPrefab, lotteryData); + } + + private void AddSeCueSheet() + { + Toolbox.AudioManager.AddCueSheet("se_sys_box_open_lottery_ticket_01", "se_sys_box_open_lottery_ticket_01.acb", "s/"); + } + + private void InitFooter() + { + UIManager.GetInstance()._Footer.UpdateCurrentIndex(0); + } + + private void InitSpriteAtlasOverwriter() + { + UIAtlas component = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("dummy", ResourcesManager.AssetLoadPathType.QuestAtlas, isfetch: true)).GetComponent(); + UISpriteAtlasOverwriter.TargetObject[] targetObjects = new UISpriteAtlasOverwriter.TargetObject[2] + { + new UISpriteAtlasOverwriter.TargetObject(base.gameObject, includeChildren: true), + new UISpriteAtlasOverwriter.TargetObject(UIManager.GetInstance()._Footer.gameObject, includeChildren: true) + }; + base.gameObject.AddMissingComponent().Init(component, targetObjects); + } + + private void AddAtlasOverrider(DialogBase dialog) + { + UIAtlas component = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath("dummy", ResourcesManager.AssetLoadPathType.QuestAtlas, isfetch: true)).GetComponent(); + UISpriteAtlasOverwriter.TargetObject[] targetObjects = new UISpriteAtlasOverwriter.TargetObject[1] + { + new UISpriteAtlasOverwriter.TargetObject(dialog.gameObject, includeChildren: true) + }; + dialog.gameObject.AddMissingComponent().Init(component, targetObjects); + } + + private void OpenDetail(LotteryInfoTask.LotteryInfoData lotteryData) + { + if (!string.IsNullOrEmpty(lotteryData.AnnounceId)) + { + UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(lotteryData.AnnounceId, delegate(DialogBase dialog) + { + SetExceptionDialog(dialog); + }); + return; + } + if (!string.IsNullOrEmpty(lotteryData.InfoUrl)) + { + UIManager.ShowDialogUrl(Data.SystemText.Get("Mission_0049"), lotteryData.InfoUrl); + return; + } + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(systemText.Get("Bingo_0007")); + dialogBase.SetText(systemText.Get("Quest_0034")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + SetExceptionDialog(dialogBase); + } + + private void SetExceptionDialog(DialogBase dialog) + { + List exceptionObjects = new List + { + new UISpriteAtlasOverwriter.TargetObject(dialog.gameObject, includeChildren: true) + }; + UISpriteAtlasOverwriter component = base.gameObject.GetComponent(); + if (component != null) + { + component.AddExceptionObjects(exceptionObjects); + } + } + + public void LateUpdate() + { + BingoPage.FixDialogRibbon(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryRewardData.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryRewardData.cs new file mode 100644 index 0000000..60e9fe6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryRewardData.cs @@ -0,0 +1,125 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard.Lottery; + +public class LotteryRewardData +{ + public class NormalGotRewardData + { + private string _textureName = string.Empty; + + public UserGoods.Type RewardType { get; private set; } + + public long RewardId { get; private set; } + + public int RewardGotNum { get; private set; } + + public string TextureName + { + get + { + if (_textureName == string.Empty) + { + _textureName = UserGoods.GetUserGoodsImageName(RewardType, RewardId); + } + return _textureName; + } + } + + public NormalGotRewardData(UserGoods.Type reward_type, long reward_id, int reward_got_num) + { + RewardType = reward_type; + RewardId = reward_id; + RewardGotNum = reward_got_num; + } + } + + public enum eLotteryRewardState + { + None, + Unapplied, + Applied, + WaitResult, + NotReceived, + Received, + NotAchieved + } + + public eLotteryRewardState state; + + private JsonData NormalRewardList; + + public int MissionId { get; private set; } + + public int GradeId { get; private set; } + + public bool IsCurrent { get; private set; } + + public int LotteryId { get; private set; } + + public string LotteryUrl { get; private set; } + + public string DialogMessage { get; private set; } + + public string Description { get; private set; } + + public string PrizeMessage { get; private set; } + + public List NormalGotRewardList { get; private set; } + + public LotteryMissionData MissionData { get; set; } + + public bool IsSpecial + { + get + { + if (LotteryId <= 0) + { + return false; + } + return true; + } + } + + public LotteryRewardData(JsonData lotteryRewardData) + { + MissionId = lotteryRewardData["mission_id"].ToInt(); + state = (eLotteryRewardState)lotteryRewardData["status"].ToInt(); + GradeId = lotteryRewardData["grade_id"].ToInt(); + IsCurrent = lotteryRewardData["is_current"].ToInt() == 1; + LotteryId = lotteryRewardData["lottery_id"].ToInt(); + LotteryUrl = lotteryRewardData["lottery_url"].ToString(); + DialogMessage = lotteryRewardData["dialog_message"].ToString(); + NormalGotRewardList = ParseGotRewardList(lotteryRewardData["got_reward_list"]); + PrizeMessage = lotteryRewardData.GetValueOrDefault("prize_message", string.Empty); + if (lotteryRewardData.TryGetValue("reward_list", out var _)) + { + NormalRewardList = lotteryRewardData["reward_list"]; + } + Description = lotteryRewardData["description_message"].ToString().Replace("\\n", "\n"); + } + + public void UpdateHaveUserGoodsByNormalRwardList() + { + if (NormalRewardList != null) + { + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(NormalRewardList); + NormalRewardList = null; + } + } + + private List ParseGotRewardList(JsonData data) + { + List list = new List(); + for (int i = 0; i < data.Count; i++) + { + JsonData jsonData = data[i]; + UserGoods.Type reward_type = (UserGoods.Type)jsonData["reward_type"].ToInt(); + long reward_id = jsonData["reward_id"].ToLong(); + int reward_got_num = jsonData["reward_got_num"].ToInt(); + list.Add(new NormalGotRewardData(reward_type, reward_id, reward_got_num)); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotterySpecialRewardDialog.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotterySpecialRewardDialog.cs new file mode 100644 index 0000000..34ee9d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotterySpecialRewardDialog.cs @@ -0,0 +1,26 @@ +using UnityEngine; + +namespace Wizard.Lottery; + +public class LotterySpecialRewardDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _labelDescription; + + private LotteryRewardData _lotteryRewardData; + + public void Init(LotteryRewardData lotteryRewardData) + { + _lotteryRewardData = lotteryRewardData; + _labelDescription.text = _lotteryRewardData.Description; + } + + public void OnClickSpecialRewardSiteBtn() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (_lotteryRewardData.IsSpecial) + { + UIManager.GetInstance().WebViewHelper.OpenUrl(_lotteryRewardData.LotteryUrl); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryTreasureBox.cs b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryTreasureBox.cs new file mode 100644 index 0000000..22ae4f4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Lottery/LotteryTreasureBox.cs @@ -0,0 +1,232 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard.Lottery; + +public class LotteryTreasureBox : MonoBehaviour +{ + private static readonly Color COLOR_NON_ACTIVE_REWARD_IMAGE = new Color32(65, 65, 65, byte.MaxValue); + + private static readonly Color COLOR_NON_ACTIVE_NUM_TEXT = new Color32(100, 100, 100, byte.MaxValue); + + private static readonly Color COLOR_TICKET_WAIT = new Color32(90, 90, 90, byte.MaxValue); + + [SerializeField] + protected UILabel _labelInfoText; + + [SerializeField] + protected UILabel _labelStatus; + + [SerializeField] + protected UILabel _labelRewardNum; + + [SerializeField] + protected UITexture _textureRewardImage; + + [SerializeField] + protected UITexture _textureRewardImageFg; + + [SerializeField] + protected UISprite _spriteTreasureImage; + + [SerializeField] + protected UILabel _labelTreasureTouch; + + [SerializeField] + protected GameObject _touchObject; + + protected LotteryRewardData _lotteryRewardData; + + public LotteryRewardData LotteryRewardData => _lotteryRewardData; + + public void SetData(LotteryRewardData rewardData, string infoText, Action onClickEvent = null) + { + _labelInfoText.text = infoText; + UIEventListener.Get(base.gameObject).onClick = null; + UIEventListener.Get(base.gameObject).onClick = delegate + { + onClickEvent.Call(); + }; + UpdateData(rewardData); + } + + public void UpdateData(LotteryRewardData rewardData) + { + _lotteryRewardData = rewardData; + UpdateInfoLabel(); + UpdateStatusText(); + UpdateRewardImage(); + UpdateNonActiveColor(); + } + + protected virtual void UpdateInfoLabel() + { + if (_lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived) + { + _labelInfoText.gameObject.SetActive(value: false); + } + else + { + _labelInfoText.gameObject.SetActive(value: true); + } + } + + protected virtual void UpdateStatusText() + { + switch (_lotteryRewardData.state) + { + case LotteryRewardData.eLotteryRewardState.Unapplied: + _labelStatus.text = Data.SystemText.Get("Mission_0051"); + break; + case LotteryRewardData.eLotteryRewardState.Applied: + _labelStatus.text = Data.SystemText.Get("Mission_0053"); + break; + case LotteryRewardData.eLotteryRewardState.WaitResult: + _labelStatus.text = Data.SystemText.Get("Mission_0052"); + break; + case LotteryRewardData.eLotteryRewardState.NotReceived: + _labelStatus.text = string.Empty; + break; + case LotteryRewardData.eLotteryRewardState.Received: + if (_lotteryRewardData.IsSpecial) + { + _labelStatus.text = string.Empty; + } + else + { + _labelStatus.text = Data.SystemText.Get("Mission_0054"); + } + break; + default: + _labelStatus.text = string.Empty; + break; + } + } + + protected virtual void UpdateRewardImage() + { + bool flag = LotteryRewardData.state == LotteryRewardData.eLotteryRewardState.WaitResult || LotteryRewardData.state == LotteryRewardData.eLotteryRewardState.Applied; + if (_textureRewardImageFg != null) + { + _textureRewardImageFg.gameObject.SetActive(flag); + } + if (_touchObject != null) + { + _touchObject.SetActive(LotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived); + } + string textureRewardImage = string.Empty; + ChangeSpriteSizeForTicket(isExpandSize: false); + if (_lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.NotReceived) + { + _labelRewardNum.gameObject.SetActive(value: false); + string path = "box_lottery_01_close"; + textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + SetTextureRewardImage(textureRewardImage); + ChangeSpriteSizeForTicket(isExpandSize: true); + _labelTreasureTouch.text = GetTouchText(); + } + else if (_lotteryRewardData.state == LotteryRewardData.eLotteryRewardState.Received) + { + if (_lotteryRewardData.IsSpecial) + { + string path2 = "thumbnail_lottery"; + textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(path2, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + _labelRewardNum.gameObject.SetActive(value: false); + } + else if (_lotteryRewardData.NormalGotRewardList.Count > 0) + { + string textureName = _lotteryRewardData.NormalGotRewardList[0].TextureName; + textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(textureName, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + _labelRewardNum.gameObject.SetActive(value: true); + _labelRewardNum.text = _lotteryRewardData.NormalGotRewardList[0].RewardGotNum.ToString(); + } + SetTextureRewardImage(textureRewardImage); + } + else if (_textureRewardImageFg != null && flag) + { + _labelRewardNum.gameObject.SetActive(value: false); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath("thumbnail_blank", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + SetTextureRewardImage(assetTypePath); + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath("box_lottery_01_close", ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + SetTextureRewardImageFg(assetTypePath2); + } + else + { + string path3 = "thumbnail_blank"; + textureRewardImage = Toolbox.ResourcesManager.GetAssetTypePath(path3, ResourcesManager.AssetLoadPathType.Lottery, isfetch: true); + _labelRewardNum.gameObject.SetActive(value: false); + SetTextureRewardImage(textureRewardImage); + } + } + + protected string GetTouchText() + { + _ = string.Empty; + return Data.SystemText.Get("Common_0146"); + } + + private void ChangeSpriteSizeForTicket(bool isExpandSize) + { + _textureRewardImage.width = (isExpandSize ? 115 : 87); + _textureRewardImage.height = (isExpandSize ? 115 : 87); + } + + protected void SetTextureRewardImage(string imagePath) + { + _textureRewardImage.gameObject.SetActive(value: true); + _spriteTreasureImage.gameObject.SetActive(value: false); + _textureRewardImage.mainTexture = Toolbox.ResourcesManager.LoadObject(imagePath) as Texture; + } + + private void SetTextureRewardImageFg(string imagePath) + { + _textureRewardImageFg.gameObject.SetActive(value: true); + _textureRewardImageFg.mainTexture = Toolbox.ResourcesManager.LoadObject(imagePath) as Texture; + _textureRewardImageFg.color = COLOR_TICKET_WAIT; + } + + protected virtual void UpdateNonActiveColor() + { + switch (_lotteryRewardData.state) + { + case LotteryRewardData.eLotteryRewardState.Unapplied: + SetNonActiveColor(isNonActive: true); + break; + case LotteryRewardData.eLotteryRewardState.Received: + if (_lotteryRewardData.IsSpecial) + { + SetNonActiveColor(isNonActive: false); + } + else + { + SetNonActiveColor(isNonActive: true); + } + break; + case LotteryRewardData.eLotteryRewardState.Applied: + case LotteryRewardData.eLotteryRewardState.WaitResult: + case LotteryRewardData.eLotteryRewardState.NotReceived: + SetNonActiveColor(isNonActive: false); + break; + default: + _labelStatus.text = string.Empty; + break; + } + } + + protected virtual void SetNonActiveColor(bool isNonActive) + { + if (isNonActive) + { + _textureRewardImage.color = COLOR_NON_ACTIVE_REWARD_IMAGE; + _labelRewardNum.color = COLOR_NON_ACTIVE_NUM_TEXT; + _labelStatus.color = LabelDefine.TEXT_COLOR_CREAM; + } + else + { + _textureRewardImage.color = Color.white; + _labelRewardNum.color = LabelDefine.TEXT_COLOR_NORMAL; + _labelStatus.color = LabelDefine.TEXT_COLOR_NORMAL; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseInfoTask.cs new file mode 100644 index 0000000..e00a28e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Data.TaskData.ItemPurchase/ItemPurchaseInfoTask.cs @@ -0,0 +1,56 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Data.TaskData.ItemPurchase; + +public class ItemPurchaseInfoTask : BaseTask +{ + public ItemPurchaseInfoTask() + { + base.type = ApiType.Type.ItemPurchaseInfo; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Wizard.Data.ItemPurchaseInfo.itemPurchaseList.Clear(); + JsonData jsonData = base.ResponseData["data"]["item_purchase_info"]; + for (int i = 0; i < jsonData.Count; i++) + { + ItemPurchaseData itemData = new ItemPurchaseData(); + itemData.purchase_id = jsonData[i]["purchase_id"].ToInt(); + itemData.purchase_item_type = (UserGoods.Type)jsonData[i]["purchase_item_type"].ToInt(); + itemData.PurchaseUserGoodsId = jsonData[i]["purchase_item_id"].ToLong(); + itemData.purchase_item_num = jsonData[i]["purchase_item_num"].ToInt(); + itemData.purchase_name = jsonData[i]["purchase_name"].ToString(); + if (string.IsNullOrEmpty(itemData.purchase_name)) + { + string userGoodsName = UserGoods.getUserGoodsName(itemData.purchase_item_type, itemData.PurchaseUserGoodsId); + itemData.purchase_name = Wizard.Data.SystemText.Get("Shop_0132", userGoodsName.ToString(), itemData.purchase_item_num.ToString()); + } + itemData.require_item_type = (UserGoods.Type)jsonData[i]["require_item_type"].ToInt(); + itemData.RequireUserGoodsId = jsonData[i]["require_item_id"].ToLong(); + itemData.require_item_num = jsonData[i]["require_item_num"].ToInt(); + itemData.isMonthryReset = ((jsonData[i]["is_monthly_reset"].ToInt() != 0) ? true : false); + itemData.rest = jsonData[i]["rest"].ToInt(); + if (itemData.purchase_item_type == UserGoods.Type.Item) + { + itemData.textureName = Wizard.Data.Master.ItemList.Find((Item data) => data.UserGoodsId == itemData.PurchaseUserGoodsId).thumbnail; + } + else + { + itemData.textureName = UserGoods.GetUserGoodsImageName(itemData.purchase_item_type, itemData.PurchaseUserGoodsId); + } + Wizard.Data.ItemPurchaseInfo.itemPurchaseList.Add(itemData); + } + JsonData jsonData2 = base.ResponseData["data"]["user_card_pack_ticket_list"]; + for (int num2 = 0; num2 < jsonData2.Count; num2++) + { + PlayerStaticData.UpdateItemNum(jsonData2[num2]["item_id"].ToInt(), jsonData2[num2]["number"].ToInt()); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.Competition/CardChooseTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.Competition/CardChooseTask.cs new file mode 100644 index 0000000..d459430 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.Competition/CardChooseTask.cs @@ -0,0 +1,45 @@ +using LitJson; +using Wizard.Scripts.Network.Data.TableData.Arena.TwoPick; +using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick; + +namespace Wizard.Scripts.Network.Task.Arena.Competition; + +public class CardChooseTask : BaseTask +{ + public class CompetitionCardChooseTaskParam : BaseParam + { + public int selected_id; + } + + public CandidateCardInfo CandidateCardInfo; + + public Deck DeckInfo; + + public CardChooseTask() + { + base.type = ApiType.Type.CompetitionCardChoose; + } + + public void SetParameter(int selected_id) + { + CompetitionCardChooseTaskParam competitionCardChooseTaskParam = new CompetitionCardChooseTaskParam(); + competitionCardChooseTaskParam.selected_id = selected_id; + base.Params = competitionCardChooseTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + DeckInfo = new Deck(jsonData["deck_info"]); + if (!DeckInfo.isSelectCompleted) + { + CandidateCardInfo = new CandidateCardInfo(jsonData["candidate_card_list"]); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/ClassCharaChooseTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/ClassCharaChooseTask.cs new file mode 100644 index 0000000..89bd638 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/ClassCharaChooseTask.cs @@ -0,0 +1,37 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Task.Arena.TwoPick; + +public class ClassCharaChooseTask : BaseTask +{ + public class ArenaTwoPickClassCharaChooseTaskParam : BaseParam + { + public int class_id; + } + + public ClassCharaChooseTask() + { + base.type = ApiType.Type.ArenaTwoPickClassCharaChoose; + } + + public void SetParameter(int class_id) + { + ArenaTwoPickClassCharaChooseTaskParam arenaTwoPickClassCharaChooseTaskParam = new ArenaTwoPickClassCharaChooseTaskParam(); + arenaTwoPickClassCharaChooseTaskParam.class_id = class_id; + base.Params = arenaTwoPickClassCharaChooseTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + Wizard.Data.TwoPickInfo.SetClassInfo(jsonData["class_info"]); + Wizard.Data.TwoPickInfo.SetDeckInfo(jsonData["deck_info"]); + Wizard.Data.TwoPickInfo.SetCandidateCardList(jsonData["candidate_card_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/FinishTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/FinishTask.cs new file mode 100644 index 0000000..5a79418 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/FinishTask.cs @@ -0,0 +1,34 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Task.Arena.TwoPick; + +public class FinishTask : BaseTask +{ + public class FinishTaskParam : BaseParam + { + } + + public FinishTask() + { + base.type = ApiType.Type.ArenaTwoPickFinish; + } + + public void SetParameter() + { + FinishTaskParam finishTaskParam = new FinishTaskParam(); + base.Params = finishTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + Wizard.Data.TwoPickInfo.SetEntryRewardList(jsonData["rewards"]); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/TwoPickDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/TwoPickDoMatchingTask.cs new file mode 100644 index 0000000..8fb7707 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/TwoPickDoMatchingTask.cs @@ -0,0 +1,53 @@ +using LitJson; + +namespace Wizard.Scripts.Network.Task.Arena.TwoPick; + +public class TwoPickDoMatchingTask : DoMatchingBase +{ + private const string DATA = "data"; + + private const string DISCOVERED_REWAED = "discovered_reward"; + + private const string GRADE_ID = "grade_id"; + + private const string REWARD_MESSAGE = "reward_message"; + + public TwoPickDoMatchingTask() + { + base.type = ApiType.Type.ArenaTwoPickDoMatching; + if (GameMgr.GetIns().GetDataMgr().TwoPickFormat == TwoPickFormat.Chaos) + { + base.type = ApiType.Type.ArenaTwoPickChaosDoMatching; + } + if (GameMgr.GetIns().GetDataMgr().TwoPickFormat == TwoPickFormat.Cube) + { + base.type = ApiType.Type.ArenaTwoPickCubeDoMatching; + } + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + SettingDoMatchingData(); + if (base.ResponseData["data"].Keys.Contains("discovered_reward")) + { + if (base.ResponseData["data"]["discovered_reward"].Keys.Contains("grade_id")) + { + JsonData jsonData = base.ResponseData["data"]["discovered_reward"]["grade_id"]; + JsonData jsonData2 = base.ResponseData["data"]["discovered_reward"]["reward_message"]; + Wizard.Data.DoMatchingDetail.data.SetWinnerRewardInfo(jsonData.ToInt(), jsonData2.ToString()); + } + } + else + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE, 0); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_STRING, ""); + Wizard.Data.DoMatchingDetail.data.ClearWinnerRewardInfo(); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/TwoPickFinishBattleTask.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/TwoPickFinishBattleTask.cs new file mode 100644 index 0000000..44b52d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena.TwoPick/TwoPickFinishBattleTask.cs @@ -0,0 +1,36 @@ +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard.Scripts.Network.Task.Arena.TwoPick; + +public class TwoPickFinishBattleTask : FinishTaskBase +{ + public TwoPickFinishBattleTask() + { + base.type = ApiType.Type.ArenaTwoPickFinishBattle; + if (GameMgr.GetIns().GetDataMgr().TwoPickFormat == TwoPickFormat.Chaos) + { + base.type = ApiType.Type.ArenaTwoPickChaosFinishBattle; + } + if (GameMgr.GetIns().GetDataMgr().TwoPickFormat == TwoPickFormat.Cube) + { + base.type = ApiType.Type.ArenaTwoPickCubeFinishBattle; + } + Wizard.Data.ArenaBattleFinish = null; + } + + protected override int Parse() + { + int num = base.Parse(); + if (IsEffectiveErrorCode(num)) + { + return num; + } + Wizard.Data.ArenaBattleFinish = new Finish(); + if (!IsResponseDataExist(base.ResponseData)) + { + return num; + } + new BattleFinishResponsProcessing().Processing(base.ResponseData, Wizard.Data.ArenaBattleFinish.data); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaEntryTaskBase.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaEntryTaskBase.cs new file mode 100644 index 0000000..3416fde --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaEntryTaskBase.cs @@ -0,0 +1,37 @@ +using LitJson; +using Wizard.Scripts.Network.Task.Arena.TwoPick; + +namespace Wizard.Scripts.Network.Task.Arena; + +public abstract class ArenaEntryTaskBase : BaseTask +{ + public ArenaEntryTaskBase() + { + } + + public abstract void SetParameter(int consumeItemType); + + public static ArenaEntryTaskBase GetTaskInstance(int mode) + { + ArenaEntryTaskBase result = null; + if (mode == 1) + { + result = new EntryTask(); + } + return result; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + SetResponseParams(base.ResponseData["data"], base.ResponseData["data_headers"]); + return num; + } + + protected abstract void SetResponseParams(JsonData data, JsonData headerData); +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaRetireTaskBase.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaRetireTaskBase.cs new file mode 100644 index 0000000..eca5212 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaRetireTaskBase.cs @@ -0,0 +1,22 @@ +using Wizard.Scripts.Network.Task.Arena.TwoPick; + +namespace Wizard.Scripts.Network.Task.Arena; + +public abstract class ArenaRetireTaskBase : BaseTask +{ + public ArenaRetireTaskBase() + { + } + + public abstract void SetParameter(); + + public static ArenaRetireTaskBase GetTaskInstance(int mode) + { + ArenaRetireTaskBase result = null; + if (mode == 1) + { + result = new RetireTask(); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaTopTaskBase.cs b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaTopTaskBase.cs new file mode 100644 index 0000000..2cb64c7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard.Scripts.Network.Task.Arena/ArenaTopTaskBase.cs @@ -0,0 +1,22 @@ +using Wizard.Scripts.Network.Task.Arena.TwoPick; + +namespace Wizard.Scripts.Network.Task.Arena; + +public abstract class ArenaTopTaskBase : BaseTask +{ + public ArenaTopTaskBase() + { + } + + public abstract void SetParameter(); + + public static ArenaTopTaskBase GetTaskInstance(int mode) + { + ArenaTopTaskBase result = null; + if (mode == 1) + { + result = new TopTask(); + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAccelerateUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIAccelerateUtility.cs new file mode 100644 index 0000000..38d248d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAccelerateUtility.cs @@ -0,0 +1,55 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIAccelerateUtility +{ + public static bool IsAccelerate(AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (card == null || card.AccelerateCostList == null || !card.IsInHand) + { + return false; + } + if (situation is AIVirtualActionInfo { ReservedPlayType: not PlaySimulationType.Undefined } aIVirtualActionInfo) + { + return aIVirtualActionInfo.ReservedPlayType == PlaySimulationType.Accelerate; + } + List playPtn2 = (card.IsAlly ? playPtn : null); + AIVariableResultContainer valResultContainer = field.AI.ValResultContainer; + ulong hash = AIFunctionResultHashCalculator.GetHash(card, field, playPtn, null, 0uL); + if (valResultContainer.GetContainsResultValue(AIScriptTokenVariableType.IS_ACCELERATE, hash, out var getResult)) + { + return getResult == 1f; + } + bool flag = field.AI.PlayPtnRecorder.IsCardPlayingSimulationType(card, field, playPtn2, situation, PlaySimulationType.Accelerate); + valResultContainer.CheckDuplicateAndAddRecord(AIScriptTokenVariableType.IS_ACCELERATE, hash, flag ? 1f : 0f, $"IsAccelerate(): Already hashed target and not equal value. CardName:[{card.CardName}] hash:[{hash}]"); + return flag; + } + + public static int GetAccelerateCost(AIVirtualCard card, AIVirtualField field, List playPtn) + { + if (card == null || card.AccelerateCostList == null) + { + return -1; + } + List playPtn2 = (card.IsAlly ? playPtn : null); + return field.AI.PlayPtnRecorder.GetCardPlaySimulationTypeCost(card, field, playPtn2, null, PlaySimulationType.Accelerate); + } + + public static int GetConditionPassedAccelerateId(AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation, int usedCost) + { + if (card.AccelerateCostList == null || card.AccelerateCostList.Count <= 0) + { + return -1; + } + for (int i = 0; i < card.AccelerateCostList.Count; i++) + { + AIAccelerateInformation aIAccelerateInformation = card.AccelerateCostList[i]; + if (aIAccelerateInformation.Cost == usedCost && aIAccelerateInformation.CheckCondition(card, field, playPtn, situation)) + { + return aIAccelerateInformation.CardId; + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttachTagSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttachTagSimulationUtility.cs new file mode 100644 index 0000000..42832d5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttachTagSimulationUtility.cs @@ -0,0 +1,176 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIAttachTagSimulationUtility +{ + public static void SimulateAttachTagToAll(List targets, AIVirtualCard owner, AIPlayTag tag, AIScriptTokenArgType removeTiming, AISituationInfo situation) + { + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsIndependent) + { + SimulateAttachTagToSingle(aIVirtualCard, owner, tag, removeTiming, situation); + } + } + } + + public static void SimulateAttachTagToTarget(AISituationInfo situation, AIVirtualCard owner, AIScriptTokenArgType whichTarget, AIPlayTag tag, AIScriptTokenArgType removeTiming) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsIndependent) + { + SimulateAttachTagToSingle(aIVirtualCard, owner, tag, removeTiming, situation); + } + } + } + + public static void SimulateAttachTagToSingle(AIVirtualCard target, AIVirtualCard owner, AIPlayTag tag, AIScriptTokenArgType removeTiming, AISituationInfo situation) + { + AIAttachedTagInformation info = new AIAttachedTagInformation(tag, removeTiming, owner, target); + target.TagCollectionContainer.AttachTag(info, target, situation); + RegisterAttachedTagStopPreprocess(owner, owner.SelfField, tag, removeTiming, target); + } + + public static void SimulateRandomSelectAttachTag(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AIPlayTag tag, AIScriptTokenArgType removeTiming, AISelectLogicArgumentBase selectLogic) + { + AIVirtualCardRealTargetInformation aIVirtualCardRealTargetInformation = situation.DequeueRealTargetInfo(tagOwner, field); + if (aIVirtualCardRealTargetInformation == null) + { + SimulateRandomSelectAttachTagToVirtualTarget(candidates, selectCount, tagOwner, field, playPtn, situation, tag, removeTiming, selectLogic); + } + else + { + SimulateRandomSelectAttachTagToRealTarget(aIVirtualCardRealTargetInformation, candidates, selectCount, tagOwner, situation, tag, removeTiming); + } + } + + private static void SimulateRandomSelectAttachTagToVirtualTarget(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AIPlayTag tag, AIScriptTokenArgType removeTiming, AISelectLogicArgumentBase selectLogic) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + if (selectCount >= candidates.Count) + { + SimulateAttachTagToAll(candidates, tagOwner, tag, removeTiming, situation); + return; + } + if (selectCount == 1) + { + SimulateAttachTagToSingle(selectLogic.SelectSingleTarget(candidates, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst), tagOwner, tag, removeTiming, situation); + return; + } + List list = selectLogic.SelectMultipleSelectedTargets(candidates, selectCount, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst); + if (list != null && list.Count > 0) + { + SimulateAttachTagToAll(list, tagOwner, tag, removeTiming, situation); + } + } + + private static void SimulateRandomSelectAttachTagToRealTarget(AIVirtualCardRealTargetInformation realTargetInfo, List candidates, int selectCount, AIVirtualCard tagOwner, AISituationInfo situation, AIPlayTag tag, AIScriptTokenArgType removeTiming) + { + List targetList = realTargetInfo.TargetList; + List list = new List(); + int num = selectCount; + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard item = targetList[i]; + if (candidates.Contains(item)) + { + list.Add(item); + num--; + if (num <= 0) + { + break; + } + } + } + SimulateAttachTagToAll(list, tagOwner, tag, removeTiming, situation); + } + + private static void RegisterAttachedTagStopPreprocess(AIVirtualCard tagOwner, AIVirtualField field, AIPlayTag attachedTag, AIScriptTokenArgType removeTiming, AIVirtualCard targetCard) + { + AIAttachedTagStopPreprocessOption option = new AIAttachedTagStopPreprocessOption(targetCard) + { + TargetTag = attachedTag + }; + switch (GetAttachedTagRemoveTimingForPreprocess(removeTiming, tagOwner)) + { + case AIAttachedTagRemoveTiming.AllyTurnEnd: + field.TagPreprocessContainer.AppendAllyTurnEndStopInfo(option); + break; + case AIAttachedTagRemoveTiming.OpponentTurnEnd: + field.TagPreprocessContainer.AppendOpponentTurnEndStopInfo(option); + break; + case AIAttachedTagRemoveTiming.NextTurnEnd: + { + int defaultDecrementValue = (tagOwner.IsSelfTurn ? 1 : 0); + if (tagOwner.IsAlly) + { + field.TagPreprocessContainer.AppendAllyTurnEndStopInfo(option, defaultDecrementValue); + } + else + { + field.TagPreprocessContainer.AppendOpponentTurnEndStopInfo(option, defaultDecrementValue); + } + break; + } + case AIAttachedTagRemoveTiming.AllyTurnStart: + field.TagPreprocessContainer.AppendAllyTurnStartStopInfo(option); + break; + case AIAttachedTagRemoveTiming.OpponentTurnStart: + field.TagPreprocessContainer.AppendOpponentTurnStartStopInfo(option); + break; + case AIAttachedTagRemoveTiming.Leave: + field.TagPreprocessContainer.AppendLeaveStopInfo(option, tagOwner); + break; + } + } + + private static AIAttachedTagRemoveTiming GetAttachedTagRemoveTimingForPreprocess(AIScriptTokenArgType srcRemoveTiming, AIVirtualCard tagOwner) + { + switch (srcRemoveTiming) + { + case AIScriptTokenArgType.WHEN_ALLY_TURNEND: + if (!tagOwner.IsAlly) + { + return AIAttachedTagRemoveTiming.OpponentTurnEnd; + } + return AIAttachedTagRemoveTiming.AllyTurnEnd; + case AIScriptTokenArgType.WHEN_OPPONENT_TURNEND: + if (!tagOwner.IsAlly) + { + return AIAttachedTagRemoveTiming.AllyTurnEnd; + } + return AIAttachedTagRemoveTiming.OpponentTurnEnd; + case AIScriptTokenArgType.WHEN_ALLY_TURNSTART: + if (!tagOwner.IsAlly) + { + return AIAttachedTagRemoveTiming.OpponentTurnStart; + } + return AIAttachedTagRemoveTiming.AllyTurnStart; + case AIScriptTokenArgType.WHEN_OPPONENT_TURNSTART: + if (!tagOwner.IsAlly) + { + return AIAttachedTagRemoveTiming.AllyTurnStart; + } + return AIAttachedTagRemoveTiming.OpponentTurnStart; + case AIScriptTokenArgType.WHEN_NEXT_TURNEND: + return AIAttachedTagRemoveTiming.NextTurnEnd; + case AIScriptTokenArgType.WHEN_LEAVE: + return AIAttachedTagRemoveTiming.Leave; + default: + return AIAttachedTagRemoveTiming.None; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagRemoveTiming.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagRemoveTiming.cs new file mode 100644 index 0000000..91fbf60 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttachedTagRemoveTiming.cs @@ -0,0 +1,12 @@ +namespace Wizard; + +public enum AIAttachedTagRemoveTiming +{ + AllyTurnEnd, + OpponentTurnEnd, + NextTurnEnd, + AllyTurnStart, + OpponentTurnStart, + Leave, + None +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIAttackableCountSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIAttackableCountSimulationUtility.cs new file mode 100644 index 0000000..900964b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIAttackableCountSimulationUtility.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AIAttackableCountSimulationUtility : MonoBehaviour +{ + public static void ExecuteChangeAttackableCountAll(List candidates, int attackableCount) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsDead) + { + aIVirtualCard.GiveAttackableCount(attackableCount); + } + } + } + + public static void ExecuteChangeAttackableCountTargetSelect(int attackableCount, AIScriptTokenArgType whichTarget, AISituationInfo situation) + { + if (situation != null) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.HasTarget) + { + ExecuteChangeAttackableCountAll(situationTarget.Targets, attackableCount); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBanAttackSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBanAttackSimulationUtility.cs new file mode 100644 index 0000000..5f2c5c4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBanAttackSimulationUtility.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using Wizard.Battle.UI; + +namespace Wizard; + +public static class AIBanAttackSimulationUtility +{ + public static void BanAttackAll(List candidates, CantAttackType banAttackType) + { + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (!aIVirtualCard.IsIndependent) + { + BanAttackSingle(aIVirtualCard, banAttackType); + } + } + } + + public static void BanAttackRandom(List candidates, CantAttackType banAttackType, int selectCount) + { + if (selectCount <= 1) + { + AIVirtualCard aIVirtualCard = SelectTargetForBanAttack(candidates, AISelectTargetPattern.Worst); + if (aIVirtualCard != null && !aIVirtualCard.IsIndependent) + { + BanAttackSingle(aIVirtualCard, banAttackType); + } + } + else + { + BanAttackAll(SelectMultipleTargetsForBanAttack(candidates, selectCount, AISelectTargetPattern.Worst), banAttackType); + } + } + + public static void BanAttackTarget(AISituationInfo situation, CantAttackType banAttackType, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.HasTarget) + { + BanAttackAll(situationTarget.Targets, banAttackType); + } + } + + public static void BanAttackTargetPrediction(List candidates, CantAttackType banAttackType, int selectCount) + { + if (selectCount <= 1) + { + AIVirtualCard aIVirtualCard = SelectTargetForBanAttack(candidates, AISelectTargetPattern.Best); + if (aIVirtualCard != null && !aIVirtualCard.IsIndependent) + { + BanAttackSingle(aIVirtualCard, banAttackType); + } + } + else + { + BanAttackAll(SelectMultipleTargetsForBanAttack(candidates, selectCount, AISelectTargetPattern.Best), banAttackType); + } + } + + private static void BanAttackSingle(AIVirtualCard target, CantAttackType banAttackType) + { + switch (banAttackType) + { + case CantAttackType.All: + target.IsCantAttackAll = true; + break; + case CantAttackType.Unit: + target.IsSkillCantAttackUnit = true; + break; + case CantAttackType.Class: + target.IsSkillCantAttackClass = true; + break; + case CantAttackType.NotHasGuard: + target.IsSkillCantAtkUnitNotHasGuard = true; + break; + } + } + + private static AIVirtualCard SelectTargetForBanAttack(List candidates, AISelectTargetPattern worstOrBest) + { + int num = ((worstOrBest == AISelectTargetPattern.Worst) ? int.MaxValue : int.MinValue); + AIVirtualCard result = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if ((worstOrBest != AISelectTargetPattern.Worst) ? (aIVirtualCard.Attack > num) : (aIVirtualCard.Attack < num)) + { + result = aIVirtualCard; + num = aIVirtualCard.Attack; + } + } + return result; + } + + private static List SelectMultipleTargetsForBanAttack(List candidates, int selectCount, AISelectTargetPattern worstOrBest) + { + List list = new List(); + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + bool flag = false; + for (int j = 0; j < list.Count; j++) + { + AIVirtualCard aIVirtualCard2 = list[j]; + if ((worstOrBest != AISelectTargetPattern.Worst) ? (aIVirtualCard.Attack > aIVirtualCard2.Attack) : (aIVirtualCard.Attack < aIVirtualCard2.Attack)) + { + list[j] = aIVirtualCard; + aIVirtualCard = aIVirtualCard2; + flag = true; + } + } + if (!flag && list.Count < selectCount) + { + list.Add(aIVirtualCard); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBanishSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIBanishSelectLogicArgument.cs new file mode 100644 index 0000000..0dd5e9d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBanishSelectLogicArgument.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBanishSelectLogicArgument : AISelectLogicArgumentBase +{ + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.BANISH_LOGIC; + + public AIBanishSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + return AISimulationRemovalUtility.SelectRemovalTarget(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Banish); + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + return AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Banish, selectCount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBanishSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBanishSimulationUtility.cs new file mode 100644 index 0000000..6d522ab --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBanishSimulationUtility.cs @@ -0,0 +1,238 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIBanishSimulationUtility +{ + public static float EvalTargetingBanish(List argList, List playPtn, AIVirtualField field, AIVirtualCard tagOwner, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothInplayCards, argList, tagOwner, playPtn, null); + if (list == null || list.Count <= 0) + { + return 0f; + } + list = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(list, tagOwner, playPtn); + int num = 0; + float num2 = float.MinValue; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsUnbanishable && (aIVirtualCard.IsAlly == tagOwner.IsAlly || (!aIVirtualCard.IsUntouchable && !aIVirtualCard.IsSneak))) + { + num++; + float num3 = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true); + float num4 = (aIVirtualCard.IsAlly ? (0f - num3 - aIVirtualCard.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) + aIVirtualCard.GetAllBanishBonus(playPtn, useIgnoreInBattle: false) + aIVirtualCard.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false)) : (num3 + aIVirtualCard.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - aIVirtualCard.GetAllBanishBonus(playPtn, useIgnoreInBattle: false) - aIVirtualCard.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false))); + if (num4 > num2) + { + num2 = num4; + } + } + } + if (num == 0) + { + num2 = 0f; + } + return num2; + } + + public static float EvalRandomBanish(List argList, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, int count, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothInplayCards, argList, tagOwner, playPtn, null); + if (list != null && list.Count > 0) + { + List list2 = new List(); + float num = 0f; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsUnbanishable && !aIVirtualCard.IsIndependent) + { + float num2 = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true); + float num3 = aIVirtualCard.EvaluateBreakValue(playPtn, useIgnoreBreak: true); + float allBanishBonus = aIVirtualCard.GetAllBanishBonus(playPtn, useIgnoreInBattle: true); + float num4 = aIVirtualCard.EvaluateLeaveValue(playPtn, useIgnoreInBattle: true); + float num5 = (aIVirtualCard.IsAlly ? (-1f) : 1f) * (num2 + num3 - allBanishBonus - num4); + list2.Add(num5); + num += num5; + } + } + if (list.Count <= count) + { + return num; + } + List list3 = AIMathematicsLibrary.EnumerateCombinations(list2, count).ToList(); + float num6 = 0f; + for (int j = 0; j < list3.Count; j++) + { + for (int k = 0; k < list3[j].Length; k++) + { + num6 += list3[j][k]; + } + } + return num6 / (float)list3.Count; + } + return 0f; + } + + public static float EvalAllBanish(List argList, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothInplayCards, argList, tagOwner, playPtn, null); + if (list == null || list.Count <= 0) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsUnbanishable) + { + float num2 = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true); + float num3 = aIVirtualCard.EvaluateBreakValue(playPtn, useIgnoreBreak: true); + float allBanishBonus = aIVirtualCard.GetAllBanishBonus(playPtn, useIgnoreInBattle: true); + float num4 = aIVirtualCard.EvaluateLeaveValue(playPtn, useIgnoreInBattle: true); + num += (aIVirtualCard.IsAlly ? (-1f) : 1f) * (num2 + num3 - allBanishBonus - num4); + } + } + return num; + } + + public static void BanishAll(List targetCards, AISituationInfo situation) + { + for (int i = 0; i < targetCards.Count; i++) + { + BanishSingle(targetCards[i], situation); + } + } + + public static void ExecuteTargetSelectBanish(AIVirtualCard owner, List targets, AIVirtualField field, List playPtn, AISituationInfo situation, AIScriptTokenArgType selectType, int selectCount = 1) + { + if (situation == null) + { + AIConsoleUtility.LogError("ExecuteTargetSelectBanish() Error!! situation is null!!!!!"); + } + else if (situation.IsTargetExists(selectType)) + { + BanishTarget(situation, targets, selectType); + } + else + { + BanishTargetPrediction(situation, targets, owner, field, playPtn, selectType, selectCount); + } + } + + private static void BanishTargetPrediction(AISituationInfo situation, List candidates, AIVirtualCard banishOwner, AIVirtualField field, List playPtn, AIScriptTokenArgType selectType, int selectCount) + { + List candidates2 = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(candidates, banishOwner, playPtn); + if (selectCount <= 1) + { + AIVirtualCard target = AISimulationRemovalUtility.SelectRemovalTarget(candidates2, banishOwner, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Banish); + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, selectType); + BanishTarget(situation, candidates, selectType); + } + else + { + BanishAll(AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates2, banishOwner, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Banish, selectCount), situation); + } + } + + public static void BanishTarget(AISituationInfo situation, List candidates, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("BanishTarget error!! No target!!!!!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard)) + { + BanishSingle(aIVirtualCard, situation); + } + } + } + + public static void BanishSingle(AIVirtualCard target, AISituationInfo situation) + { + if (!target.IsDead && !target.IsIndependent && !target.IsUnbanishable) + { + target.RemoveCard(situation, AIRemovalType.Banish, isFromSkill: true); + } + } + + public static void BanishRandom(List targets, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, int selectCount = 1) + { + if (selectCount <= 1) + { + AIVirtualCard aIVirtualCard = AISimulationRemovalUtility.SelectRemovalTarget(targets, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Banish); + if (aIVirtualCard != null) + { + BanishSingle(aIVirtualCard, situation); + } + } + else + { + BanishAll(AISimulationRemovalUtility.SelectMultipleRemovalTargets(targets, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Banish, selectCount), situation); + } + } + + public static int GetInplayBanishedCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List argList) + { + return GetFilterdBanishCardList(tagOwner, field, playPtn, situation, argList, BattleCardBase.BanishInfo.BanishPlace.Field)?.Count ?? 0; + } + + public static int GetHandBanishedCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List argList) + { + return GetFilterdBanishCardList(tagOwner, field, playPtn, situation, argList, BattleCardBase.BanishInfo.BanishPlace.Hand)?.Count ?? 0; + } + + private static List GetFilterdBanishCardList(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List argList, BattleCardBase.BanishInfo.BanishPlace place) + { + List banishedCards = field.CardListSet.BanishedCards; + if (banishedCards == null || banishedCards.Count <= 0) + { + return null; + } + SeparateArgListToFilterAndTimingArg(argList, out var filters, out var turnOrGame); + if (filters == null || filters.Count <= 0 || (turnOrGame != AIScriptTokenArgType.TURN && turnOrGame != AIScriptTokenArgType.GAME)) + { + return null; + } + List list = AIFilteringUtility.MultipleFiltering(banishedCards, filters, tagOwner, playPtn, situation, isBlockDeadCard: false); + if (list == null || list.Count <= 0) + { + return null; + } + if (turnOrGame == AIScriptTokenArgType.TURN) + { + list.RemoveAll((AIVirtualCard c) => !c.IsBanishedTargetTurn(field.CurrentTurnCount)); + } + list.RemoveAll((AIVirtualCard c) => c.BanishedInfo.Place != place); + return list; + } + + private static void SeparateArgListToFilterAndTimingArg(List argList, out List filters, out AIScriptTokenArgType turnOrGame) + { + if (argList == null || argList.Count <= 0) + { + AIConsoleUtility.LogError("AIBanishSimulationUtility.SeparateArgListToFilterAndTimingArg() error!! argList is null!!"); + filters = null; + turnOrGame = AIScriptTokenArgType.NONE; + return; + } + if (argList[argList.Count - 1] is AIScriptArgumentToken aIScriptArgumentToken) + { + turnOrGame = aIScriptArgumentToken.ArgumentType; + } + else + { + AIConsoleUtility.LogError("AIBanishSimulationUtility.SeparateArgListToFilterAndTimingArg() error!! lastToken is not ArgumentToken!!"); + turnOrGame = AIScriptTokenArgType.NONE; + } + filters = argList.GetRange(0, argList.Count - 1); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBarrierGlobal.cs b/SVSim.BattleEngine/Engine/Wizard/AIBarrierGlobal.cs new file mode 100644 index 0000000..a871a5a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBarrierGlobal.cs @@ -0,0 +1,6 @@ +namespace Wizard; + +public static class AIBarrierGlobal +{ + public const int CLIPPING_RANGE_MAX = 9999; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBasicTargetSelectUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBasicTargetSelectUtility.cs new file mode 100644 index 0000000..98d220e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBasicTargetSelectUtility.cs @@ -0,0 +1,180 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public static class AIBasicTargetSelectUtility +{ + public static AIVirtualCard SelectSingleBasicSkillTarget(List candidates, AIScriptTokenArgType skillType, AISelectTargetPattern worstOrBest) + { + if (candidates == null || candidates.Count <= 0) + { + return null; + } + Func func = SelectCompareFunc(skillType); + if (func == null) + { + return candidates[0]; + } + AIVirtualCard aIVirtualCard = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard2 = candidates[i]; + if (aIVirtualCard2.IsUnit && !aIVirtualCard2.IsDead) + { + aIVirtualCard = ((aIVirtualCard != null) ? func(aIVirtualCard, aIVirtualCard2, worstOrBest) : aIVirtualCard2); + } + } + return aIVirtualCard; + } + + private static Func SelectCompareFunc(AIScriptTokenArgType skillType) + { + switch (skillType) + { + case AIScriptTokenArgType.SNEAK: + return CompareSneakCandidates; + case AIScriptTokenArgType.QUICK: + case AIScriptTokenArgType.RUSH: + return CompareRushOrQuickCandidates; + case AIScriptTokenArgType.GUARD: + return CompareGuardCandidates; + case AIScriptTokenArgType.KILLER: + return CompareKillerCandidates; + case AIScriptTokenArgType.IGNORE_GUARD: + return CompareIgnoreGuardCandidates; + case AIScriptTokenArgType.DRAIN: + case AIScriptTokenArgType.UNTOUCHABLE: + case AIScriptTokenArgType.FORCE_TARGETING: + case AIScriptTokenArgType.UNBANISHABLE: + return null; + default: + return null; + } + } + + private static AIVirtualCard CompareRushOrQuickCandidates(AIVirtualCard currentResultTarget, AIVirtualCard checkCard, AISelectTargetPattern worstOrBest) + { + int attack = currentResultTarget.Attack; + int attack2 = checkCard.Attack; + AIVirtualCard result = currentResultTarget; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + if (checkCard.IsSummonDrunkenness && !checkCard.IsCantAttackAll && attack2 > attack) + { + result = checkCard; + } + break; + case AISelectTargetPattern.Worst: + if (attack2 < attack) + { + result = checkCard; + } + break; + } + return result; + } + + private static AIVirtualCard CompareGuardCandidates(AIVirtualCard currentResultTarget, AIVirtualCard checkCard, AISelectTargetPattern worstOrBest) + { + int life = currentResultTarget.Life; + int life2 = checkCard.Life; + AIVirtualCard result = currentResultTarget; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + if (life2 > life) + { + result = checkCard; + } + break; + case AISelectTargetPattern.Worst: + if (life2 < life) + { + result = checkCard; + } + break; + } + return result; + } + + private static AIVirtualCard CompareSneakCandidates(AIVirtualCard currentResultTarget, AIVirtualCard checkCard, AISelectTargetPattern worstOrBest) + { + int attack = currentResultTarget.Attack; + int life = currentResultTarget.Life; + int attack2 = checkCard.Attack; + int life2 = checkCard.Life; + AIVirtualCard result = currentResultTarget; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + if (attack2 > attack) + { + result = checkCard; + } + else if (attack2 == attack && life2 > life) + { + result = checkCard; + } + break; + case AISelectTargetPattern.Worst: + if (attack2 < attack) + { + result = checkCard; + } + else if (attack2 == attack && life2 < life) + { + result = checkCard; + } + break; + } + return result; + } + + private static AIVirtualCard CompareKillerCandidates(AIVirtualCard currentResultTarget, AIVirtualCard checkCard, AISelectTargetPattern worstOrBest) + { + int attack = currentResultTarget.Attack; + int attack2 = checkCard.Attack; + AIVirtualCard result = currentResultTarget; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + if (attack > attack2 || (attack == attack2 && currentResultTarget.Life < checkCard.Life)) + { + result = checkCard; + } + break; + case AISelectTargetPattern.Worst: + if (attack < attack2 || (attack == attack2 && currentResultTarget.Life > checkCard.Life)) + { + result = checkCard; + } + break; + } + return result; + } + + private static AIVirtualCard CompareIgnoreGuardCandidates(AIVirtualCard currentResultTarget, AIVirtualCard checkCard, AISelectTargetPattern worstOrBest) + { + int attack = currentResultTarget.Attack; + int attack2 = checkCard.Attack; + AIVirtualCard result = currentResultTarget; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + if (attack2 > attack) + { + result = checkCard; + } + break; + case AISelectTargetPattern.Worst: + if (attack2 < attack) + { + result = checkCard; + } + break; + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBerserkUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBerserkUtility.cs new file mode 100644 index 0000000..0a1f635 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBerserkUtility.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIBerserkUtility +{ + public static bool IsToBeBerserk(AIVirtualField field, List playPtn, AISituationInfo situation, bool isAlly) + { + int num = 0; + if (isAlly && playPtn != null) + { + for (int i = 0; i < playPtn.Count; i++) + { + int index = playPtn[i]; + BattleCardBase baseCard = field.AllyHandCards[index].BaseCard; + num += AIPlayOnSkillUtility.GetLifePenaltyOnPlay(baseCard, field.AI); + } + } + if (SkillConditionHalfLife.IsHalfLife((isAlly ? field.AllyClass : field.EnemyClass).Life - num) || IsForceBerserk(field, playPtn, situation, isAlly)) + { + return true; + } + return false; + } + + public static bool IsForceBerserk(AIVirtualField field, List playPtn, AISituationInfo situation, bool isAlly) + { + List forceBerserkTagHolders = field.CardListSet.ForceBerserkTagHolders; + if (forceBerserkTagHolders == null || forceBerserkTagHolders.Count <= 0) + { + return false; + } + for (int i = 0; i < forceBerserkTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = forceBerserkTagHolders[i]; + if (aIVirtualCard.IsAlly == isAlly && aIVirtualCard.TagCollectionContainer.ForceBerserkTags.IsForceBerserk(aIVirtualCard, playPtn, situation)) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBounceSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIBounceSelectLogicArgument.cs new file mode 100644 index 0000000..d38be38 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBounceSelectLogicArgument.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBounceSelectLogicArgument : AISelectLogicArgumentBase +{ + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.BOUNCE_LOGIC; + + public AIBounceSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + return AISimulationRemovalUtility.SelectRemovalTarget(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Bounce); + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + return AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Bounce, selectCount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBounceSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBounceSimulationUtility.cs new file mode 100644 index 0000000..4c63e16 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBounceSimulationUtility.cs @@ -0,0 +1,134 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIBounceSimulationUtility +{ + public static void BounceAll(List candidates, AISituationInfo situation) + { + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (!aIVirtualCard.IsIndependent) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Bounce, isFromSkill: true); + BounceActivation(aIVirtualCard, situation); + } + } + } + + public static void BounceRandom(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, int selectCount = 1) + { + if (selectCount <= 1) + { + AIVirtualCard aIVirtualCard = AISimulationRemovalUtility.SelectRemovalTarget(candidates, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Bounce); + if (aIVirtualCard != null && !aIVirtualCard.IsIndependent) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Bounce, isFromSkill: true); + BounceActivation(aIVirtualCard, situation); + } + } + else + { + BounceAll(AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates, tagOwner, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Bounce, selectCount), situation); + } + } + + public static void ExecuteTargetSelectBounce(AIVirtualCard owner, List targets, AISituationInfo situation, AIVirtualField field, List playPtn, AIScriptTokenArgType selectType, AIRemovalType removalType, int selectCount = 1) + { + if (situation == null) + { + AIConsoleUtility.LogError("ExecuteTargetSelectDestroy() Error!! situation is null!!!!!"); + return; + } + if (situation.IsTargetExists(selectType)) + { + BounceTarget(situation, targets, selectType); + return; + } + situation.SelectedTargets.UpdateRemovalType(selectType, removalType); + BounceTargetPrediction(situation, targets, owner, field, playPtn, selectType, selectCount); + } + + private static void BounceTargetPrediction(AISituationInfo situation, List candidates, AIVirtualCard bounceOwner, AIVirtualField field, List playPtn, AIScriptTokenArgType selectType, int selectCount) + { + List candidates2 = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(candidates, bounceOwner, playPtn); + if (selectCount <= 1) + { + AIVirtualCard target = AISimulationRemovalUtility.SelectRemovalTarget(candidates2, bounceOwner, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Bounce); + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, selectType); + BounceTarget(situation, candidates, selectType); + } + else + { + List list = AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates2, bounceOwner, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Bounce, selectCount); + situation.SetMultipleTargetsInInfo(list, TargetSelectType.Default, AIRemovalType.Bounce, selectType); + BounceAll(list, situation); + } + } + + public static void BounceTarget(AISituationInfo situation, List candidates, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("BounceTarget error!! No target!!!!!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard) && !aIVirtualCard.IsIndependent) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Bounce, isFromSkill: true); + } + BounceActivation(aIVirtualCard, situation); + } + } + + private static void BounceActivation(AIVirtualCard bouncedCard, AISituationInfo situation) + { + AIVirtualField selfField = situation.Actor.SelfField; + if (!selfField.CardListSet.HasBounceTagHolders) + { + return; + } + List bounceTagHolders = selfField.CardListSet.BounceTagHolders; + for (int i = 0; i < bounceTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = bounceTagHolders[i]; + if (!aIVirtualCard.IsDead && aIVirtualCard.IsOnField) + { + aIVirtualCard.ExecuteBounceSkills(bouncedCard, selfField, selfField.BestPlayPtn, situation); + } + } + } + + public static int GetBounceCount(AIVirtualField field, AISituationInfo situation, AIScriptTokenArgType type) + { + int result = 0; + switch (type) + { + case AIScriptTokenArgType.NOW: + result = GetCurrentSituationBounceCount(situation); + break; + case AIScriptTokenArgType.TURN: + result = field.TurnBounceCount + GetCurrentSituationBounceCount(situation); + break; + case AIScriptTokenArgType.GAME: + result = field.GameBounceCount + GetCurrentSituationBounceCount(situation); + break; + } + return result; + } + + private static int GetCurrentSituationBounceCount(AISituationInfo situation) + { + if (situation.BounceCardList == null) + { + return 0; + } + return situation.BounceCardList.Count; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBrokenCostSumUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBrokenCostSumUtility.cs new file mode 100644 index 0000000..00b8649 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBrokenCostSumUtility.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIBrokenCostSumUtility +{ + public static int GetBrokenCostSum(AIVirtualField field, AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation) + { + int num = 0; + List list = (tagOwner.IsAlly ? field.CardListSet.AllyDestroyedCards : field.CardListSet.EnemyDestroyedCards); + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, list, filters, playPtn, tagOwner, situation)) + { + num += aIVirtualCard.BaseCost; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffCountUtility.cs new file mode 100644 index 0000000..d9aff28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffCountUtility.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIBuffCountUtility +{ + public static int GetBuffCount(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation, List playPtn, List argList) + { + if (argList.Count < 2) + { + return 0; + } + AIScriptTokenArgType argumentType = ((AIScriptArgumentToken)argList[0]).ArgumentType; + AIScriptTokenArgType argumentType2 = ((AIScriptArgumentToken)argList[1]).ArgumentType; + if (!IsDurationArgLegal(argumentType2) || !IsPositionArgLegal(argumentType)) + { + return 0; + } + argList.RemoveRange(0, 2); + argList.Reverse(); + if (argumentType == AIScriptTokenArgType.PLAYED) + { + return GetPlayedBuffCount(owner, field, argList, situation, playPtn, argumentType2); + } + return 0; + } + + private static int GetPlayedBuffCount(AIVirtualCard owner, AIVirtualField field, List filters, AISituationInfo situation, List playPtn, AIScriptTokenArgType duration) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothInplayCards, filters, owner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0; + } + int num = 0; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + switch (duration) + { + case AIScriptTokenArgType.TURN: + if (aIVirtualCard.BuffRecorderCollection != null) + { + int turn = (aIVirtualCard.IsAlly ? field.AllyTurnCount : field.EnemyTurnCount); + num += aIVirtualCard.BuffRecorderCollection.GetTurnBuffCount(turn, aIVirtualCard.IsSelfTurn); + } + break; + case AIScriptTokenArgType.GAME: + num += aIVirtualCard.BuffCount; + break; + } + } + return num; + } + + private static bool IsDurationArgLegal(AIScriptTokenArgType duration) + { + if (duration != AIScriptTokenArgType.TURN) + { + return duration == AIScriptTokenArgType.GAME; + } + return true; + } + + private static bool IsPositionArgLegal(AIScriptTokenArgType position) + { + return position == AIScriptTokenArgType.PLAYED; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBuffEvaluationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBuffEvaluationUtility.cs new file mode 100644 index 0000000..4b04933 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBuffEvaluationUtility.cs @@ -0,0 +1,241 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIBuffEvaluationUtility +{ + public static readonly AIScriptTokenArgType[] LEGAL_TEMP_OR_PERM_ARGUMENTS = new AIScriptTokenArgType[2] + { + AIScriptTokenArgType.TEMP, + AIScriptTokenArgType.PERM + }; + + public static float EvalAllBuff(AIVirtualCard tagOwner, AIVirtualField field, List argList, List playPtn, AISituationInfo situation) + { + if (tagOwner == null || field == null || argList == null || argList.Count <= 3) + { + return 0f; + } + CreateBuffInfoAndFilters(argList, out var filters, out var buffInfo); + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null); + if (list == null || list.Count == 0) + { + return 0f; + } + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + return CalculateAllBuffValue(list, field, buffInfo, playPtn, situation); + } + + public static float EvalRandomBuff(AIVirtualCard tagOwner, AIVirtualField field, List argList, List playPtn, AISituationInfo situation) + { + if (tagOwner == null || field == null || argList == null || argList.Count <= 3) + { + return 0f; + } + CreateBuffInfoAndFilters(argList, out var filters, out var buffInfo); + List list = new List(); + list.AddRange(field.CardListSet.BothClassAndInplayCards); + List list2 = AIFilteringUtility.MultipleFiltering(list, filters, tagOwner, playPtn, null); + if (list2 == null || list2.Count == 0) + { + return 0f; + } + list2.RemoveAll((AIVirtualCard c) => c.IsAmulet); + float num = 0f; + for (int num2 = 0; num2 < list2.Count; num2++) + { + AIVirtualCard target = list2[num2]; + num += CalculateBuffValue(target, field, buffInfo, playPtn, situation); + } + return num / (float)list2.Count; + } + + public static float EvalTargetingBuff(AIVirtualCard tagOwner, AIVirtualField field, List argList, List playPtn, AISituationInfo situation) + { + if (tagOwner == null || field == null || argList == null || argList.Count <= 3) + { + return 0f; + } + CreateBuffInfoAndFilters(argList, out var filters, out var buffInfo); + List list = new List(); + list.AddRange(field.CardListSet.BothClassAndInplayCards); + List list2 = AIFilteringUtility.MultipleFiltering(list, filters, tagOwner, playPtn, null); + if (list2 == null || list2.Count == 0) + { + return 0f; + } + list2.RemoveAll((AIVirtualCard c) => c.IsAmulet); + bool flag = true; + float num = float.MinValue; + for (int num2 = 0; num2 < list2.Count; num2++) + { + AIVirtualCard aIVirtualCard = list2[num2]; + if (!aIVirtualCard.IsIndependent && (aIVirtualCard.IsAlly == tagOwner.IsAlly || !aIVirtualCard.CantBeFocusedSkill)) + { + flag = false; + float num3 = CalculateBuffValue(aIVirtualCard, field, buffInfo, playPtn, situation); + if (num3 > num) + { + num = num3; + } + } + } + if (flag) + { + num = 0f; + } + return num; + } + + private static void CreateBuffInfoAndFilters(List argList, out List filters, out AISimulationBuffInfo buffInfo) + { + int index = 0; + int index2 = 1; + int num = 2; + AIScriptArgumentToken aIScriptArgumentToken = argList[index] as AIScriptArgumentToken; + bool flag = false; + if (aIScriptArgumentToken != null) + { + flag = aIScriptArgumentToken.ArgumentType == AIScriptTokenArgType.TEMP; + } + int num2 = (int)argList[index2].Value; + int num3 = (int)argList[num].Value; + if (flag) + { + buffInfo = new AISimulationBuffInfo(num3, num2, num3, num2); + } + else + { + buffInfo = new AISimulationBuffInfo(0, 0, num3, num2); + } + filters = new List(); + for (int num4 = argList.Count - 1; num4 > num; num4--) + { + filters.Add(argList[num4]); + } + } + + private static float CalculateAllBuffValue(List targets, AIVirtualField field, AISimulationBuffInfo buffInfo, List playPtn, AISituationInfo situation) + { + List list = new List(); + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[i]; + if (aIVirtualCard.IsUnit) + { + list.Add(new AIVirtualCardStatusInfo(aIVirtualCard, aIVirtualCard.Attack, aIVirtualCard.Life)); + } + } + List list2 = new List(); + for (int j = 0; j < field.EnemyInplayCards.Count; j++) + { + AIVirtualCard aIVirtualCard2 = field.EnemyInplayCards[j]; + if (aIVirtualCard2.IsUnit) + { + list2.Add(new AIVirtualCardStatusInfo(aIVirtualCard2, aIVirtualCard2.Attack, aIVirtualCard2.Life)); + } + } + float num = 0f; + for (int k = 0; k < targets.Count; k++) + { + AIVirtualCard target = targets[k]; + if (!target.IsUnit) + { + continue; + } + int attack = target.Attack + buffInfo.TotalAttackBuff; + int num2 = target.Life + buffInfo.TotalLifeBuff; + AIVirtualCardStatusInfo aIVirtualCardStatusInfo = null; + List list3 = (target.IsAlly ? list : list2); + aIVirtualCardStatusInfo = list3.FirstOrDefault((AIVirtualCardStatusInfo info) => info.BaseCard.IsSameCard(target)); + if (num2 <= 0) + { + float num3 = target.EvaluateValueOnField(playPtn, situation, useStyle: true) - target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + num += num3 * (target.IsAlly ? (-1f) : 1f); + if (aIVirtualCardStatusInfo != null) + { + list3.Remove(aIVirtualCardStatusInfo); + } + } + else + { + num += (float)(buffInfo.TotalAttackBuff + buffInfo.TotalLifeBuff) * (target.IsAlly ? 1f : (-1f)); + aIVirtualCardStatusInfo?.ModifyStatus(attack, num2); + } + } + if (list2 != null && list2.Count > 0 && list.Count > 0) + { + num += AISimulationUtility.EvaluateAttackValueAfterAllSkill(field, situation, list, list2, playPtn); + } + if (buffInfo.TempAttackBuff > 0) + { + for (int num4 = 0; num4 < targets.Count; num4++) + { + AIVirtualCard target2 = targets[num4]; + AIVirtualCardStatusInfo aIVirtualCardStatusInfo2 = null; + aIVirtualCardStatusInfo2 = ((!target2.IsAlly) ? list2.FirstOrDefault((AIVirtualCardStatusInfo info) => info.BaseCard.IsSameCard(target2)) : list.FirstOrDefault((AIVirtualCardStatusInfo info) => info.BaseCard.IsSameCard(target2))); + if (aIVirtualCardStatusInfo2 != null && aIVirtualCardStatusInfo2.Life > 0) + { + num += (float)buffInfo.TempAttackBuff * (target2.IsAlly ? (-1f) : 1f); + } + } + } + return num; + } + + private static float CalculateBuffValue(AIVirtualCard target, AIVirtualField field, AISimulationBuffInfo buffInfo, List playPtn, AISituationInfo situation) + { + List list = new List(); + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[i]; + if (aIVirtualCard.IsUnit) + { + list.Add(new AIVirtualCardStatusInfo(aIVirtualCard, aIVirtualCard.Attack, aIVirtualCard.Life)); + } + } + List list2 = new List(); + for (int j = 0; j < field.EnemyInplayCards.Count; j++) + { + AIVirtualCard aIVirtualCard2 = field.EnemyInplayCards[j]; + if (aIVirtualCard2.IsUnit) + { + list2.Add(new AIVirtualCardStatusInfo(aIVirtualCard2, aIVirtualCard2.Attack, aIVirtualCard2.Life)); + } + } + float num = 0f; + int attack = target.Attack + buffInfo.TotalAttackBuff; + int num2 = target.Life + buffInfo.TotalLifeBuff; + List list3 = (target.IsAlly ? list : list2); + AIVirtualCardStatusInfo aIVirtualCardStatusInfo = list3.FirstOrDefault((AIVirtualCardStatusInfo info) => info.BaseCard.IsSameCard(target)); + if (num2 <= 0) + { + float num3 = target.EvaluateValueOnField(playPtn, situation, useStyle: true) - target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + num += num3 * (target.IsAlly ? (-1f) : 1f); + if (aIVirtualCardStatusInfo != null) + { + list3.Remove(aIVirtualCardStatusInfo); + } + } + else + { + num += (float)(buffInfo.TotalAttackBuff + buffInfo.TotalLifeBuff) * (target.IsAlly ? 1f : (-1f)); + aIVirtualCardStatusInfo?.ModifyStatus(attack, num2); + } + if (list2 != null && list2.Count > 0 && list.Count > 0) + { + num += AISimulationUtility.EvaluateAttackValueAfterAllSkill(field, situation, list, list2, playPtn); + } + if (buffInfo.TempAttackBuff > 0) + { + AIVirtualCardStatusInfo aIVirtualCardStatusInfo2 = null; + aIVirtualCardStatusInfo2 = ((!target.IsAlly) ? list2.FirstOrDefault((AIVirtualCardStatusInfo info) => info.BaseCard.IsSameCard(target)) : list.FirstOrDefault((AIVirtualCardStatusInfo info) => info.BaseCard.IsSameCard(target))); + if (aIVirtualCardStatusInfo2 != null && aIVirtualCardStatusInfo2.Life > 0) + { + num += (float)buffInfo.TempAttackBuff * (target.IsAlly ? (-1f) : 1f); + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIBurialUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIBurialUtility.cs new file mode 100644 index 0000000..8956aff --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIBurialUtility.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIBurialUtility +{ + public static bool IsBurialRite(AISituationInfo situation, List filters, AIVirtualField field) + { + AISelectedTargetInfo burialRiteTarget = situation.GetBurialRiteTarget(); + if (burialRiteTarget == null || burialRiteTarget.Type != TargetSelectType.BurialRite || !burialRiteTarget.HasTarget) + { + return false; + } + List targets = burialRiteTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + if (AIFilteringUtility.CheckMatchTargetFiltering(targets[i], field.AllyHandCards, filters, null, situation.Actor, situation)) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AICannotPlaySimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AICannotPlaySimulationUtility.cs new file mode 100644 index 0000000..7457612 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AICannotPlaySimulationUtility.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AICannotPlaySimulationUtility +{ + public static bool IsCannotPlayByTag(this AIVirtualField field, AIVirtualTargetSelectAction situation, List playPtn) + { + if (situation.ActionType != AIOperationType.PLAY || !situation.OriginalCard.IsAlly) + { + return false; + } + if (field.CannotPlayInformationList == null || field.CannotPlayInformationList.Count <= 0) + { + return false; + } + AIVirtualCard originalCard = situation.OriginalCard; + for (int i = 0; i < field.CannotPlayInformationList.Count; i++) + { + AICannotPlayInformation aICannotPlayInformation = field.CannotPlayInformationList[i]; + if (AIFilteringUtility.CheckMatchTargetFiltering(originalCard, field.AllyHandCards, aICannotPlayInformation.Filters, playPtn, aICannotPlayInformation.Owner, situation)) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeClassSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeClassSimulationUtility.cs new file mode 100644 index 0000000..dc8fe4f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeClassSimulationUtility.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIChangeClassSimulationUtility +{ + public static void ChangeClassAll(List candidates, CardBasePrm.ClanType classType) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsIndependent) + { + aIVirtualCard.ChangeClass(classType); + } + } + } + + public static void ChangeClassTarget(List candidates, CardBasePrm.ClanType classType, AIScriptTokenArgType whichTarget, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.HasTarget) + { + ChangeClassAll(situationTarget.Targets, classType); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIChangeCostSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIChangeCostSimulationUtility.cs new file mode 100644 index 0000000..ef0c268 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIChangeCostSimulationUtility.cs @@ -0,0 +1,168 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIChangeCostSimulationUtility +{ + public static void AddCostAll(int count, List targets) + { + if (targets != null && targets.Count > 0) + { + for (int i = 0; i < targets.Count; i++) + { + targets[i].AddCurrentCost(count); + } + } + } + + public static void AddCostTarget(AIVirtualCard owner, int count, List candidates, List targets) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (!owner.IsSameCard(aIVirtualCard) && candidates.Contains(aIVirtualCard)) + { + aIVirtualCard.AddCurrentCost(count); + } + } + } + + public static void SetCostAll(int count, List targets) + { + if (targets != null && targets.Count > 0) + { + for (int i = 0; i < targets.Count; i++) + { + targets[i].SetCurrentCost(count); + } + } + } + + public static void SetCostTarget(AIVirtualCard owner, int count, List candidates, List targets) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (!owner.IsSameCard(aIVirtualCard) && candidates.Contains(aIVirtualCard)) + { + aIVirtualCard.SetCurrentCost(count); + } + } + } + + public static AIVirtualCard SelectTargetForChangeCost(AIVirtualCard owner, List candidates, AISelectTargetPattern worstOrBest) + { + if (candidates == null || candidates.Count <= 0) + { + return null; + } + AIVirtualCard aIVirtualCard = candidates[0]; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + { + for (int j = 1; j < candidates.Count; j++) + { + AIVirtualCard aIVirtualCard3 = candidates[j]; + if (!owner.IsSameCard(aIVirtualCard3) && aIVirtualCard.Cost < aIVirtualCard3.Cost) + { + aIVirtualCard = aIVirtualCard3; + } + } + break; + } + case AISelectTargetPattern.Worst: + { + for (int i = 1; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard2 = candidates[i]; + if (!owner.IsSameCard(aIVirtualCard2) && aIVirtualCard.Cost > aIVirtualCard2.Cost) + { + aIVirtualCard = aIVirtualCard2; + } + } + break; + } + } + return aIVirtualCard; + } + + public static void ExecuteCostChange(AIScriptTokenArgType changeType, AIScriptTokenArgType whichTarget, int changeCost, AIVirtualCard owner, List candidates, AISituationInfo situation, AIVirtualField field) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + switch (whichTarget) + { + case AIScriptTokenArgType.ALL_SELECT: + ChangeCostValue(isTargetAll: true, changeType, changeCost, owner, candidates, null); + break; + case AIScriptTokenArgType.TARGET_SELECT: + case AIScriptTokenArgType.SECOND_TARGET_SELECT: + if (situation != null && situation.IsTargetExists(whichTarget)) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.Log("ExecuteCostChange Nothing TargetInfo"); + break; + } + List targets2 = situationTarget.Targets; + ChangeCostValue(isTargetAll: false, changeType, changeCost, owner, candidates, targets2); + } + break; + case AIScriptTokenArgType.RANDOM_SELECT: + { + AIVirtualCard aIVirtualCard = SelectTargetForChangeCost(owner, candidates, AISelectTargetPattern.Worst); + if (aIVirtualCard != null) + { + List targets = new List { aIVirtualCard }; + ChangeCostValue(isTargetAll: false, changeType, changeCost, owner, candidates, targets); + } + break; + } + default: + AIConsoleUtility.LogError("ExecuteCostChange: ilegal Target Arg type [" + whichTarget.ToString() + "]"); + break; + } + } + + public static void ChangeCostValue(bool isTargetAll, AIScriptTokenArgType changeType, int changeCost, AIVirtualCard owner, List candidates, List targets) + { + switch (changeType) + { + case AIScriptTokenArgType.ADD: + if (isTargetAll) + { + AddCostAll(changeCost, candidates); + } + else + { + AddCostTarget(owner, changeCost, candidates, targets); + } + break; + case AIScriptTokenArgType.SET: + if (isTargetAll) + { + SetCostAll(changeCost, candidates); + } + else + { + SetCostTarget(owner, changeCost, candidates, targets); + } + break; + default: + AIConsoleUtility.LogError("ChangeCostValue: ilegal Cost Arg type [" + changeType.ToString() + "]"); + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIClashHeal.cs b/SVSim.BattleEngine/Engine/Wizard/AIClashHeal.cs new file mode 100644 index 0000000..59f66be --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIClashHeal.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIClashHeal : AIFiltersAndSelectTypeArgument +{ + private readonly int HEAL_ARG_OFFSET = 1; + + private AIPolishConvertedExpression _healArg; + + protected override int SELECT_TYPE_OFFSET => 2; + + public AIClashHeal(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + _healArg = _exprList[_exprList.Count - HEAL_ARG_OFFSET]; + } + + public override void Execute(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + List targetsFromField = GetTargetsFromField(tagOwner, field, playPtn, situation); + if (targetsFromField != null && targetsFromField.Count > 0) + { + int heal = (int)_healArg.EvalArg(tagOwner, playPtn, field, situation); + if (base.SelectType == AIScriptTokenArgType.ALL_SELECT) + { + AISkillSimulationUtility.HealAll(targetsFromField, field, heal, playPtn, situation); + } + } + } + + public override List GetFilteredTargets(List candidates, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isBlockDead = true) + { + return AIFilteringUtility.FilteringForStatusEffectiveAbility(candidates, tagOwner, base.Filters, playPtn, situation, isAttackEffective: false, isBlockDead); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AICopyTagSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AICopyTagSimulationUtility.cs new file mode 100644 index 0000000..e372bc8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AICopyTagSimulationUtility.cs @@ -0,0 +1,197 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AICopyTagSimulationUtility +{ + public static List GetCopyTagListFromCard(AIVirtualCard target, List timingList) + { + List list = null; + for (int i = 0; i < timingList.Count; i++) + { + AIScriptTokenArgType timing = timingList[i]; + List copyTagOfCertainTiming = GetCopyTagOfCertainTiming(target, timing); + if (copyTagOfCertainTiming != null && copyTagOfCertainTiming.Count > 0) + { + list = AIParamQuery.AddRangeToList(copyTagOfCertainTiming, list); + } + } + return list; + } + + public static void ExecuteCopyAndAttachTagToAll(AIVirtualCard tagOwner, List targetList, List skillTimingList, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (targetList == null || targetList.Count <= 0) + { + return; + } + for (int i = 0; i < targetList.Count; i++) + { + List copyTagListFromCard = GetCopyTagListFromCard(targetList[i], skillTimingList); + if (copyTagListFromCard != null) + { + AttachTagFromCopyTagList(tagOwner, tagOwner, copyTagListFromCard, situation); + } + } + } + + public static void ExecuteCopyAndAttachTagToSelectedTarget(AIVirtualCard tagOwner, List candidates, List skillTimingList, AIScriptTokenArgType whichTarget, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(whichTarget)) + { + CopyAndAttachTagToSituationTarget(tagOwner, candidates, skillTimingList, whichTarget, field, playPtn, situation); + } + else + { + CopyAndAttachTagPrediction(tagOwner, candidates, skillTimingList, field, playPtn, situation); + } + } + + private static void CopyAndAttachTagToSituationTarget(AIVirtualCard tagOwner, List candidates, List skillTimingList, AIScriptTokenArgType whichTarget, AIVirtualField field, List playPtn, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.Targets != null) + { + ExecuteCopyAndAttachTagToAll(tagOwner, situationTarget.Targets, skillTimingList, field, playPtn, situation); + } + } + + private static void CopyAndAttachTagPrediction(AIVirtualCard tagOwner, List candidates, List skillTimingList, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + AIVirtualCard aIVirtualCard = SelecteBestCopyTarget(tagOwner, candidates, field, playPtn, situation); + if (aIVirtualCard != null) + { + List copyTagListFromCard = GetCopyTagListFromCard(aIVirtualCard, skillTimingList); + if (copyTagListFromCard != null) + { + AttachTagFromCopyTagList(tagOwner, tagOwner, copyTagListFromCard, situation); + } + } + } + + private static AIVirtualCard SelecteBestCopyTarget(AIVirtualCard attachTarget, List candidates, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (candidates == null || candidates.Count <= 0) + { + return null; + } + AIVirtualCard result = null; + float num = float.MinValue; + for (int i = 0; i < candidates.Count; i++) + { + float num2 = 0f; + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAttack)) + { + num2 += (float)aIVirtualCard.TagCollectionContainer.AttackTags.TagList.Count * 1f; + } + if (aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Lastword)) + { + num2 += (float)aIVirtualCard.TagCollectionContainer.LastwordTags.TagList.Count * 1f; + } + num2 += (aIVirtualCard.IsQuick ? 3f : 0f); + num2 += (aIVirtualCard.IsKiller ? 1f : 0f); + num2 += (aIVirtualCard.IsDrain ? 1f : 0f); + num2 += (aIVirtualCard.IsGuard ? 1f : 0f); + if (aIVirtualCard.IsRush) + { + List list = (attachTarget.IsAlly ? field.EnemyInplayCards : field.AllyInplayCards); + num2 += ((list != null && list.Count > 0) ? 1f : 0.5f); + } + if (num2 > num) + { + num = num2; + result = aIVirtualCard; + } + } + return result; + } + + private static void AttachTagFromCopyTagList(AIVirtualCard tagOwner, AIVirtualCard attachTarget, List copyTgList, AISituationInfo situation) + { + for (int i = 0; i < copyTgList.Count; i++) + { + AIAttachTagSimulationUtility.SimulateAttachTagToSingle(attachTarget, tagOwner, copyTgList[i], AIScriptTokenArgType.NONE, situation); + } + } + + private static List GetCopyTagOfCertainTiming(AIVirtualCard target, AIScriptTokenArgType timing) + { + switch (timing) + { + case AIScriptTokenArgType.KILLER: + case AIScriptTokenArgType.QUICK: + case AIScriptTokenArgType.RUSH: + case AIScriptTokenArgType.DRAIN: + case AIScriptTokenArgType.GUARD: + return CopyKeywordSkillTags(target, timing); + case AIScriptTokenArgType.WHEN_DESTROY: + return CopyWhenDestroyTags(target); + case AIScriptTokenArgType.WHEN_ATTACK: + return CopyWhenAttackTags(target); + case AIScriptTokenArgType.WHEN_CLASH: + return CopyWhenClashTags(target); + default: + return null; + } + } + + private static List CopyKeywordSkillTags(AIVirtualCard target, AIScriptTokenArgType skillType) + { + List list = null; + if (target.IsHoldKeywordSkill(skillType)) + { + AIPlayTag aIPlayTag = AIPlayTagInitializingUtility.CreateBasicSkillTag(skillType); + if (aIPlayTag == null) + { + return null; + } + list = AIParamQuery.AddElementToList(aIPlayTag, list); + } + return list; + } + + private static List CopyWhenDestroyTags(AIVirtualCard target) + { + List list = null; + if (target.TagCollectionContainer.HasTagCollection(TagCollectionType.Lastword)) + { + list = AIParamQuery.AddRangeToList(target.TagCollectionContainer.LastwordTags.TagList, list); + } + if (target.TagCollectionContainer.HasTag(AIPlayTagType.Break)) + { + list = AIParamQuery.AddRangeToList(target.TagCollectionContainer.BreakBonusTags.TagList, list); + } + if (target.TagCollectionContainer.HasTag(AIPlayTagType.IgnoreBreak)) + { + list = AIParamQuery.AddRangeToList(target.TagCollectionContainer.IgnoreBreakTags.TagList, list); + } + return list; + } + + private static List CopyWhenAttackTags(AIVirtualCard target) + { + if (target.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAttack)) + { + return target.TagCollectionContainer.AttackTags.TagList; + } + return null; + } + + private static List CopyWhenClashTags(AIVirtualCard target) + { + if (target.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAttack)) + { + AttackTagCollection attackTags = target.TagCollectionContainer.AttackTags; + if (attackTags.HasClashTag) + { + return attackTags.ClashTags; + } + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AICountdownChangeUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AICountdownChangeUtility.cs new file mode 100644 index 0000000..cc0c433 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AICountdownChangeUtility.cs @@ -0,0 +1,122 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AICountdownChangeUtility +{ + public static float EvalChantCountChange(AIVirtualCard actCard, int amount, List playPtn, bool isSelect, AISituationInfo situation) + { + if (GetMemberChantFieldNum(actCard.SelfField, playPtn) <= 0) + { + return 0f; + } + float num = 0f; + List allyClassAndInplayCards = actCard.SelfField.CardListSet.AllyClassAndInplayCards; + List list = new List(); + for (int i = 0; i < allyClassAndInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = allyClassAndInplayCards[i]; + if ((aIVirtualCard.CardIndex != actCard.CardIndex || aIVirtualCard.IsPlayer != actCard.IsPlayer) && aIVirtualCard.IsCountdownAmulet) + { + list.Add(aIVirtualCard); + } + } + if (playPtn != null && playPtn.Count > 0) + { + for (int j = 0; j < playPtn.Count; j++) + { + AIVirtualCard aIVirtualCard2 = actCard.SelfField.AllyHandCards[playPtn[j]]; + if ((aIVirtualCard2.CardIndex != actCard.CardIndex || aIVirtualCard2.IsPlayer != actCard.IsPlayer) && aIVirtualCard2.IsCountdownAmulet) + { + list.Add(aIVirtualCard2); + } + } + } + if (isSelect) + { + int bestCandidateIndex = 0; + return CalcMaxSelectChantCountChangeBonus(amount, list, playPtn, ref bestCandidateIndex, situation); + } + return CalcAllChantCountChangeBonus(amount, list, playPtn, situation); + } + + public static float CalcMaxSelectChantCountChangeBonus(int amount, List targets, List playPtn, ref int bestCandidateIndex, AISituationInfo situation) + { + float num = 0f; + int count = targets.Count; + for (int i = 0; i < count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + float num2 = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: false, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true); + AIVirtualCard aIVirtualCard2 = new AIVirtualCard(aIVirtualCard, aIVirtualCard.SelfField); + int chantCount = aIVirtualCard2.ChantCount; + chantCount = ((chantCount > amount) ? (chantCount - amount) : 0); + float num3 = 0f; + if (chantCount > 0) + { + aIVirtualCard2.ChantCount = chantCount; + num3 = aIVirtualCard2.EvaluateValueOnField(playPtn, situation, useStyle: false, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true); + } + else + { + num3 = aIVirtualCard.EvaluateBreakValue(playPtn, useIgnoreBreak: true); + } + float num4 = num3 - num2; + if (num4 > num) + { + num = num4; + bestCandidateIndex = i; + } + } + return num; + } + + public static float CalcAllChantCountChangeBonus(int amount, List targets, List playPtn, AISituationInfo situation) + { + float num = 0f; + int count = targets.Count; + for (int i = 0; i < count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + float num2 = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: false, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true); + AIVirtualCard aIVirtualCard2 = new AIVirtualCard(aIVirtualCard, aIVirtualCard.SelfField); + int chantCount = aIVirtualCard2.ChantCount; + chantCount = ((chantCount > amount) ? (chantCount - amount) : 0); + float num3 = 0f; + if (chantCount > 0) + { + aIVirtualCard2.ChantCount = chantCount; + num3 = aIVirtualCard2.EvaluateValueOnField(playPtn, situation, useStyle: false, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true); + } + else + { + num3 = aIVirtualCard.EvaluateBreakValue(playPtn, useIgnoreBreak: true); + } + num += num3 - num2; + } + return num; + } + + public static int GetMemberChantFieldNum(AIVirtualField field, List handPtn) + { + int num = 0; + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + if (field.AllyInplayCards[i].IsCountdownAmulet) + { + num++; + } + } + if (handPtn != null) + { + for (int j = 0; j < handPtn.Count; j++) + { + if (field.AllyHandCards[handPtn[j]].IsCountdownAmulet) + { + num++; + } + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AICrystalizeUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AICrystalizeUtility.cs new file mode 100644 index 0000000..1166992 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AICrystalizeUtility.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AICrystalizeUtility +{ + public static bool IsCrystalize(AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (card == null || card.CrystalizeCostList == null || !card.IsInHand) + { + return false; + } + AIVariableResultContainer valResultContainer = field.AI.ValResultContainer; + ulong hash = AIFunctionResultHashCalculator.GetHash(card, field, playPtn, null, 0uL); + if (valResultContainer.GetContainsResultValue(AIScriptTokenVariableType.IS_CRYSTALIZE, hash, out var getResult)) + { + return getResult == 1f; + } + List playPtn2 = (card.IsAlly ? playPtn : null); + bool flag = field.AI.PlayPtnRecorder.IsCardPlayingSimulationType(card, field, playPtn2, situation, PlaySimulationType.Crystalize); + valResultContainer.CheckDuplicateAndAddRecord(AIScriptTokenVariableType.IS_CRYSTALIZE, hash, flag ? 1f : 0f, $"IsCrystalize(): Already hashed target and not equal value. CardName:[{card.CardName}] hash:[{hash}]"); + return flag; + } + + public static int GetCrystalizeId(AIVirtualCard card, int usedCost) + { + if (card.CrystalizeCostList == null || card.CrystalizeCostList.Count <= 0) + { + return -1; + } + for (int i = 0; i < card.CrystalizeCostList.Count; i++) + { + AICrystalizeInformation aICrystalizeInformation = card.CrystalizeCostList[i]; + if (aICrystalizeInformation.Cost == usedCost) + { + return aICrystalizeInformation.CardId; + } + } + return -1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamageClippingInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamageClippingInfo.cs new file mode 100644 index 0000000..a4632ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamageClippingInfo.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AIDamageClippingInfo : AIBarrierInfoBase +{ + public override AIBarrierType BarrierType => AIBarrierType.DamageClipping; + + public int ClippingRange { get; protected set; } = 9999; + + public AIDamageClippingInfo(int amount, int range, AIDamageType damageType, AIBarrierStopTiming stopTiming) + : base(amount, damageType, stopTiming) + { + ClippingRange = range; + UpdateHash(); + } + + public AIDamageClippingInfo(int amount, int range, AIDamageType damageType, List stopTimingList) + : base(amount, damageType, stopTimingList) + { + ClippingRange = range; + UpdateHash(); + } + + public override AIBarrierInfoBase Clone() + { + return new AIDamageClippingInfo(base.BarrierAmount, ClippingRange, base.DamageType, base.StopTimingList); + } + + public override bool IsShield() + { + if (ClippingRange == 9999) + { + return base.BarrierAmount <= 0; + } + return false; + } + + protected override int CalcDamage(AIVirtualCard owner, int damage) + { + if (damage > ClippingRange) + { + return damage; + } + return Mathf.Min(damage, base.BarrierAmount); + } + + protected override void UpdateHash() + { + base.Hash = AIBarrierSimulationUtility.CalculateDamageClipInfoHash(base.DamageType, BarrierType, base.StopTimingList, base.BarrierAmount, ClippingRange); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamageCutInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamageCutInfo.cs new file mode 100644 index 0000000..5afaf41 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamageCutInfo.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AIDamageCutInfo : AIBarrierInfoBase +{ + public override AIBarrierType BarrierType => AIBarrierType.DamageCut; + + public AIDamageCutInfo(int amount, AIDamageType damageType, AIBarrierStopTiming stopTiming) + : base(amount, damageType, stopTiming) + { + UpdateHash(); + } + + public AIDamageCutInfo(int amount, AIDamageType damageType, List stopTimingList) + : base(amount, damageType, stopTimingList) + { + UpdateHash(); + } + + public override AIBarrierInfoBase Clone() + { + return new AIDamageCutInfo(base.BarrierAmount, base.DamageType, base.StopTimingList); + } + + public override bool IsShield() + { + return false; + } + + protected override int CalcDamage(AIVirtualCard owner, int damage) + { + return Mathf.Max(0, damage - base.BarrierAmount); + } + + protected override void UpdateHash() + { + base.Hash = AIBarrierSimulationUtility.CalculateDamageCutInfoHash(base.DamageType, BarrierType, base.StopTimingList, base.BarrierAmount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamageSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamageSelectLogicArgument.cs new file mode 100644 index 0000000..a90152c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamageSelectLogicArgument.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDamageSelectLogicArgument : AISelectLogicArgumentBase +{ + private const int DAMAGE_VALUE_ARG_INDEX = 0; + + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.DAMAGE_LOGIC; + + public AIDamageSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + int damageValue = GetDamageValue(tagOwner, field, playPtn, situation); + return AIDamageSimulationUtility.SelectDamageTarget(candidates, field, playPtn, situation, damageValue, tagOwner.IsSpell, worstOrBest); + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + LogNotImplementMultipleSelect(); + return null; + } + + private int GetDamageValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (_argumentList == null || _argumentList.Count <= 0) + { + AIConsoleUtility.LogError("AIDamageSelectLogicArgument error!! _argumentList is null"); + return 0; + } + return (int)_argumentList[0].EvalArg(tagOwner, playPtn, field, situation); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDamageSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIDamageSimulationUtility.cs new file mode 100644 index 0000000..96769c6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDamageSimulationUtility.cs @@ -0,0 +1,657 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public static class AIDamageSimulationUtility +{ + public static float EvalTargetingDamageAndRandomMultiSelectDamage(AIVirtualCard tagOwner, AIVirtualField field, List targetFilters, List randomFilters, List playPtn, AISituationInfo situation, int targetDamage, int randomDamage, int randomDamageCount) + { + if (tagOwner == null || field == null || targetFilters == null) + { + return 0f; + } + int num = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, targetDamage); + int damageAmount = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, randomDamage); + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, targetFilters, tagOwner, playPtn, situation); + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + list = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(list, tagOwner, playPtn); + float num2 = float.MinValue; + int count = list.Count; + AIVirtualCard target = null; + for (int num3 = 0; num3 < count; num3++) + { + AIVirtualCard aIVirtualCard = list[num3]; + if (aIVirtualCard.IsAlly == tagOwner.IsAlly || (!aIVirtualCard.IsUntouchable && !aIVirtualCard.IsSneak)) + { + float num4 = 0f; + num4 = ((!aIVirtualCard.IsLeader) ? EvalDamageToCertainUnit(tagOwner, aIVirtualCard, field, num, playPtn, situation, field.AllyHandCards.Contains(tagOwner)) : AILeaderLifeEvaluationUtility.Evaluate(CalcLifeAfterDamage(aIVirtualCard, situation, num, tagOwner.IsSpell), aIVirtualCard.Life, aIVirtualCard.IsAlly, tagOwner.IsAlly)); + if (num4 > num2) + { + num2 = num4; + target = aIVirtualCard; + } + } + } + if (target == null) + { + return AIRandomMultiDamageEvaluator.EvaluateRandomDamageAverage(tagOwner, field, playPtn, situation, targetFilters, damageAmount, randomDamageCount); + } + int num5 = target.SimulateDamageAmount(num, tagOwner.IsUnit, tagOwner.IsSpell); + float num6 = 0f; + int num7 = CalcLifeAfterDamage(target, situation, num, tagOwner.IsSpell); + if (num7 <= 0) + { + int num8 = target.Life - num7; + float num9 = target.EvaluateValueOnField(playPtn, situation, useStyle: true) - (target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) + target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false)) + (float)(num8 - target.Life) * -0.1f; + num6 = (target.IsAlly ? (0f - num9) : num9); + new List(field.CardListSet.BothClassAndInplayCards).RemoveAll((AIVirtualCard c) => c.Equals(target)); + } + else + { + _ = field.CardListSet.BothClassAndInplayCards; + num6 = target.EvaluateValueOnField(playPtn, situation, useStyle: true); + target.Life -= num5; + num6 -= target.EvaluateValueOnField(playPtn, situation, useStyle: true); + target.Life += num5; + } + target.Life -= num5; + num6 += AIRandomMultiDamageEvaluator.EvaluateRandomDamageAverage(tagOwner, field, playPtn, situation, targetFilters, damageAmount, randomDamageCount); + target.Life += num5; + return num6; + } + + public static float EvalTargetingDamage(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AISituationInfo situation, int damage) + { + if (tagOwner == null || field == null || filters == null) + { + return 0f; + } + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0f; + } + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + list = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(list, tagOwner, playPtn); + int damage2 = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damage); + float num = float.MinValue; + int count = list.Count; + if (count <= 0) + { + return 0f; + } + for (int num2 = 0; num2 < count; num2++) + { + AIVirtualCard aIVirtualCard = list[num2]; + if (aIVirtualCard.IsAlly == tagOwner.IsAlly || (!aIVirtualCard.IsUntouchable && !aIVirtualCard.IsSneak)) + { + float num3 = 0f; + num3 = ((!aIVirtualCard.IsLeader) ? EvalDamageToCertainUnit(tagOwner, aIVirtualCard, field, damage2, playPtn, situation, field.AllyHandCards.Contains(tagOwner)) : AILeaderLifeEvaluationUtility.Evaluate(CalcLifeAfterDamage(aIVirtualCard, situation, damage2, tagOwner.IsSpell), aIVirtualCard.Life, aIVirtualCard.IsAlly, tagOwner.IsAlly)); + if (num3 > num) + { + num = num3; + } + } + } + if (num == float.MinValue) + { + num = 0f; + } + return num; + } + + private static float EvalDamageToCertainUnit(AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, int damage, List playPtn, AISituationInfo situation, bool isWhenPlaySkill) + { + float num = target.EvaluateValueOnField(playPtn, situation, useStyle: true) - (target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) + target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false)); + int life = target.Life; + float num2 = 0f; + int num3 = CalcLifeAfterDamage(target, situation, damage, tagOwner.IsSpell); + if (num3 <= 0) + { + int num4 = life - num3; + float num5 = num + (float)(num4 - life) * -0.1f; + num2 = (target.IsAlly ? (0f - num5) : num5); + } + else + { + if (target.IsAlly) + { + return 0f; + } + if (target.IsCantUnderAnyAttack()) + { + num2 += 0f; + } + else if (field.ParamQuery.GetEnemyGuardiansCount() > 0 && !target.IsGuard && !tagOwner.IsIgnoreGuard) + { + num2 += 0f; + } + else + { + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(null, target); + List list = new List(); + List list2 = new List(); + List list3 = new List(); + if (tagOwner.IsUnit && isWhenPlaySkill && tagOwner.IsAbleEvolution()) + { + aIVirtualAttackInfo.SetActor(tagOwner); + list.Add(tagOwner.SimulateAttackAmount(tagOwner.Attack + tagOwner.EvoAttackPlus, aIVirtualAttackInfo)); + list2.Add(tagOwner.Life + tagOwner.EvoLifePlus); + list3.Add(tagOwner.EvaluateValueOnField(playPtn, situation, useStyle: true)); + } + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyInplayCards[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsDead && aIVirtualCard.IsAttackable(EnemyAI.EmptyPlayPtn)) + { + aIVirtualAttackInfo.SetActor(aIVirtualCard); + list.Add(aIVirtualCard.SimulateAttackAmount(aIVirtualAttackInfo)); + list2.Add(aIVirtualCard.Life); + list3.Add(aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true)); + } + } + int num6 = (int)Mathf.Pow(2f, list.Count); + for (int j = 0; j < num6; j++) + { + int num7 = j; + int num8 = 0; + int num9 = 0; + float num10 = 0f; + float num11 = 0f; + while (num7 > 0) + { + if (num7 % 2 == 1) + { + num9 += list[num8]; + if (list2[num8] <= target.Attack) + { + num10 += list3[num8]; + } + } + num8++; + num7 /= 2; + } + num9 = target.SimulateDamageAmount(num9); + num11 = ((num9 >= life) ? (num11 + 0f) : ((num9 >= num3) ? (num11 + (num - num10)) : (num11 + 0f))); + if (num2 < num11) + { + num2 = num11; + } + } + } + } + return num2; + } + + public static float EvalRandomMultiSelectDamage(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AISituationInfo situation, int damage, int selectCount) + { + if (tagOwner == null || field == null || filters == null) + { + return 0f; + } + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null); + if (list != null && list.Count > 0) + { + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + if (list.Count <= selectCount) + { + return CalculateMultiAllDamage(tagOwner, list, field, playPtn, situation, damage, 1); + } + int num = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damage); + List list2 = new List(); + List list3 = new List(); + for (int num2 = 0; num2 < list.Count; num2++) + { + list2.Add(list[num2].EvaluateValueOnField(playPtn, situation, useStyle: true) - list[num2].GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - list[num2].GetAllLeaveBonus(playPtn, useIgnoreInBattle: false)); + list3.Add(num2); + } + List list4 = AIMathematicsLibrary.EnumerateCombinations(list3, selectCount).ToList(); + if (list4 == null || list4.Count == 0) + { + return 0f; + } + float num3 = 0f; + for (int num4 = 0; num4 < list4.Count; num4++) + { + int[] array = list4[num4]; + float num5 = 0f; + for (int num6 = 0; num6 < array.Length; num6++) + { + int num7 = CalcLifeAfterDamage(list[array[num6]], situation, num, tagOwner.IsSpell); + num5 += ((num7 <= 0) ? list2[array[num6]] : ((float)num)); + } + num3 += num5; + } + return num3 / (float)list4.Count; + } + return 0f; + } + + public static int CalcLifeAfterDamage(AIVirtualCard target, AISituationInfo situation, int damage, bool isSpell) + { + int num = target.SimulateDamageAmount(damage, isSkillDamage: true, isSpell); + int num2 = target.Life - num; + int atkBuff = 0; + int lifeBuff = 0; + if (target.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenDamaged)) + { + target.TagCollectionContainer.DamagedTags.GetDamagedBuffValue(target, target.SelfField, target.SelfField.BestPlayPtn, situation, out atkBuff, out lifeBuff); + num2 += lifeBuff; + } + return num2; + } + + public static float EvalEchoDamage(AIVirtualCard tagOwner, AIVirtualField field, List filters, int damage, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count == 0) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + float item = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true) - aIVirtualCard.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - aIVirtualCard.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + List list2 = new List { aIVirtualCard }; + List list3 = new List { item }; + List list4 = (aIVirtualCard.IsAlly ? field.AllyInplayCards : field.EnemyInplayCards); + for (int j = 0; j < list4.Count; j++) + { + AIVirtualCard aIVirtualCard2 = list4[j]; + if (!aIVirtualCard2.IsSameCard(aIVirtualCard) && aIVirtualCard2.BaseId == aIVirtualCard.BaseId) + { + list2.Add(aIVirtualCard2); + float item2 = aIVirtualCard2.EvaluateValueOnField(playPtn, situation, useStyle: true) - aIVirtualCard2.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - aIVirtualCard2.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + list3.Add(item2); + } + } + float num2 = 0f; + for (int k = 0; k < list2.Count; k++) + { + AIVirtualCard aIVirtualCard3 = list2[k]; + int damageAmount = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damage); + damageAmount = aIVirtualCard3.SimulateDamageAmount(damageAmount, isSkillDamage: true, tagOwner.IsSpell); + if (damageAmount >= aIVirtualCard3.Life) + { + num2 += list3[k]; + } + } + if (EnemyAI.IsLargerThan(num2, num)) + { + num = num2; + } + } + return num; + } + + public static AIVirtualCard SelectDamageTarget(List candidates, AIVirtualField field, List playPtn, AISituationInfo situation, int damage, bool isSpell, AISelectTargetPattern bestOrWorst) + { + if (candidates == null || candidates.Count <= 0) + { + AIConsoleUtility.LogError("AISimulationDamageUtility.SelectDamageTarget() : candidates is null "); + return null; + } + AIVirtualCard result = null; + float num = ((bestOrWorst == AISelectTargetPattern.Worst) ? float.MaxValue : float.MinValue); + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (!aIVirtualCard.IsDead) + { + float damageValueToCertainTarget = GetDamageValueToCertainTarget(aIVirtualCard, damage, situation, playPtn, isSpell); + bool flag = false; + switch (bestOrWorst) + { + case AISelectTargetPattern.Worst: + flag = num > damageValueToCertainTarget; + break; + case AISelectTargetPattern.Best: + flag = damageValueToCertainTarget > num; + break; + } + if (flag) + { + num = damageValueToCertainTarget; + result = aIVirtualCard; + } + } + } + return result; + } + + public static float GetDamageValueToCertainTarget(AIVirtualCard target, int damage, AISituationInfo situation, List playPtn, bool isSpell) + { + float num = 0f; + int num2 = CalcLifeAfterDamage(target, situation, damage, isSpell); + float num3 = target.EvaluateValueOnField(playPtn, situation, useStyle: true); + if (num2 <= 0) + { + num = num3 - target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + } + else + { + float num4 = 0.01f; + num = (float)(target.Life - num2) + num3 * num4; + } + return num * (target.IsAlly ? (-1f) : 1f); + } + + public static float EvalOldestDamage(AIVirtualCard tagOwner, List candidates, AIVirtualField field, int damage, List playPtn, AISituationInfo situation) + { + float num = 0f; + if (candidates == null || candidates.Count <= 0) + { + return 0f; + } + int num2 = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damage); + AIVirtualCard aIVirtualCard = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard2 = candidates[i]; + if (aIVirtualCard2.IsLeader) + { + if (aIVirtualCard == null) + { + aIVirtualCard = aIVirtualCard2; + } + else + { + AIConsoleUtility.LogError("EvalOldestDamage(): Already selected leader card! Candidate cards is illegal."); + } + } + else if (aIVirtualCard2.IsUnit) + { + int life = aIVirtualCard2.Life; + int num3 = ((num2 < life) ? num2 : life); + num += EvalDamageToCertainUnit(tagOwner, aIVirtualCard2, field, num3, playPtn, situation, field.AllyHandCards.Contains(tagOwner)); + num2 -= num3; + if (num2 <= 0) + { + break; + } + } + } + if (aIVirtualCard != null && num2 > 0) + { + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = new AIBarrierPseudoSimulationInfo(aIVirtualCard); + bool isSpell = tagOwner.IsSpell; + int num4 = aIBarrierPseudoSimulationInfo.SimulateDamageAmount(aIVirtualCard.SimulateDamageShield(damage, isSkillDamage: true, isSpell), isSpell); + num += AILeaderLifeEvaluationUtility.Evaluate(aIVirtualCard.Life - num4, aIVirtualCard.Life, aIVirtualCard.IsAlly, tagOwner.IsAlly); + } + return num; + } + + public static float EvalMultiAllDamage(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AISituationInfo situation, int damage, int damageCount) + { + if (tagOwner == null || field == null || filters == null) + { + return 0f; + } + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null); + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + if (!list.IsNotNullOrEmpty()) + { + return 0f; + } + AIFunctionResultContainer funcResultContainer = field.AI.FuncResultContainer; + ulong hash = AIFunctionResultHashCalculator.GetHash(tagOwner, field, playPtn, null, GetArgumentHash(list, damage, damageCount)); + if (funcResultContainer.GetContainsResultValue(AIScriptTokenFuncType.EVAL_ALL_MULTI_DAMAGE, hash, out var getResult)) + { + return getResult; + } + float result = CalculateMultiAllDamage(tagOwner, list, field, playPtn, situation, damage, damageCount); + funcResultContainer.AddRecord(AIScriptTokenFuncType.EVAL_ALL_MULTI_DAMAGE, hash, result); + return result; + } + + private static float CalculateMultiAllDamage(AIVirtualCard tagOwner, List targetList, AIVirtualField field, List playPtn, AISituationInfo situation, int damage, int damageCount) + { + float num = 0f; + List list = new List(); + List list2 = new List(); + int damageAmount = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damage); + bool isSpell = tagOwner.IsSpell; + for (int i = 0; i < targetList.Count; i++) + { + AIVirtualCard aIVirtualCard = targetList[i]; + int num2 = aIVirtualCard.Life; + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = new AIBarrierPseudoSimulationInfo(aIVirtualCard); + for (int j = 0; j < damageCount; j++) + { + int num3 = aIBarrierPseudoSimulationInfo.SimulateDamageAmount(aIVirtualCard.SimulateDamageShield(damageAmount, isSkillDamage: true, isSpell), isSpell); + num2 -= num3; + if (num2 <= 0) + { + break; + } + aIBarrierPseudoSimulationInfo.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + } + if (aIVirtualCard.IsLeader) + { + num += AILeaderLifeEvaluationUtility.Evaluate(num2, aIVirtualCard.Life, aIVirtualCard.IsAlly, tagOwner.IsAlly); + } + else if (num2 <= 0) + { + float num4 = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true) - aIVirtualCard.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - aIVirtualCard.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + num += num4 * (aIVirtualCard.IsAlly ? (-1f) : 1f); + } + else if (!aIVirtualCard.IsAlly || aIVirtualCard.IsAttackable(playPtn)) + { + (aIVirtualCard.IsAlly ? list : list2).Add(new AIVirtualCardStatusInfo(aIVirtualCard, aIVirtualCard.Attack, num2)); + } + } + if (list2.Count > 0 && list.Count > 0) + { + num += AISimulationUtility.EvaluateAttackValueAfterAllSkill(field, situation, list, list2, playPtn); + } + return num; + } + + public static void DamageAll(List targets, AIVirtualCard damageOwner, AIVirtualField field, int damage, AISituationInfo situation) + { + int baseDamage = field.DamageModifierCollection.CalcModifiedDamage(field, field.BestPlayPtn, situation, damageOwner, damage); + for (int i = 0; i < targets.Count; i++) + { + if ((targets[i].IsUnit || targets[i].IsLeader) && !targets[i].IsDead && !targets[i].IsIndependent) + { + targets[i].AddDamage(situation, baseDamage, isSkillDamage: true); + if (targets[i].IsLeader && targets[i].IsAlly) + { + field.AllyDamageCountInGame++; + field.AllyDamageCountInTurn++; + } + } + } + for (int j = 0; j < targets.Count; j++) + { + if (targets[j].IsDead) + { + targets[j].RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + } + } + + public static void DamageRandom(List targets, AIVirtualCard damageOwner, AIVirtualField field, int damage, AISituationInfo situation) + { + List bestPlayPtn = field.BestPlayPtn; + AIVirtualCard aIVirtualCard = SelectDamageTarget(targets, field, bestPlayPtn, situation, damage, damageOwner.IsSpell, AISelectTargetPattern.Worst); + if (aIVirtualCard != null && !aIVirtualCard.IsDead) + { + int baseDamage = field.DamageModifierCollection.CalcModifiedDamage(field, bestPlayPtn, situation, damageOwner, damage); + aIVirtualCard.AddDamage(situation, baseDamage, isSkillDamage: true); + if (aIVirtualCard.IsDead) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + } + } + + public static void DamageTarget(AISituationInfo situation, List candidates, AIVirtualCard damageOwner, AIVirtualField field, AIScriptTokenArgType whichTarget, int damage, int count) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("DamageTarget error!! No target!!!!!"); + return; + } + int baseDamage = field.DamageModifierCollection.CalcModifiedDamage(field, field.BestPlayPtn, situation, damageOwner, damage); + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + bool flag = candidates.Contains(aIVirtualCard); + for (int j = 0; j < count; j++) + { + if (aIVirtualCard.Life <= 0) + { + break; + } + if (flag) + { + aIVirtualCard.AddDamage(situation, baseDamage, isSkillDamage: true); + } + } + } + for (int k = 0; k < targets.Count; k++) + { + if (targets[k].IsDead) + { + targets[k].RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + } + } + + public static void ExecuteTargetSelectDamage(AIVirtualCard tagOwner, List candidates, AIVirtualField field, List playPtn, AISituationInfo situation, AIScriptTokenArgType selectType, int damageAmount, int selectCount = 1) + { + if (situation == null) + { + AIConsoleUtility.LogError("ExecuteTargetSelectDamage() Error!! situation is null!!!!!"); + } + else if (situation.IsTargetExists(selectType)) + { + DamageTarget(situation, candidates, tagOwner, field, selectType, damageAmount, selectCount); + } + else + { + DamageTargetPrediction(situation, candidates, tagOwner, field, playPtn, selectType, damageAmount, selectCount); + } + } + + private static void DamageTargetPrediction(AISituationInfo situation, List candidates, AIVirtualCard damageOwner, AIVirtualField field, List playPtn, AIScriptTokenArgType whichTarget, int damage, int count) + { + if (count > 0) + { + List candidates2 = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(candidates, damageOwner, playPtn); + if (count == 1) + { + AIVirtualCard target = SelectDamageTarget(candidates2, field, playPtn, situation, damage, damageOwner.IsSpell, AISelectTargetPattern.Best); + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, whichTarget); + DamageTarget(situation, candidates2, damageOwner, field, whichTarget, damage, count); + } + else + { + AIConsoleUtility.LogError("DamageTargetPrediction(): 複数選択ダメージのPrediction未対応"); + } + } + } + + public static void DamageRandomMultiSelect(List targets, AIVirtualCard owner, AIVirtualField field, int damage, int selectCount, AISituationInfo situation) + { + List list = null; + List bestPlayPtn = field.BestPlayPtn; + for (int i = 0; i < selectCount; i++) + { + AIVirtualCard aIVirtualCard = SelectDamageTarget(targets, field, bestPlayPtn, situation, damage, owner.IsSpell, AISelectTargetPattern.Worst); + if (aIVirtualCard == null || aIVirtualCard.IsDead) + { + break; + } + int baseDamage = field.DamageModifierCollection.CalcModifiedDamage(field, bestPlayPtn, situation, owner, damage); + aIVirtualCard.AddDamage(situation, baseDamage, isSkillDamage: true); + targets.Remove(aIVirtualCard); + if (targets.Count <= 0) + { + break; + } + if (aIVirtualCard.IsDead) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + if (list != null) + { + for (int j = 0; j < list.Count; j++) + { + list[j].RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: false); + } + } + } + + public static void DamageOldOrderedTargets(List targets, int damage, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (targets == null || targets.Count <= 0) + { + return; + } + int num = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damage); + AIVirtualCard aIVirtualCard = null; + List list = null; + for (int i = 0; i < targets.Count; i++) + { + if (num <= 0) + { + break; + } + AIVirtualCard aIVirtualCard2 = targets[i]; + if (aIVirtualCard2.IsAlly != tagOwner.IsAlly && aIVirtualCard2.IsLeader) + { + aIVirtualCard = aIVirtualCard2; + continue; + } + int num2 = 0; + num2 = ((aIVirtualCard != null || i != targets.Count - 1) ? Math.Min(aIVirtualCard2.Life, num) : num); + num -= num2; + aIVirtualCard2.AddDamage(situation, num2, isSkillDamage: true); + if (aIVirtualCard2.IsDead) + { + list = AIParamQuery.AddElementToList(aIVirtualCard2, list); + } + } + if (aIVirtualCard != null && num > 0) + { + aIVirtualCard.AddDamage(situation, num, isSkillDamage: true); + if (aIVirtualCard.IsDead) + { + return; + } + } + if (list != null) + { + for (int j = 0; j < list.Count; j++) + { + list[j].RemoveCard(situation, AIRemovalType.Destroy, isFromSkill: true); + } + } + } + + private static ulong GetArgumentHash(List targets, int damage, int damageCount) + { + ulong[] array = new ulong[12] + { + 907uL, 911uL, 919uL, 929uL, 937uL, 941uL, 947uL, 953uL, 967uL, 971uL, + 977uL, 983uL + }; + ulong num = 0uL; + for (int i = 0; i < targets.Count; i++) + { + num += targets[i].GetHash() * array[i]; + } + num += (ulong)((long)damage * 3L); + return num + (ulong)((long)damageCount * 313L); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDeckSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIDeckSimulationUtility.cs new file mode 100644 index 0000000..7f373ab --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDeckSimulationUtility.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIDeckSimulationUtility +{ + public static List GetFilteredDeck(List filter, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(tagOwner.IsAlly ? field.AI.AllyDeckCards : field.AI.EnemyDeckCards, filter, tagOwner, playPtn, situation); + if (list == null) + { + list = new List(); + } + List list2 = AIFilteringUtility.MultipleFiltering(field.DummyDeckContainer.GetDeck(tagOwner.IsAlly), filter, tagOwner, playPtn, situation); + if (list2 != null) + { + list.AddRange(list2); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDefaultSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIDefaultSelectLogicArgument.cs new file mode 100644 index 0000000..d33ba8c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDefaultSelectLogicArgument.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AIDefaultSelectLogicArgument : AISelectLogicArgumentBase +{ + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.DEFAULT_LOGIC; + + public AIDefaultSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + return candidates[0]; + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + int num = Mathf.Min(candidates.Count, selectCount); + List list = new List(); + for (int i = 0; i < num; i++) + { + list.Add(candidates[i]); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDestroySelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIDestroySelectLogicArgument.cs new file mode 100644 index 0000000..0bc992a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDestroySelectLogicArgument.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIDestroySelectLogicArgument : AISelectLogicArgumentBase +{ + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.DESTROY_LOGIC; + + public AIDestroySelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + return AISimulationRemovalUtility.SelectRemovalTarget(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Destroy); + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + return AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Destroy, selectCount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDestroySimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIDestroySimulationUtility.cs new file mode 100644 index 0000000..8659fa4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDestroySimulationUtility.cs @@ -0,0 +1,343 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIDestroySimulationUtility +{ + public static float CalcEvalDestroy(AIVirtualCard card, List playPtn, AISituationInfo situation, bool useIgnoreBreak) + { + return (card.EvaluateValueOnField(playPtn, situation, useStyle: true, doesUseLostLife: true, useOthersTag: true, useIgnoreBreak) - card.GetAllBreakBonus(playPtn, useIgnoreBreak) - card.GetAllLeaveBonus(playPtn, useIgnoreBreak)) * (card.IsAlly ? (-1f) : 1f); + } + + public static float EvalTargetingDestroy(List filters, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(tagOwner.SelfField.CardListSet.BothInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0f; + } + list = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(list, tagOwner, playPtn); + int num = 0; + float num2 = float.MinValue; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (aIVirtualCard.IsAlly == tagOwner.IsAlly || (!aIVirtualCard.IsUntouchable && !aIVirtualCard.IsSneak)) + { + num++; + float num3 = 0f; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsIndestructible) + { + num3 = CalcEvalDestroy(aIVirtualCard, playPtn, situation, useIgnoreBreak: false); + } + if (num3 > num2) + { + num2 = num3; + } + } + } + if (num == 0) + { + num2 = 0f; + } + return num2; + } + + public static float EvalTargetingOtherDestroy(List target_filters, List destroy_filters, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, int select_count) + { + AIVirtualField selfField = tagOwner.SelfField; + List list = AIFilteringUtility.MultipleFiltering(selfField.CardListSet.BothInplayCards, target_filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0f; + } + List list2 = null; + List list3 = new List(); + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (aIVirtualCard.IsUntouchable || aIVirtualCard.IsSneak) + { + if (list2 == null) + { + list2 = new List(); + } + list2.Add(aIVirtualCard); + bool flag = AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, selfField.AllyHandCards, destroy_filters, playPtn, tagOwner, situation); + if (aIVirtualCard.IsIndependent || aIVirtualCard.IsIndestructible || !flag) + { + list3.Add(0f); + continue; + } + float item = CalcEvalDestroy(aIVirtualCard, playPtn, situation, useIgnoreBreak: false); + list3.Add(item); + } + } + if (list2 != null && list.Count - list2.Count < select_count) + { + return 0f; + } + List list4 = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(list, tagOwner, playPtn); + List list5 = null; + for (int j = 0; j < list4.Count; j++) + { + if (list5 == null) + { + list5 = new List(); + } + AIVirtualCard aIVirtualCard2 = list4[j]; + bool flag2 = AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard2, selfField.AllyHandCards, destroy_filters, playPtn, tagOwner, situation); + if (aIVirtualCard2.IsIndependent || aIVirtualCard2.IsIndestructible || !flag2) + { + list5.Add(0f); + continue; + } + float item2 = CalcEvalDestroy(aIVirtualCard2, playPtn, situation, useIgnoreBreak: false); + list5.Add(item2); + } + list5?.Sort((float score0, float score1) => (int)(score1 - score0)); + List list6 = new List(); + for (int num = 0; num < list.Count; num++) + { + int num2 = 0; + for (num2 = 0; num2 < list4.Count; num2++) + { + if (list[num].Equals(list4[num2])) + { + num2 = 99999999; + break; + } + } + int num3 = 0; + num3 = 0; + while (list2 != null && num3 < list2.Count) + { + if (list[num].Equals(list2[num3])) + { + num3 = 99999999; + break; + } + num3++; + } + if (num2 != 99999999 && num3 != 99999999) + { + list6.Add(list[num]); + } + } + List list7 = null; + if (list6.Count > 0) + { + list7 = new List(); + for (int num4 = 0; num4 < list6.Count; num4++) + { + AIVirtualCard aIVirtualCard3 = list6[num4]; + bool flag3 = AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard3, selfField.AllyHandCards, destroy_filters, playPtn, tagOwner, situation); + if (aIVirtualCard3.IsIndependent || aIVirtualCard3.IsIndestructible || !flag3) + { + list7.Add(0f); + continue; + } + float item3 = CalcEvalDestroy(aIVirtualCard3, playPtn, situation, useIgnoreBreak: false); + list7.Add(item3); + } + list7.Sort((float score0, float score1) => (int)(score1 - score0)); + } + List list8 = new List(); + if (list3 != null) + { + list8.AddRange(list3); + } + if (list7 != null) + { + list8.AddRange(list7); + } + if (list5 != null) + { + list8.AddRange(list5); + } + int num5 = list.Count - select_count; + if (num5 >= list8.Count) + { + return 0f; + } + float num6 = 0f; + for (int num7 = 0; num7 < num5; num7++) + { + num6 += list8[num7]; + } + return num6; + } + + public static float EvalTargetingMultiDestroy(List filter, int selectableCount, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + float num = 0f; + List list = AIFilteringUtility.MultipleFiltering(tagOwner.SelfField.CardListSet.BothInplayCards, filter, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0f; + } + list.RemoveAll((AIVirtualCard c) => c.IsAlly != tagOwner.IsAlly && (c.IsUntouchable || c.IsSneak)); + if (list.Count <= selectableCount) + { + for (int num2 = 0; num2 < list.Count; num2++) + { + AIVirtualCard aIVirtualCard = list[num2]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsIndestructible) + { + float num3 = CalcEvalDestroy(aIVirtualCard, playPtn, situation, useIgnoreBreak: false); + num += num3; + } + } + return num; + } + List list2 = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(list, tagOwner, playPtn); + if (list2.Count <= selectableCount) + { + for (int num4 = 0; num4 < list2.Count; num4++) + { + AIVirtualCard aIVirtualCard2 = list2[num4]; + num += CalcEvalDestroy(aIVirtualCard2, playPtn, situation, useIgnoreBreak: false); + list.Remove(aIVirtualCard2); + selectableCount--; + if (selectableCount <= 0) + { + return num; + } + } + } + else + { + list = list2; + } + Dictionary dictionary = new Dictionary(); + for (int num5 = 0; num5 < list.Count; num5++) + { + AIVirtualCard aIVirtualCard3 = list[num5]; + dictionary.Add(aIVirtualCard3, CalcEvalDestroy(aIVirtualCard3, playPtn, situation, useIgnoreBreak: false)); + } + for (int num6 = 0; num6 < selectableCount; num6++) + { + float num7 = float.MinValue; + AIVirtualCard aIVirtualCard4 = null; + for (int num8 = 0; num8 < list.Count; num8++) + { + AIVirtualCard aIVirtualCard5 = list[num8]; + float num9 = dictionary[aIVirtualCard5]; + if (num9 > num7) + { + num7 = num9; + aIVirtualCard4 = aIVirtualCard5; + } + } + num += num7; + if (aIVirtualCard4 != null) + { + list.Remove(aIVirtualCard4); + dictionary.Remove(aIVirtualCard4); + } + } + return num; + } + + public static float EvalAllDestroy(List argList, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(tagOwner.SelfField.CardListSet.BothInplayCards, argList, tagOwner, playPtn, situation); + if (list == null || list.Count == 0) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsIndestructible) + { + float num2 = CalcEvalDestroy(aIVirtualCard, playPtn, situation, useIgnoreBreak: false); + num += num2; + } + } + return num; + } + + public static float EvalRandomDestroy(List argList, int count, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + AIVirtualField selfField = tagOwner.SelfField; + if (count == 0) + { + return 0f; + } + List list = AIFilteringUtility.MultipleFiltering(selfField.CardListSet.BothInplayCards, argList, tagOwner, playPtn, situation); + if (list == null || list.Count == 0) + { + return 0f; + } + float num = 0f; + if (list.Count <= count) + { + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsIndestructible) + { + float num2 = CalcEvalDestroy(aIVirtualCard, playPtn, situation, useIgnoreBreak: false); + num += num2; + } + } + return num; + } + List list2 = new List(); + for (int j = 0; j < list.Count; j++) + { + list2.Add(j); + } + List list3 = AIMathematicsLibrary.EnumerateCombinations(list2, count).ToList(); + for (int k = 0; k < list3.Count; k++) + { + int[] array = list3[k]; + for (int l = 0; l < array.Length; l++) + { + AIVirtualCard aIVirtualCard2 = list[array[l]]; + if (!aIVirtualCard2.IsIndependent && !aIVirtualCard2.IsIndestructible) + { + float num3 = CalcEvalDestroy(aIVirtualCard2, playPtn, situation, useIgnoreBreak: false); + num += num3; + } + } + } + return num / (float)list3.Count; + } + + public static void ExecuteTargetSelectDestroy(AIVirtualCard owner, List targets, AIVirtualField field, List playPtn, AISituationInfo situation, AIScriptTokenArgType selectType, int selectCount = 1) + { + if (situation == null) + { + AIConsoleUtility.LogError("ExecuteTargetSelectDestroy() Error!! situation is null!!!!!"); + } + else if (situation.IsTargetExists(selectType)) + { + AISkillSimulationUtility.DestroyTarget(situation, targets, selectType); + } + else + { + DestroyTargetPrediction(owner, targets, field, playPtn, situation, selectCount, selectType); + } + } + + private static void DestroyTargetPrediction(AIVirtualCard tagOwner, List candidates, AIVirtualField field, List playPtn, AISituationInfo situation, int selectCount, AIScriptTokenArgType whichTarget) + { + AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(candidates, tagOwner, playPtn); + if (selectCount <= 1) + { + AIVirtualCard target = AISimulationRemovalUtility.SelectRemovalTarget(candidates, tagOwner, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Destroy); + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, whichTarget); + AISkillSimulationUtility.DestroyTarget(situation, candidates, whichTarget); + } + else + { + List targets = AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates, tagOwner, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Destroy, selectCount); + situation.SetMultipleTargetsInInfo(targets, TargetSelectType.Default, AIRemovalType.Destroy, whichTarget); + AISkillSimulationUtility.DestroyTarget(situation, candidates, whichTarget); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIDrawCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIDrawCountUtility.cs new file mode 100644 index 0000000..131938a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIDrawCountUtility.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIDrawCountUtility +{ + public static int GetDrawCount(AIVirtualCard owner, AIVirtualField field, List playPtn, AIScriptTokenArgType period, AIScriptTokenArgType range) + { + int num = 0; + switch (range) + { + case AIScriptTokenArgType.PLAYPTN: + return num + GetDrawCountOfPlayptn(owner, field, playPtn); + case AIScriptTokenArgType.PLAYED: + return num + GetDrawCountOfPlayed(period, field); + default: + num += GetDrawCountOfPlayptn(owner, field, playPtn); + return num + GetDrawCountOfPlayed(period, field); + } + } + + private static int GetDrawCountOfPlayptn(AIVirtualCard owner, AIVirtualField field, List playPtn) + { + if (playPtn == null || playPtn.Count <= 0) + { + return 0; + } + AISinglePlayptnRecord playptnRecordOnSim = field.GetPlayptnRecordOnSim(playPtn); + if (playptnRecordOnSim == null) + { + return 0; + } + int num = 0; + List playedCardList = playptnRecordOnSim.PlayedCardList; + for (int i = 0; i < playedCardList.Count && !playedCardList[i].Card.IsSameCard(owner); i++) + { + num += playedCardList[i].DrawCount; + } + return num; + } + + private static int GetDrawCountOfPlayed(AIScriptTokenArgType period, AIVirtualField field) + { + int virtualDrawCount = field.VirtualDrawCount; + return period switch + { + AIScriptTokenArgType.TURN => virtualDrawCount + field.TurnDrawCount, + AIScriptTokenArgType.GAME => virtualDrawCount + field.GameDrawCount, + _ => 0, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEmoteCtrlNull.cs b/SVSim.BattleEngine/Engine/Wizard/AIEmoteCtrlNull.cs new file mode 100644 index 0000000..f2d1b69 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEmoteCtrlNull.cs @@ -0,0 +1,48 @@ +namespace Wizard; + +public class AIEmoteCtrlNull : IAIEmoteCtrl +{ + public void SetUpEmoteEvent(BattlePlayerBase self, BattlePlayerBase opponent, OperateMgr operateManager) + { + } + + public AIEmoteCmd OnOpponentEmotion(ClassCharaPrm.EmotionType emoteType) + { + return null; + } + + public AIEmoteCmd OnAllyTurnStart(AISituationInfo situation) + { + return null; + } + + public AIEmoteCmd OnAllyTurnEnd() + { + return null; + } + + public AIEmoteCmd OnOpponentTurnStart(AISituationInfo situation) + { + return null; + } + + public AIEmoteCmd OnOpponentTurnEnd() + { + return null; + } + + public AIEmoteCmd OnCardPlay(AISituationInfo situation) + { + return null; + } + + public AIEmoteCmd OnCardDestroy(AISituationInfo situation) + { + return null; + } + + public AIEmoteCmd OnAllyEvolution(AISituationInfo situation) + { + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEnemyHandTagCollectionContainer.cs b/SVSim.BattleEngine/Engine/Wizard/AIEnemyHandTagCollectionContainer.cs new file mode 100644 index 0000000..44a1be6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEnemyHandTagCollectionContainer.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +internal class AIEnemyHandTagCollectionContainer : AITagCollectionContainer +{ + private readonly AIPlayTagType[] ENEMY_HAND_LEGAL_TAG_TYPES = new AIPlayTagType[19] + { + AIPlayTagType.TurnEndAttachTag, + AIPlayTagType.Enhance, + AIPlayTagType.Accelerate, + AIPlayTagType.Crystalize, + AIPlayTagType.ChoiceTransform, + AIPlayTagType.GenerateTag, + AIPlayTagType.PlayCopyTag, + AIPlayTagType.FanfareCopyTag, + AIPlayTagType.PlayAttachTag, + AIPlayTagType.FanfareAttachTag, + AIPlayTagType.PlaySelect, + AIPlayTagType.FanfareSelect, + AIPlayTagType.PlayHandSelect, + AIPlayTagType.FanfareHandSelect, + AIPlayTagType.FanfareAttachStyle, + AIPlayTagType.PlayReanimate, + AIPlayTagType.FanfareReanimate, + AIPlayTagType.PlayRemoveSkill, + AIPlayTagType.FanfareRemoveSkill + }; + + public AIEnemyHandTagCollectionContainer() + { + } + + public AIEnemyHandTagCollectionContainer(AITagCollectionContainer container, AIVirtualCard owner) + { + if (container.Count <= 0) + { + return; + } + _holdingTagTypes = new List(); + _holdingTagCollectionTypes = new List(); + base.TagDictionary = new List(); + for (int i = 0; i < container.Count; i++) + { + TagCollectionWithTypeBase tagCollectionWithTypeBase = container.TagDictionary[i]; + if (IsEnemyHandLegalTagCollection(tagCollectionWithTypeBase)) + { + base.TagDictionary.Add(tagCollectionWithTypeBase.Clone()); + tagCollectionWithTypeBase.RegisterTypes(_holdingTagTypes); + _holdingTagCollectionTypes.Add(tagCollectionWithTypeBase.Collection.Type); + } + } + CreateFixedUseCostListWhenInit(owner, owner.SelfField); + } + + public override void InitTags(AIVirtualCard owner, AIParamQuery query) + { + int tagCount = query.GetTagCount(owner); + for (int i = 0; i < tagCount; i++) + { + AIPlayTag tag = query.GetTag(owner, i); + if (Array.IndexOf(ENEMY_HAND_LEGAL_TAG_TYPES, tag.Type) >= 0) + { + AddTag(tag, owner, null); + } + } + CreateFixedUseCostListWhenInit(owner, owner.SelfField); + } + + private bool IsEnemyHandLegalTagCollection(TagCollectionWithTypeBase tagCollectionWithTypes) + { + for (int i = 0; i < ENEMY_HAND_LEGAL_TAG_TYPES.Length; i++) + { + if (tagCollectionWithTypes.IsUnderManagement(ENEMY_HAND_LEGAL_TAG_TYPES[i])) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEnhanceUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIEnhanceUtility.cs new file mode 100644 index 0000000..a0fffe2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEnhanceUtility.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIEnhanceUtility +{ + public static bool IsEnhanced(AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (card == null || card.EnhanceCostList == null) + { + return false; + } + AIVariableResultContainer valResultContainer = field.AI.ValResultContainer; + ulong hash = AIFunctionResultHashCalculator.GetHash(card, field, playPtn, null, 0uL); + if (valResultContainer.GetContainsResultValue(AIScriptTokenVariableType.IS_ENHANCED, hash, out var getResult)) + { + return getResult == 1f; + } + bool flag = false; + if (card.PlayedCost < 0 && card.IsInHand) + { + List playPtn2 = (card.IsAlly ? playPtn : null); + flag = field.AI.PlayPtnRecorder.IsCardPlayingSimulationType(card, field, playPtn2, situation, PlaySimulationType.Enhance); + } + else + { + flag = card.PlayedCost >= 0 && card.EnhanceCostList.Contains(card.PlayedCost); + } + valResultContainer.CheckDuplicateAndAddRecord(AIScriptTokenVariableType.IS_ENHANCED, hash, flag ? 1f : 0f, $"IsEnhanced(): Already hashed target and not equal value. CardName:[{card.CardName}] hash:[{hash}]"); + return flag; + } + + public static int GetEnhanceCost(AIVirtualCard card, AIVirtualField field, List playPtn) + { + if (card == null || card.EnhanceCostList == null) + { + return -1; + } + if (card.PlayedCost >= 0) + { + if (card.EnhanceCostList.Contains(card.PlayedCost)) + { + return card.PlayedCost; + } + return -1; + } + List playPtn2 = (card.IsAlly ? playPtn : null); + return field.AI.PlayPtnRecorder.GetCardPlaySimulationTypeCost(card, field, playPtn2, null, PlaySimulationType.Enhance); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvalAttackRemoveUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvalAttackRemoveUtility.cs new file mode 100644 index 0000000..44fe9f7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvalAttackRemoveUtility.cs @@ -0,0 +1,149 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIEvalAttackRemoveUtility +{ + private const int REMOVE_TYPE_INDEX = 1; + + private const int REMOVE_COUNT_INDEX = 0; + + public static float EvalAttackRemove(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List argList) + { + List list = (tagOwner.IsAlly ? field.EnemyInplayCards : field.AllyInplayCards); + if (list.Count <= 0) + { + return 0f; + } + List list2 = null; + List list3 = null; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsCantUnderAnyAttack()) + { + if (aIVirtualCard.IsGuard) + { + list2 = AIParamQuery.AddElementToList(aIVirtualCard, list2); + } + else + { + list3 = AIParamQuery.AddElementToList(aIVirtualCard, list3); + } + } + } + int num = list2?.Count ?? 0; + int num2 = list3?.Count ?? 0; + if (num + num2 <= 0) + { + return 0f; + } + int removeCount = (int)argList[0].Value; + AIScriptTokenArgType removeType = GetRemoveType(argList[1]); + List replacedTargetSideInplayCardList = new List(list); + return CalculateAttackRemoveValue(tagOwner, field, playPtn, removeCount, removeType, list2, list3, replacedTargetSideInplayCardList); + } + + private static float CalculateAttackRemoveValue(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, int removeCount, AIScriptTokenArgType removeType, List guardList, List nonGuardList, List replacedTargetSideInplayCardList) + { + AIVirtualCard sourceCard = AIInstantAttackUtility.CreateDummyAttacker(field, tagOwner, 1, 1, 1, isEvalRush: true); + Dictionary dictionary = null; + if (removeCount > 1) + { + dictionary = new Dictionary(); + } + float num = 0f; + for (int i = 0; i < removeCount; i++) + { + List list = ((guardList == null || guardList.Count <= 0) ? nonGuardList : guardList); + if (list == null) + { + break; + } + float num2 = float.MinValue; + AIVirtualCard aIVirtualCard = null; + bool flag = false; + for (int j = 0; j < list.Count; j++) + { + AIVirtualCard aIVirtualCard2 = list[j]; + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(sourceCard, aIVirtualCard2); + bool isRemoved = false; + if (!AIAttackSimulationUtility.IsAttackPossible(field, aIVirtualAttackInfo, replacedTargetSideInplayCardList)) + { + continue; + } + float num3; + if (removeCount > 1 && dictionary.ContainsKey(aIVirtualCard2.CardIndex)) + { + (num3, isRemoved) = dictionary[aIVirtualCard2.CardIndex]; + } + else + { + num3 = CalculateSingleRemoveValue(aIVirtualAttackInfo, field, playPtn, removeType, ref isRemoved); + if (removeCount > 1) + { + dictionary.Add(aIVirtualCard2.CardIndex, (num3, isRemoved)); + } + } + if (num3 > num2) + { + num2 = num3; + aIVirtualCard = aIVirtualCard2; + flag = isRemoved; + } + } + if (aIVirtualCard == null) + { + break; + } + num += num2; + if (flag) + { + list.Remove(aIVirtualCard); + replacedTargetSideInplayCardList.Remove(aIVirtualCard); + if (removeCount > 1) + { + dictionary.Remove(aIVirtualCard.CardIndex); + } + } + } + AIInstantAttackUtility.RemoveDummyCardFromField(field); + return num; + } + + private static float CalculateSingleRemoveValue(AIVirtualAttackInfo situation, AIVirtualField field, List playPtn, AIScriptTokenArgType removeType, ref bool isRemoved) + { + AIVirtualCard attackTarget = situation.AttackTarget; + isRemoved = true; + AIRemovalType removeType2; + switch (removeType) + { + case AIScriptTokenArgType.DESTROY: + removeType2 = AIRemovalType.Destroy; + isRemoved = !attackTarget.IsIndependent && !attackTarget.IsIndestructible; + break; + case AIScriptTokenArgType.BANISH: + removeType2 = AIRemovalType.Banish; + isRemoved = !attackTarget.IsIndependent && !attackTarget.IsUnbanishable; + break; + default: + AIConsoleUtility.LogError("AIEvalAttackRemoveUtility.CalculateSingleRemoveValue() error!! Not implemented removeType = " + removeType); + isRemoved = false; + return 0f; + } + if (isRemoved) + { + return AISimulationRemovalUtility.CalculateRemovalValue(attackTarget, field, playPtn, situation, removeType2, null); + } + return 0f; + } + + private static AIScriptTokenArgType GetRemoveType(AIScriptTokenBase token) + { + if (token is AIScriptArgumentToken aIScriptArgumentToken) + { + return aIScriptArgumentToken.ArgumentType; + } + return AIScriptTokenArgType.NONE; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvalReanimateUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvalReanimateUtility.cs new file mode 100644 index 0000000..66239cb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvalReanimateUtility.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIEvalReanimateUtility +{ + private const int SIDE_INDEX = 0; + + private const int REANIMATE_COST_INDEX = 1; + + public static float EvalReanimate(AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, List argList) + { + if (argList.Count < 2) + { + AIConsoleUtility.LogError("EVAL_REANIMATE error!!! argList count = " + argList.Count); + return 0f; + } + argList.Reverse(); + if (!TryGetIsSummonToAllySide(argList[0], out var isSummonToAllySide)) + { + return 0f; + } + int reanimateCost = (int)argList[1].Value; + argList.RemoveRange(0, 2); + return EvalReanimate(tagOwner, isSummonToAllySide, reanimateCost, argList, playPtn, situation); + } + + private static float EvalReanimate(AIVirtualCard tagOwner, bool isSummonAllyField, int reanimateCost, List filters, List playPtn, AISituationInfo situation) + { + float num = 0f; + AIVirtualField selfField = tagOwner.SelfField; + List list = (((tagOwner.IsAlly && isSummonAllyField) || (!tagOwner.IsAlly && !isSummonAllyField)) ? selfField.CardListSet.AllyDestroyedCards : selfField.CardListSet.EnemyDestroyedCards); + if (list == null || list.Count <= 0) + { + return 0f; + } + list = AIReanimateSimulationUtility.FilteringReanimateTargets(list, reanimateCost, tagOwner, filters, playPtn, situation); + if (list != null && list.Count > 0) + { + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard target = list[i]; + num += EvalReanimateTargetValue(target, selfField, playPtn, situation); + } + num /= (float)list.Count; + } + return num * (isSummonAllyField ? 1f : (-1f)); + } + + public static float EvalReanimateTargetValue(AIVirtualCard target, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return ((float)(target.DefaultAttack * target.DefaultMaxAttackableCount) + (float)target.DefaultLife + field.StyleQuery.GetUnitBonus(field, target, playPtn)) * field.StyleQuery.GetUnitRate(field, target, playPtn) * target.EvaluateAllBattleBonusRate(playPtn, useOthersTag: true, useIgnoreInBattle: false, situation) + target.GetFieldBonus(playPtn) + target.GetReanimateBonus(playPtn); + } + + private static bool TryGetIsSummonToAllySide(AIScriptTokenBase sideToken, out bool isSummonToAllySide) + { + if (sideToken is AIScriptArgumentToken { ArgumentType: var argumentType }) + { + switch (argumentType) + { + case AIScriptTokenArgType.ALLY: + isSummonToAllySide = true; + return true; + case AIScriptTokenArgType.OPPONENT: + isSummonToAllySide = false; + return true; + } + } + AIConsoleUtility.LogError("EVAL_REANIMATE error!!! Argument[0] is not ALLY or ENEMY"); + isSummonToAllySide = true; + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIEvaluateTagExtension.cs b/SVSim.BattleEngine/Engine/Wizard/AIEvaluateTagExtension.cs new file mode 100644 index 0000000..4ad44ac --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIEvaluateTagExtension.cs @@ -0,0 +1,1088 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIEvaluateTagExtension +{ + public static int GetChoiceTransformCost(this AIVirtualCard card, AIVirtualField field, List playPtn) + { + return AIChoiceTransformUtility.GetChoiceTransformCost(card, field, playPtn); + } + + public static bool IsEnhanced(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (tagOwner == null) + { + return false; + } + return AIEnhanceUtility.IsEnhanced(tagOwner, field, playPtn, situation); + } + + public static bool IsAccelerated(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (tagOwner == null) + { + return false; + } + return AIAccelerateUtility.IsAccelerate(tagOwner, field, playPtn, situation); + } + + public static bool IsCrystalize(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation = null) + { + if (tagOwner == null) + { + return false; + } + return AICrystalizeUtility.IsCrystalize(tagOwner, field, playPtn, situation); + } + + public static float EvaluateValueOnField(this AIVirtualCard card, List playPtn, AISituationInfo situation, bool useStyle, bool doesUseLostLife = true, bool useOthersTag = true, bool useIgnoreInBattle = false) + { + if (card.IsUnit) + { + float num = card.EvaluateUnitBase(playPtn, useStyle, doesUseLostLife) + card.GetFieldBonus(playPtn); + float num2 = card.EvaluateAllBattleBonusRate(playPtn, useOthersTag, useIgnoreInBattle, situation); + if (useStyle) + { + num2 *= card.SelfField.StyleQuery.GetUnitRate(card.SelfField, card, playPtn); + } + return num * num2; + } + return card.GetFieldBonus(playPtn); + } + + public static float EvaluateUnitBase(this AIVirtualCard card, List playPtn, bool useStyle, bool doseUseLostLife = true) + { + float num = card.Attack * card.MaxAttackableCount; + num += (doseUseLostLife ? ((float)card.Life) : ((float)card.DefLife - (float)(card.DefLife - card.Life) * 0.01f)); + if (useStyle) + { + num += card.SelfField.StyleQuery.GetUnitBonus(card.SelfField, card, playPtn); + } + return num; + } + + public static float EvaluateBounceValue(this AIVirtualCard card, List playPtn, int restPp, bool useStyle = true) + { + float num = 0f; + num = card.EvaluateValueOnField(playPtn, null, useStyle, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true); + if (card.IsAlly) + { + if (card.Cost > restPp) + { + return 0f - num + card.GetBounceBonus() + card.EvaluateLeaveValue(playPtn, useIgnoreInBattle: true); + } + return num - (float)(card.Attack - card.BaseParameter.DefaultAttack) - (float)(card.Life - card.BaseParameter.DefaultLife) - num + card.GetBounceBonus() + card.EvaluateLeaveValue(playPtn, useIgnoreInBattle: true); + } + return num + card.EvaluateBreakValue(playPtn, useIgnoreBreak: true) - card.GetBounceBonus() - card.EvaluateLeaveValue(playPtn, useIgnoreInBattle: true); + } + + public static float GetBounceBonus(this AIVirtualCard tagOwner) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BounceBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.BounceBonusTags.GetBounceBonus(tagOwner.SelfField, tagOwner); + } + + public static float GetGetOffTokenValue(this AIVirtualCard tagOwner, List playPtn, bool useIgnoreInBattle) + { + if (!tagOwner.IsGetOn || useIgnoreInBattle) + { + return 0f; + } + float num = 0f; + AIVirtualField selfField = tagOwner.SelfField; + AIVirtualCard tokenFromId = selfField.AI.tokenManager.GetTokenFromId(tagOwner.GetOnCardId, tagOwner.IsAlly, selfField); + if (tokenFromId != null) + { + num += tokenFromId.EvaluateValueOnField(playPtn, null, useStyle: true, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle); + } + return num; + } + + public static float EvaluateLeaveValue(this AIVirtualCard card, List playPtn, bool useIgnoreInBattle, AISituationInfo situation = null) + { + float num = card.GetLeaveBonus(playPtn, useIgnoreInBattle, situation); + if (useIgnoreInBattle) + { + num += card.GetLeaveTokenBonus(playPtn, useIgnoreInBattle, situation); + } + return num; + } + + public static float GetPriority(this AIVirtualCard card, List playPtn) + { + if (card == null) + { + return 0f; + } + float num = 0f; + AIVirtualTargetSelectAction situation = new AIVirtualTargetSelectAction(card, card, AIOperationType.PLAY); + if (card.AIData != null) + { + num += card.AIData.PriorityExpr.EvalArg(card, playPtn, card.SelfField, situation); + } + if (card.TagCollectionContainer.HasTag(AIPlayTagType.Priority)) + { + num += card.TagCollectionContainer.PriorityTags.GetPriorityBonus(card, playPtn, situation); + } + return num; + } + + public static float EvaluatePlayValue(this AIVirtualCard card, List playPtn, AISituationInfo situation = null) + { + if (card == null) + { + return 0f; + } + AIVirtualField selfField = card.SelfField; + return (card.AIData.PlayBonusExpr.EvalArg(card, playPtn, selfField, situation) + card.GetPlayBonus(playPtn, situation) + card.GetFanfareBonus(playPtn, situation) + AIEvaluateBonusFromOhterUtility.GetAllyPlayBonus(card, playPtn, situation) + AIEvaluateBonusFromOhterUtility.GetEnemyPlayBonus(card, playPtn, situation)) * card.GetPlayBonusRate(playPtn, situation); + } + + public static float GetPlayBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.PlayBonusTags.GetPlayBonus(tagOwner, playPtn, situation); + } + + public static float GetPlayBonusRate(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayBonusRate)) + { + return 1f; + } + return tagOwner.TagCollectionContainer.PlayBonusRateTags.GetPlayBonusRate(tagOwner, playPtn, situation); + } + + public static float GetFanfareBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.FanfareBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.FanfareBonusTags.GetFanfareBonus(tagOwner, playPtn, situation); + } + + public static bool IsEnableIgnoreFanfareBonus(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.IgnoreFanfareBonus)) + { + return false; + } + return tagOwner.TagCollectionContainer.IgnoreFanfareBonusTags.IsEnableIgnoreFanfareBonus(tagOwner, playPtn); + } + + public static int GetHandPlusCount(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.HandPlus)) + { + return 0; + } + return tagOwner.TagCollectionContainer.HandPlusTags.GetHandPlus(tagOwner, playPtn); + } + + public static float GetAllyPlayBonus(this AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn, AISituationInfo situation, ref float currentUseMinValue) + { + if (tagOwner.IsDead || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.AllyPlayBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.AllyPlayBonusTags.GetAllyPlayBonus(tagOwner, targetCard, playPtn, situation, ref currentUseMinValue); + } + + public static float GetEnemyPlayBonus(this AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn, AISituationInfo situation) + { + if (tagOwner.IsDead || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.EnemyPlayBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.EnemyPlayBonusTags.GetEnemyPlayBonus(tagOwner, targetCard, playPtn, situation); + } + + public static int GetCostBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.CostBonus)) + { + return 0; + } + return tagOwner.TagCollectionContainer.CostBonusTags.GetCostBonus(tagOwner, playPtn, situation); + } + + public static int GerWhenPlayRecoverPp(this AIVirtualCard tagOwner, AIVirtualCard playCard, List playPtn, AISituationInfo situation) + { + int num = 0; + if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayRecoverPP)) + { + PlayTagCollection playTags = tagOwner.TagCollectionContainer.PlayTags; + num += playTags.GetWhenPlayRecoverPp(tagOwner, playPtn, situation); + } + if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.FanfareRecoverPp)) + { + FanfareTagCollection fanfareTags = tagOwner.TagCollectionContainer.FanfareTags; + num += fanfareTags.GetWhenPlayRecoverPp(tagOwner, playPtn, situation); + } + return num; + } + + public static int GetOtherPlayRecoverPp(this AIVirtualCard tagOwner, AIVirtualCard playCard, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OtherPlayRecoverPp)) + { + return 0; + } + return tagOwner.TagCollectionContainer.OtherPlayTags.GetTotalOtherPlayRecoverPp(tagOwner, playCard, field, playPtn, situation); + } + + public static int GetPlayDrawCount(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayDraw)) + { + return 0; + } + return tagOwner.TagCollectionContainer.PlayDrawTags.GetPlayDrawCount(tagOwner, playPtn, situation); + } + + public static float GetPlayLimit(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayLimit)) + { + return float.MinValue; + } + return tagOwner.TagCollectionContainer.PlayLimitTags.GetPlayLimit(tagOwner, playPtn); + } + + public static float GetPlayPtnBonus(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayptnBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.PlayptnBonusTags.GetPlayPtnBonus(tagOwner, playPtn); + } + + public static float GetFieldBonus(this AIVirtualCard card, List playPtn) + { + return 0f + card.GetBattleBonus(playPtn) + AIEvaluateBonusFromOhterUtility.GetOtherBattleBonus(card, playPtn); + } + + public static float GetAttackBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.AttackBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.AttackBonusTags.GetAttackBonus(tagOwner, playPtn, situation); + } + + public static float GetBattleBonus(this AIVirtualCard tagOwner, List playPtn) + { + float num = 0f; + if (tagOwner.AIData != null && !tagOwner.AIData.BattleBonusExpr.IsHoldingEVAL() && !tagOwner.IsSkillLost) + { + num = tagOwner.AIData.BattleBonusExpr.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + } + if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BattleBonus)) + { + num += tagOwner.TagCollectionContainer.BattleBonusTags.GetBattleBonus(tagOwner, playPtn); + } + return num; + } + + public static float GetOtherBattleBonusFromOneCard(this AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn) + { + if (targetCard.IsSameCard(tagOwner)) + { + return 0f; + } + float num = 0f; + if (tagOwner.IsAlly == targetCard.IsAlly) + { + if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.MemberBattleBonus)) + { + num += tagOwner.TagCollectionContainer.MemberBattleBonusTags.GetMemberBattleBonus(tagOwner, targetCard, playPtn); + } + } + else if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.EnemyBattleBonus)) + { + num += tagOwner.TagCollectionContainer.EnemyBattleBonusTags.GetEnemyBattleBonus(tagOwner, targetCard, playPtn); + } + return num; + } + + public static float EvaluateAllBattleBonusRate(this AIVirtualCard targetCard, List playPtn, bool useOthersTag, bool useIgnoreInBattle, AISituationInfo situation) + { + float num = 1f; + num *= targetCard.GetBattleBonusRate(playPtn); + if (useOthersTag) + { + num *= AIEvaluateBonusFromOhterUtility.GetOtherBattleBonusRate(targetCard, playPtn, useIgnoreInBattle, situation); + } + return num; + } + + public static float GetBattleBonusRate(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BattleBonusRate)) + { + return 1f; + } + return tagOwner.TagCollectionContainer.BattleBonusRateTags.GetBattleBonusRate(tagOwner, playPtn); + } + + public static float GetOtherBattleBonusRateFromOneCard(this AIVirtualCard tagOwner, AIVirtualCard targetCard, List playPtn, bool useIgnoreInBattle, AISituationInfo situation) + { + if (tagOwner.IsSameCard(targetCard)) + { + return 1f; + } + float result = 1f; + if (tagOwner.IsAlly == targetCard.IsAlly) + { + if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.MemberBattleBonusRate)) + { + result = tagOwner.TagCollectionContainer.MemberBattleBonusRateTags.GetMemberBattleBonusRate(tagOwner, targetCard, playPtn, useIgnoreInBattle, situation); + } + } + else if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.EnemyBattleBonusRate)) + { + result = tagOwner.TagCollectionContainer.EnemyBattleBonusRateTags.GetEnemyBattleBonusRate(tagOwner, targetCard, playPtn, useIgnoreInBattle, situation); + } + return result; + } + + public static float EvaluateAllEvoBonus(this AIVirtualCard card, List playPtn, AISituationInfo situation) + { + return 0f + card.GetEvoBonus(playPtn, situation) + AIEvaluateBonusFromOhterUtility.GetAllOtherEvoBonus(situation, playPtn); + } + + public static float GetEvoBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.EvoBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.EvoBonusTags.GetEvoBonus(tagOwner, playPtn, situation); + } + + public static float GetMemberEvoBonus(this AIVirtualCard tagOwner, AISituationInfo situation, List playPtn) + { + if (tagOwner == null || tagOwner.IsDead || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.MemberEvoBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.MemberEvoBonusTags.GetMemberEvoBonus(tagOwner, situation, playPtn); + } + + public static float GetEnemyEvoBonus(this AIVirtualCard tagOwner, AISituationInfo situation, List playPtn) + { + if (tagOwner == null || tagOwner.IsDead || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.EnemyEvoBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.EnemyEvoBonusTags.GetEnemyEvoBonus(tagOwner, situation, playPtn); + } + + public static float EvaluateBreakValue(this AIVirtualCard card, List playPtn, bool useIgnoreBreak) + { + float num = card.GetAllBreakBonus(playPtn, useIgnoreBreak); + if (useIgnoreBreak) + { + num += card.GetLastwordTokenBonus(playPtn, useIgnoreBreak); + } + return num; + } + + public static bool HasBreakBonus(this AIVirtualCard card, AIVirtualField field) + { + if (card.TagCollectionContainer.HasTag(AIPlayTagType.Break) || field.CardListSet.HasOtherBreakBonusHolder) + { + return true; + } + return false; + } + + public static float GetAllBreakBonus(this AIVirtualCard tagOwner, List playPtn, bool useIgnoreInBattle) + { + return tagOwner.GetBreakBonus(playPtn, useIgnoreInBattle) + AIEvaluateBonusFromOhterUtility.GetOtherBreakBonus(tagOwner, tagOwner.SelfField, playPtn, useIgnoreInBattle); + } + + public static float GetBreakBonus(this AIVirtualCard tagOwner, List playPtn, bool useIgnoreBreak) + { + if (useIgnoreBreak && tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.IgnoreBreak) && tagOwner.TagCollectionContainer.IgnoreBreakTags.IsIgnoreBreak(tagOwner, playPtn)) + { + return 0f; + } + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.Break)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.BreakBonusTags.GetBreakBonus(tagOwner, playPtn); + } + + public static float GetOtherBreakBonus(this AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, List playPtn, bool useIgnoreBreak) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OtherBreakBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.OtherBreakBonusTags.GetOtherBreakBonus(tagOwner, target, field, playPtn, useIgnoreBreak); + } + + public static float GetLastwordTokenBonus(this AIVirtualCard tagOwner, List playPtn, bool useIgnoreInBattle) + { + float num = 0f; + AITokenIdCollection lastwordTokenTargetSideAndIds = tagOwner.GetLastwordTokenTargetSideAndIds(playPtn); + if (lastwordTokenTargetSideAndIds == null) + { + return num; + } + if (lastwordTokenTargetSideAndIds.HasAllyToken) + { + for (int i = 0; i < lastwordTokenTargetSideAndIds.AllyTokenIdList.Count; i++) + { + int tokenId = lastwordTokenTargetSideAndIds.AllyTokenIdList[i].TokenId; + AIVirtualCard tokenFromId = tagOwner.SelfField.AI.tokenManager.GetTokenFromId(tokenId, isAlly: true, tagOwner.SelfField); + if (tokenFromId != null) + { + num += tokenFromId.EvaluateValueOnField(playPtn, null, useStyle: true, doesUseLostLife: true, useOthersTag: false, useIgnoreInBattle) * (tagOwner.IsAlly ? 1f : (-1f)); + } + else + { + AIConsoleUtility.LogError("GetLastwordTokenBonus: tokenCard is null!id = " + tokenId); + } + } + } + if (lastwordTokenTargetSideAndIds.HasOpponentToken) + { + for (int j = 0; j < lastwordTokenTargetSideAndIds.OpponentTokenIdList.Count; j++) + { + int tokenId2 = lastwordTokenTargetSideAndIds.OpponentTokenIdList[j].TokenId; + AIVirtualCard tokenFromId2 = tagOwner.SelfField.AI.tokenManager.GetTokenFromId(tokenId2, isAlly: false, tagOwner.SelfField); + if (tokenFromId2 != null) + { + num += tokenFromId2.EvaluateValueOnField(playPtn, null, useStyle: true, doesUseLostLife: true, useOthersTag: false, useIgnoreInBattle) * ((!tagOwner.IsAlly) ? 1f : (-1f)); + } + else + { + AIConsoleUtility.LogError("GetLastwordTokenBonus: tokenCard is null!id = " + tokenId2); + } + } + } + return num; + } + + public static float GetBanishBonus(this AIVirtualCard tagOwner, List playPtn) + { + if (tagOwner == null || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BanishBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.BanishBonusTags.GetBanishBonus(tagOwner, playPtn); + } + + public static float GetOtherBanishBonus(this AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, List playPtn, bool useIgnoreInBattle) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OtherBanishBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.OtherBanishBonusTags.GetOtherBanishBonus(tagOwner, target, field, playPtn, useIgnoreInBattle); + } + + public static float GetAllBanishBonus(this AIVirtualCard card, List playPtn, bool useIgnoreInBattle) + { + return 0f + card.GetBanishBonus(playPtn) + AIEvaluateBonusFromOhterUtility.GetOtherBanishBonus(card, card.SelfField, playPtn, useIgnoreInBattle); + } + + public static float GetLeaveBonus(this AIVirtualCard tagOwner, List playPtn, bool useIgnoreInBattle, AISituationInfo situation = null) + { + if (tagOwner == null) + { + return 0f; + } + float num = 0f; + if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.LeaveBonus)) + { + num = tagOwner.TagCollectionContainer.LeaveBonusTags.GetLeaveBonus(tagOwner, playPtn, situation, useIgnoreInBattle); + } + return num + tagOwner.GetGetOffTokenValue(playPtn, useIgnoreInBattle); + } + + public static float GetOtherLeaveBonus(this AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, List playPtn, bool useIgnoreInBattle) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OtherLeaveBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.OtherLeaveBonusTags.GetOtherLeaveBonus(tagOwner, target, field, playPtn, useIgnoreInBattle); + } + + public static float GetAllLeaveBonus(this AIVirtualCard tagOwner, List playPtn, bool useIgnoreInBattle, AISituationInfo situation = null) + { + return 0f + tagOwner.GetLeaveBonus(playPtn, useIgnoreInBattle, situation) + AIEvaluateBonusFromOhterUtility.GetOtherLeaveBonus(tagOwner, tagOwner.SelfField, playPtn, useIgnoreInBattle); + } + + public static float GetLeaveTokenBonus(this AIVirtualCard card, List playPtn, bool useIgnoreInBattle, AISituationInfo situation) + { + float num = 0f; + if (card == null) + { + return num; + } + AIVirtualField selfField = card.SelfField; + _ = selfField.ParamQuery; + List leaveTokenIds = card.GetLeaveTokenIds(selfField, playPtn, situation); + if (leaveTokenIds == null) + { + return num; + } + for (int i = 0; i < leaveTokenIds.Count; i++) + { + AIVirtualCard tokenFromId = selfField.AI.tokenManager.GetTokenFromId(leaveTokenIds[i].TokenId, card.IsAlly, selfField); + if (tokenFromId != null) + { + num += tokenFromId.EvaluateValueOnField(playPtn, situation, useStyle: true, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle); + } + } + return num; + } + + public static float GetDiscardedBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isIgnroeInBattle) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.DiscardedBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.DiscardedBonusTags.GetDiscardedBonus(tagOwner, playPtn, situation, isIgnroeInBattle); + } + + public static float GetAllyDiscardBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool useIgnoreInBattle) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.AllyDiscardBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.AfterDiscardTags.GetAllyDiscardBonus(tagOwner, playPtn, situation, useIgnoreInBattle); + } + + public static AITokenIdCollection GetLastwordTokenTargetSideAndIds(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.LastwordToken)) + { + return null; + } + return tagOwner.TagCollectionContainer.LastwordTags.GetLastwordTokenIds(tagOwner, tagOwner.SelfField, playPtn); + } + + public static int GetAllyLastwordTokenCount(this AIVirtualCard owner, List playPtn) + { + if (!owner.TagCollectionContainer.HasTag(AIPlayTagType.LastwordToken)) + { + return 0; + } + int num = 0; + AITokenIdCollection lastwordTokenIds = owner.TagCollectionContainer.LastwordTags.GetLastwordTokenIds(owner, owner.SelfField, playPtn); + if (lastwordTokenIds != null) + { + if (owner.IsAlly && lastwordTokenIds.HasAllyToken) + { + num += lastwordTokenIds.AllyTokenIdList.Count; + } + if (!owner.IsAlly && lastwordTokenIds.HasOpponentToken) + { + num += lastwordTokenIds.OpponentTokenIdList.Count; + } + } + return num; + } + + public static List GetLeaveTokenIds(this AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!card.TagCollectionContainer.HasTag(AIPlayTagType.LeaveToken)) + { + return null; + } + return card.TagCollectionContainer.LeaveTags.GetLeaveTokenIds(card, field, playPtn, situation); + } + + public static List GetDiscardedTokenIds(this AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!card.TagCollectionContainer.HasTag(AIPlayTagType.DiscardedToken)) + { + return null; + } + return card.TagCollectionContainer.DiscardedTags.GetDiscardedTokenIds(card, field, playPtn, situation); + } + + public static float GetDiscardedTokenBonus(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, bool useIgnoreInBattle) + { + List discardedTokenIds = tagOwner.GetDiscardedTokenIds(field, playPtn, situation); + if (discardedTokenIds == null || discardedTokenIds.Count <= 0) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < discardedTokenIds.Count; i++) + { + AIVirtualCard tokenFromId = tagOwner.SelfField.AI.tokenManager.GetTokenFromId(discardedTokenIds[i].TokenId, tagOwner.IsAlly, field); + if (tokenFromId != null) + { + num += tokenFromId.EvaluateValueOnField(playPtn, situation, useStyle: true, doesUseLostLife: true, useOthersTag: false, useIgnoreInBattle); + } + } + return num; + } + + public static int GetNecromanceCountOrDefault(this AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, AIScriptTokenArgType timing) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.Necromance)) + { + return -1; + } + return tagOwner.TagCollectionContainer.PreprocessTags.GetNecromanceOrDefault(tagOwner, field, situation, timing); + } + + public static int GetEarthRiteCount(this AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, AIScriptTokenArgType timing) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.EarthRite)) + { + return 0; + } + return tagOwner.TagCollectionContainer.PreprocessTags.GetEarthRiteCount(tagOwner, field, situation, timing); + } + + public static int GetBurialRiteCount(this AIVirtualCard tagOwner, AIVirtualField field, AISituationInfo situation, List playPtn, AIScriptTokenArgType timing) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BurialRite)) + { + return 0; + } + return tagOwner.TagCollectionContainer.PreprocessTags.GetBurialRiteCount(tagOwner, field, situation, playPtn, timing); + } + + public static float GetReanimateBonus(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.ReanimateBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.ReanimateBonusTags.GetReanimateBonus(tagOwner, playPtn); + } + + public static bool IsReanimateEvo(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.ReanimateEvo)) + { + return false; + } + return tagOwner.TagCollectionContainer.ReanimateEvoTags.IsReanimateEvo(tagOwner, playPtn); + } + + public static bool IsBreakFirst(this AIVirtualCard tagOwner, List playPtn) + { + if (tagOwner.SelfField.AI.IsFullSimulation || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BreakFirst)) + { + return false; + } + return tagOwner.TagCollectionContainer.BreakFirstTags.EnabledBreakFirst(tagOwner, playPtn); + } + + public static bool IsBreakLast(this AIVirtualCard tagOwner, List playPtn) + { + if (tagOwner.SelfField.AI.IsFullSimulation || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BreakLast)) + { + return false; + } + return tagOwner.TagCollectionContainer.BreakLastTags.EnabledBreakLast(tagOwner, playPtn); + } + + public static bool IsBreakBeforePlay(this AIVirtualCard tagOwner, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BreakBeforePlay)) + { + return false; + } + return tagOwner.TagCollectionContainer.BreakBeforePlayTags.EnabledBreakBeforePlay(tagOwner, playPtn); + } + + public static bool IsFirstEvo(this AIVirtualCard tagOwner, AIVirtualCard evoTarget, List playPtn) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.FirstEvo)) + { + return false; + } + return tagOwner.TagCollectionContainer.FirstEvoTags.IsFirstEvo(tagOwner, evoTarget, playPtn); + } + + public static int GetEvoTokenCount(this AIVirtualCard evolver, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int num = (evolver.TagCollectionContainer.HasTag(AIPlayTagType.EvoToken) ? evolver.TagCollectionContainer.EvoTags.GetEvoTokenSummonCount(evolver, playPtn, situation) : 0); + List otherEvoTagHolders = field.CardListSet.OtherEvoTagHolders; + if (otherEvoTagHolders == null) + { + return num; + } + for (int i = 0; i < otherEvoTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = otherEvoTagHolders[i]; + if (!aIVirtualCard.IsSameCard(evolver) && aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenOtherEvo)) + { + num += aIVirtualCard.TagCollectionContainer.OtherEvoTags.GetOtherEvoTokenSummonCount(aIVirtualCard, field, playPtn, situation); + } + } + return num; + } + + public static int GetPlayPlusCount(this AIVirtualCard tagOwner, List playPtn) + { + if (tagOwner == null || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayPlus)) + { + return 0; + } + return tagOwner.TagCollectionContainer.PlayPlusTags.GetPlayPlusCount(tagOwner, playPtn); + } + + public static int GetPlayoutAttackBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (tagOwner == null || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayoutAttackBonus)) + { + return 0; + } + return tagOwner.TagCollectionContainer.PlayoutBonusTags.GetPlayoutAttackBonus(tagOwner, playPtn, situation); + } + + public static int GetAllPlayoutDamageBonus(this AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + return card.GetPlayoutDamageBonus(playPtn, situation) + AIEvaluateBonusFromOhterUtility.GetOtherPlayoutDamageBonus(card, field, playPtn); + } + + public static int GetPlayoutDamageBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (tagOwner == null || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.PlayoutDamageBonus)) + { + return 0; + } + return tagOwner.TagCollectionContainer.PlayoutBonusTags.GetPlayoutDamageBonus(tagOwner, playPtn, situation); + } + + public static int GetAllyPlayoutDamageBonus(this AIVirtualCard tagOwner, AIVirtualCard target, AIVirtualField field, List playPtn) + { + if (tagOwner == null || !tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.AllyPlayoutDamageBonus)) + { + return 0; + } + return tagOwner.TagCollectionContainer.OtherPlayoutBonusTags.GetPlayoutDamageBonus(tagOwner, target, field, playPtn); + } + + public static float GetHandBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation, bool isIgnoreInFusion) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.HandBonus)) + { + return HandBonusTagCollection.DEFAULT_HAND_BONUS; + } + return tagOwner.TagCollectionContainer.HandBonusTags.GetHandBonus(tagOwner, playPtn, situation, isIgnoreInFusion); + } + + public static float GetFusionBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.FusionBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.FusionBonusTags.GetFusionBonus(tagOwner, playPtn, situation); + } + + public static int GetFusionDrawCount(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.FusionDraw)) + { + return 0; + } + return tagOwner.TagCollectionContainer.FusionDrawTags.GetFusionDrawCount(tagOwner, tagOwner.SelfField, playPtn, situation); + } + + public static List GetCondChoiceTargets(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, IEnumerable selectableCards) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.CondChoice)) + { + return null; + } + return tagOwner.TagCollectionContainer.CondChoiceTags.GetCondChoiceTargets(tagOwner, field, playPtn, selectableCards); + } + + public static List GetChoiceTargets(this AIVirtualCard actor, AIVirtualField field, List candidates, List playPtn, int choiceCount, AISituationInfo situation) + { + if (!actor.TagCollectionContainer.HasTag(AIPlayTagType.CondChoice)) + { + return null; + } + return actor.TagCollectionContainer.CondChoiceTags.GetCondChoiceTargets(actor, field, playPtn, candidates, choiceCount, situation); + } + + public static List GetAddedCardIdsWhenPlayout(this AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!card.TagCollectionContainer.HasTag(AIPlayTagType.AddCardToPlayoutPlayPtn)) + { + return null; + } + return card.TagCollectionContainer.AddCardToPlayoutPlayPtnTags.GetIdList(card, field, playPtn, situation); + } + + public static bool IsNoInstantAttack(this AIVirtualCard card, AIVirtualField field, List playPtn) + { + if (!card.TagCollectionContainer.HasTag(AIPlayTagType.NoInstantAttack)) + { + return false; + } + return card.TagCollectionContainer.NoInstantAttackTags.IsNoInstantAttackActivate(card, field, playPtn); + } + + public static int GetEmoteOnTurnEndCategory(this AIVirtualCard owner, bool isAllyTurnEnd) + { + if (!owner.TagCollectionContainer.HasTag(AIPlayTagType.EmoteOnTurnEnd)) + { + return EmoteTagCollection.INVALID_EMOTE_CATEGORY; + } + return owner.TagCollectionContainer.EmoteTags.GetEmoteOnTurnEndCategory(owner, owner.IsAlly == isAllyTurnEnd); + } + + public static int GetEmoteCategory(this AIVirtualCard owner, AIPlayTagType emoteType) + { + if (!owner.TagCollectionContainer.HasTag(emoteType)) + { + return EmoteTagCollection.INVALID_EMOTE_CATEGORY; + } + return owner.TagCollectionContainer.EmoteTags.GetEmoteCategory(owner, emoteType); + } + + public static int GetEvoHandPlusCount(this AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!card.TagCollectionContainer.HasTag(AIPlayTagType.EvoHandPlus)) + { + return 0; + } + return card.TagCollectionContainer.EvoHandPlusTags.GetEvoHandPlusCount(card, field, playPtn, situation); + } + + public static bool IsNoNormalEvo(this AIVirtualCard card, AIVirtualField field) + { + if (!card.TagCollectionContainer.HasTag(AIPlayTagType.NoNormalEvo)) + { + return false; + } + return card.TagCollectionContainer.NoNormalEvoTags.IsNoNormalEvo(card, field); + } + + public static bool IsPlagueCity(this AIVirtualCard card, AIVirtualField field, List playPtn) + { + if (!card.TagCollectionContainer.HasTag(AIPlayTagType.PlagueCity)) + { + return false; + } + return card.TagCollectionContainer.PlagueCityTags.IsPlagueCity(card, field, playPtn); + } + + public static bool IsRemoveByDestroy(this AIVirtualCard card, List playPtn, AISituationInfo situation) + { + List removeByDestroyHolders = card.SelfField.CardListSet.RemoveByDestroyHolders; + if (removeByDestroyHolders == null || removeByDestroyHolders.Count <= 0) + { + return false; + } + for (int i = 0; i < removeByDestroyHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = removeByDestroyHolders[i]; + if (aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.RemoveByDestroy) && aIVirtualCard.TagCollectionContainer.RemoveByDestroyTags.IsRemoveByDestroy(card, aIVirtualCard, playPtn, situation)) + { + return true; + } + } + return false; + } + + public static bool HasWhenPlayRemovalTag(this AIVirtualCard card) + { + if (!card.TagCollectionContainer.HasAnyTag(PlayTagCollection.TAG_FOR_REMOVAL_CHECK)) + { + return card.TagCollectionContainer.HasAnyTag(FanfareTagCollection.TAG_FOR_REMOVAL_CHECK); + } + return true; + } + + public static AIVirtualTargetSelectInfo GetChoiceSelectInfo(this AIVirtualCard card, AIVirtualField field, AIVirtualTargetSelectAction situation) + { + if (!card.TagCollectionContainer.HasTagCollection(TagCollectionType.Choice)) + { + return null; + } + return card.TagCollectionContainer.ChoiceTags.GetSelectInfo(card, field, situation); + } + + public static bool CheckAITribe(this AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation, string tribe) + { + if (tribe == null) + { + return false; + } + if (owner.PermanentAITribeList != null && owner.PermanentAITribeList.Contains(tribe)) + { + return true; + } + if (!owner.TagCollectionContainer.HasTag(AIPlayTagType.SetAITribe)) + { + return false; + } + return owner.TagCollectionContainer.SetAITribeTags.CheckTribe(owner, field, tribe, playPtn, situation); + } + + public static void ExecuteWhenPlayTagsForEvaluation(this AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (owner.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + owner.TagCollectionContainer.FanfareTags.ExecuteForPlayPtnEvaluation(owner, field, playPtn, situation); + } + if (owner.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + owner.TagCollectionContainer.PlayTags.ExecuteForPlayPtnEvaluation(owner, field, playPtn, situation); + } + } + + public static void PseudoExecuteWhenPlayTags(this AIVirtualCard owner, AIVirtualField field, AISinglePlayptnRecord record, PlayedCardInfo playInfo, AIVirtualTargetSelectAction situation) + { + if (owner.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + owner.TagCollectionContainer.FanfareTags.PseudoExecute(field, playInfo, record, situation); + } + if (owner.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + owner.TagCollectionContainer.PlayTags.PseudoExecute(field, playInfo, record, situation); + } + } + + public static List GetPlaySkipInformation(this AIVirtualCard owner, List playPtn, List lastInfo, AISituationInfo situation) + { + if (!owner.TagCollectionContainer.HasTagCollection(TagCollectionType.PlaySkip)) + { + return lastInfo; + } + return owner.TagCollectionContainer.PlaySkipTags.RegisterPlaySkipInfo(owner, playPtn, lastInfo, situation); + } + + public static void EnqueueGiveSkill(this AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (owner.TagCollectionContainer.HasTag(AIPlayTagType.GiveSkill)) + { + owner.TagCollectionContainer.GiveSkillTags.EnqueueGiveSkill(owner, field, playPtn, situation); + } + } + + public static void ExecuteBounceSkills(this AIVirtualCard owner, AIVirtualCard bouncedCard, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (owner.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenBounce)) + { + owner.TagCollectionContainer.BounceTags.Execute(owner, bouncedCard, playPtn, situation); + } + } + + public static bool IsDelayHeal(this AIVirtualCard owner, AIVirtualField field, AISituationInfo situation) + { + if (owner.TagCollectionContainer.HasTag(AIPlayTagType.PlayHeal) && owner.TagCollectionContainer.PlayTags.IsDelayHeal(owner, field, situation)) + { + return true; + } + if (owner.TagCollectionContainer.HasTag(AIPlayTagType.FanfareHeal) && owner.TagCollectionContainer.FanfareTags.IsDelayHeal(owner, field, situation)) + { + return true; + } + return false; + } + + public static int GetWhenPlayHealCount(this AIVirtualCard owner, List wishHealTargetList, AIVirtualField field, List playPtn, AISituationInfo situation) + { + int num = 0; + if (owner.TagCollectionContainer.HasTag(AIPlayTagType.PlayHeal)) + { + num += owner.TagCollectionContainer.PlayTags.GetHealCount(owner, wishHealTargetList, field, playPtn, situation); + } + if (owner.TagCollectionContainer.HasTag(AIPlayTagType.FanfareHeal)) + { + num += owner.TagCollectionContainer.FanfareTags.GetHealCount(owner, wishHealTargetList, field, playPtn, situation); + } + return num; + } + + public static AIVirtualCard FindRealActor(this AIVirtualCard card, AISinglePlayptnRecord playptnRecord) + { + if (playptnRecord == null) + { + return card; + } + return playptnRecord.FindRealActor(card); + } + + public static void ExecuteWhenChangeInplayTag(this AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (owner.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenChangeInplay)) + { + owner.TagCollectionContainer.ChangeInplayTags.Execute(owner, field, playPtn, situation); + } + } + + public static bool HasDestroyPlayPtnTag(this AIVirtualCard actor, AIOperationType operationType) + { + if (operationType == AIOperationType.PLAY) + { + return actor.TagCollectionContainer.HasWhenPlayDestroyPlayPtnTags(); + } + return false; + } + + public static int GetAttackDamageToCertainTarget(this AIVirtualCard tagOwner, AIVirtualAttackInfo situation, AIVirtualField field, List playPtn, AIBarrierPseudoSimulationInfo targetBarrierInfo) + { + if (tagOwner.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenAttack)) + { + return tagOwner.TagCollectionContainer.AttackTags.GetAttackDamageToCertainTarget(tagOwner, situation, field, playPtn, targetBarrierInfo); + } + return 0; + } + + public static float GetClashBonus(this AIVirtualCard tagOwner) + { + if (tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.ClashBonus)) + { + return tagOwner.EvaluateClashBonus() * (float)(tagOwner.IsAlly ? 1 : (-1)); + } + return 0f; + } + + public static void PreparateOtherToEvolve(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (tagOwner.TagCollectionContainer.HasTagCollection(TagCollectionType.EvolveToOther)) + { + tagOwner.TagCollectionContainer.EvolveToOtherTags.PreparateBeforeEvolve(tagOwner, field, playPtn, situation); + } + } + + public static float GetBuffBonus(this AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.BuffBonus)) + { + return 0f; + } + return tagOwner.TagCollectionContainer.BuffBonusTags.GetBuffBonus(tagOwner, playPtn, situation); + } + + public static bool IsForceImmediateAttack(this AIVirtualCard tagOwner, AIVirtualField field) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.ForceImmediateAttack)) + { + return false; + } + return tagOwner.TagCollectionContainer.ForceImmediateAttackTags.IsForceImmediateAttack(tagOwner, field); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIFusionCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIFusionCountUtility.cs new file mode 100644 index 0000000..e824386 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIFusionCountUtility.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIFusionCountUtility +{ + public static int GetFusionCount(AIVirtualCard tagOwner, List argList, List playPtn, AISituationInfo situation) + { + List allFusionIngredientsList = tagOwner.GetAllFusionIngredientsList(situation); + if (allFusionIngredientsList == null || allFusionIngredientsList.Count <= 0) + { + return 0; + } + argList.Reverse(); + return AIFilteringUtility.MultipleFiltering(allFusionIngredientsList, argList, tagOwner, playPtn, situation)?.Count ?? 0; + } + + public static int GetFusionCountAtOnce(AIVirtualCard tagOwner, List argList, List playPtn, AISituationInfo situation) + { + if (situation == null || !situation.Actor.IsSameCard(tagOwner)) + { + return 0; + } + List list = null; + if (situation is AIFusionSituationInfo || situation is AIVirtualTargetSelectAction { ActionType: AIOperationType.FUSION }) + { + if (situation.IsTargetExists(AIScriptTokenArgType.TARGET_SELECT)) + { + argList.Reverse(); + list = AIFilteringUtility.MultipleFiltering(situation.GetSituationTarget(AIScriptTokenArgType.TARGET_SELECT).Targets, argList, tagOwner, playPtn, situation); + } + } + else + { + AIConsoleUtility.LogError("AIFusionCountUtility.GetFusionCountAtOnce(): Unexpected situation type. Not fusion situation."); + } + return list?.Count ?? 0; + } + + public static int GetNowFusionCount(AIVirtualCard tagOwner, List filters, List playPtn) + { + if (tagOwner.FusionIngredients == null) + { + return 0; + } + return AIFilteringUtility.MultipleFiltering(tagOwner.FusionIngredients.CardList, filters, tagOwner, playPtn, null)?.Count ?? 0; + } + + public static int GetFusionNameCount(AIVirtualCard tagOwner, List argList, List playPtn, AISituationInfo situation) + { + List allFusionIngredientsList = tagOwner.GetAllFusionIngredientsList(situation); + if (allFusionIngredientsList == null || allFusionIngredientsList.Count <= 0) + { + return 0; + } + argList.Reverse(); + return AIFilteringUtility.GetCardNameCountFromList(allFusionIngredientsList, argList, tagOwner, playPtn, situation); + } + + public static int GetFusedCardCountInGame(AIVirtualCard tagOwner, List filter, List playPtn, AISituationInfo situation, bool isWithoutSameId) + { + List list = (tagOwner.IsAlly ? tagOwner.SelfField.AllyGameFusedCards : tagOwner.SelfField.EnemyGameFusedCards); + if (list == null || list.Count <= 0) + { + return 0; + } + List list2 = AIFilteringUtility.MultipleFiltering(list, filter, tagOwner, playPtn, situation, isBlockDeadCard: false); + if (list2 == null) + { + return 0; + } + int count = list2.Count; + if (isWithoutSameId) + { + HashSet hashSet = new HashSet(); + for (int i = 0; i < list2.Count; i++) + { + hashSet.Add(list2[i].BaseId); + } + count = hashSet.Count; + } + return count; + } + + private static List GetAllFusionIngredientsList(this AIVirtualCard card, AISituationInfo situation) + { + List list = null; + if (card.FusionIngredients != null && card.FusionIngredients.HasFusionIngredients) + { + list = new List(card.FusionIngredients.CardList); + } + else if (card.BeforeTransformCard != null && card.BeforeTransformCard.FusionIngredients != null && card.BeforeTransformCard.FusionIngredients.HasFusionIngredients) + { + list = new List(card.BeforeTransformCard.FusionIngredients.CardList); + } + if (situation != null && situation is AIFusionSituationInfo aIFusionSituationInfo && aIFusionSituationInfo.Actor.IsSameCard(card) && aIFusionSituationInfo.IsTargetExists(AIScriptTokenArgType.TARGET_SELECT)) + { + list = AIParamQuery.AddRangeToList(aIFusionSituationInfo.GetSituationTarget(AIScriptTokenArgType.TARGET_SELECT).Targets, list); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGenerateTagUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIGenerateTagUtility.cs new file mode 100644 index 0000000..bfcc40c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGenerateTagUtility.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIGenerateTagUtility +{ + private class GenerateTagExecutingInfo + { + public AIVirtualCard Owner; + + public AIVirtualCard Target; + + public AIAttachedTagInformation AttachedTagInfo; + } + + public static void ExecuteGenerateTag(AISituationInfo situation, AIVirtualField field, AIGenerateTagOwnerTable generateTagOwnerTable, AttachedSkillInfoReceiveDataCollection attachedInfoReceiveCollection) + { + List list = CreateGeneratedTagExecutingInfoList(generateTagOwnerTable, attachedInfoReceiveCollection, field, situation); + if (list != null) + { + AttachGenerateTagOnField(list, field, situation); + } + attachedInfoReceiveCollection.Clear(); + } + + private static List CreateGeneratedTagExecutingInfoList(AIGenerateTagOwnerTable generateTagOwnerTable, AttachedSkillInfoReceiveDataCollection attachedInfoReceiveCollection, AIVirtualField field, AISituationInfo situation) + { + List list = null; + for (int i = 0; i < attachedInfoReceiveCollection.InfoList.Count; i++) + { + List list2 = CreateGenerateTagExecutingInfoFromReceiveData(generateTagOwnerTable, attachedInfoReceiveCollection.InfoList[i], field, situation); + if (list2 != null) + { + list = AIParamQuery.AddRangeToList(list2, list); + } + } + return list; + } + + private static List CreateGenerateTagExecutingInfoFromReceiveData(AIGenerateTagOwnerTable generateTagOwnerTable, AttachedSkillInfoReceiveData attachedInfoReceiveData, AIVirtualField field, AISituationInfo situation) + { + List list = null; + AIGenerateTagOwnerTable.GenerateTagOwnerInfo generateTagOwnerInfo = generateTagOwnerTable.GetGenerateTagOwnerInfo(attachedInfoReceiveData.OwnerBaseCardId, attachedInfoReceiveData.OwnerIndex, attachedInfoReceiveData.OwnerIsPlayer); + if (generateTagOwnerInfo == null || generateTagOwnerInfo.GenerateTagList == null) + { + return null; + } + List generateTagList = generateTagOwnerInfo.GenerateTagList; + bool flag = field.AllyBattlePlayer.IsPlayer == generateTagOwnerInfo.OwnerIsPlayer; + AIVirtualCard owner = FindVirtualCard(generateTagOwnerInfo.OwnerCardIndex, flag, field); + for (int i = 0; i < attachedInfoReceiveData.TargetInfoList.Count; i++) + { + AttachedSkillInfoReceiveData.TargetInfo targetInfo = attachedInfoReceiveData.TargetInfoList[i]; + bool flag2 = field.AllyBattlePlayer.IsPlayer == targetInfo.TargetIsPlayer; + AIVirtualCard aIVirtualCard = FindVirtualCard(targetInfo.TargetIndex, flag2, field); + if (aIVirtualCard == null) + { + continue; + } + for (int j = 0; j < generateTagList.Count; j++) + { + if (generateTagList[j].ArgumentExpressions is AIGenerateTag aIGenerateTag && aIGenerateTag.CheckMatchedHashList(targetInfo.SkillHashList)) + { + list = AIParamQuery.AddElementToList(new GenerateTagExecutingInfo + { + Owner = owner, + Target = aIVirtualCard, + AttachedTagInfo = new AIAttachedTagInformation(aIGenerateTag.Tag, aIGenerateTag.RemoveTiming, generateTagOwnerInfo.OwnerBaseCardId, generateTagOwnerInfo.OwnerCardIndex, flag, targetInfo.TargetIndex, flag2) + }, list); + } + } + } + return list; + } + + private static void AttachGenerateTagOnField(List executingInfoList, AIVirtualField field, AISituationInfo situation) + { + if (executingInfoList != null) + { + for (int i = 0; i < executingInfoList.Count; i++) + { + GenerateTagExecutingInfo generateTagExecutingInfo = executingInfoList[i]; + AIVirtualCard target = generateTagExecutingInfo.Target; + target.TagCollectionContainer.AttachTag(generateTagExecutingInfo.AttachedTagInfo, target, situation); + } + } + } + + private static AIVirtualCard FindVirtualCard(int cardIndex, bool isAlly, AIVirtualField field) + { + AIVirtualCard aIVirtualCard = null; + aIVirtualCard = FindFromList(field.CardListSet.AllReferableCards); + if (aIVirtualCard != null) + { + return aIVirtualCard; + } + return FindFromList(field.GetEnemyHandCardList()); + AIVirtualCard FindFromList(List _cardList) where T : AIVirtualCard + { + for (int i = 0; i < _cardList.Count; i++) + { + T val = _cardList[i]; + if (val.CardIndex == cardIndex && val.IsAlly == isAlly) + { + return val; + } + } + return null; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetPreprocessInformationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetPreprocessInformationUtility.cs new file mode 100644 index 0000000..035232d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetPreprocessInformationUtility.cs @@ -0,0 +1,48 @@ +namespace Wizard; + +public static class AIGetPreprocessInformationUtility +{ + public static int GetEarthRiteCount(AIVirtualCard owner, AISituationInfo situation) + { + if (situation == null) + { + return 0; + } + if (situation.PreprocessRecorder == null || !situation.PreprocessRecorder.HasRecord) + { + return 0; + } + int num = 0; + for (int i = 0; i < situation.PreprocessRecorder.RecordList.Count; i++) + { + AISinglePreprocessRecord aISinglePreprocessRecord = situation.PreprocessRecorder.RecordList[i]; + if (aISinglePreprocessRecord.RealActor.IsSameCard(owner) || aISinglePreprocessRecord.OriginalCard.IsSameCard(owner)) + { + num += aISinglePreprocessRecord.EarthRiteCount; + } + } + return num; + } + + public static int GetNecromanceCount(AIVirtualCard owner, AISituationInfo situation) + { + if (situation == null) + { + return 0; + } + if (situation.PreprocessRecorder == null || !situation.PreprocessRecorder.HasRecord) + { + return 0; + } + int num = 0; + for (int i = 0; i < situation.PreprocessRecorder.RecordList.Count; i++) + { + AISinglePreprocessRecord aISinglePreprocessRecord = situation.PreprocessRecorder.RecordList[i]; + if (aISinglePreprocessRecord.RealActor.IsSameCard(owner) || aISinglePreprocessRecord.OriginalCard.IsSameCard(owner)) + { + num += aISinglePreprocessRecord.NecromanceCount; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIGetStatusUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIGetStatusUtility.cs new file mode 100644 index 0000000..19d5773 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIGetStatusUtility.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIGetStatusUtility +{ + public static int GetLife(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List filters) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.AllReferableCards, filters, tagOwner, playPtn, situation, isBlockDeadCard: false); + if (list == null || list.Count <= 0) + { + return 0; + } + return list[0].Life; + } + + public static int GetAttack(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List filters) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.AllReferableCards, filters, tagOwner, playPtn, situation, isBlockDeadCard: false); + if (list == null || list.Count <= 0) + { + return 0; + } + return list[0].Attack; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHandBuffSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIHandBuffSimulationUtility.cs new file mode 100644 index 0000000..276abbd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHandBuffSimulationUtility.cs @@ -0,0 +1,143 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIHandBuffSimulationUtility +{ + public static void ExecuteHandBuffAll(List candidates, AIBuffExecutingInfo_old buffInfo, AISituationInfo situation) + { + if (candidates == null || candidates.Count <= 0) + { + return; + } + List list = new List(); + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.IsInHand && aIVirtualCard.IsUnit) + { + aIVirtualCard.GiveBuff(situation, buffInfo, isTemp: false); + list.Add(aIVirtualCard); + } + } + if (list.Count > 0) + { + situation.RegisterLatestTargetList(list); + } + } + + public static void ExecuteHandBuffRandom(List candidates, AIBuffExecutingInfo_old buffInfo, List playPtn, AISituationInfo situation) + { + if (candidates != null && candidates.Count > 0) + { + AIVirtualCard aIVirtualCard = SelectHandBuffTarget(candidates, AISelectTargetPattern.Worst, playPtn, situation); + if (aIVirtualCard != null) + { + aIVirtualCard.GiveBuff(situation, buffInfo, isTemp: false); + situation.RegisterSingleLatestTarget(aIVirtualCard); + } + } + } + + public static void ExecuteHandBuffTargetSelect(AIBuffExecutingInfo_old buffInfo, AIScriptTokenArgType whichTarget, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.HasTarget) + { + ExecuteHandBuffAll(situationTarget.Targets, buffInfo, situation); + } + } + + public static void ExecuteHandBuffBestTarget(List candidates, AIBuffExecutingInfo_old buffInfo, AISituationInfo situation) + { + AIVirtualCard aIVirtualCard = SelectHandBuffTarget(candidates, AISelectTargetPattern.Best, EnemyAI.EmptyPlayPtn, situation); + if (aIVirtualCard != null) + { + aIVirtualCard.GiveBuff(situation, buffInfo, isTemp: false); + situation.RegisterSingleLatestTarget(aIVirtualCard); + } + } + + public static AIVirtualCard SelectHandBuffTarget(List candidates, AISelectTargetPattern worstOrBest, List playPtn, AISituationInfo situation) + { + if (candidates == null || candidates.Count <= 0) + { + return null; + } + float num = 0f; + AIVirtualCard aIVirtualCard = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard2 = candidates[i]; + float handBonus = aIVirtualCard2.GetHandBonus(playPtn, situation, isIgnoreInFusion: false); + if (aIVirtualCard == null) + { + aIVirtualCard = aIVirtualCard2; + num = handBonus; + continue; + } + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + if (handBonus > num) + { + num = handBonus; + aIVirtualCard = aIVirtualCard2; + } + else + { + if (handBonus < num) + { + break; + } + if (aIVirtualCard2.Cost < aIVirtualCard.Cost) + { + aIVirtualCard = aIVirtualCard2; + } + else if (aIVirtualCard2.Cost <= aIVirtualCard.Cost) + { + if (aIVirtualCard2.Attack > aIVirtualCard.Attack) + { + aIVirtualCard = aIVirtualCard2; + } + else if (aIVirtualCard2.Attack == aIVirtualCard.Attack && aIVirtualCard2.Life > aIVirtualCard.Life) + { + aIVirtualCard = aIVirtualCard2; + } + } + } + break; + case AISelectTargetPattern.Worst: + if (handBonus < num) + { + num = handBonus; + aIVirtualCard = aIVirtualCard2; + } + else + { + if (handBonus > num) + { + break; + } + if (aIVirtualCard2.Cost > aIVirtualCard.Cost) + { + aIVirtualCard = aIVirtualCard2; + } + else if (aIVirtualCard2.Cost <= aIVirtualCard.Cost) + { + if (aIVirtualCard2.Attack < aIVirtualCard.Attack) + { + aIVirtualCard = aIVirtualCard2; + } + else if (aIVirtualCard2.Attack == aIVirtualCard.Attack && aIVirtualCard2.Life < aIVirtualCard.Life) + { + aIVirtualCard = aIVirtualCard2; + } + } + } + break; + } + } + return aIVirtualCard; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHandCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIHandCountUtility.cs new file mode 100644 index 0000000..f827343 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHandCountUtility.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIHandCountUtility +{ + public static int GetHandCount(AIVirtualField field, List filters, AIVirtualCard tagOwner, AISituationInfo situation, List playPtn) + { + ReplaceIllegalFilter(filters); + int num = ((!tagOwner.IsAlly) ? AIFilteringUtility.MultipleFiltering(field.GetEnemyHandCardList(), filters, tagOwner, playPtn, situation) : AIFilteringUtility.MultipleFiltering(field.AllyHandCards, filters, tagOwner, playPtn, situation))?.Count ?? 0; + if (filters[0] is AIScriptArgumentToken { ArgumentType: AIScriptTokenArgType.ALL }) + { + num += field.VirtualDrawCount; + } + return num; + } + + public static int GetHandNameCount(AIVirtualField field, List filters, AIVirtualCard tagOwner, AISituationInfo situation, List playPtn) + { + ReplaceIllegalFilter(filters); + return AIFilteringUtility.GetCardNameCountFromList(tagOwner.IsAlly ? field.AllyHandCards : field.GetEnemyHandCardList(), filters, tagOwner, playPtn, situation); + } + + private static void ReplaceIllegalFilter(List filters) + { + for (int i = 0; i < filters.Count; i++) + { + if (filters[i] is AIScriptArgumentToken { ArgumentType: var argumentType } aIScriptArgumentToken) + { + switch (argumentType) + { + case AIScriptTokenArgType.FOLLOWER: + aIScriptArgumentToken.ArgumentType = AIScriptTokenArgType.FOLLOWER_CARD_TYPE; + break; + case AIScriptTokenArgType.BUFFED_FOLLOWER: + aIScriptArgumentToken.ArgumentType = AIScriptTokenArgType.BUFFED_FOLLOWER_CARD_TYPE; + break; + case AIScriptTokenArgType.SPELL: + aIScriptArgumentToken.ArgumentType = AIScriptTokenArgType.SPELL_CARD_TYPE; + break; + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealCountUtility.cs new file mode 100644 index 0000000..802d108 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealCountUtility.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIHealCountUtility +{ + public static int GetHealCount(AIVirtualCard owner, AIVirtualField field, AISituationInfo situation, List playPtn, List argList) + { + if (argList.Count < 2) + { + return 0; + } + AIScriptTokenArgType argumentType = ((AIScriptArgumentToken)argList[0]).ArgumentType; + AIScriptTokenArgType durationType; + AIScriptTokenArgType aIScriptTokenArgType; + if (argumentType == AIScriptTokenArgType.TURN || argumentType == AIScriptTokenArgType.GAME) + { + durationType = argumentType; + aIScriptTokenArgType = AIScriptTokenArgType.NONE; + argList.RemoveAt(0); + } + else + { + aIScriptTokenArgType = argumentType; + durationType = ((AIScriptArgumentToken)argList[1]).ArgumentType; + argList.RemoveRange(0, 2); + } + argList.Reverse(); + if (aIScriptTokenArgType == AIScriptTokenArgType.NONE) + { + return AIHealSimulationUtility.GetSelfTurnHealCountAll(owner, field, argList, playPtn, situation, durationType); + } + return AIHealSimulationUtility.GetSelfTurnHealCountAtCountType(owner, field, argList, playPtn, situation, durationType, aIScriptTokenArgType); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIHealSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIHealSimulationUtility.cs new file mode 100644 index 0000000..4de88ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIHealSimulationUtility.cs @@ -0,0 +1,216 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public static class AIHealSimulationUtility +{ + public static int CalcHealModifier(AIVirtualCard healTarget, List playPtn, AISituationInfo situation, int originalHealValue) + { + if (!healTarget.TagCollectionContainer.HasTag(AIPlayTagType.ModifyHeal)) + { + return originalHealValue; + } + return healTarget.TagCollectionContainer.ModifyHealTags.GetModifiedHealValue(healTarget, healTarget, originalHealValue, playPtn, situation); + } + + public static float EvalTargetingHeal(AIVirtualCard tagOwner, List filters, List playPtn, int heal) + { + float num = float.MinValue; + AIVirtualField selfField = tagOwner.SelfField; + AIVirtualCard aIVirtualCard = null; + List list = AIFilteringUtility.MultipleFiltering(selfField.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null); + if (list != null && list.Count > 0) + { + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard2 = list[i]; + if (aIVirtualCard2.IsAlly == tagOwner.IsAlly || (!aIVirtualCard2.IsUntouchable && !aIVirtualCard2.IsSneak)) + { + int num2 = CalcHealModifier(aIVirtualCard2, playPtn, null, heal); + float num3 = 0f; + if (aIVirtualCard2.IsUnit) + { + num3 = (float)Mathf.Min(num2, aIVirtualCard2.MaxLife - aIVirtualCard2.Life) * (aIVirtualCard2.IsAlly ? 1f : (-1f)); + } + else if (aIVirtualCard2.IsLeader) + { + num3 = AILeaderLifeEvaluationUtility.Evaluate(Mathf.Min(aIVirtualCard2.MaxLife, aIVirtualCard2.Life + num2), aIVirtualCard2.Life, aIVirtualCard2.IsAlly, tagOwner.IsAlly); + } + if (num < num3) + { + num = num3; + aIVirtualCard = aIVirtualCard2; + } + float num4 = CalcEvalHealAfterAttack(aIVirtualCard2, num2); + if (num < num4) + { + num = num4; + aIVirtualCard = aIVirtualCard2; + } + } + } + } + if (aIVirtualCard != null) + { + return num; + } + return 0f; + } + + public static float EvalAllHeal(AIVirtualCard tagOwner, List filters, List playPtn, int heal) + { + List list = AIFilteringUtility.MultipleFiltering(tagOwner.SelfField.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null); + if (list == null || list.Count <= 0) + { + return 0f; + } + float num = 0f; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (aIVirtualCard.IsAlly == tagOwner.IsAlly) + { + int num2 = CalcHealModifier(aIVirtualCard, playPtn, null, heal); + float num3 = 0f; + if (aIVirtualCard.IsUnit) + { + num3 = (float)Mathf.Min(num2, aIVirtualCard.MaxLife - aIVirtualCard.Life) * (aIVirtualCard.IsAlly ? 1f : (-1f)); + } + else if (aIVirtualCard.IsLeader) + { + num3 = AILeaderLifeEvaluationUtility.Evaluate(Mathf.Min(aIVirtualCard.MaxLife, aIVirtualCard.Life + num2), aIVirtualCard.Life, aIVirtualCard.IsAlly, tagOwner.IsAlly); + } + num += num3; + } + } + return num; + } + + public static float CalcEvalHealAfterAttack(AIVirtualCard healTarget, int heal) + { + AIVirtualField selfField = healTarget.SelfField; + if (!healTarget.IsUnit || !healTarget.IsAlly) + { + return 0f; + } + float num = float.MinValue; + bool flag = healTarget.IsAbleEvolution(); + for (int i = 0; i < selfField.EnemyInplayCards.Count; i++) + { + AIVirtualCard aIVirtualCard = selfField.EnemyInplayCards[i]; + if (aIVirtualCard.IsCantUnderAttack(selfField.ParamQuery, healTarget, EnemyAI.EmptyPlayPtn, selfField)) + { + continue; + } + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(healTarget, aIVirtualCard); + if (!(AIAttackSimulationUtility.IsAttackPossible(selfField, aIVirtualAttackInfo) || flag)) + { + continue; + } + int num2 = healTarget.SimulateDamageAmount(aIVirtualCard.SimulateAttackAmount(aIVirtualAttackInfo)); + if (healTarget.Life > num2) + { + int b = healTarget.MaxLife - (healTarget.Life - num2); + float num3 = Mathf.Min(heal, b); + if (num3 > num) + { + num = num3; + } + } + else if (flag && healTarget.EvolutionLife > num2) + { + int b2 = healTarget.BaseCard.BaseParameter.EvoLife - (healTarget.EvolutionLife - num2); + float num4 = Mathf.Min(heal, b2); + if (num4 > num) + { + num = num4; + } + } + } + return num; + } + + public static int GetSelfTurnHealCountAll(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AISituationInfo situation, AIScriptTokenArgType durationType) + { + return GetSelfTurnHealCountPlayed(tagOwner, field, filters, playPtn, durationType, situation) + GetSelfTurnHealCountPlayPtn(tagOwner, field, filters, playPtn, situation); + } + + public static int GetSelfTurnHealCountAtCountType(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AISituationInfo situation, AIScriptTokenArgType durationType, AIScriptTokenArgType countType) + { + return countType switch + { + AIScriptTokenArgType.PLAYED => GetSelfTurnHealCountPlayed(tagOwner, field, filters, playPtn, durationType, situation), + AIScriptTokenArgType.PLAYPTN => GetSelfTurnHealCountPlayPtn(tagOwner, field, filters, playPtn, situation), + AIScriptTokenArgType.BEFORE_PLAYPTN => GetSelfTurnHealCountBeforePlayPtn(tagOwner, field, filters, playPtn, situation, durationType), + _ => 0, + }; + } + + private static int GetSelfTurnHealCountPlayed(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AIScriptTokenArgType durationType, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0; + } + int turn = (tagOwner.IsAlly ? field.AllyTurnCount : field.EnemyTurnCount); + return 0 + field.HealRecorderCollection.GetTurnHealCount(turn, list, tagOwner.IsAlly); + } + + private static int GetSelfTurnHealCountPlayPtn(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AISituationInfo situation) + { + if (playPtn == null || !tagOwner.IsAlly) + { + return 0; + } + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0; + } + int num = 0; + for (int i = 0; i < playPtn.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[i]]; + if (aIVirtualCard.IsSameCard(tagOwner)) + { + break; + } + num += aIVirtualCard.GetWhenPlayHealCount(list, field, playPtn, situation); + } + return num; + } + + private static int GetSelfTurnHealCountBeforePlayPtn(AIVirtualCard tagOwner, AIVirtualField field, List filters, List playPtn, AISituationInfo situation, AIScriptTokenArgType durationType) + { + if (playPtn == null || !tagOwner.IsAlly) + { + return 0; + } + return GetSelfTurnHealCountPlayPtn(tagOwner, field, filters, playPtn, situation) + GetSelfTurnHealCountPlayed(tagOwner, field, filters, playPtn, durationType, situation); + } + + public static AIVirtualCard SelectBestTarget(List targets, int healPoint) + { + float num = -1f; + AIVirtualCard result = null; + for (int i = 0; i < targets.Count; i++) + { + if (!targets[i].IsIndependent) + { + float num2 = Mathf.Min(healPoint, targets[i].MaxLife - targets[i].Life); + if (num2 > num) + { + num = num2; + result = targets[i]; + } + if (num2 >= (float)healPoint) + { + break; + } + } + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIIsSelectableUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIIsSelectableUtility.cs new file mode 100644 index 0000000..ade33ce --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIIsSelectableUtility.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIIsSelectableUtility +{ + public static bool IsSelectable(List filters, float minSelectableCount, AIVirtualCard owner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.AllReferableCards, filters, owner, playPtn, situation); + list.RemoveAll((AIVirtualCard card) => card.IsAlly != owner.IsAlly && card.CantBeFocusedSkill); + list = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(list, owner, playPtn); + if (list == null || (float)list.Count < minSelectableCount) + { + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILethalTargetSelectUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AILethalTargetSelectUtility.cs new file mode 100644 index 0000000..a95b216 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILethalTargetSelectUtility.cs @@ -0,0 +1,134 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AILethalTargetSelectUtility +{ + public class LethalTargetSelectResult + { + public AISelectedTargetInfoSet TargetSet; + + public AIVirtualField ResultField; + } + + public static bool LethalSelectTarget(AIVirtualField field, AIVirtualTargetSelectAction situation, AISinglePlayptnRecord playPtnRecord) + { + AIVirtualCard actor = situation.Actor; + List list = actor.CreateAIVirtualSelectInfo(field, situation); + if (list == null || list.Count <= 0) + { + return TargetSelectAction(field, situation); + } + AISelectedTargetInfoSet preDecidedTargetSet = null; + if (situation.SelectedTargets.IsAnyTargetExists()) + { + preDecidedTargetSet = situation.SelectedTargets; + } + List allTargetSelectSimulationPattern = AIVirtualTargetSelectSimulator.GetAllTargetSelectSimulationPattern(list, preDecidedTargetSet, situation, field, playPtnRecord); + if (allTargetSelectSimulationPattern == null || allTargetSelectSimulationPattern.Count <= 0) + { + AIConsoleUtility.LogError("LethalSelectTarget error!! Cannot find target pattern!!!!! actor.id == " + actor.BaseId); + return TargetSelectAction(field, situation); + } + LethalTargetSelectResult lethalTargetSelectResult = new LethalTargetSelectResult + { + ResultField = field, + TargetSet = null + }; + CalculateBestTargetPattern(lethalTargetSelectResult, field, situation, allTargetSelectSimulationPattern, playPtnRecord, list); + situation.SelectedTargets = lethalTargetSelectResult.TargetSet; + return TargetSelectAction(field, situation); + } + + private static bool TargetSelectAction(AIVirtualField field, AIVirtualTargetSelectAction situation) + { + switch (situation.ActionType) + { + case AIOperationType.PLAY: + { + PlaySimulationInfo playSimulationInfo = AIPlayCardSimulationUtility.CreatePlaySimulationInfo(situation.Actor, situation, field); + if (playSimulationInfo != null) + { + AIVirtualPlaySimulator.PlayCard(situation, field, playSimulationInfo); + return true; + } + return false; + } + case AIOperationType.EVOLVE: + AIVirtualEvolutionSimulator.ManualEvolve(situation, field); + return true; + default: + return false; + } + } + + private static void CalculateBestTargetPattern(LethalTargetSelectResult result, AIVirtualField field, AIVirtualTargetSelectAction situation, List patternSet, AISinglePlayptnRecord playptnRecord, List selectInfoList) + { + AIVirtualCard originalCard = situation.OriginalCard; + AIOperationType actionType = situation.ActionType; + int giveQuickSelectIndex = GetGiveQuickSelectIndex(selectInfoList); + bool isSecondTargetForbbidenSelectedTarget = selectInfoList.Count > 1 && selectInfoList[1].IsForbiddenSelectedTarget; + for (int i = 0; i < patternSet.Count; i++) + { + AISelectedTargetInfoSet aISelectedTargetInfoSet = patternSet[i]; + if (!AIVirtualTargetSelectSimulator.IsAbleToReplaceDummyTarget(aISelectedTargetInfoSet, result.TargetSet, isSecondTargetForbbidenSelectedTarget)) + { + continue; + } + if (!aISelectedTargetInfoSet.IsTargetExist(0) && aISelectedTargetInfoSet.IsTargetExist(1)) + { + AIConsoleUtility.LogError("AILethalTargetSelectUtility.CalculateBestTargetPattern error!! targetPattern.firstTarget is null & secondTaget is not null"); + continue; + } + AIVirtualField aIVirtualField = new AIVirtualField(field); + AISelectedTargetInfoSet similarTargetInfoSet = aISelectedTargetInfoSet.GetSimilarTargetInfoSet(aIVirtualField); + AIVirtualCard aIVirtualCard = aIVirtualField.SearchVirtualCard(originalCard); + AIVirtualCard actor = aIVirtualCard; + if (actionType == AIOperationType.PLAY) + { + actor = aIVirtualCard.FindRealActor(playptnRecord); + } + AIVirtualTargetSelectAction situation2 = new AIVirtualTargetSelectAction(actor, aIVirtualCard, actionType, similarTargetInfoSet); + TargetSelectAction(aIVirtualField, situation2); + if (giveQuickSelectIndex >= 0) + { + GiveQuickTargetSelectSimulation(similarTargetInfoSet.Get(giveQuickSelectIndex), aIVirtualField); + } + if (result.TargetSet == null || aIVirtualField.EnemyClass.Life < result.ResultField.EnemyClass.Life) + { + result.ResultField = aIVirtualField; + result.TargetSet = aISelectedTargetInfoSet.Clone(); + } + } + } + + private static int GetGiveQuickSelectIndex(List selectInfoList) + { + for (int i = 0; i < selectInfoList.Count; i++) + { + AIVirtualTargetSelectInfo aIVirtualTargetSelectInfo = selectInfoList[i]; + if (aIVirtualTargetSelectInfo.SelectRule != null && (aIVirtualTargetSelectInfo.SelectRule.Type == AIPlayTagType.PlayQuick || aIVirtualTargetSelectInfo.SelectRule.Type == AIPlayTagType.FanfareQuick)) + { + return i; + } + } + return -1; + } + + private static void GiveQuickTargetSelectSimulation(AISelectedTargetInfo receiveQuickTargets, AIVirtualField field) + { + if (!receiveQuickTargets.HasTarget) + { + return; + } + for (int i = 0; i < receiveQuickTargets.Targets.Count; i++) + { + AIVirtualCard aIVirtualCard = receiveQuickTargets.Targets[i]; + AIVirtualAttackInfo aIVirtualAttackInfo = new AIVirtualAttackInfo(aIVirtualCard, field.EnemyClass); + if (AIAttackSimulationUtility.IsAttackPossible(field, aIVirtualAttackInfo) && !aIVirtualAttackInfo.WillTargetDestroyByAttackTags(field, field.BestPlayPtn, aIVirtualCard)) + { + AIVirtualAttackSimulator.Attack(aIVirtualAttackInfo, field); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AILifeLowerLimitInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AILifeLowerLimitInfo.cs new file mode 100644 index 0000000..fcbfec5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AILifeLowerLimitInfo.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class AILifeLowerLimitInfo : AIBarrierInfoBase +{ + public override AIBarrierType BarrierType => AIBarrierType.DamageClippingLifeLowerLimit; + + public AILifeLowerLimitInfo(AIDamageType damageType, AIBarrierStopTiming stopTiming) + : base(0, damageType, stopTiming) + { + UpdateHash(); + } + + public AILifeLowerLimitInfo(AIDamageType damageType, List stopTimingList) + : base(0, damageType, stopTimingList) + { + UpdateHash(); + } + + public override AIBarrierInfoBase Clone() + { + return new AILifeLowerLimitInfo(base.DamageType, base.StopTimingList); + } + + public override bool IsShield() + { + return false; + } + + protected override int CalcDamage(AIVirtualCard owner, int damage) + { + int b = owner.Life - 1; + return Mathf.Min(damage, b); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIMaxAttackSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIMaxAttackSelectLogicArgument.cs new file mode 100644 index 0000000..5a115c0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIMaxAttackSelectLogicArgument.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIMaxAttackSelectLogicArgument : AISelectLogicArgumentBase +{ + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.MAX_ATTACK_LOGIC; + + public AIMaxAttackSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + AIVirtualCard aIVirtualCard = null; + int compare = 0; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard2 = candidates[i]; + if (aIVirtualCard2.IsUnit && (aIVirtualCard == null || IsWellChosenTarget(aIVirtualCard2, compare, worstOrBest))) + { + aIVirtualCard = aIVirtualCard2; + compare = aIVirtualCard2.Attack; + } + } + return aIVirtualCard; + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + LogNotImplementMultipleSelect(); + return null; + } + + private bool IsWellChosenTarget(AIVirtualCard target, int compare, AISelectTargetPattern worstOrBest) + { + return worstOrBest switch + { + AISelectTargetPattern.Best => target.Attack > compare, + AISelectTargetPattern.Worst => target.Attack < compare, + _ => false, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIMetamorphoseSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIMetamorphoseSelectLogicArgument.cs new file mode 100644 index 0000000..b8188bf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIMetamorphoseSelectLogicArgument.cs @@ -0,0 +1,53 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIMetamorphoseSelectLogicArgument : AISelectLogicArgumentBase +{ + private const int INVALID_ID = -1; + + private const int METAMORPHOSE_ID_ARG_INDEX = 0; + + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.METAMORPHOSE_LOGIC; + + public AIMetamorphoseSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + AIRemovalEvaluationOption aIRemovalEvaluationOption = CreateMetamorphoseOption(tagOwner, field); + if (aIRemovalEvaluationOption == null) + { + return null; + } + return AISimulationRemovalUtility.SelectRemovalTarget(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Metamorphose, aIRemovalEvaluationOption); + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + AIRemovalEvaluationOption aIRemovalEvaluationOption = CreateMetamorphoseOption(tagOwner, field); + if (aIRemovalEvaluationOption == null) + { + return null; + } + return AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates, tagOwner, field, playPtn, situation, worstOrBest, AIRemovalType.Metamorphose, selectCount, aIRemovalEvaluationOption); + } + + private AIRemovalEvaluationOption CreateMetamorphoseOption(AIVirtualCard tagOwner, AIVirtualField field) + { + if (_argumentList == null || _argumentList.Count <= 0) + { + AIConsoleUtility.LogError("AIMetamorphoseSelectLogicArgument error!! _argumentList is null"); + return null; + } + int num = _argumentList[0].EvalID(); + if (num == -1) + { + AIConsoleUtility.LogError("AIMetamorphoseSelectLogicArgument error!! tokenId is invalid"); + return null; + } + return AIMetamorphoseSimulationUtility.CreateMetamorphoseEvaluationOption(tagOwner, field, num); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIMetamorphoseSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIMetamorphoseSimulationUtility.cs new file mode 100644 index 0000000..2b92d82 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIMetamorphoseSimulationUtility.cs @@ -0,0 +1,440 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public static class AIMetamorphoseSimulationUtility +{ + private struct SwappedMetamorphoseInfo + { + public AIVirtualCard TargetCard; + + public AIVirtualCard TokenCard; + + public List SwappedCardList; + + public int SwappedIndex; + } + + public static AIRemovalEvaluationOption CreateMetamorphoseEvaluationOption(AIVirtualCard tagOwner, AIVirtualField field, int metamorphoseId) + { + return new AIRemovalEvaluationOption + { + TagOwner = tagOwner, + MetamorphoseTokenId = metamorphoseId + }; + } + + public static void MetamorphoseAll(AIVirtualField field, List range, int metamorphoseId, AIVirtualCard actor, AISituationInfo situation) + { + for (int i = 0; i < range.Count; i++) + { + AIVirtualCard aIVirtualCard = range[i]; + if (!aIVirtualCard.IsIndependent && !aIVirtualCard.IsDead) + { + ExecuteMetamorphose(aIVirtualCard, metamorphoseId, actor, field, situation); + } + } + } + + public static void MetamorphoseRandom(AIVirtualField field, List range, int metamorphoseId, AIVirtualCard actor, List playPtn, AISituationInfo situation, int selectCount = 1) + { + if (selectCount <= 0) + { + AIConsoleUtility.LogError($"AIMetamorphoseSimulationUtility.MetamorphoseRandom() error!! selectCount == {selectCount}"); + return; + } + AIRemovalEvaluationOption aIRemovalEvaluationOption = CreateMetamorphoseEvaluationOption(actor, field, metamorphoseId); + if (aIRemovalEvaluationOption == null) + { + AIConsoleUtility.LogError("AIMetamorphoseSimulationUtility.MetamorphoseRandom() error!! failed create option"); + return; + } + if (selectCount == 1) + { + AIVirtualCard aIVirtualCard = AISimulationRemovalUtility.SelectRemovalTarget(range, actor, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Metamorphose, aIRemovalEvaluationOption); + if (aIVirtualCard != null && !aIVirtualCard.IsIndependent) + { + ExecuteMetamorphose(aIVirtualCard, metamorphoseId, actor, field, situation); + } + return; + } + List list = AISimulationRemovalUtility.SelectMultipleRemovalTargets(range, actor, field, playPtn, situation, AISelectTargetPattern.Worst, AIRemovalType.Metamorphose, selectCount, aIRemovalEvaluationOption); + if (list != null && list.Count > 0) + { + for (int i = 0; i < list.Count; i++) + { + ExecuteMetamorphose(list[i], metamorphoseId, actor, field, situation); + } + } + } + + public static void MetamorphoseTarget(AIVirtualField field, List candidates, int metamorphoseId, List playPtn, AISituationInfo situation, AIScriptTokenArgType whichTarget, int count) + { + if (situation.IsTargetExists(whichTarget)) + { + MetamorphoseSelectedTarget(field, metamorphoseId, situation, whichTarget); + } + else + { + MetamorphoseTargetPrediction(field, candidates, metamorphoseId, playPtn, situation, whichTarget, count); + } + } + + private static void MetamorphoseSelectedTarget(AIVirtualField field, int metamorphoseId, AISituationInfo situation, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("MetamorphoseSelectedTarget(): error!! No target!!!!!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + ExecuteMetamorphose(targets[i], metamorphoseId, situation.Actor, field, situation); + } + } + + private static void MetamorphoseTargetPrediction(AIVirtualField field, List candidates, int metamorphoseId, List playPtn, AISituationInfo situation, AIScriptTokenArgType whichTarget, int count) + { + if (candidates.Count < count) + { + AIConsoleUtility.LogError("MetamorphoseTargetPrediction(): Target candidates is not enough"); + return; + } + AIVirtualCard actor = situation.Actor; + AIRemovalEvaluationOption aIRemovalEvaluationOption = CreateMetamorphoseEvaluationOption(actor, field, metamorphoseId); + if (aIRemovalEvaluationOption == null) + { + AIConsoleUtility.LogError("MetamorphoseTargetPrediction() error!! failed create option"); + return; + } + if (count == 1) + { + AIVirtualCard aIVirtualCard = AISimulationRemovalUtility.SelectRemovalTarget(candidates, actor, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Metamorphose, aIRemovalEvaluationOption); + if (aIVirtualCard != null && !aIVirtualCard.IsIndependent) + { + ExecuteMetamorphose(aIVirtualCard, metamorphoseId, actor, field, situation); + } + return; + } + List list = AISimulationRemovalUtility.SelectMultipleRemovalTargets(candidates, actor, field, playPtn, situation, AISelectTargetPattern.Best, AIRemovalType.Metamorphose, count, aIRemovalEvaluationOption); + if (list != null && list.Count > 0) + { + for (int i = 0; i < list.Count; i++) + { + ExecuteMetamorphose(list[i], metamorphoseId, actor, field, situation); + } + } + } + + private static void ExecuteMetamorphose(AIVirtualCard target, int metamorphoseTokenId, AIVirtualCard actor, AIVirtualField field, AISituationInfo situation) + { + target.MetamorphoseLeave(situation); + MetamorphoseTokenOnVirtualField(target, metamorphoseTokenId, actor, field); + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + field.ExecuteWhenChangeInplayTags(emptyPlayPtn, situation); + } + + public static float EvalTargetingMetamorphose(AIVirtualCard tagOwner, AIVirtualField field, List filters, int tokenId, List playPtn, AISituationInfo situation) + { + float num = float.MinValue; + List bothClassAndInplayCards = tagOwner.SelfField.CardListSet.BothClassAndInplayCards; + bothClassAndInplayCards = AIFilteringUtility.MultipleFiltering(bothClassAndInplayCards, filters, tagOwner, playPtn, situation); + bothClassAndInplayCards.RemoveAll((AIVirtualCard c) => c.IsLeader); + if (bothClassAndInplayCards == null || bothClassAndInplayCards.Count <= 0) + { + return 0f; + } + AIVirtualCard aIVirtualCard = null; + if (bothClassAndInplayCards.IsNotNullOrEmpty()) + { + bothClassAndInplayCards = AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(bothClassAndInplayCards, tagOwner, playPtn); + for (int num2 = 0; num2 < bothClassAndInplayCards.Count; num2++) + { + AIVirtualCard aIVirtualCard2 = bothClassAndInplayCards[num2]; + if (!aIVirtualCard2.IsIndependent && (aIVirtualCard2.IsAlly == tagOwner.IsAlly || (!aIVirtualCard2.IsUntouchable && !aIVirtualCard2.IsSneak))) + { + float num3 = EvaluateSingleMetamorphoseValue(aIVirtualCard2, tokenId, tagOwner, field, playPtn, situation); + if (num < num3) + { + num = num3; + aIVirtualCard = aIVirtualCard2; + } + } + } + } + if (aIVirtualCard == null) + { + return 0f; + } + return num; + } + + public static float EvalRandomMetamorphose(AIVirtualCard tagOwner, AIVirtualField field, List filters, int tokenId, List playPtn, int count, AISituationInfo situation) + { + List bothClassAndInplayCards = field.CardListSet.BothClassAndInplayCards; + bothClassAndInplayCards = AIFilteringUtility.MultipleFiltering(bothClassAndInplayCards, filters, tagOwner, playPtn, null); + if (bothClassAndInplayCards == null || bothClassAndInplayCards.Count <= 0) + { + return 0f; + } + bothClassAndInplayCards.RemoveAll((AIVirtualCard c) => c.IsLeader); + if (bothClassAndInplayCards == null || bothClassAndInplayCards.Count <= 0) + { + return 0f; + } + if (bothClassAndInplayCards.Count <= count) + { + return EvalAllMetamorphose(bothClassAndInplayCards, tokenId, tagOwner, field, playPtn, situation); + } + float num = 0f; + new List(); + List list = AIMathematicsLibrary.EnumerateCombinations(bothClassAndInplayCards, count).ToList(); + for (int num2 = 0; num2 < list.Count; num2++) + { + List targetCards = new List(list[num2]); + num += EvalAllMetamorphose(targetCards, tokenId, tagOwner, field, playPtn, situation); + } + return num / (float)list.Count; + } + + public static float EvalAllMetamorphose(AIVirtualCard tagOwner, AIVirtualField field, List filters, int tokenId, List playPtn, AISituationInfo situation) + { + return EvalAllMetamorphose(AIFilteringUtility.MultipleFiltering(tagOwner.SelfField.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null), tokenId, tagOwner, field, playPtn, situation); + } + + private static float EvalAllMetamorphose(List targetCards, int tokenId, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + targetCards.RemoveAll((AIVirtualCard c) => c.IsLeader); + if (targetCards == null || targetCards.Count <= 0) + { + return 0f; + } + if (targetCards == null || targetCards.Count <= 0) + { + return 0f; + } + List swappedList = new List(); + float num = 0f; + List list = new List(); + AIVirtualCard aIVirtualCard = null; + AIVirtualCard aIVirtualCard2 = null; + for (int num2 = 0; num2 < targetCards.Count; num2++) + { + AIVirtualCard aIVirtualCard3 = targetCards[num2]; + if (aIVirtualCard3.IsIndependent) + { + continue; + } + AIVirtualCard aIVirtualCard4 = null; + if (aIVirtualCard3.IsAlly) + { + if (aIVirtualCard == null) + { + aIVirtualCard = field.AI.tokenManager.GetTokenFromId(tokenId, isAlly: true, field); + } + aIVirtualCard4 = aIVirtualCard; + } + else + { + if (aIVirtualCard2 == null) + { + aIVirtualCard2 = field.AI.tokenManager.GetTokenFromId(tokenId, isAlly: false, field); + } + aIVirtualCard4 = aIVirtualCard2; + } + if (aIVirtualCard4 == null) + { + AIConsoleUtility.LogError(string.Format("AIMetamorphosSimulationUtility.EvaluateSingleMetamorphoseValue() error!! Not found {0}: {1}", aIVirtualCard3.IsAlly ? "Ally" : "ENEMY", tokenId)); + return 0f; + } + num += EvaluateMetamorphoseTargetValue(aIVirtualCard3, playPtn, situation) * ((tagOwner.IsAlly != aIVirtualCard3.IsAlly) ? 1f : (-1f)); + list.Add(aIVirtualCard4); + } + for (int num3 = 0; num3 < targetCards.Count; num3++) + { + SwapInplayMetamorphoseCard(list[num3], targetCards[num3], field, ref swappedList); + } + float num4 = 0f; + for (int num5 = 0; num5 < list.Count; num5++) + { + AIVirtualCard aIVirtualCard5 = list[num5]; + float num6 = EvaluateMetamorphoseTokenValue(aIVirtualCard5, playPtn, situation); + num4 += num6 * ((tagOwner.IsAlly != aIVirtualCard5.IsAlly) ? 1f : (-1f)); + } + RestoreInplayMetamorphoseCard(swappedList); + list.Clear(); + return (num - num4) * (tagOwner.IsAlly ? 1f : (-1f)); + } + + public static float EvaluateSingleMetamorphoseValue(AIVirtualCard targetCard, int afterMetamorphoseTokenId, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation) + { + float num = EvaluateMetamorphoseTargetValue(targetCard, playPtn, situation); + AIVirtualCard tokenFromId = field.AI.tokenManager.GetTokenFromId(afterMetamorphoseTokenId, targetCard.IsAlly, field); + if (tokenFromId == null) + { + AIConsoleUtility.LogError($"AIMetamorphosSimulationUtility.EvaluateSingleMetamorphoseValue() error!! Not found id == {afterMetamorphoseTokenId}"); + return 0f; + } + List swappedList = new List(); + SwapInplayMetamorphoseCard(tokenFromId, targetCard, field, ref swappedList); + float num2 = EvaluateMetamorphoseTokenValue(tokenFromId, playPtn, situation); + float result = (num - num2) * ((targetCard.IsAlly != tagOwner.IsAlly) ? 1f : (-1f)); + RestoreInplayMetamorphoseCard(swappedList); + return result; + } + + private static float EvaluateMetamorphoseTargetValue(AIVirtualCard target, List playPtn, AISituationInfo situation) + { + return target.EvaluateValueOnField(playPtn, situation, useStyle: true) + (target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) + target.GetAllBanishBonus(playPtn, useIgnoreInBattle: false) + target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false)); + } + + private static float EvaluateMetamorphoseTokenValue(AIVirtualCard tokenCard, List playPtn, AISituationInfo situation) + { + return tokenCard.EvaluateValueOnField(playPtn, situation, useStyle: true, doesUseLostLife: true, useOthersTag: true, useIgnoreInBattle: true) + (tokenCard.EvaluateBreakValue(playPtn, useIgnoreBreak: true) + tokenCard.EvaluateLeaveValue(playPtn, useIgnoreInBattle: true)) * EnemyAI.BREAKBONUS_RATE_IN_HAND; + } + + private static void SwapInplayMetamorphoseCard(AIVirtualCard tokenCard, AIVirtualCard targetCard, AIVirtualField fieldTemp, ref List swappedList) + { + if (targetCard.IsAlly) + { + Swap(fieldTemp.AllyInplayCards, swappedList); + Swap(fieldTemp.CardListSet.AllAllyCards, swappedList); + Swap(fieldTemp.CardListSet.AllyClassAndInplayCards, swappedList); + } + else + { + Swap(fieldTemp.EnemyInplayCards, swappedList); + Swap(fieldTemp.CardListSet.EnemyClassAndInplayCards, swappedList); + } + Swap(fieldTemp.CardListSet.AllReferableCards, swappedList); + Swap(fieldTemp.CardListSet.BothClassAndInplayCards, swappedList); + Swap(fieldTemp.CardListSet.BothInplayCards, swappedList); + void Swap(List _cardList, List _swappedList) + { + int num = _cardList.IndexOf(targetCard); + if (num >= 0 && num < _cardList.Count) + { + _cardList.Insert(num, tokenCard); + _cardList.Remove(targetCard); + _swappedList = AIParamQuery.AddElementToList(new SwappedMetamorphoseInfo + { + TargetCard = targetCard, + TokenCard = tokenCard, + SwappedCardList = _cardList, + SwappedIndex = num + }, _swappedList); + } + } + } + + private static void RestoreInplayMetamorphoseCard(List swappedList) + { + if (swappedList != null) + { + for (int i = 0; i < swappedList.Count; i++) + { + SwappedMetamorphoseInfo swappedMetamorphoseInfo = swappedList[i]; + List swappedCardList = swappedMetamorphoseInfo.SwappedCardList; + int swappedIndex = swappedMetamorphoseInfo.SwappedIndex; + swappedCardList.Insert(swappedIndex, swappedMetamorphoseInfo.TargetCard); + swappedCardList.Remove(swappedMetamorphoseInfo.TokenCard); + } + swappedList.Clear(); + } + } + + public static void MetamorphoseTokenOnVirtualField(AIVirtualCard targetCard, int tokenId, AIVirtualCard tagOwner, AIVirtualField field) + { + AIVirtualCard tokenFromId = field.AI.tokenManager.GetTokenFromId(tokenId, targetCard.IsAlly, field, needsClone: true); + if (tokenFromId == null) + { + AIConsoleUtility.LogError("MetamorphoseTokenOnVirtualField: tokenCard is null"); + return; + } + tokenFromId.InitAtMetamorphose(targetCard, tagOwner); + field.CardListSet.ReplaceInplayCard(targetCard.IsAlly, tokenFromId, targetCard); + targetCard.IsMetamorphosed = true; + if (targetCard.IsAlly) + { + List allyInplayCards = field.AllyInplayCards; + allyInplayCards.Insert(allyInplayCards.IndexOf(targetCard), tokenFromId); + allyInplayCards.Remove(targetCard); + } + else + { + List enemyInplayCards = field.EnemyInplayCards; + enemyInplayCards.Insert(enemyInplayCards.IndexOf(targetCard), tokenFromId); + enemyInplayCards.Remove(targetCard); + field.EnemyTokenQueue.Enqueue(new Tuple(targetCard, tokenFromId)); + } + } + + public static void MetamorphoseHandAll(AIVirtualField field, List range, int metamorphoseId, AIVirtualCard actor, AISituationInfo situation) + { + for (int i = 0; i < range.Count; i++) + { + MetamorphoseHandOnVirtualField(range[i], metamorphoseId, actor, field); + } + } + + public static void MetamorphoseHandRandom(AIVirtualField field, List range, int metamorphoseId, AIVirtualCard actor, List playPtn, AISituationInfo situaion) + { + AIVirtualCard aIVirtualCard = null; + float num = float.MinValue; + for (int i = 0; i < range.Count; i++) + { + AIVirtualCard aIVirtualCard2 = range[i]; + float num2 = aIVirtualCard2.EvaluatePlayValue(playPtn, situaion) + aIVirtualCard2.GetHandBonus(playPtn, situaion, isIgnoreInFusion: false); + if (num < num2) + { + aIVirtualCard = aIVirtualCard2; + num = num2; + } + } + if (aIVirtualCard != null) + { + MetamorphoseHandOnVirtualField(aIVirtualCard, metamorphoseId, actor, field); + } + } + + public static void MetamorphoseHandTarget(AIVirtualField field, List candidates, int metamorphoseId, AISituationInfo situation, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("MetamorphoseHandTarget error!! No target!!!!!"); + return; + } + for (int i = 0; i < situationTarget.Targets.Count; i++) + { + AIVirtualCard aIVirtualCard = situationTarget.Targets[i]; + if (candidates.Contains(aIVirtualCard)) + { + MetamorphoseHandOnVirtualField(aIVirtualCard, metamorphoseId, situation.Actor, field); + } + } + } + + public static void MetamorphoseHandOnVirtualField(AIVirtualCard targetCard, int tokenId, AIVirtualCard tagOwner, AIVirtualField field) + { + AIVirtualCard tokenFromId = field.AI.tokenManager.GetTokenFromId(tokenId, tagOwner.IsAlly, field, needsClone: true); + if (tokenFromId == null) + { + AIConsoleUtility.LogError("MetamorphoseHandOnVirtualField: tokenCard is null"); + return; + } + tokenFromId.InitAtHandMetamorphose(targetCard, tagOwner); + targetCard.IsMetamorphosed = true; + if (targetCard.IsAlly) + { + field.CardListSet.ReplaceAllyHandCard(tokenFromId, targetCard); + } + List obj = (targetCard.IsAlly ? field.AllyHandCards : field.GetEnemyHandCardList()); + obj.Insert(obj.IndexOf(targetCard), tokenFromId); + obj.Remove(targetCard); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AINetworkBattleManager.cs b/SVSim.BattleEngine/Engine/Wizard/AINetworkBattleManager.cs new file mode 100644 index 0000000..b6ffafe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AINetworkBattleManager.cs @@ -0,0 +1,503 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.Battle; +using Wizard.Battle.Phase; +using Wizard.Battle.Recovery; +using Wizard.Battle.View.Vfx; +using Wizard.BattleMgr; + +namespace Wizard; + +public class AINetworkBattleManager : NetworkBattleManagerBase +{ + private AITurnControl _aiTurnControl; + + private Func _turnTransitionFunc; + + private VfxBase _initiateGameEndFunc; + + private bool _sendFinshBattleTask; + + private bool _isWin; + + public AIBattleInfoReceiver BattleInfoReceiver { get; protected set; } + + public AINetworkBattleManager(IBattleMgrContentsCreator contentsCreator) + : base(contentsCreator) + { + _turnTransitionFunc = null; + } + + protected override void NetworkBattleManagerSetup() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.SetDeckMaxCount(40, isSelf: true); + dataMgr.SetDeckMaxCount(40, isSelf: false); + IsShowDisconnectPanel = false; + IsShowOpponentDisconnectPanel = false; + NotReplaceCardList = new List(); + base.validateSkillIndexList = new List(); + RegisterActionManager = new RegisterActionManager(this); + base.RegisterUnapprovedList = new List(); + base.registerSelectTypeSkillIndexList = new List(); + sendKeyActionDataManager = new SendKeyActionDataManager(); + TouchControl = new NetworkTouchControl(this, _battleCamera, _backGround); + networkTouchControl = TouchControl as NetworkTouchControl; + JudgeResultReceiveCode = NetworkBattleReceiver.RESULT_CODE.NotFinish; + if (base.IsRecovery || GameMgr.GetIns().IsReplayBattle) + { + networkTouchControl.SetDisableTouch(); + base.networkBattleData = new NetworkRecoveryBattleData(this); + networkReceiver = new NetworkReplayBattleReceiver(this); + OperateReceive = new RecoveryOperateReceive(this, RegisterActionManager, OperateMgr, base.networkBattleData); + int selfIdxSeed = (base.IsRecovery ? _contentsCreator.RecoveryManager.IdxChangeSeed : Data.ReplayBattleInfo.IdxChangeSeed); + int oppIdxSeed = (GameMgr.GetIns().IsReplayBattle ? Data.ReplayBattleInfo.OppoIdxChangeSeed : (-1)); + CreateXorShift(selfIdxSeed, oppIdxSeed); + BattleEnemy.EnableEnemyAI = false; + } + else + { + base.networkBattleData = new NetworkBattleData(this); + networkReceiver = new NetworkBattleReceiver(this); + OperateReceive = new OperateReceive(this, RegisterActionManager, OperateMgr, base.networkBattleData); + } + OperateMgr.SetTouchControl(TouchControl); + networkConsistency = new NetworkConsistency(this); + _networkBattleSetupCardEventBase = new NetworkAIBattleSetupCardEvent(this, RegisterActionManager, base.networkBattleData); + operateReceiveChecker = new OperateReceiveChecker(this, base.networkBattleData); + _intervalCheckList = new List(); + base.opponentRecoveryToDispChecker = new OpponentRecoveryToDispChecker(); + base.disconnectToDispChecker = new DisconnectToDispChecker(); + _intervalCheckList.Add(base.disconnectToDispChecker); + base.disconnectToLoseChecker = new DisconnectToLoseChecker(); + base.disconnectToLoseChecker.OnDisconnectLose += delegate + { + DisconnectLose(); + }; + base.disconnectToLoseChecker.OnBeforeDisconnectLose += delegate + { + BeforeDisconnectLose(); + }; + _intervalCheckList.Add(base.disconnectToLoseChecker); + base.notMulliganEndToJudgeChecker = new NullNotMulliganEndToJudgeChecker(); + base.notTurnEndToLoseChecker = new NullNotTurnEndToLoseChecker(this); + base.receiveTurnEndToJudgeResult = new NullReceiveTurnEndToJudgeResult(); + _intervalCheckList.Add(base.notTurnEndToLoseChecker); + base.notTurnStartToLoseChecker = new NullNotTurnStartToLoseChecker(); + _intervalCheckList.Add(base.notTurnStartToLoseChecker); + SendIntervalTriggerMain = new AISendIntervalTrigger(); + base.NetworkSender = new NetworkBattleSender(this, RegisterActionManager, base.RegisterUnapprovedList, networkConsistency); + _aiTurnControl = new AITurnControl(); + if (!base.IsRecovery) + { + SettingOpponentAliveEvent(); + IsStopIntervalCheck = false; + ToolboxGame.RealTimeNetworkAgent.StartPreparedStartTimer(DateTime.Now); + ToolboxGame.RealTimeNetworkAgent.StartRecoveryRecording(); + } + } + + protected override void DisconnectLose() + { + JudgeErrorDialog(isError: false); + } + + public override VfxBase ChangePhase(IPhase phase) + { + if (phase is NetworkMulliganPhase || (phase is MainPhase && base.IsRecovery)) + { + base.notMulliganEndToJudgeChecker.StartChecker(); + base.disconnectToDispChecker.OnDisp += delegate + { + ControlDisconnectOffTouchAndView(flag: true); + }; + base.disconnectToDispChecker.OnErase += delegate + { + ControlDisconnectOffTouchAndView(flag: false); + }; + } + if (phase is OpeningPhase) + { + ConnectionReportTrigger.ConnectionReport(this); + } + return base.ChangePhase(phase); + } + + public override void Update(float dt) + { + base.Update(dt); + if (_turnTransitionFunc != null && ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive) + { + base.VfxMgr.RegisterSequentialVfx(_turnTransitionFunc.GetAllFuncVfxResults()); + _turnTransitionFunc = null; + } + if (_initiateGameEndFunc != null && ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive) + { + base.VfxMgr.RegisterSequentialVfx(_initiateGameEndFunc); + _initiateGameEndFunc = null; + } + if (ToolboxGame.RealTimeNetworkAgent != null && _turnTransitionFunc == null && !IsBattleEnd && BattleEnemy.IsSelfTurn) + { + _aiTurnControl.Update(EnemyAI); + } + } + + public override void SetupBattlePlayersEvent() + { + BattlePlayer.OnSetupCardEvent += SetupCardEvent; + BattleEnemy.OnSetupCardEvent += SetupCardEvent; + BattlePlayer.OnSetupClassEvent += SetupPlayerClassEvent; + BattleEnemy.OnSetupClassEvent += SetupOpponentClassEvent; + BattlePlayer.Setup(BattleEnemy); + BattleEnemy.Setup(BattlePlayer); + BattlePlayer.OnTurnEnd += delegate + { + base.VfxMgr.Cancel(); + return NullVfx.GetInstance(); + }; + } + + protected override void SetupNetworkEvent(bool isRecovery) + { + BattlePlayer.OnPlayerActive += delegate + { + if (turnEndTimeController != null) + { + turnEndTimeController.StartCountDown("AIOnPlayerActive"); + } + }; + BattlePlayer battlePlayer = BattlePlayer; + battlePlayer.OnPostTurnEndComplete = (Action)Delegate.Combine(battlePlayer.OnPostTurnEndComplete, (Action)delegate + { + if (turnEndTimeController != null) + { + turnEndTimeController.EndCountDown("AIOnTurnEndComplete"); + } + SendTurnEndAction(); + }); + BattleEnemy.OnTurnStartBeforeDraw += delegate + { + if (!IsVirtualBattle) + { + _aiTurnControl.StartTurnTimer(); + } + return NullVfx.GetInstance(); + }; + BattleEnemy battleEnemy = BattleEnemy; + battleEnemy.OnPostTurnEndComplete = (Action)Delegate.Combine(battleEnemy.OnPostTurnEndComplete, (Action)delegate + { + if (!IsVirtualBattle) + { + _aiTurnControl.StopTurnTimer(); + } + }); + } + + public override void InitiateGameEndSequence(bool hasWon) + { + if (ToolboxGame.RealTimeNetworkAgent != null && ToolboxGame.RealTimeNetworkAgent.PlayerNetworkStatus.IsAlive) + { + if (!_sendFinshBattleTask) + { + _sendFinshBattleTask = true; + _isWin = hasWon; + BattleFinishToEffectClear(); + BattleFinishToStopIntervalChecker(); + ToolboxGame.RealTimeNetworkAgent.FinishBattleTask(this); + } + } + else + { + _initiateGameEndFunc = InstantVfx.Create(delegate + { + InitiateGameEndSequence(hasWon); + }); + } + } + + public override void FinishBattleEffect(bool classDead) + { + classDead = !_isWin; + if (classDead) + { + BattleCardBase battleCardBase = GetBattlePlayer(classDead).Class; + if (battleCardBase.Life >= 1 && !battleCardBase.IsDead) + { + battleCardBase.FlagCardAsDestroyedByKiller(); + FINISH_TYPE finishTypeByStatus = GetFinishTypeByStatus(); + base.VfxMgr.RegisterSequentialVfx(DeadClass(classDead, finishTypeByStatus)); + } + } + base.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + base.InitiateGameEndSequence(!classDead); + })); + } + + public override VfxBase JudgeBattleResult() + { + if (BattlePlayer.Class.IsDead && BattleEnemy.Class.IsDead) + { + return InstantVfx.Create(delegate + { + InitiateGameEndSequence(!BattlePlayer.IsSelfTurn); + }); + } + if (BattlePlayer.Class.IsDead) + { + return InstantVfx.Create(delegate + { + InitiateGameEndSequence(hasWon: false); + }); + } + if (BattleEnemy.Class.IsDead) + { + return InstantVfx.Create(delegate + { + InitiateGameEndSequence(hasWon: true); + }); + } + return NullVfx.GetInstance(); + } + + protected override void SetupEvent() + { + base.SetupEvent(); + BattlePlayer.OnShortageDeck += () => OnShortageDeck(BattlePlayer); + BattleEnemy.OnShortageDeck += () => OnShortageDeck(BattleEnemy); + SetUpTurnTransitionEvent(); + } + + private void SetUpTurnTransitionEvent() + { + BattlePlayer.OnTurnEndFinish += delegate + { + if (IsVirtualBattle || base.IsRecovery) + { + return NullVfx.GetInstance(); + } + _turnTransitionFunc = null; + _turnTransitionFunc = (Func)Delegate.Combine(_turnTransitionFunc, new Func(base.ControlTurnStartOpponent)); + return NullVfx.GetInstance(); + }; + BattleEnemy.OnTurnEndFinish += delegate + { + if (IsVirtualBattle || base.IsRecovery) + { + return NullVfx.GetInstance(); + } + _turnTransitionFunc = null; + _turnTransitionFunc = (Func)Delegate.Combine(_turnTransitionFunc, new Func(base.ControlTurnStartPlayer)); + return NullVfx.GetInstance(); + }; + } + + protected override void SetupBattlePlayerRegisterEvents(BattlePlayerBase battlePlayer) + { + } + + protected override void SetupNetworkActionProcessorEvent(ActionProcessor processor, bool isPlayer) + { + } + + public override void SetupFieldAndHandAfterRecovery(Action onEndRecoveryCallback, RecoveryOperationInfo aiBattleRecoveryData = null) + { + if (aiBattleRecoveryData.SetupInfo.HasMulliganInfo) + { + BattlePlayer.PlayerBattleView.ClearPlayQueue(); + BattleEnemy.BattleEnemyView.ClearPlayQueue(); + RecreateCardViews(BattlePlayer.InPlayCards); + RecreateCardViews(BattlePlayer.HandCardList); + RecreateCardViews(BattlePlayer.DeckCardList); + RecreateCardViews(BattlePlayer.ReservedCardList); + RecreateCardViews(BattleEnemy.InPlayCards); + RecreateCardViews(BattleEnemy.HandCardList); + RecreateCardViews(BattleEnemy.DeckCardList); + RecreateCardViews(BattleEnemy.ReservedCardList); + RefreshHealthVfx refreshHealthVfx = new RefreshHealthVfx(BattlePlayer); + RefreshHealthVfx refreshHealthVfx2 = new RefreshHealthVfx(BattleEnemy); + ParallelVfxPlayer parallelVfxPlayer = ParallelVfxPlayer.Create(BattlePlayer.BattleView.Recovery(doseFirst: false), BattleEnemy.BattleView.Recovery(doseFirst: false), refreshHealthVfx, refreshHealthVfx2); + VfxBase vfxBase = (BattleEnemy.IsSelfTurn ? BattleEnemy.CreateThinkingVfx(this) : NullVfx.GetInstance()); + SequentialVfxPlayer vfx = SequentialVfxPlayer.Create(RecoveryAfterMulliganPhase.RestoreUI(this), parallelVfxPlayer, HandViewBase.CreateHideCardMeshesVfx(BattleEnemy.HandCardList), vfxBase, InstantVfx.Create(delegate + { + ResetLeaderAnimation(BattlePlayer, BattleEnemy); + })); + base.VfxMgr.RegisterSequentialVfx(vfx); + } + } + + public override void RecoveryEnd() + { + base.IsRecovery = false; + SettingOpponentAliveEvent(); + IsStopIntervalCheck = false; + SetUpTurnTransitionEvent(); + networkTouchControl.SetEnableTouch(); + NetworkBattleData networkBattleData = base.networkBattleData; + base.networkBattleData = new NetworkBattleData(this); + base.networkBattleData.isPlayerMulliganEnd = networkBattleData.isPlayerMulliganEnd; + base.networkBattleData.isOppoMulliganEnd = networkBattleData.isOppoMulliganEnd; + base.networkBattleData.SetReceiveData(networkBattleData.GetReceiveData()); + base.networkBattleData.isEnemyFirstTurn = networkBattleData.isEnemyFirstTurn; + _networkBattleSetupCardEventBase.OverwriteNetworkBattleData(base.networkBattleData); + SetupCreateBattleCardFunc(createCardWithoutGameObject: false); + OperateMgr operateMgr = OperateMgr; + OperateMgr = CreateOperateMgr(); + OperateMgr.SetUpRecoveryEvent(operateMgr); + StartRecoveryRecording(); + operateMgr = null; + OperateReceive = new OperateReceive(this, RegisterActionManager, OperateMgr, base.networkBattleData); + if (_phase is NetworkMulliganPhase) + { + (_phase as NetworkMulliganPhase).MulliganEventSetting(); + } + operateReceiveChecker = new OperateReceiveChecker(this, base.networkBattleData); + networkReceiver = new NetworkBattleReceiver(this); + SetupNetworkEvent(isRecovery: true); + if (_specialWinVfx == null) + { + ClearRegisterCardList(); + } + BattleEnemy.EnableEnemyAI = true; + BattlePlayer.Emotion.Enable = true; + BattleEnemy.Emotion.Enable = true; + if (BattleEnemy.IsSelfTurn) + { + EnemyAI.StopEnemyAI(); + EnemyAI.ExecuteEnemyAI(useWait: true); + } + ConnectionReportTrigger.ConnectionReport(this); + } + + protected override void FirstRecoverySetting() + { + if (!base.IsRecovery) + { + StartRecoveryRecording(); + } + } + + protected override int CreateBackgroundId() + { + if (_contentsCreator is RecoveryNetworkBattleMgrContentsCreator) + { + int backGroundId = ((RecoveryNetworkBattleMgrContentsCreator)_contentsCreator).RecoveryControllerInstance.AIBattleRecoveryData.SetupInfo.BackGroundId; + if (backGroundId >= 0) + { + return backGroundId; + } + } + return CalculationRandomStage(); + } + + public override void FinishBattle() + { + EnemyAI.StopEnemyAI(); + } + + public override void RecoveryTimeOutSetting(float extendTime, bool isMulliganEnd, long startTime = -1L) + { + if (!isMulliganEnd) + { + if (MulliganMgr != null) + { + MulliganMgr.GetMulliganInfo().SetExtendTime(extendTime); + } + return; + } + if (!BattlePlayer.IsSelfTurn) + { + if (startTime != -1) + { + _aiTurnControl.SetAndStartTurnTimer(DateTimeOffset.FromUnixTimeSeconds(startTime).LocalDateTime); + } + return; + } + if (turnEndTimeController == null) + { + TurnEndButtonUI component = SBattleLoad.m_TurnEndBtnUI.GetComponent(); + turnEndTimeController = new TurnEndTimeController(this, BattlePlayer, component); + } + if (!turnEndTimeController.IsCountdownRunning()) + { + turnEndTimeController.StartCountDown("SetTimeoutSetting"); + } + turnEndTimeController.SetExtendTime(extendTime); + } + + public void SetupMulliganLaunchCompleteEvent() + { + _contentsCreator.RecoveryRecordManager.SetupMulliganStartTimeRecorderEvent(this); + } + + public override VfxBase StartBattle() + { + SequentialVfxPlayer sequentialVfxPlayer = SequentialVfxPlayer.Create(); + LocalLog.SetLastTraceLogTurn(1); + sequentialVfxPlayer.Register(ChangePhase(base.PhaseCreator.CreateMainPhase())); + if (IsFirst) + { + sequentialVfxPlayer.Register(BattlePlayer.StartTurnControl("AIFirst")); + } + else + { + sequentialVfxPlayer.Register(BattleEnemy.StartTurnControl()); + } + return sequentialVfxPlayer; + } + + public override void SetupEnemyAI() + { + EnemyAI enemyAI = new RankMatchEnemyAI(); + enemyAI.LoadBufferedBattleState(); + EnemyAI = enemyAI; + BattleInfoReceiver = new AIBattleInfoReceiver(EnemyAI); + EnemyAI.InitOnGame(BattleEnemy, BattlePlayer); + if (!base.IsRecovery) + { + BattleEnemy.EnableEnemyAI = true; + } + } + + public override BattleCardBase MetamorphoseCard(int cardId, bool isPlayer, int addIndex, SkillBase skill, bool isFusion = false) + { + return CreateBattleCardWithGameObject(new CardCreateInfo(cardId, isPlayer, skill.ApplyingTargetFilter is SkillTargetChosenCardsFilter, NetworkBattleDefine.NetworkCardPlaceState.None, isReferenceOpponentCard: false, skill), new IndexInfo(addIndex)); + } + + public override BattleCardBase CreateBattleCardWithGameObject(CardCreateInfo info, IndexInfo indexInfo, int repeatCount = -1, bool isVirtual = false, bool isActualCard = false) + { + CardParameter cardParameterFromId = CardMaster.GetInstanceForBattle().GetCardParameterFromId(info.Id); + BattlePlayerBase battlePlayer = GetBattlePlayer(info.IsPlayer); + int cardIndex = SetupCardIndex(battlePlayer, indexInfo.AddIndex); + GameObject cardGameObject = null; + if (!base.IsRecovery || !isVirtual) + { + cardGameObject = CreateBaseCardGameObject(cardParameterFromId, info.IsPlayer, cardIndex); + } + BattleCardBase battleCardBase = CreateBattleCard(info.Id, info.IsPlayer, cardGameObject, cardParameterFromId, battlePlayer, cardIndex); + if (!base.IsRecovery || !isVirtual) + { + SetupCardObjectMaterials(cardGameObject, battleCardBase); + } + return battleCardBase; + } + + protected override void ControlDisconnectOffTouchAndView(bool flag) + { + if (!_sendFinshBattleTask) + { + base.ControlDisconnectOffTouchAndView(flag); + } + } + + public override void PlayRetire() + { + if (RecoveryRecordManagerBase.IsExistsAINetworkRecoveryFile()) + { + GameMgr.GetIns().GetDataMgr().SetRecoveryData(RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_ai_network.json")); + RecoveryRecordManagerBase.DeleteRecoveryFile(); + } + base.PlayRetire(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AINotBeAttackedSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AINotBeAttackedSimulationUtility.cs new file mode 100644 index 0000000..709812b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AINotBeAttackedSimulationUtility.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AINotBeAttackedSimulationUtility +{ + public static void GiveNotBeAttackedToAll(List targets) + { + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (!aIVirtualCard.IsIndependent) + { + aIVirtualCard.NotBeAttacked(); + } + } + } + + public static void GiveNotBeAttackedToTargeted(AISituationInfo situation, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("GiveNotBeAttackedToTargeted error! No target!"); + } + else + { + GiveNotBeAttackedToAll(situationTarget.Targets); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIOneMoreLastwordUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIOneMoreLastwordUtility.cs new file mode 100644 index 0000000..04790c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIOneMoreLastwordUtility.cs @@ -0,0 +1,134 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIOneMoreLastwordUtility +{ + public static bool IsHoldingOneMoreLastword(AIVirtualCard tagOwner, AIVirtualField field) + { + if (!tagOwner.TagCollectionContainer.HasTag(AIPlayTagType.OneMoreLastword)) + { + return false; + } + return tagOwner.TagCollectionContainer.OneMoreLastwordTags.CheckCondition(tagOwner, field); + } + + private static bool IsOneMoreLastwordHolderInplay(AIVirtualField field, List enemyTargets, ref int holderIndex, ref float threshold) + { + for (int i = 0; i < enemyTargets.Count; i++) + { + AIVirtualCard owner = field.EnemyInplayCards[enemyTargets[i]]; + if (IsGiveTagOfOneMoreLastwordTagged(field, owner, ref threshold)) + { + holderIndex = i; + return true; + } + } + return false; + } + + public static void SortEnemyTargetByBreakBonus(AIVirtualField field, List enemyTargets) + { + if (IsHoldingOneMoreLastword(field.EnemyClass, field)) + { + SortEnemyTargetsWhenLeaderTaggedOneMoreLastword(field, enemyTargets); + return; + } + float threshold = 0f; + int holderIndex = -1; + if (IsOneMoreLastwordHolderInplay(field, enemyTargets, ref holderIndex, ref threshold)) + { + SortEnemyTargetsWhenOneMoreLastwordHolderInplay(field, enemyTargets, holderIndex, threshold); + } + } + + private static void SortEnemyTargetsWhenLeaderTaggedOneMoreLastword(AIVirtualField field, List enemyTargets) + { + float num = float.MaxValue; + int num2 = -1; + for (int i = 0; i < enemyTargets.Count; i++) + { + AIVirtualCard aIVirtualCard = field.EnemyInplayCards[enemyTargets[i]]; + if (aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Lastword)) + { + float num3 = aIVirtualCard.EvaluateBreakValue(field.BestPlayPtn, useIgnoreBreak: true); + if (num3 < num) + { + num = num3; + num2 = i; + } + } + } + if (num2 > 0) + { + int value = enemyTargets[num2]; + for (int num4 = num2; num4 > 0; num4--) + { + enemyTargets[num4] = enemyTargets[num4 - 1]; + } + enemyTargets[0] = value; + } + } + + private static void SortEnemyTargetsWhenOneMoreLastwordHolderInplay(AIVirtualField field, List enemyTargets, int holderIndex, float breakBonusThreshold) + { + List list = new List(); + List list2 = new List(); + float num = float.MaxValue; + for (int i = 0; i < enemyTargets.Count; i++) + { + if (i == holderIndex) + { + continue; + } + int num2 = enemyTargets[i]; + AIVirtualCard aIVirtualCard = field.EnemyInplayCards[num2]; + if (!aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Lastword) && !aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.Break)) + { + list2.Add(num2); + continue; + } + float num3 = aIVirtualCard.EvaluateBreakValue(field.BestPlayPtn, useIgnoreBreak: true); + if (num3 >= breakBonusThreshold) + { + list.Add(num2); + } + else if (num3 <= num) + { + num = num3; + list2.Insert(0, num2); + } + else + { + list2.Add(num2); + } + } + list.Add(enemyTargets[holderIndex]); + enemyTargets.Clear(); + enemyTargets.AddRange(list); + enemyTargets.AddRange(list2); + } + + private static bool IsGiveTagOfOneMoreLastwordTagged(AIVirtualField field, AIVirtualCard owner, ref float threshold) + { + if (!owner.TagCollectionContainer.HasTag(AIPlayTagType.LastwordAttachTag)) + { + return false; + } + List lastwordAttachTagContents = owner.TagCollectionContainer.LastwordTags.GetLastwordAttachTagContents(); + if (lastwordAttachTagContents == null || lastwordAttachTagContents.Count <= 0) + { + return false; + } + for (int i = 0; i < lastwordAttachTagContents.Count; i++) + { + AIPlayTag aIPlayTag = lastwordAttachTagContents[i]; + if (aIPlayTag.Type == AIPlayTagType.OneMoreLastword) + { + threshold = aIPlayTag.EvalArg(field.EnemyClass, field.BestPlayPtn, field, null); + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayBounce.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayBounce.cs new file mode 100644 index 0000000..4e5c6b0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayBounce.cs @@ -0,0 +1,19 @@ +namespace Wizard; + +public class AIPlayBounce : AIFiltersAndSelectTypeArgument +{ + public AIPlayBounce(string text) + : base(text) + { + } + + protected override void CreateLegalSelectTypes() + { + base.LegalSelectTypes = new AIScriptTokenArgType[3] + { + AIScriptTokenArgType.ALL_SELECT, + AIScriptTokenArgType.RANDOM_SELECT, + AIScriptTokenArgType.TARGET_SELECT + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayReanimate.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayReanimate.cs new file mode 100644 index 0000000..b25a6da --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayReanimate.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIPlayReanimate : AIScriptArgumentExpressions +{ + private AIPolishConvertedExpression _reanimateCostArg; + + private AIPolishConvertedExpression _reanimateCountArg; + + private const int REANIMATE_COST_INDEX = 0; + + private const int REANIMATE_COUNT_INDEX = 1; + + public AIPlayReanimate(string text) + : base(text) + { + } + + protected override void InitExpressions(string text) + { + base.InitExpressions(text); + if (_exprList.Count > 1) + { + _reanimateCostArg = _exprList[0]; + _reanimateCountArg = _exprList[1]; + } + } + + public int GetReanimateCost(AIVirtualCard tagOwner, List playPtn) + { + if (_reanimateCostArg == null) + { + return -1; + } + return (int)_reanimateCostArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + } + + public int GetReanimateCount(AIVirtualCard tagOwner, List playPtn) + { + if (_reanimateCountArg == null) + { + return 0; + } + return (int)_reanimateCountArg.EvalArg(tagOwner, playPtn, tagOwner.SelfField); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayerLifeSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayerLifeSimulationUtility.cs new file mode 100644 index 0000000..2400db6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayerLifeSimulationUtility.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AIPlayerLifeSimulationUtility +{ + public static int GetAllSelfTurnDamageCount(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AIScriptTokenArgType durationType) + { + return GetSelfTurnDamageCountAtPlayed(tagOwner, field, playPtn, durationType) + GetSelfTurnDamageCountAtPlayPtn(tagOwner, field, playPtn); + } + + public static int GetSelfTurnDamageCountAtPlayed(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AIScriptTokenArgType durationType) + { + int num = 0; + if (!tagOwner.IsAlly) + { + _ = field.EnemyBattlePlayer; + } + else + { + _ = field.AllyBattlePlayer; + } + return durationType switch + { + AIScriptTokenArgType.TURN => field.AllyDamageCountInTurn, + AIScriptTokenArgType.GAME => tagOwner.IsAlly ? field.AllyDamageCountInGame : field.EnemyDamageCountInGame, + _ => num, + }; + } + + public static int GetSelfTurnDamageCountAtPlayPtn(AIVirtualCard tagOwner, AIVirtualField field, List playPtn) + { + if (!tagOwner.IsAlly) + { + return 0; + } + int num = 0; + IEnumerable enumerable = null; + for (int i = 0; i < playPtn.Count; i++) + { + enumerable = GetSelfInjurySkillsOnPlay(field.AllyHandCards[playPtn[i]], field); + if (enumerable != null) + { + num += enumerable.Count(); + } + } + return num; + } + + public static int GetSelfTurnDamageCountAtBeforePlayPtn(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AIScriptTokenArgType durationType) + { + if (!tagOwner.IsAlly) + { + return 0; + } + int num = 0; + IEnumerable enumerable = null; + for (int i = 0; i < playPtn.Count && !tagOwner.IsSameCard(field.AllyHandCards[playPtn[i]]); i++) + { + enumerable = GetSelfInjurySkillsOnPlay(field.AllyHandCards[playPtn[i]], field); + if (enumerable != null) + { + num += enumerable.Count(); + } + } + return num + GetSelfTurnDamageCountAtPlayed(tagOwner, field, playPtn, durationType); + } + + public static IEnumerable GetSelfInjurySkillsOnPlay(AIVirtualCard card, AIVirtualField field) + { + foreach (SkillBase battleSkill in card.BattleSkills) + { + if (!(battleSkill is Skill_damage) || !battleSkill.IsWhenPlaySkill) + { + continue; + } + BattlePlayerReadOnlyInfoPair playerInfoPair = new BattlePlayerReadOnlyInfoPair(field.AllyBattlePlayer, field.EnemyBattlePlayer); + if (!battleSkill.CheckConditionAI(playerInfoPair, new SkillConditionCheckerOption(), isPrePlay: true)) + { + continue; + } + IEnumerable selectableCards = battleSkill.GetSelectableCards(playerInfoPair, new SkillConditionCheckerOption()); + foreach (BattleCardBase item in selectableCards) + { + if (item == field.AllyBattlePlayer.Class) + { + yield return battleSkill; + break; + } + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIPlayoutAttackerCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIPlayoutAttackerCountUtility.cs new file mode 100644 index 0000000..0598034 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIPlayoutAttackerCountUtility.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIPlayoutAttackerCountUtility +{ + public static int GetPlayoutAttackerCount(AIVirtualField field, AIVirtualCard tagOwner, List playPtn, List filters, AISituationInfo situation) + { + int num = 0; + for (int i = 0; i < field.AllyInplayCards.Count; i++) + { + if (IsPlayoutAttacker(field.AllyInplayCards[i], field, filters, playPtn, tagOwner, situation)) + { + num++; + } + } + AISinglePlayptnRecord playptnRecordOnSim = field.GetPlayptnRecordOnSim(playPtn); + for (int j = 0; j < playPtn.Count; j++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[playPtn[j]]; + if (aIVirtualCard == null) + { + continue; + } + if (IsPlayoutAttacker(aIVirtualCard, field, filters, playPtn, tagOwner, situation)) + { + num++; + } + AIVirtualCard actor = aIVirtualCard; + if (playptnRecordOnSim != null) + { + PlayedCardInfo playedCardInfo = playptnRecordOnSim.PlayedCardList[j]; + actor = ((playedCardInfo.TransformCard != null) ? playedCardInfo.TransformCard : aIVirtualCard); + } + AIVirtualTargetSelectAction aIVirtualTargetSelectAction = new AIVirtualTargetSelectAction(actor, aIVirtualCard, AIOperationType.PLAY, (AISelectedTargetInfoSet)null); + aIVirtualTargetSelectAction.forceLethalMode = true; + List allySideTokenIdsOfPlaySituation = AIPlayTokenSimulationUtility.GetAllySideTokenIdsOfPlaySituation(field, playPtn, aIVirtualTargetSelectAction); + if (allySideTokenIdsOfPlaySituation == null || allySideTokenIdsOfPlaySituation.Count <= 0) + { + continue; + } + for (int k = 0; k < allySideTokenIdsOfPlaySituation.Count; k++) + { + if (IsPlayoutAttacker(field.AI.tokenManager.GetTokenFromId(allySideTokenIdsOfPlaySituation[k].TokenId, isAlly: true, field), field, filters, playPtn, tagOwner, situation)) + { + num++; + } + } + if (num >= 6) + { + break; + } + } + return num; + } + + private static bool IsPlayoutAttacker(AIVirtualCard card, AIVirtualField field, List filters, List playPtn, AIVirtualCard tagOwner, AISituationInfo situation) + { + if (!card.IsAlly || !card.IsOnField) + { + return false; + } + if (!card.IsUnit || card.IsDead || !AIAttackSimulationUtility.IsAttackPossible(field, card.AttackLeaderSituation)) + { + return false; + } + if (!AIFilteringUtility.CheckMatchTargetFiltering(card, field.AllyInplayCards, filters, playPtn, tagOwner, situation)) + { + return false; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRallySimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIRallySimulationUtility.cs new file mode 100644 index 0000000..b6a25fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRallySimulationUtility.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIRallySimulationUtility +{ + public static void ExecuteAppendRallyCount(AIVirtualField field, AIVirtualCard summonCard) + { + if (summonCard != null && CanAppendRallyCount(field, summonCard)) + { + field.AddRallyCount(1, summonCard.IsAlly); + } + } + + public static bool CanAppendRallyCount(AIVirtualField field, AIVirtualCard summonCard) + { + if (summonCard.IsUnit) + { + return true; + } + List tagHolders = field.CardListSet.GetTagHolders(CardListsForReference.TagHolderReferenceType.RallyCountPlus); + if (tagHolders == null) + { + return false; + } + for (int i = 0; i < tagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = tagHolders[i]; + if (aIVirtualCard.TagCollectionContainer.RallyCountPlusTags.CanAppendRallyCount(aIVirtualCard, summonCard)) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRandomMultiDamageEvaluator.cs b/SVSim.BattleEngine/Engine/Wizard/AIRandomMultiDamageEvaluator.cs new file mode 100644 index 0000000..e682eef --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRandomMultiDamageEvaluator.cs @@ -0,0 +1,733 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public static class AIRandomMultiDamageEvaluator +{ + private struct DamageSituationInfo + { + public AIVirtualCard TagOwner; + + public AIVirtualField Field; + + public List PlayPtn; + + public bool IsAlly; + + public bool IsSpell; + + public int DamageAmount; + + public int DamageCount; + + public List BarrierSimList; + } + + private class RandomDamageSimulationResult + { + public float BreakValue; + + public List RestLifeList; + + public List BarrierSimulationList; + } + + private class CardValueInformationForEvalRandomMultiDamage + { + public float BreakValue; + + public float BattleBonusRate; + } + + public static void CreateEvalRandomDamageArgList(List src, out List filters, out int damage, out int count) + { + filters = src.GetRange(0, src.Count - 2); + damage = (int)src[src.Count - 2].Value; + count = (int)src[src.Count - 1].Value; + } + + private static float CalcSingleTargetEvaluation(AIVirtualCard target, AIVirtualField field, List playPtn, AISituationInfo situation, bool ownerIsAlly, int damageAmount, bool isSpellDamage) + { + float num = 0f; + int num2 = target.SimulateDamageAmount(damageAmount, isSkillDamage: true, isSpellDamage); + int num3 = target.Life - num2; + if (target.IsLeader) + { + return AILeaderLifeEvaluationUtility.Evaluate(num3, target.Life, target.IsAlly, ownerIsAlly); + } + if (num3 > 0) + { + float num4 = field.StyleQuery.GetUnitRate(field, target, playPtn) * target.EvaluateAllBattleBonusRate(playPtn, useOthersTag: true, useIgnoreInBattle: false, situation); + num = (float)num2 * num4; + } + else + { + num = target.EvaluateValueOnField(playPtn, situation, useStyle: true) - target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false, situation); + } + return num * (target.IsAlly ? (-1f) : 1f); + } + + public static float EvaluateRandomDamageAverage(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List filters, int damageAmount, int damageCount) + { + if (damageCount < 0) + { + AIConsoleUtility.LogError("EvaluateRandomMultiDamageAverage() error!! damageCount < 0"); + return 0f; + } + if (damageCount == 1) + { + return EvaluateSingleTargetAverage(tagOwner, field, playPtn, situation, filters, damageAmount); + } + return EvaluateMultiTargetsAverage(tagOwner, playPtn, field, filters, situation, damageAmount, damageCount); + } + + private static float EvaluateSingleTargetAverage(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List filters, int damageAmount) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0f; + } + list.RemoveAll((AIVirtualCard c) => !c.IsUnit && !c.IsLeader); + if (list.Count <= 0) + { + return 0f; + } + bool isSpellDamage = tagOwner.IsSpell || tagOwner.IsAccelerated(field, playPtn, situation); + float num = 0f; + for (int num2 = 0; num2 < list.Count; num2++) + { + float num3 = CalcSingleTargetEvaluation(list[num2], field, playPtn, situation, tagOwner.IsAlly, damageAmount, isSpellDamage); + num += num3; + } + return num / (float)list.Count; + } + + private static float EvaluateMultiTargetsAverage(AIVirtualCard tagOwner, List playPtn, AIVirtualField field, List filters, AISituationInfo situation, int damageAmount, int damageCount) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null); + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + if (!list.IsNotNullOrEmpty()) + { + return 0f; + } + int count = list.Count; + SeparateTargetCardBySide(list, out var allyInplays, out var enemyInplays, out var allyLeader, out var enemyLeader); + int num = damageCount / count; + int num2 = ((allyLeader != null) ? num : 0); + int num3 = ((enemyLeader != null) ? num : 0); + int num4 = ((allyInplays != null && allyInplays.Count > 0) ? ((damageCount - num2 - num3) / 2) : 0); + int num5 = ((enemyInplays != null && enemyInplays.Count > 0) ? ((damageCount - num2 - num3) / 2) : 0); + int num6 = damageCount - (num2 + num4 + num3 + num5); + if (num6 > 0) + { + if (enemyLeader != null) + { + num3 += num6; + } + else if (enemyInplays.IsNotNullOrEmpty()) + { + num5 += num6; + } + else if (allyInplays.IsNotNullOrEmpty()) + { + num4 += num6; + } + else if (allyLeader != null) + { + num2 += num6; + } + } + num6 = 0; + DamageSituationInfo damageSituation = new DamageSituationInfo + { + DamageAmount = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damageAmount), + TagOwner = tagOwner, + Field = field, + PlayPtn = playPtn, + IsSpell = (tagOwner.IsSpell || tagOwner.IsAccelerated(field, playPtn)) + }; + Dictionary cardValueList = CreateCardValueInformationDictionary(allyInplays, field, playPtn, situation); + Dictionary cardValueList2 = CreateCardValueInformationDictionary(enemyInplays, field, playPtn, situation); + List barrierSimList = new List(field.CardListSet.BothClassAndInplayCards.Select((AIVirtualCard c) => new AIBarrierPseudoSimulationInfo(c))); + List barrierSimList2 = new List(field.CardListSet.BothClassAndInplayCards.Select((AIVirtualCard c) => new AIBarrierPseudoSimulationInfo(c))); + damageSituation.IsAlly = false; + float num7 = 0f; + RandomDamageSimulationResult randomDamageSimulationResult = new RandomDamageSimulationResult(); + RandomDamageSimulationResult randomDamageSimulationResult2 = new RandomDamageSimulationResult(); + if (enemyInplays.IsNotNullOrEmpty()) + { + damageSituation.DamageCount = num5; + damageSituation.BarrierSimList = barrierSimList2; + List targetLifeList = GetTargetLifeList(enemyInplays); + randomDamageSimulationResult = EvalWorstInplayRandomDamage(enemyInplays, targetLifeList, cardValueList2, damageSituation, situation, ref num6); + if (randomDamageSimulationResult.RestLifeList.Sum() == 0) + { + randomDamageSimulationResult2.BreakValue = randomDamageSimulationResult.BreakValue; + } + else + { + randomDamageSimulationResult2 = EvalBestInplayRandomDamage(enemyInplays, targetLifeList, cardValueList2, damageSituation, situation, ref num6); + } + } + float num8 = 0f; + int restLife = enemyLeader?.Life ?? 0; + if (enemyLeader != null) + { + damageSituation.DamageCount = num3 + num6; + damageSituation.BarrierSimList = barrierSimList; + num8 = EvalRandomMultiDamageToLeader(enemyLeader, damageSituation, tagOwner.IsAlly, ref restLife, out num6); + } + damageSituation.IsAlly = true; + float num9 = 0f; + if (allyInplays.IsNotNullOrEmpty()) + { + damageSituation.DamageCount = num4 + num6; + damageSituation.BarrierSimList = barrierSimList2; + List targetLifeList2 = GetTargetLifeList(allyInplays); + RandomDamageSimulationResult randomDamageSimulationResult3 = EvalWorstInplayRandomDamage(allyInplays, targetLifeList2, cardValueList, damageSituation, situation, ref num6); + float breakValue = randomDamageSimulationResult3.BreakValue; + num9 = ((randomDamageSimulationResult3.RestLifeList.Sum() != 0) ? ((EvalBestInplayRandomDamage(allyInplays, targetLifeList2, cardValueList, damageSituation, situation, ref num6).BreakValue + breakValue) / 2f) : breakValue); + } + float num10 = 0f; + if (allyLeader != null) + { + int restLife2 = allyLeader.Life; + damageSituation.DamageCount = num2 + num6; + damageSituation.BarrierSimList = barrierSimList; + num10 = EvalRandomMultiDamageToLeader(allyLeader, damageSituation, tagOwner.IsAlly, ref restLife2, out num6); + } + if (num6 > 0) + { + damageSituation.IsAlly = false; + if (enemyInplays.IsNotNullOrEmpty()) + { + damageSituation.DamageCount = num6; + damageSituation.BarrierSimList = randomDamageSimulationResult.BarrierSimulationList; + RandomDamageSimulationResult randomDamageSimulationResult4 = EvalWorstInplayRandomDamage(enemyInplays, randomDamageSimulationResult.RestLifeList, cardValueList2, damageSituation, situation, ref num6); + randomDamageSimulationResult.BreakValue += randomDamageSimulationResult4.BreakValue; + if (randomDamageSimulationResult4.RestLifeList.Sum() == 0) + { + randomDamageSimulationResult2.BreakValue = randomDamageSimulationResult.BreakValue; + } + else + { + damageSituation.BarrierSimList = randomDamageSimulationResult2.BarrierSimulationList; + randomDamageSimulationResult2.BreakValue += EvalBestInplayRandomDamage(enemyInplays, randomDamageSimulationResult2.RestLifeList, cardValueList2, damageSituation, situation, ref num6).BreakValue; + } + } + if (num6 > 0 && enemyLeader != null && restLife > 0) + { + damageSituation.DamageCount = num6; + damageSituation.BarrierSimList = barrierSimList; + num8 += EvalRandomMultiDamageToLeader(enemyLeader, damageSituation, tagOwner.IsAlly, ref restLife, out num6); + } + } + num7 = (randomDamageSimulationResult2.BreakValue + randomDamageSimulationResult.BreakValue) / 2f; + return num8 + num7 + num10 + num9; + } + + public static float EvaluateRandomDamageMax(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, List filters, AISituationInfo situation, int damageAmount, int damageCount) + { + if (damageCount < 0) + { + AIConsoleUtility.LogError("EvaluateRandomMultiDamageAverage() error!! damageCount < 0"); + return 0f; + } + if (damageCount == 1) + { + return EvaluateSingleTargetMax(tagOwner, field, playPtn, situation, filters, damageAmount); + } + return EvaluateMultiTargetsMax(tagOwner, playPtn, field, filters, situation, damageAmount, damageCount); + } + + private static float EvaluateSingleTargetMax(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List filters, int damageAmount) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0f; + } + list.RemoveAll((AIVirtualCard c) => !c.IsUnit && !c.IsLeader); + if (list.Count <= 0) + { + return 0f; + } + bool flag = false; + bool isSpellDamage = tagOwner.IsSpell || tagOwner.IsAccelerated(field, playPtn, situation); + float num = float.MinValue; + for (int num2 = 0; num2 < list.Count; num2++) + { + float num3 = CalcSingleTargetEvaluation(list[num2], field, playPtn, situation, tagOwner.IsAlly, damageAmount, isSpellDamage); + if (num3 > num) + { + num = num3; + } + flag = true; + } + if (!flag) + { + num = 0f; + } + return num; + } + + private static float EvaluateMultiTargetsMax(AIVirtualCard tagOwner, List playPtn, AIVirtualField field, List filters, AISituationInfo situation, int damageAmount, int damageCount) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, null); + list.RemoveAll((AIVirtualCard c) => c.IsAmulet); + if (!list.IsNotNullOrEmpty()) + { + return 0f; + } + _ = list.Count; + SeparateTargetCardBySide(list, out var allyInplays, out var enemyInplays, out var allyLeader, out var enemyLeader); + DamageSituationInfo damageSituation = new DamageSituationInfo + { + DamageAmount = field.DamageModifierCollection.CalcModifiedDamage(field, playPtn, situation, tagOwner, damageAmount), + TagOwner = tagOwner, + Field = field, + PlayPtn = playPtn, + IsSpell = (tagOwner.IsSpell || tagOwner.IsAccelerated(field, playPtn)) + }; + Dictionary cardValueList = CreateCardValueInformationDictionary(allyInplays, field, playPtn, situation); + Dictionary cardValueList2 = CreateCardValueInformationDictionary(enemyInplays, field, playPtn, situation); + List barrierSimList = new List(field.CardListSet.BothClassAndInplayCards.Select((AIVirtualCard c) => new AIBarrierPseudoSimulationInfo(c))); + List barrierSimList2 = new List(field.CardListSet.BothClassAndInplayCards.Select((AIVirtualCard c) => new AIBarrierPseudoSimulationInfo(c))); + damageSituation.IsAlly = false; + float num = 0f; + int restDamageCount = damageCount; + if (enemyLeader != null) + { + int restLife = enemyLeader.Life; + damageSituation.DamageCount = restDamageCount; + damageSituation.BarrierSimList = barrierSimList; + num = EvalRandomMultiDamageToLeader(enemyLeader, damageSituation, tagOwner.IsAlly, ref restLife, out restDamageCount); + if (restLife <= 0) + { + return num; + } + } + float num2 = 0f; + int restDamageCount2 = damageCount; + if (enemyInplays != null && enemyInplays.Count > 0) + { + damageSituation.DamageCount = restDamageCount2; + damageSituation.BarrierSimList = barrierSimList2; + List targetLifeList = GetTargetLifeList(enemyInplays); + RandomDamageSimulationResult randomDamageSimulationResult = EvalBestInplayRandomDamage(enemyInplays, targetLifeList, cardValueList2, damageSituation, situation, ref restDamageCount2); + num2 = randomDamageSimulationResult.BreakValue; + if (restDamageCount2 > 0 && enemyLeader != null) + { + int restLife2 = enemyLeader.Life; + damageSituation.DamageCount = restDamageCount2; + damageSituation.BarrierSimList = randomDamageSimulationResult.BarrierSimulationList; + num2 += EvalRandomMultiDamageToLeader(enemyLeader, damageSituation, tagOwner.IsAlly, ref restLife2, out restDamageCount); + if (restLife2 <= 0) + { + return num2; + } + } + } + float num3 = 0f; + if (enemyLeader != null && enemyInplays.IsNotNullOrEmpty()) + { + num3 = Mathf.Max(num2, num); + } + else if (enemyLeader != null && !enemyInplays.IsNotNullOrEmpty()) + { + num3 = num; + } + else if (enemyLeader == null && enemyInplays.IsNotNullOrEmpty()) + { + num3 = num2; + } + if (restDamageCount2 <= 0) + { + return num3; + } + damageSituation.IsAlly = true; + int restDamageCount3 = restDamageCount2; + float num4 = 0f; + if (allyLeader != null) + { + int restLife3 = allyLeader.Life; + damageSituation.DamageCount = restDamageCount3; + damageSituation.BarrierSimList = barrierSimList; + num4 = EvalRandomMultiDamageToLeader(allyLeader, damageSituation, tagOwner.IsAlly, ref restLife3, out restDamageCount3); + } + float num5 = 0f; + int restDamageCount4 = restDamageCount2; + if (allyInplays != null && allyInplays.Count > 0) + { + damageSituation.DamageCount = restDamageCount4; + damageSituation.BarrierSimList = barrierSimList2; + List targetLifeList2 = GetTargetLifeList(allyInplays); + RandomDamageSimulationResult randomDamageSimulationResult2 = EvalWorstInplayRandomDamage(allyInplays, targetLifeList2, cardValueList, damageSituation, situation, ref restDamageCount4); + num5 = randomDamageSimulationResult2.BreakValue; + if (restDamageCount4 > 0 && allyLeader != null) + { + int restLife4 = allyLeader.Life; + damageSituation.DamageCount = restDamageCount4; + damageSituation.BarrierSimList = randomDamageSimulationResult2.BarrierSimulationList; + num4 += EvalRandomMultiDamageToLeader(allyLeader, damageSituation, tagOwner.IsAlly, ref restLife4, out restDamageCount4); + } + } + float num6 = 0f; + if (allyLeader != null && allyInplays.IsNotNullOrEmpty()) + { + num6 = Mathf.Max(num5, num4); + } + else if (allyLeader != null && !allyInplays.IsNotNullOrEmpty()) + { + num6 = num4; + } + else if (allyLeader == null && allyInplays.IsNotNullOrEmpty()) + { + num6 = num5; + } + return num3 + num6; + } + + private static RandomDamageSimulationResult EvalWorstInplayRandomDamage(List targetCards, List targetLifeList, Dictionary cardValueList, DamageSituationInfo damageSituation, AISituationInfo situation, ref int restDamageCount) + { + restDamageCount = damageSituation.DamageCount; + RandomDamageSimulationResult simResult = new RandomDamageSimulationResult + { + BreakValue = 0f, + RestLifeList = new List(targetLifeList), + BarrierSimulationList = new List(damageSituation.BarrierSimList.Select((AIBarrierPseudoSimulationInfo info) => new AIBarrierPseudoSimulationInfo(info))) + }; + List list = targetCards.OrderBy((AIVirtualCard c) => cardValueList[c].BreakValue).ToList(); + List list2 = list.Select((AIVirtualCard sortedCard) => targetCards.FindIndex((AIVirtualCard originalCard) => originalCard.IsSameCard(sortedCard))).ToList(); + List list3 = list2.Select((int index2) => targetLifeList[index2]).ToList(); + List list4 = new List(list.Select((AIVirtualCard c) => 0)); + List list5 = list.Select((AIVirtualCard c) => simResult.BarrierSimulationList.Find((AIBarrierPseudoSimulationInfo info) => info.Owner.IsSameCard(c))).ToList(); + bool isSpell = damageSituation.IsSpell; + for (int num = 0; num < damageSituation.DamageCount; num++) + { + int num2 = int.MaxValue; + int num3 = -1; + int num4 = 0; + if (list3.Count((int life) => life > 0) == 0) + { + simResult.BreakValue *= (damageSituation.IsAlly ? (-1f) : 1f); + return simResult; + } + int num5 = -1; + for (int num6 = 0; num6 < list.Count; num6++) + { + if (list3[num6] > 0) + { + if (num5 < 0) + { + num5 = num6; + } + int damage = list[num6].SimulateDamageShield(damageSituation.DamageAmount, isSkillDamage: true, isSpell); + damage = list5[num6].SimulateDamageAmount(damage, isSpell); + if (damage > 0 && list3[num6] <= damage) + { + num4++; + } + else if (damage < num2) + { + num2 = damage; + num3 = num6; + } + } + } + if (num4 == list3.Count((int life) => life > 0)) + { + num3 = num5; + num2 = list[num3].SimulateDamageShield(damageSituation.DamageAmount, isSkillDamage: true, isSpell); + num2 = list5[num3].SimulateDamageAmount(num2, isSpell); + } + if (0 <= num3) + { + int index = list2[num3]; + AIVirtualCard key = list[num3]; + list3[num3] = Mathf.Max(0, list3[num3] - num2); + simResult.RestLifeList[index] = list3[num3]; + list4[num3]++; + AIBarrierPseudoSimulationInfo targetBarrierInfo = list5[num3]; + bool flag = list3[num3] <= 0; + PseudoRemoveBarrierWhenTargetGetDamaged(targetBarrierInfo, simResult.BarrierSimulationList, flag); + if (flag) + { + simResult.BreakValue += cardValueList[key].BreakValue; + } + } + restDamageCount--; + } + for (int num7 = 0; num7 < targetCards.Count; num7++) + { + AIVirtualCard aIVirtualCard = targetCards[num7]; + int num8 = list4[num7]; + if (aIVirtualCard.TagCollectionContainer.HasTag(AIPlayTagType.DamagedBuff) && num8 > 0 && simResult.RestLifeList[num7] > 0) + { + DamagedTagCollection damagedTags = aIVirtualCard.TagCollectionContainer.DamagedTags; + for (int num9 = 0; num9 < num8; num9++) + { + int atkBuff = 0; + int lifeBuff = 0; + damagedTags.GetDamagedBuffValue(aIVirtualCard, aIVirtualCard.SelfField, damageSituation.PlayPtn, situation, out atkBuff, out lifeBuff); + simResult.RestLifeList[num7] += lifeBuff; + if (simResult.RestLifeList[num7] <= 0) + { + simResult.BreakValue += cardValueList[aIVirtualCard].BreakValue; + break; + } + } + } + if (simResult.RestLifeList[num7] > 0) + { + simResult.BreakValue += aIVirtualCard.Life - simResult.RestLifeList[num7]; + } + } + simResult.BreakValue *= (damageSituation.IsAlly ? (-1f) : 1f); + return simResult; + } + + private static RandomDamageSimulationResult EvalBestInplayRandomDamage(List targetCards, List targetLifeList, Dictionary cardValueList, DamageSituationInfo damageSituation, AISituationInfo situation, ref int restDamageCount) + { + RandomDamageSimulationResult randomDamageSimulationResult = new RandomDamageSimulationResult(); + randomDamageSimulationResult.BreakValue = float.MinValue; + int num = (int)Mathf.Pow(2f, targetCards.Count); + for (int i = 0; i < num; i++) + { + List list = new List(); + List list2 = new List(); + int num2 = i; + for (int j = 0; j < targetCards.Count; j++) + { + int num3 = (int)Mathf.Pow(2f, targetCards.Count - j - 1); + if (num2 / num3 <= 0) + { + list.Add(j); + continue; + } + list2.Add(j); + num2 -= num3; + } + float num4 = 0f; + int damageCount = damageSituation.DamageCount; + List list3 = new List(damageSituation.BarrierSimList.Select((AIBarrierPseudoSimulationInfo info) => new AIBarrierPseudoSimulationInfo(info))); + List list4 = new List(targetLifeList); + if (0 < list2.Count) + { + num4 += EvalRandomMultiDamageBreakValue(damageSituation.DamageAmount, ref damageCount, list2, damageSituation.IsSpell, targetCards, damageSituation.PlayPtn, situation, list4, cardValueList, list3); + } + if (0 < damageCount && 0 < list.Count) + { + num4 += EvalRandomMultiDamageBreakValue(damageSituation.DamageAmount, ref damageCount, list, damageSituation.IsSpell, targetCards, damageSituation.PlayPtn, situation, list4, cardValueList, list3); + } + num4 *= (damageSituation.IsAlly ? (-1f) : 1f); + if (randomDamageSimulationResult.BreakValue < num4) + { + randomDamageSimulationResult.BreakValue = num4; + randomDamageSimulationResult.BarrierSimulationList = list3; + randomDamageSimulationResult.RestLifeList = list4; + restDamageCount = damageCount; + } + } + if (randomDamageSimulationResult.RestLifeList == null) + { + randomDamageSimulationResult.RestLifeList = new List(targetLifeList); + } + if (randomDamageSimulationResult.BarrierSimulationList == null) + { + randomDamageSimulationResult.BarrierSimulationList = new List(damageSituation.BarrierSimList.Select((AIBarrierPseudoSimulationInfo info) => new AIBarrierPseudoSimulationInfo(info))); + } + return randomDamageSimulationResult; + } + + private static float EvalRandomMultiDamageBreakValue(int damageAmount, ref int damageCount, List targetIdxList, bool isSpell, List candidates, List playPtn, AISituationInfo situation, List lifeList, Dictionary cardValueList, List removeBarrierSimList) + { + if (lifeList.Sum() == 0) + { + return 0f; + } + float num = 0f; + int num2 = damageCount; + float num3 = 0f; + if (targetIdxList.Count > 0) + { + int num4 = -1; + for (int i = 0; i < targetIdxList.Count; i++) + { + if (lifeList[targetIdxList[i]] > 0) + { + num4 = i; + break; + } + } + if (num4 < 0 || num4 >= targetIdxList.Count) + { + return 0f; + } + int index = targetIdxList[num4]; + int num5 = 0; + int num6 = lifeList[index]; + AIVirtualCard target = candidates[index]; + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = removeBarrierSimList.Find((AIBarrierPseudoSimulationInfo info) => info.Owner.IsSameCard(target)); + float battleBonusRate = cardValueList[target].BattleBonusRate; + while (true) + { + if (num2 <= 0) + { + damageCount = num2; + return num + num3; + } + int num7 = target.SimulateDamageShield(damageAmount, isSkillDamage: true, isSpell); + if (num7 > 0) + { + num7 = aIBarrierPseudoSimulationInfo.SimulateDamageAmount(damageAmount, isSpell); + } + num5++; + num3 += (float)num7 * battleBonusRate; + lifeList[index] -= num7; + aIBarrierPseudoSimulationInfo.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + num2--; + if (target.TagCollectionContainer.HasTag(AIPlayTagType.DamagedBuff) && num5 >= num6) + { + DamagedTagCollection damagedTags = target.TagCollectionContainer.DamagedTags; + for (int num8 = 0; num8 < num5; num8++) + { + int atkBuff = 0; + int lifeBuff = 0; + damagedTags.GetDamagedBuffValue(target, target.SelfField, playPtn, situation, out atkBuff, out lifeBuff); + lifeList[index] += lifeBuff; + if (lifeList[index] <= 0) + { + break; + } + } + } + if (lifeList[index] <= 0) + { + lifeList[index] = 0; + num3 = 0f; + num5 = 0; + num += cardValueList[target].BreakValue; + num4 = targetIdxList.FindIndex((int idx) => lifeList[idx] > 0); + if (num4 < 0 || num4 >= targetIdxList.Count) + { + break; + } + index = targetIdxList[num4]; + num6 = lifeList[index]; + target = candidates[index]; + battleBonusRate = cardValueList[target].BattleBonusRate; + aIBarrierPseudoSimulationInfo = removeBarrierSimList.Find((AIBarrierPseudoSimulationInfo info) => info.Owner.IsSameCard(target)); + } + } + } + damageCount = num2; + return num + num3; + } + + private static float EvalRandomMultiDamageToLeader(AIVirtualCard leader, DamageSituationInfo damageSituation, bool isAllyOwner, ref int restLife, out int restDamageCount) + { + restDamageCount = damageSituation.DamageCount; + int defaultLife = restLife; + AIBarrierPseudoSimulationInfo aIBarrierPseudoSimulationInfo = damageSituation.BarrierSimList.Find((AIBarrierPseudoSimulationInfo c) => c.Owner.IsSameCard(leader)); + bool isSpell = damageSituation.IsSpell; + for (int num = 0; num < damageSituation.DamageCount; num++) + { + if (restLife <= 0) + { + restLife = 0; + break; + } + int num2 = aIBarrierPseudoSimulationInfo.SimulateDamageAmount(leader.SimulateDamageShield(damageSituation.DamageAmount, isSkillDamage: true, isSpell), isSpell); + restLife -= num2; + aIBarrierPseudoSimulationInfo.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + restDamageCount--; + } + return AILeaderLifeEvaluationUtility.Evaluate(restLife, defaultLife, leader.IsAlly, isAllyOwner); + } + + private static void SeparateTargetCardBySide(List allTargets, out List allyInplays, out List enemyInplays, out AIVirtualCard allyLeader, out AIVirtualCard enemyLeader) + { + allyInplays = null; + enemyInplays = null; + allyLeader = null; + enemyLeader = null; + if (allTargets == null) + { + return; + } + for (int i = 0; i < allTargets.Count; i++) + { + AIVirtualCard aIVirtualCard = allTargets[i]; + if (aIVirtualCard.IsAlly) + { + if (aIVirtualCard.IsLeader) + { + allyLeader = aIVirtualCard; + } + else + { + allyInplays = AIParamQuery.AddElementToList(aIVirtualCard, allyInplays); + } + } + else if (aIVirtualCard.IsLeader) + { + enemyLeader = aIVirtualCard; + } + else + { + enemyInplays = AIParamQuery.AddElementToList(aIVirtualCard, enemyInplays); + } + } + } + + private static List GetTargetLifeList(List targets) + { + if (targets == null) + { + return null; + } + List list = null; + for (int i = 0; i < targets.Count; i++) + { + list = AIParamQuery.AddElementToList(targets[i].Life, list); + } + return list; + } + + private static Dictionary CreateCardValueInformationDictionary(List cardList, AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (cardList == null) + { + return null; + } + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < cardList.Count; i++) + { + AIVirtualCard aIVirtualCard = cardList[i]; + float breakValue = aIVirtualCard.EvaluateValueOnField(playPtn, situation, useStyle: true) - (aIVirtualCard.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) + aIVirtualCard.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false)); + float battleBonusRate = field.StyleQuery.GetUnitRate(field, aIVirtualCard, playPtn) * aIVirtualCard.EvaluateAllBattleBonusRate(playPtn, useOthersTag: true, useIgnoreInBattle: false, situation); + CardValueInformationForEvalRandomMultiDamage value = new CardValueInformationForEvalRandomMultiDamage + { + BreakValue = breakValue, + BattleBonusRate = battleBonusRate + }; + dictionary.Add(aIVirtualCard, value); + } + return dictionary; + } + + private static void PseudoRemoveBarrierWhenTargetGetDamaged(AIBarrierPseudoSimulationInfo targetBarrierInfo, List otherDamageCandidateBarrierInfoList, bool isTargetLeaveFromField) + { + targetBarrierInfo.DepriveBarrier(AIBarrierStopTiming.AfterDamage); + if (isTargetLeaveFromField) + { + AIVirtualCard owner = targetBarrierInfo.Owner; + owner.SelfField.TagPreprocessContainer.LeaveStopInfoContainer?.PseudoSimulateForEvalRandomMultiDamage(otherDamageCandidateBarrierInfoList, owner); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIReanimateSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIReanimateSimulationUtility.cs new file mode 100644 index 0000000..ed96727 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIReanimateSimulationUtility.cs @@ -0,0 +1,118 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public static class AIReanimateSimulationUtility +{ + public const int NONE_REANIMATE_COST = -1; + + public const int NONE_REANIMATE_ID = -1; + + public static bool IsReanimate(AIVirtualCard tagOwner, int cost) + { + AIVirtualField selfField = tagOwner.SelfField; + return (tagOwner.IsAlly ? selfField.CardListSet.AllyDestroyedCards : selfField.CardListSet.EnemyDestroyedCards).Any((AIVirtualCard c) => c.IsUnit && c.Cost <= cost); + } + + public static int GetReanimateTokenId(AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List filters, AIPolishConvertedExpression costExpression, AIScriptTokenArgType side, out bool isTokenAlly) + { + int num = (int)costExpression.EvalArg(tagOwner, playPtn, field, situation); + if (num < 0) + { + isTokenAlly = true; + return -1; + } + isTokenAlly = AISummonTokenUtility.GetIsTokenAlly(tagOwner, side); + return EvalReanimateTokenID(tagOwner, num, filters, isTokenAlly, playPtn, situation); + } + + private static int EvalReanimateTokenID(AIVirtualCard tagOwner, int reanimateCost, List filters, bool isTokenAlly, List playPtn, AISituationInfo situation) + { + if (reanimateCost == -1) + { + return -1; + } + int result = -1; + AIVirtualField selfField = tagOwner.SelfField; + List list = (isTokenAlly ? selfField.CardListSet.AllyDestroyedCards : selfField.CardListSet.EnemyDestroyedCards); + if (list.IsNotNullOrEmpty()) + { + list = FilteringReanimateTargets(list, reanimateCost, tagOwner, filters, playPtn, situation); + if (list == null || list.Count <= 0) + { + return result; + } + Dictionary dictionary = new Dictionary(); + for (int i = 0; i < list.Count; i++) + { + int baseId = list[i].BaseId; + if (dictionary.ContainsKey(baseId)) + { + dictionary[baseId]++; + } + else + { + dictionary.Add(baseId, 1); + } + } + int maxDestroyedCount = dictionary.Max((KeyValuePair pair) => pair.Value); + if (dictionary.Count((KeyValuePair pair) => pair.Value == maxDestroyedCount) == 1) + { + result = dictionary.First((KeyValuePair pair) => pair.Value == maxDestroyedCount).Key; + } + else + { + float num = float.MaxValue; + List> maxDestroyedPair = dictionary.Where((KeyValuePair pair) => pair.Value == maxDestroyedCount).ToList(); + int i2; + for (i2 = 0; i2 < maxDestroyedPair.Count; i2++) + { + AIVirtualCard aIVirtualCard = list.First((AIVirtualCard c) => c.BaseId == maxDestroyedPair[i2].Key); + float num2 = AIEvalReanimateUtility.EvalReanimateTargetValue(aIVirtualCard, selfField, playPtn, situation); + num2 *= (isTokenAlly ? 1f : (-1f)); + if (num2 < num) + { + result = aIVirtualCard.BaseId; + num = num2; + } + } + } + } + return result; + } + + public static List FilteringReanimateTargets(List reanimateTargets, int reanimateCost, AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation) + { + if (reanimateTargets == null) + { + return null; + } + int maxReanimateCost = -1; + List list = null; + for (int i = 0; i < reanimateTargets.Count; i++) + { + AIVirtualCard aIVirtualCard = reanimateTargets[i]; + int cost = aIVirtualCard.Cost; + if (aIVirtualCard.IsUnit && cost <= reanimateCost && (filters == null || filters.Count < 0 || AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, reanimateTargets, filters, playPtn, tagOwner, situation))) + { + if (maxReanimateCost < cost) + { + maxReanimateCost = cost; + } + if (list == null) + { + list = new List(); + } + list.Add(aIVirtualCard); + } + } + if (list == null) + { + return null; + } + list.RemoveAll((AIVirtualCard c) => c.Cost != maxReanimateCost); + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRecoverAttackableCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIRecoverAttackableCountUtility.cs new file mode 100644 index 0000000..951f353 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRecoverAttackableCountUtility.cs @@ -0,0 +1,121 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIRecoverAttackableCountUtility +{ + public static void RecoverAttackableCountTarget(AIScriptTokenArgType targetSelectType, AISituationInfo situation) + { + if (situation != null && situation.IsTargetExists(targetSelectType)) + { + RecoverAttackableCountAll(situation.GetSituationTarget(targetSelectType).Targets); + } + } + + public static void RecoverAttackableCountTargetPrediction(List candidatis, int selectCount) + { + if (selectCount > 1) + { + List list = SelectMultipleTarget(candidatis, selectCount, AISelectTargetPattern.Best); + if (list != null && list.Count > 0) + { + RecoverAttackableCountAll(list); + } + } + else + { + SelectSingleTarget(candidatis, AISelectTargetPattern.Best)?.RecoverAttackableCount(); + } + } + + public static void RecoverAttackableCountAll(List targets) + { + if (targets != null) + { + for (int i = 0; i < targets.Count; i++) + { + targets[i].RecoverAttackableCount(); + } + } + } + + public static AIVirtualCard SelectSingleTarget(List candidates, AISelectTargetPattern worstOrBest) + { + if (candidates == null || candidates.Count <= 0) + { + return null; + } + AIVirtualCard result = null; + int num = ((worstOrBest == AISelectTargetPattern.Best) ? int.MinValue : int.MaxValue); + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.IsUnit && aIVirtualCard.AttackableCount <= 0 && !aIVirtualCard.IsCantAttackAll) + { + int num2 = aIVirtualCard.Attack * aIVirtualCard.MaxAttackableCount; + bool flag = false; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + flag = num2 > num; + break; + case AISelectTargetPattern.Worst: + flag = num2 < num; + break; + } + if (flag) + { + result = aIVirtualCard; + num = num2; + } + } + } + return result; + } + + private static List SelectMultipleTarget(List candidates, int selectCount, AISelectTargetPattern worstOrBest) + { + if (candidates == null || candidates.Count <= 0) + { + return null; + } + List list = null; + for (int i = 0; i < selectCount; i++) + { + if (list != null && list.Count == selectCount) + { + break; + } + AIVirtualCard aIVirtualCard = null; + int num = ((worstOrBest == AISelectTargetPattern.Best) ? int.MinValue : int.MaxValue); + for (int j = 0; j < candidates.Count; j++) + { + AIVirtualCard aIVirtualCard2 = candidates[j]; + if (aIVirtualCard2.IsUnit && aIVirtualCard2.AttackableCount <= 0 && !aIVirtualCard2.IsCantAttackAll && (list == null || !list.Contains(aIVirtualCard2))) + { + int num2 = aIVirtualCard2.Attack * aIVirtualCard2.MaxAttackableCount; + bool flag = false; + switch (worstOrBest) + { + case AISelectTargetPattern.Best: + flag = num2 > num; + break; + case AISelectTargetPattern.Worst: + flag = num2 < num; + break; + } + if (flag) + { + aIVirtualCard = aIVirtualCard2; + num = num2; + } + } + } + if (aIVirtualCard != null) + { + list = AIParamQuery.AddElementToList(aIVirtualCard, list); + } + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRemovalEvaluationOption.cs b/SVSim.BattleEngine/Engine/Wizard/AIRemovalEvaluationOption.cs new file mode 100644 index 0000000..f5f48be --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRemovalEvaluationOption.cs @@ -0,0 +1,8 @@ +namespace Wizard; + +public class AIRemovalEvaluationOption +{ + public AIVirtualCard TagOwner; + + public int MetamorphoseTokenId; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIRemoveSkillSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIRemoveSkillSimulationUtility.cs new file mode 100644 index 0000000..fe1c839 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIRemoveSkillSimulationUtility.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIRemoveSkillSimulationUtility +{ + public static void RemoveSkillAll(List candidates, AISituationInfo situation) + { + for (int i = 0; i < candidates.Count; i++) + { + candidates[i].RemoveAllSkills(situation); + } + } + + public static void RemoveSkillTargetSelect(AIScriptTokenArgType whichTarget, AISituationInfo situation) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.HasTarget) + { + RemoveSkillAll(situationTarget.Targets, situation); + } + } + + public static void RemoveSkillRandom(List candidates, AISituationInfo situation) + { + SelectRemoveSkillTarget(candidates, AISelectTargetPattern.Worst)?.RemoveAllSkills(situation); + } + + private static AIVirtualCard SelectRemoveSkillTarget(List candidates, AISelectTargetPattern worstOrBest) + { + if (candidates == null || candidates.Count <= 0) + { + return null; + } + float posiOrNega = ((worstOrBest == AISelectTargetPattern.Best) ? 1f : (-1f)); + float num = 0f; + AIVirtualCard aIVirtualCard = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard2 = candidates[i]; + if (aIVirtualCard == null) + { + num = CalcValue(aIVirtualCard2); + aIVirtualCard = aIVirtualCard2; + continue; + } + float num2 = CalcValue(aIVirtualCard2); + if (num2 > num) + { + num = num2; + aIVirtualCard = aIVirtualCard2; + } + } + return aIVirtualCard; + float CalcValue(AIVirtualCard card) + { + return (card.Value - (float)card.Attack - (float)card.Life) * posiOrNega; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIReverseDiscardSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIReverseDiscardSelectLogicArgument.cs new file mode 100644 index 0000000..a82cc21 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIReverseDiscardSelectLogicArgument.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIReverseDiscardSelectLogicArgument : AISelectLogicArgumentBase +{ + public AIReverseDiscardSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + AIReverseEvaluateValueListOrder aIReverseEvaluateValueListOrder = new AIReverseEvaluateValueListOrder(); + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + float value = aIVirtualCard.GetHandBonus(playPtn, situation, isIgnoreInFusion: false) + aIVirtualCard.GetDiscardedBonus(playPtn, situation, isIgnroeInBattle: true); + aIReverseEvaluateValueListOrder.AddData(value, aIVirtualCard); + } + return aIReverseEvaluateValueListOrder.GetFirst(); + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + AIConsoleUtility.Log("REVERSE_DISCARD_LOGIC は複数選択に未対応です"); + return null; + } + + private bool IsWellTarget(float maxHandBonus, float currentHandBonus, AISelectTargetPattern worstOrBest) + { + return worstOrBest switch + { + AISelectTargetPattern.Best => maxHandBonus < currentHandBonus, + AISelectTargetPattern.Worst => maxHandBonus > currentHandBonus, + _ => false, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIReverseEvaluateValueListOrder.cs b/SVSim.BattleEngine/Engine/Wizard/AIReverseEvaluateValueListOrder.cs new file mode 100644 index 0000000..18c02ba --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIReverseEvaluateValueListOrder.cs @@ -0,0 +1,66 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class AIReverseEvaluateValueListOrder +{ + private List evalvalues = new List(); + + private List cards = new List(); + + public void AddData(float value, AIVirtualCard card) + { + if (card == null) + { + AIConsoleUtility.LogError("CompValue:AddData() Target card is null"); + } + else if (evalvalues.Any()) + { + bool flag = false; + for (int i = 0; i < evalvalues.Count; i++) + { + if (evalvalues[i] > value) + { + evalvalues.Insert(i, value); + cards.Insert(i, card); + flag = true; + break; + } + } + if (!flag) + { + evalvalues.Add(value); + cards.Add(card); + } + } + else + { + evalvalues.Add(value); + cards.Add(card); + } + } + + public List GetCardList(int takeCount) + { + if (takeCount <= 0 || cards.Count < takeCount) + { + return null; + } + List list = new List(); + for (int i = 0; i < takeCount; i++) + { + list.Add(cards[i]); + } + return list; + } + + public AIVirtualCard GetFirst() + { + if (cards == null || cards.Count <= 0) + { + return null; + } + return cards[0]; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISelectLogicSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISelectLogicSimulationUtility.cs new file mode 100644 index 0000000..9f05cef --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISelectLogicSimulationUtility.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public static class AISelectLogicSimulationUtility +{ + public static AISelectLogicArgumentBase CreateSelectLogicArgument(string args) + { + List list = AIPlayTagInitializingUtility.TrimAttachTagArgument(args).Replace(" ", "").Split(';') + .ToList(); + AIScriptTokenArgType aIScriptTokenArgType = AIScriptTokenArgType.NONE; + if (AIScriptParser.ConvertWordToToken(list[0]) is AIScriptArgumentToken aIScriptArgumentToken) + { + aIScriptTokenArgType = aIScriptArgumentToken.ArgumentType; + } + if (aIScriptTokenArgType <= AIScriptTokenArgType.SELECT_LOGIC_TYPE_BEGIN || aIScriptTokenArgType >= AIScriptTokenArgType.SELECT_LOGIC_TYPE_END) + { + AIConsoleUtility.LogError($"CreateSelectLogicArgument error!! logicType == {aIScriptTokenArgType}"); + return null; + } + list.RemoveAt(0); + return aIScriptTokenArgType switch + { + AIScriptTokenArgType.DEFAULT_LOGIC => new AIDefaultSelectLogicArgument(list), + AIScriptTokenArgType.DESTROY_LOGIC => new AIDestroySelectLogicArgument(list), + AIScriptTokenArgType.DAMAGE_LOGIC => new AIDamageSelectLogicArgument(list), + AIScriptTokenArgType.BOUNCE_LOGIC => new AIBounceSelectLogicArgument(list), + AIScriptTokenArgType.BANISH_LOGIC => new AIBanishSelectLogicArgument(list), + AIScriptTokenArgType.METAMORPHOSE_LOGIC => new AIMetamorphoseSelectLogicArgument(list), + AIScriptTokenArgType.MAX_ATTACK_LOGIC => new AIMaxAttackSelectLogicArgument(list), + AIScriptTokenArgType.TYRANT_ORDER_LOGIC => new AITyrantOrderSelectLogicArgument(list), + AIScriptTokenArgType.REVERSE_DISCARD_LOGIC => new AIReverseDiscardSelectLogicArgument(list), + AIScriptTokenArgType.WHITEFROST_WHISPER_LOGIC => new AIWhitefrostWhisperLogicArgument(list), + _ => null, + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISetStatusSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISetStatusSimulationUtility.cs new file mode 100644 index 0000000..5d7c92d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISetStatusSimulationUtility.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISetStatusSimulationUtility +{ + public static bool IsNoneSetValue(AIPolishConvertedExpression expression) + { + if (expression.TokenList[0] is AIScriptArgumentToken aIScriptArgumentToken) + { + return aIScriptArgumentToken.ArgumentType == AIScriptTokenArgType.NONE; + } + return false; + } + + public static void SetMaxStatusToAll(List targets, int attack, int life, AISituationInfo situation) + { + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (attack >= 0) + { + aIVirtualCard.SetAttack(attack); + } + if (life >= 0) + { + aIVirtualCard.SetMaxLife(situation, life); + } + } + } + + public static void SetMaxStatusToTarget(AISituationInfo situation, int attack, int life, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget != null && situationTarget.HasTarget) + { + SetMaxStatusToAll(situationTarget.Targets, attack, life, situation); + } + } + + public static (AIVirtualCard allyLeader, AIVirtualCard enemyLeader) GetTargetSideLeaders(AIVirtualCard tagOwner, AIVirtualField field) + { + if (tagOwner == null) + { + return (allyLeader: null, enemyLeader: null); + } + if (!tagOwner.IsAlly) + { + return (allyLeader: field.EnemyClass, enemyLeader: field.AllyClass); + } + return (allyLeader: field.AllyClass, enemyLeader: field.EnemyClass); + } + + public static void SetLeaderMaxLife(AIVirtualCard tagOwner, int maxLife, AIScriptTokenArgType sideType, AIVirtualField field, AISituationInfo situation = null) + { + (AIVirtualCard, AIVirtualCard) targetSideLeaders = GetTargetSideLeaders(tagOwner, field); + if (targetSideLeaders.Item1 == null || targetSideLeaders.Item2 == null) + { + AIConsoleUtility.LogError("AISetStatusSimulationUtility.SetLeaderMaxLife(): Failed to get the leader."); + return; + } + switch (sideType) + { + case AIScriptTokenArgType.ALLY: + targetSideLeaders.Item1.SetMaxLife(situation, maxLife); + break; + case AIScriptTokenArgType.OPPONENT: + targetSideLeaders.Item2.SetMaxLife(situation, maxLife); + break; + case AIScriptTokenArgType.BOTH: + targetSideLeaders.Item1.SetMaxLife(situation, maxLife); + targetSideLeaders.Item2.SetMaxLife(situation, maxLife); + break; + default: + AIConsoleUtility.LogError($"AISetStatusSimulationUtility.SetLeaderMaxLife(): Unexpected side type. type:{sideType}"); + break; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIShieldInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AIShieldInfo.cs new file mode 100644 index 0000000..5c7d55e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIShieldInfo.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIShieldInfo : AIBarrierInfoBase +{ + public override AIBarrierType BarrierType => AIBarrierType.Shield; + + public AIShieldInfo(AIDamageType damageType, AIBarrierStopTiming stopTiming) + : base(0, damageType, stopTiming) + { + UpdateHash(); + } + + public AIShieldInfo(AIDamageType damageType, List stopTimingList) + : base(0, damageType, stopTimingList) + { + UpdateHash(); + } + + public override bool IsShield() + { + return true; + } + + public override AIBarrierInfoBase Clone() + { + return new AIShieldInfo(base.DamageType, base.StopTimingList); + } + + protected override int CalcDamage(AIVirtualCard owner, int damage) + { + return 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISimulationRemovalUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISimulationRemovalUtility.cs new file mode 100644 index 0000000..bbcd8ff --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISimulationRemovalUtility.cs @@ -0,0 +1,285 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISimulationRemovalUtility +{ + public static bool WillDieBySkillPrediction(AIVirtualCard card, AIVirtualField field, List playPtn, AISituationInfo situation, bool isHandTagValid) + { + LifeRecord lifeRecord = new LifeRecord + { + MaxLife = card.MaxLife, + CurrentLife = card.Life + }; + if (isHandTagValid && playPtn != null && playPtn.Count > 0) + { + for (int i = 0; i < playPtn.Count; i++) + { + GetRestLifeAfterCardPlay(field.AllyHandCards[playPtn[i]], card, field, playPtn, situation, lifeRecord); + if (lifeRecord.CurrentLife <= 0) + { + break; + } + } + } + return lifeRecord.CurrentLife <= 0; + } + + private static void GetRestLifeAfterCardPlay(AIVirtualCard playCard, AIVirtualCard target, AIVirtualField field, List playPtn, AISituationInfo situation, LifeRecord targetLife) + { + if (playCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + FanfareTagCollection fanfareTags = playCard.TagCollectionContainer.FanfareTags; + if (fanfareTags.HasRemovalTags) + { + fanfareTags.RemovalPrediction(playCard, target, targetLife, field, playPtn, situation); + } + } + if (playCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + PlayTagCollection playTags = playCard.TagCollectionContainer.PlayTags; + if (playTags.HasRemovalTags) + { + playTags.RemovalPrediction(playCard, target, targetLife, field, playPtn, situation); + } + } + if (!field.CardListSet.HasOtherPlayTagHolder) + { + return; + } + for (int i = 0; i < field.CardListSet.OtherPlayTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.OtherPlayTagHolders[i]; + OtherPlayTagCollection otherPlayTags = aIVirtualCard.TagCollectionContainer.OtherPlayTags; + if (otherPlayTags.HasRemovalTags) + { + otherPlayTags.RemovalPrediction(aIVirtualCard, playCard, target, targetLife, field, playPtn, situation); + } + } + } + + public static void PredictSurvivorsLifeAfterCardPlay(AIVirtualCard playCard, List targetList, AIVirtualField field, List playPtn, AISituationInfo situation, List targetLifeList) + { + if (playCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Fanfare)) + { + FanfareTagCollection fanfareTags = playCard.TagCollectionContainer.FanfareTags; + if (fanfareTags.HasRemovalTags) + { + fanfareTags.MultipleRemovalPrediction(playCard, targetList, field, playPtn, situation, targetLifeList); + } + } + if (playCard.TagCollectionContainer.HasTagCollection(TagCollectionType.Play)) + { + PlayTagCollection playTags = playCard.TagCollectionContainer.PlayTags; + if (playTags.HasRemovalTags) + { + playTags.MultipleRemovalPrediction(playCard, targetList, field, playPtn, situation, targetLifeList); + } + } + if (!field.CardListSet.HasOtherPlayTagHolder) + { + return; + } + for (int i = 0; i < field.CardListSet.OtherPlayTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.OtherPlayTagHolders[i]; + if (!aIVirtualCard.IsSameCard(playCard)) + { + OtherPlayTagCollection otherPlayTags = aIVirtualCard.TagCollectionContainer.OtherPlayTags; + if (otherPlayTags.HasRemovalTags) + { + otherPlayTags.MultipleRemovalPrediction(aIVirtualCard, playCard, targetList, field, playPtn, situation, targetLifeList); + } + } + } + } + + public static AIVirtualCard SelectRemovalTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest, AIRemovalType removeType, AIRemovalEvaluationOption removalEvalOption = null) + { + if (removeType == AIRemovalType.None) + { + return null; + } + AIVirtualCard result = null; + float num = ((worstOrBest == AISelectTargetPattern.Worst) ? float.MaxValue : float.MinValue); + bool flag = worstOrBest == AISelectTargetPattern.Best; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + bool flag2 = tagOwner.IsAlly != aIVirtualCard.IsAlly && (aIVirtualCard.IsSneak || aIVirtualCard.IsUntouchable); + if (!aIVirtualCard.IsDead && !aIVirtualCard.IsIndependent && !(flag && flag2)) + { + float num2 = CalculateRemovalValue(aIVirtualCard, field, playPtn, situation, removeType, removalEvalOption); + bool flag3 = false; + switch (worstOrBest) + { + case AISelectTargetPattern.Worst: + flag3 = num2 < num; + break; + case AISelectTargetPattern.Best: + flag3 = num2 > num; + break; + } + if (flag3) + { + num = num2; + result = aIVirtualCard; + } + } + } + return result; + } + + public static List SelectMultipleRemovalTargets(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest, AIRemovalType removeType, int count, AIRemovalEvaluationOption removalEvalOption = null) + { + if (removeType == AIRemovalType.None) + { + return null; + } + List list = new List(); + float[] array = new float[count]; + float num = ((worstOrBest == AISelectTargetPattern.Worst) ? float.MaxValue : float.MinValue); + bool flag = worstOrBest == AISelectTargetPattern.Best; + for (int i = 0; i < count; i++) + { + array[i] = num; + list.Add(null); + } + for (int j = 0; j < candidates.Count; j++) + { + AIVirtualCard aIVirtualCard = candidates[j]; + bool flag2 = tagOwner.IsAlly != aIVirtualCard.IsAlly && (aIVirtualCard.IsSneak || aIVirtualCard.IsUntouchable); + if (aIVirtualCard.IsDead || aIVirtualCard.IsIndependent || (flag && flag2)) + { + continue; + } + float num2 = CalculateRemovalValue(aIVirtualCard, field, playPtn, situation, removeType, removalEvalOption); + bool flag3 = false; + int num3 = -1; + for (int k = 0; k < list.Count; k++) + { + float num4 = array[k]; + switch (worstOrBest) + { + case AISelectTargetPattern.Worst: + flag3 = num2 < num4; + break; + case AISelectTargetPattern.Best: + flag3 = num2 > num4; + break; + } + if (flag3) + { + num3 = k; + break; + } + } + if (flag3) + { + AIVirtualCard value = aIVirtualCard; + float num5 = num2; + for (int l = num3; l < list.Count; l++) + { + AIVirtualCard aIVirtualCard2 = list[l]; + float num6 = array[l]; + list[l] = value; + array[l] = num5; + value = aIVirtualCard2; + num5 = num6; + } + } + } + list.RemoveAll((AIVirtualCard c) => c == null); + return list; + } + + public static float CalculateRemovalValue(AIVirtualCard target, AIVirtualField field, List playPtn, AISituationInfo situation, AIRemovalType removeType, AIRemovalEvaluationOption removalEvalOption) + { + float num = 0f; + switch (removeType) + { + case AIRemovalType.Destroy: + if (!target.IsIndestructible) + { + num = target.EvaluateValueOnField(playPtn, situation, useStyle: true) - target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false); + } + break; + case AIRemovalType.Banish: + if (!target.IsUnbanishable) + { + num = target.EvaluateValueOnField(playPtn, situation, useStyle: true) + target.GetAllBreakBonus(playPtn, useIgnoreInBattle: false) - target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false) - target.GetAllBanishBonus(playPtn, useIgnoreInBattle: false); + } + break; + case AIRemovalType.Bounce: + { + int restPp = (target.IsAlly ? field.AI.PlayPtnRecorder.GetRestPp(playPtn, field) : field.EnemyBattlePlayer.Pp); + num = target.EvaluateBounceValue(playPtn, restPp); + num -= target.GetAllLeaveBonus(playPtn, useIgnoreInBattle: false) * (float)((!target.IsAlly) ? 1 : (-1)); + break; + } + case AIRemovalType.Metamorphose: + if (removalEvalOption == null) + { + AIConsoleUtility.LogError("SelectRemovalTarget()でMetamorphoseを指定する場合はremovalEvalOptionが必要です"); + return 0f; + } + num = AIMetamorphoseSimulationUtility.EvaluateSingleMetamorphoseValue(target, removalEvalOption.MetamorphoseTokenId, removalEvalOption.TagOwner, field, playPtn, situation); + break; + } + if (target.IsAlly && removeType != AIRemovalType.Bounce && removeType != AIRemovalType.Metamorphose) + { + num *= -1f; + } + return num; + } + + public static AIVirtualCard SelectWorstTargetForBuff(List candidates, AIBuffExecutingInfo_old buffInfo) + { + AIVirtualCard result = null; + float num = float.MaxValue; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsDead) + { + int num2 = (aIVirtualCard.IsAttackable(aIVirtualCard.SelfField.BestPlayPtn) ? aIVirtualCard.AttackableCount : 0); + float num3 = (100f - (float)aIVirtualCard.Attack) * (float)num2; + float num4 = 100f + (float)aIVirtualCard.Attack; + int expectedAttackBuffValue = buffInfo.GetExpectedAttackBuffValue(aIVirtualCard); + int expectedLifeBuffValue = buffInfo.GetExpectedLifeBuffValue(aIVirtualCard); + float num5 = (aIVirtualCard.IsAlly ? 1f : (-1f)) * ((float)expectedAttackBuffValue * num3 + (float)expectedLifeBuffValue * num4); + if (num5 < num) + { + num = num5; + result = aIVirtualCard; + } + } + } + return result; + } + + public static AIVirtualCard SelectBestTargetForBuff(List candidates, AIBuffExecutingInfo_old buff) + { + AIVirtualCard result = null; + float num = float.MinValue; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.IsUnit && !aIVirtualCard.IsDead) + { + int num2 = (aIVirtualCard.IsAttackable(aIVirtualCard.SelfField.BestPlayPtn) ? aIVirtualCard.AttackableCount : 0); + float num3 = (100f - (float)aIVirtualCard.Attack) * (float)num2; + float num4 = 100f + (float)aIVirtualCard.Attack; + int expectedAttackBuffValue = buff.GetExpectedAttackBuffValue(aIVirtualCard); + int expectedLifeBuffValue = buff.GetExpectedLifeBuffValue(aIVirtualCard); + float num5 = (aIVirtualCard.IsAlly ? 1f : (-1f)) * ((float)expectedAttackBuffValue * num3 + (float)expectedLifeBuffValue * num4); + if (num5 > num) + { + num = num5; + result = aIVirtualCard; + } + } + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISituationCurrentProcessAccessExtension.cs b/SVSim.BattleEngine/Engine/Wizard/AISituationCurrentProcessAccessExtension.cs new file mode 100644 index 0000000..4d8f181 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISituationCurrentProcessAccessExtension.cs @@ -0,0 +1,248 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISituationCurrentProcessAccessExtension +{ + public static AIVirtualCard GetCurrentTriggerCard(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return null; + } + return situation.CurrentSkillProcessInfo.TriggerInfo.TriggerCard; + } + + public static bool IsSameCurrentTriggerCardAndTriggerType(this AISituationInfo situation, AIVirtualCard card, AISituationTriggerInformation.TriggerType triggerType) + { + if (situation.IsNull()) + { + return false; + } + AISituationTriggerInformation triggerInfo = situation.CurrentSkillProcessInfo.TriggerInfo; + if (triggerInfo.TriggerCard == null || triggerInfo.Type != triggerType) + { + return false; + } + return triggerInfo.IsTriggerCardAndTriggerType(card, triggerType); + } + + public static bool IsSameCurrentTriggerCard(this AISituationInfo situation, AIVirtualCard card) + { + if (situation.IsNull()) + { + return false; + } + AISituationTriggerInformation triggerInfo = situation.CurrentSkillProcessInfo.TriggerInfo; + if (triggerInfo.TriggerCard == null) + { + return false; + } + return triggerInfo.IsTriggerCard(card); + } + + public static bool IsBanishTrigger(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return false; + } + AISituationTriggerInformation triggerInfo = situation.CurrentSkillProcessInfo.TriggerInfo; + if (triggerInfo.Type == AISituationTriggerInformation.TriggerType.Banish) + { + return triggerInfo.TriggerCard != null; + } + return false; + } + + public static bool IsOwnSummonedCard(this AISituationInfo situation, AIVirtualCard card, AIScriptTokenArgType targetCardType, bool isLatest = false) + { + if (situation.IsNull()) + { + return false; + } + List list = (isLatest ? situation.GetOwnLatestSummonedCards() : situation.GetOwnSummonedCards()); + if (list == null || list.Count <= 0) + { + return false; + } + switch (targetCardType) + { + case AIScriptTokenArgType.FOLLOWER: + if (!card.IsUnit) + { + return false; + } + break; + case AIScriptTokenArgType.AMULET: + if (!card.IsAmulet) + { + return false; + } + break; + default: + AIConsoleUtility.LogError($"IsOwnSummonedCard(): Unsupported target card type. type:{targetCardType}"); + return false; + case AIScriptTokenArgType.ALL: + break; + } + for (int i = 0; i < list.Count; i++) + { + if (list[i].IsSameCard(card)) + { + return true; + } + } + return false; + } + + public static bool IsLatestOwnDrewCard(this AISituationInfo situation, AIVirtualCard card) + { + if (situation.IsNull()) + { + return false; + } + List ownLatestDrewCards = situation.GetOwnLatestDrewCards(); + if (ownLatestDrewCards == null || ownLatestDrewCards.Count <= 0) + { + return false; + } + for (int i = 0; i < ownLatestDrewCards.Count; i++) + { + if (ownLatestDrewCards[i].IsSameCard(card)) + { + return true; + } + } + return false; + } + + public static bool IsLatestTarget(this AISituationInfo situation, AIVirtualCard card) + { + List latestTargets = situation.GetLatestTargets(); + if (latestTargets == null || latestTargets.Count <= 0) + { + AIConsoleUtility.LogError("IsLatestTarget error!! candidates is empty!!!!!"); + return false; + } + for (int i = 0; i < latestTargets.Count; i++) + { + if (card.IsSameCard(latestTargets[i])) + { + return true; + } + } + return false; + } + + public static List GetOwnDestroyedCards(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return null; + } + return situation.CurrentSkillProcessInfo.OwnProcessRecord.OwnDestroyedCards; + } + + public static List GetOwnSummonedCards(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return null; + } + return situation.CurrentSkillProcessInfo.OwnProcessRecord.OwnSummonedCards; + } + + public static List GetOwnLatestSummonedCards(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return null; + } + return situation.CurrentSkillProcessInfo.OwnProcessRecord.OwnLatestSummonedCards; + } + + public static List GetOwnLatestDrewCards(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return null; + } + return situation.CurrentSkillProcessInfo.OwnProcessRecord.OwnLatestDrewCards; + } + + public static List GetLatestTargets(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return null; + } + return situation.CurrentSkillProcessInfo.OwnProcessRecord.LatestTargets; + } + + public static int GetCurrentProcessDefaultDamage(this AISituationInfo situation) + { + if (situation.IsNull()) + { + return -1; + } + return situation.CurrentSkillProcessInfo.OwnProcessRecord.DefaultDamage; + } + + public static void RegisterOwnDestroyedCard(this AISituationInfo situation, AIVirtualCard card) + { + if (!situation.IsNull()) + { + situation.CurrentSkillProcessInfo.OwnProcessRecord.AddOwnDestroyedCard(card); + } + } + + public static void RegisterOwnBanishedCard(this AISituationInfo situation, AIVirtualCard card) + { + if (!situation.IsNull()) + { + situation.CurrentSkillProcessInfo.OwnProcessRecord.AddOwnBanishedCard(card); + } + } + + public static void RegisterOwnSummonedCardList(this AISituationInfo situation, List cards) + { + if (!situation.IsNull() && cards != null && cards.Count > 0) + { + situation.CurrentSkillProcessInfo.OwnProcessRecord.AddOwnSummonedCards(cards); + } + } + + public static void RegisterOwnDrewCardList(this AISituationInfo situation, List cards) + { + if (!situation.IsNull() && cards != null && cards.Count > 0) + { + situation.CurrentSkillProcessInfo.OwnProcessRecord.AddOwnDrewCards(cards); + } + } + + public static void RegisterSingleLatestTarget(this AISituationInfo situation, AIVirtualCard card) + { + if (!situation.IsNull()) + { + situation.CurrentSkillProcessInfo.OwnProcessRecord.RegisterSingleLatestTarget(card); + } + } + + public static void RegisterLatestTargetList(this AISituationInfo situation, List list) + { + if (!situation.IsNull() && list != null && list.Count > 0) + { + situation.CurrentSkillProcessInfo.OwnProcessRecord.RegisterLatestTargetList(list); + } + } + + private static bool IsNull(this AISituationInfo situation) + { + if (situation != null) + { + return situation.CurrentSkillProcessInfo == null; + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISkillActivateCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISkillActivateCountUtility.cs new file mode 100644 index 0000000..94992f2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISkillActivateCountUtility.cs @@ -0,0 +1,134 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISkillActivateCountUtility +{ + public const int NONE_LIMIT_ACTIVATE_COUNT = -1; + + public static void AllActivateCountHolderIncrement(this AIVirtualField field, AISituationInfo situation, AIPlayTagType counterType, AIVirtualCard triggerCard = null) + { + if (field.CardListSet.HasActivateCountHolder) + { + List activateCountHolders = field.CardListSet.ActivateCountHolders; + for (int i = 0; i < activateCountHolders.Count; i++) + { + activateCountHolders[i].Increment(situation, counterType, triggerCard); + } + } + } + + public static void AllActivateCountHolderIncrement(this AIVirtualField field, AISituationInfo situation, AIPlayTagType counterType, List triggerCardList) + { + if (field.CardListSet.HasActivateCountHolder) + { + List activateCountHolders = field.CardListSet.ActivateCountHolders; + for (int i = 0; i < activateCountHolders.Count; i++) + { + activateCountHolders[i].Increment(situation, counterType, triggerCardList); + } + } + } + + public static void Increment(this AIVirtualCard card, AISituationInfo situation, AIPlayTagType counterType, AIVirtualCard triggerCard = null) + { + if (card.TagCollectionContainer.HasTag(counterType) && CheckCounterTypeCommonIncrementCondition(counterType, card, situation)) + { + card.TagCollectionContainer.ActivateCountTags.Increment(card, situation, counterType, triggerCard); + } + } + + public static void Increment(this AIVirtualCard card, AISituationInfo situation, AIPlayTagType counterType, List triggerCardList) + { + if (card.TagCollectionContainer.HasTag(counterType) && CheckCounterTypeCommonIncrementCondition(counterType, card, situation)) + { + card.TagCollectionContainer.ActivateCountTags.Increment(card, situation, counterType, triggerCardList); + } + } + + private static bool CheckCounterTypeCommonIncrementCondition(AIPlayTagType counterType, AIVirtualCard holder, AISituationInfo situation) + { + if (counterType == AIPlayTagType.TurnEndActivateCount) + { + return holder.IsAlly == situation.Actor.IsAlly; + } + return true; + } + + public static int GetSkillActivateCount(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List argList) + { + if (!field.CardListSet.HasActivateCountHolder) + { + return 0; + } + if (!CheckActivateCounterFilteringArgument(argList, out var filters, out var skillOwnerId, out var skillIndex)) + { + return 0; + } + int num = 0; + List activateCountHolders = field.CardListSet.ActivateCountHolders; + for (int i = 0; i < activateCountHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = activateCountHolders[i]; + if (AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, null, filters, playPtn, tagOwner, situation)) + { + num += aIVirtualCard.GetSkillActivateCountFromOneCard(skillOwnerId, skillIndex); + } + } + return num; + } + + public static bool IsSkillOccurred(this AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, List argList) + { + if (!field.CardListSet.HasActivateCountHolder) + { + return false; + } + if (!CheckActivateCounterFilteringArgument(argList, out var filters, out var skillOwnerId, out var skillIndex)) + { + return false; + } + List activateCountHolders = field.CardListSet.ActivateCountHolders; + for (int i = 0; i < activateCountHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = activateCountHolders[i]; + if (AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, null, filters, playPtn, tagOwner, situation) && !aIVirtualCard.GetIsSkillOccurredFromOneCard(skillOwnerId, skillIndex)) + { + return false; + } + } + return true; + } + + public static bool CheckActivateCounterFilteringArgument(List argList, out List filters, out int skillOwnerId, out int skillIndex) + { + filters = null; + skillOwnerId = -1; + skillIndex = 0; + if (!(argList[0] is AIScriptNumericToken aIScriptNumericToken)) + { + return false; + } + skillIndex = (int)aIScriptNumericToken.Value; + argList.RemoveAt(0); + if (!(argList[0] is AIScriptIDToken aIScriptIDToken)) + { + return false; + } + skillOwnerId = aIScriptIDToken.ID; + argList.RemoveAt(0); + argList.Reverse(); + filters = argList; + return true; + } + + private static int GetSkillActivateCountFromOneCard(this AIVirtualCard counterOwner, int counterSourceCardId, int counterIndex) + { + return counterOwner.TagCollectionContainer.ActivateCountTags.GetActivateCount(counterSourceCardId, counterIndex); + } + + private static bool GetIsSkillOccurredFromOneCard(this AIVirtualCard counterOwner, int counterSourceCardId, int counterIndex) + { + return counterOwner.TagCollectionContainer.ActivateCountTags.IsSkillOccurred(counterSourceCardId, counterIndex); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISkillCountFromIdUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISkillCountFromIdUtility.cs new file mode 100644 index 0000000..ec4d0c8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISkillCountFromIdUtility.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISkillCountFromIdUtility +{ + public static int GetSkillCountFromID(List filters, int skillOwnerId, AIVirtualCard tagOwner, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(tagOwner.SelfField.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0; + } + int num = 0; + for (int i = 0; i < list.Count; i++) + { + num += GetAttachedSkillCount(list[i].BaseCard, skillOwnerId); + } + return num; + } + + public static int GetAttachedSkillCount(BattleCardBase targetCard, int skillOwnerId) + { + int num = 0; + List ownerCardIdList = targetCard.SkillApplyInformation.AttachedSkillsInfo.OwnerCardIdList; + for (int i = 0; i < ownerCardIdList.Count; i++) + { + if (EnemyAI.GetBaseId(ownerCardIdList[i]) == skillOwnerId) + { + num++; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISpellboostSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISpellboostSimulationUtility.cs new file mode 100644 index 0000000..ef0e30e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISpellboostSimulationUtility.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISpellboostSimulationUtility +{ + public static void SpellboostAll(List targets, int count) + { + for (int i = 0; i < targets.Count; i++) + { + targets[i].Spellboost(count); + } + } + + public static void SpellboostTarget(AISituationInfo situation, int count, List candidates, AIScriptTokenArgType whichTarget) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard)) + { + aIVirtualCard.Spellboost(count); + } + } + } + + public static void SpellboostWhenPlaySpellAtEvaluation(AIVirtualCard playCard, AIVirtualField field) + { + for (int i = 0; i < field.AllyHandCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[i]; + if (aIVirtualCard.HasSpellboost) + { + aIVirtualCard.Spellboost(1); + } + } + } + + public static void SpellboostWhenPlaySpell(AIVirtualCard playCard, AIVirtualField field) + { + if (!playCard.IsAlly) + { + return; + } + for (int i = 0; i < field.AllyHandCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.AllyHandCards[i]; + if (!aIVirtualCard.IsSameCard(playCard) && aIVirtualCard.HasSpellboost) + { + aIVirtualCard.Spellboost(1); + } + } + } + + public static AIVirtualCard SelectBestTargetForSpellboost(AIVirtualField field, int boostCount, List candidates) + { + AIVirtualCard result = null; + float num = float.MinValue; + List list = new List(); + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + int spellboostCount = aIVirtualCard.SpellboostCount; + list.Clear(); + list.Add(field.AllyHandCards.IndexOf(aIVirtualCard)); + float num2 = CalculateCardValueForSpellboostEvaluation(aIVirtualCard, list); + aIVirtualCard.Spellboost(boostCount); + float num3 = CalculateCardValueForSpellboostEvaluation(aIVirtualCard, list); + aIVirtualCard.SetSpellboostCount(spellboostCount); + float num4 = num3 - num2; + if (num4 > num) + { + result = aIVirtualCard; + num = num4; + } + } + return result; + } + + private static float CalculateCardValueForSpellboostEvaluation(AIVirtualCard card, List playPtn) + { + return card.EvaluatePlayValue(playPtn) + card.GetHandBonus(playPtn, null, isIgnoreInFusion: false); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISubtractCountdownSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISubtractCountdownSimulationUtility.cs new file mode 100644 index 0000000..d1d7b8e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISubtractCountdownSimulationUtility.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public static class AISubtractCountdownSimulationUtility +{ + public static void SubtractCountdownAll(List targetCards, int value, AISituationInfo situation) + { + for (int i = 0; i < targetCards.Count; i++) + { + SubtractCountdownSingle(targetCards[i], value, situation); + } + } + + public static void ExecuteTargetSelectSubtractCountdown(AIVirtualCard tagOwner, List candidats, AIVirtualField field, List playPtn, AISituationInfo situation, AIScriptTokenArgType selectType, int countChange) + { + if (situation == null) + { + AIConsoleUtility.LogError("ExecuteTargetSelectSubtractCountdown() Error!! situation is null!!!!!"); + } + else if (situation.IsTargetExists(selectType)) + { + SubtractCountdownTarget(situation, candidats, selectType, countChange); + } + else + { + SubtractCountdownTargetPrediction(situation, candidats, tagOwner, field, playPtn, selectType, countChange); + } + } + + private static void SubtractCountdownTarget(AISituationInfo situation, List candidates, AIScriptTokenArgType whichTarget, int value) + { + AISelectedTargetInfo situationTarget = situation.GetSituationTarget(whichTarget); + if (situationTarget == null || !situationTarget.HasTarget) + { + AIConsoleUtility.LogError("SubtractCountdownTarget error!! No target!!!!!"); + return; + } + List targets = situationTarget.Targets; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (candidates.Contains(aIVirtualCard)) + { + SubtractCountdownSingle(aIVirtualCard, value, situation); + } + } + } + + private static void SubtractCountdownTargetPrediction(AISituationInfo situation, List candidates, AIVirtualCard owner, AIVirtualField field, List playPtn, AIScriptTokenArgType whichTarget, int countChange) + { + AIVirtualCard target = SelectBestTarget(AITargetSelectFilteringUtility.SelectCandidatesWithForceTargeting(candidates, owner, playPtn), countChange); + situation.SetSingleTargetInInfo(target, TargetSelectType.Default, whichTarget); + SubtractCountdownTarget(situation, candidates, whichTarget, countChange); + } + + public static void SubtractCountdownSingle(AIVirtualCard target, int value, AISituationInfo situation) + { + if (!target.IsDead && target.IsCountdownAmulet) + { + target.ChantCountDown(situation, value); + } + } + + private static AIVirtualCard SelectBestTarget(List candidates, int countChange) + { + AIVirtualCard result = null; + float num = float.MinValue; + List emptyPlayPtn = EnemyAI.EmptyPlayPtn; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + float num2 = aIVirtualCard.EvaluateBreakValue(emptyPlayPtn, useIgnoreBreak: false); + int num3 = Mathf.Max(0, aIVirtualCard.ChantCount - countChange); + float num4 = num2 * Mathf.Pow(0.75f, num3); + if (num4 > num) + { + result = aIVirtualCard; + num = num4; + } + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AISummonCountUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AISummonCountUtility.cs new file mode 100644 index 0000000..6639ef0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AISummonCountUtility.cs @@ -0,0 +1,89 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AISummonCountUtility +{ + public static bool ClassificateSummonCountArgument(List argList, out List filters, out AIScriptTokenArgType turnOrGame, out AIScriptTokenArgType playedType) + { + filters = new List(); + turnOrGame = AIScriptTokenArgType.NONE; + playedType = AIScriptTokenArgType.NONE; + if (argList == null || argList.Count < 2) + { + return false; + } + bool flag = false; + if (argList[0] is AIScriptArgumentToken aIScriptArgumentToken) + { + if (aIScriptArgumentToken.ArgumentType == AIScriptTokenArgType.PLAYED || aIScriptArgumentToken.ArgumentType == AIScriptTokenArgType.PLAYPTN) + { + playedType = aIScriptArgumentToken.ArgumentType; + flag = true; + } + else if (aIScriptArgumentToken.ArgumentType == AIScriptTokenArgType.TURN || aIScriptArgumentToken.ArgumentType == AIScriptTokenArgType.GAME) + { + turnOrGame = aIScriptArgumentToken.ArgumentType; + } + argList.RemoveAt(0); + if (flag) + { + if (argList[0] is AIScriptArgumentToken aIScriptArgumentToken2 && (aIScriptArgumentToken2.ArgumentType == AIScriptTokenArgType.TURN || aIScriptArgumentToken2.ArgumentType == AIScriptTokenArgType.GAME)) + { + turnOrGame = aIScriptArgumentToken2.ArgumentType; + } + argList.RemoveAt(0); + } + if (turnOrGame == AIScriptTokenArgType.NONE) + { + return false; + } + argList.Reverse(); + filters = argList; + return true; + } + return false; + } + + public static int GetSummonCount(AIVirtualCard tagOwner, List filters, AIScriptTokenArgType turnOrGame, AIScriptTokenArgType playedType, List playPtn, AISituationInfo situation) + { + if (turnOrGame != AIScriptTokenArgType.TURN && turnOrGame != AIScriptTokenArgType.GAME) + { + return 0; + } + return playedType switch + { + AIScriptTokenArgType.NONE => GetSummonCountAtPlayed(tagOwner, filters, turnOrGame, playPtn, situation) + GetSummonCountAtPlayPtn(tagOwner, filters, playPtn, situation), + AIScriptTokenArgType.PLAYED => GetSummonCountAtPlayed(tagOwner, filters, turnOrGame, playPtn, situation), + AIScriptTokenArgType.PLAYPTN => GetSummonCountAtPlayPtn(tagOwner, filters, playPtn, situation), + _ => 0, + }; + } + + private static int GetSummonCountAtPlayed(AIVirtualCard tagOwner, List filters, AIScriptTokenArgType turnOrGame, List playPtn, AISituationInfo situation) + { + return AIFilteringUtility.MultipleFiltering(tagOwner.SelfField.SummonedCardContainer.GetSummonedList(tagOwner.IsAlly, turnOrGame == AIScriptTokenArgType.TURN), filters, tagOwner, playPtn, situation)?.Count ?? 0; + } + + private static int GetSummonCountAtPlayPtn(AIVirtualCard tagOwner, List filters, List playPtn, AISituationInfo situation) + { + if (!tagOwner.IsAlly || playPtn == null || playPtn.Count <= 0) + { + return 0; + } + int num = 0; + List allyHandCards = tagOwner.SelfField.AllyHandCards; + for (int i = 0; i < playPtn.Count; i++) + { + if (playPtn[i] < allyHandCards.Count) + { + AIVirtualCard aIVirtualCard = allyHandCards[playPtn[i]]; + if ((((aIVirtualCard.IsUnit || aIVirtualCard.IsAmulet) && !aIVirtualCard.IsAccelerated(tagOwner.SelfField, playPtn, situation)) || aIVirtualCard.IsCrystalize(tagOwner.SelfField, playPtn, situation)) && AIFilteringUtility.CheckMatchTargetFiltering(aIVirtualCard, null, filters, playPtn, tagOwner, situation)) + { + num++; + } + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITagCountFromIdUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AITagCountFromIdUtility.cs new file mode 100644 index 0000000..c3bb5d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITagCountFromIdUtility.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AITagCountFromIdUtility +{ + public static int GetTagCountFromId(AIVirtualCard tagOwner, int id, List filters, AIVirtualField field, List playPtn, AISituationInfo situation) + { + List list = AIFilteringUtility.MultipleFiltering(field.CardListSet.BothClassAndInplayCards, filters, tagOwner, playPtn, situation); + if (list == null || list.Count <= 0) + { + return 0; + } + int num = 0; + for (int i = 0; i < list.Count; i++) + { + num += GetAttachedTagCount(list[i], id); + } + return num; + } + + public static int GetAttachedTagCount(AIVirtualCard card, int id) + { + return card.TagCollectionContainer.AttachedTags?.GetAttachedTagCountFromId(id) ?? 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITurnEndMove.cs b/SVSim.BattleEngine/Engine/Wizard/AITurnEndMove.cs new file mode 100644 index 0000000..e141b24 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITurnEndMove.cs @@ -0,0 +1,13 @@ +namespace Wizard; + +internal class AITurnEndMove : AIMove +{ + public AITurnEndMove() + : base(AIOperationType.TURNEND) + { + } + + public override void RunOperation(BattleManagerBase mgr, bool isPlayer) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AITyrantOrderSelectLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AITyrantOrderSelectLogicArgument.cs new file mode 100644 index 0000000..6ad9bb5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AITyrantOrderSelectLogicArgument.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AITyrantOrderSelectLogicArgument : AISelectLogicArgumentBase +{ + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.TYRANT_ORDER_LOGIC; + + public AITyrantOrderSelectLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + AIConsoleUtility.LogError("AITyrantOrderSelectLogicArgument: This logic is cant use single target select"); + return null; + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + List list = new List(candidates); + list.RemoveAll((AIVirtualCard c) => c.IsLeader || c.IsDead || c.IsIndependent || c.IsSneak || c.IsUntouchable); + if (list.Count == selectCount) + { + return list; + } + if (list.Count < selectCount) + { + AIConsoleUtility.LogError("AITyrantOrderSelectLogicArgument:SelectMultipleSelectedTargets() - Targets dont meet the minimum number."); + return null; + } + AIReverseEvaluateValueListOrder aIReverseEvaluateValueListOrder = new AIReverseEvaluateValueListOrder(); + for (int num = 0; num < list.Count; num++) + { + AIVirtualCard aIVirtualCard = list[num]; + float value = ((!aIVirtualCard.IsForceTargeting) ? ((!aIVirtualCard.IsAmulet) ? AISimulationRemovalUtility.CalculateRemovalValue(aIVirtualCard, field, playPtn, situation, AIRemovalType.Destroy, null) : 0f) : float.MinValue); + aIReverseEvaluateValueListOrder.AddData(value, aIVirtualCard); + } + return aIReverseEvaluateValueListOrder.GetCardList(selectCount); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIUntouchableStopPreprocessOption.cs b/SVSim.BattleEngine/Engine/Wizard/AIUntouchableStopPreprocessOption.cs new file mode 100644 index 0000000..90a33eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIUntouchableStopPreprocessOption.cs @@ -0,0 +1,9 @@ +namespace Wizard; + +public class AIUntouchableStopPreprocessOption : AITagPreprocessCreationOptionBase +{ + public AIUntouchableStopPreprocessOption(AIVirtualCard targetCard) + : base(AITagPreprocessInfoType.UNTOUCHABLE_STOP, targetCard) + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualCardUpdateInformationExtension.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualCardUpdateInformationExtension.cs new file mode 100644 index 0000000..e7448c9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualCardUpdateInformationExtension.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIVirtualCardUpdateInformationExtension +{ + public static void UpdateCardInformation(this AIVirtualCard card, AIVirtualCard source) + { + card.UpdateOtherEvolveParameter(source); + card.UpdateAttachTagInformation(source); + card.UpdateRemovedTagInformation(source); + card.UpdateBarrierInfo(source); + card.UpdateWhenChangeInplayTagInformation(source); + card.UpdateRemovedAttachTagInformation(source); + card.UpdateActivateCounter(source); + card.CopyCannotAttackInfoList(source); + } + + private static void UpdateOtherEvolveParameter(this AIVirtualCard card, AIVirtualCard source) + { + card.SetOtherEvolveParameterFromVirtualCard(source); + } + + private static void UpdateWhenChangeInplayTagInformation(this AIVirtualCard owner, AIVirtualCard updateSource) + { + if (owner.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenChangeInplay) && updateSource.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenChangeInplay)) + { + ChangeInplayTagCollection changeInplayTags = owner.TagCollectionContainer.ChangeInplayTags; + ChangeInplayTagCollection changeInplayTags2 = updateSource.TagCollectionContainer.ChangeInplayTags; + changeInplayTags.UpdateIsActivatedInformation(changeInplayTags2.TagIsActivatedList, changeInplayTags2.AddedChangeInplayActivatedInfoIncrement); + } + } + + private static void UpdateAttachTagInformation(this AIVirtualCard owner, AIVirtualCard updateSource) + { + AIAttachedTagCollection attachedTags = updateSource.TagCollectionContainer.AttachedTags; + if (attachedTags == null || !attachedTags.HasAnyTag) + { + return; + } + List list = null; + AIAttachedTagCollection attachedTags2 = owner.TagCollectionContainer.AttachedTags; + if (attachedTags2 != null && attachedTags2.HasAnyTag) + { + for (int i = 0; i < attachedTags2.AllList.Count; i++) + { + list = AIParamQuery.AddElementToList(attachedTags2.AllList[i].Hash, list); + } + } + for (int j = 0; j < attachedTags.AllList.Count; j++) + { + AIAttachedTagInformation aIAttachedTagInformation = attachedTags.AllList[j]; + int num = -1; + if (list != null && list.Count > 0) + { + num = list.IndexOf(aIAttachedTagInformation.Hash); + } + if (num >= 0) + { + list.RemoveAt(num); + } + else + { + owner.TagCollectionContainer.AttachTag(aIAttachedTagInformation, owner, null); + } + } + } + + private static void UpdateRemovedTagInformation(this AIVirtualCard tagOwner, AIVirtualCard updateSource) + { + AIRemovedTagCollection removedTagCollection = tagOwner.TagCollectionContainer.RemovedTagCollection; + AIRemovedTagCollection removedTagCollection2 = updateSource.TagCollectionContainer.RemovedTagCollection; + if ((removedTagCollection.AllList == null && removedTagCollection2.AllList == null) || removedTagCollection2.AllList == null || removedTagCollection2.AllList.Count <= 0) + { + return; + } + int num = ((removedTagCollection.AllList != null) ? removedTagCollection.AllList.Count : 0); + int num2 = ((removedTagCollection2.AllList != null) ? removedTagCollection2.AllList.Count : 0); + if (num < num2) + { + for (int i = num; i < removedTagCollection2.AllList.Count; i++) + { + AIRemovedTagInformation aIRemovedTagInformation = removedTagCollection2.AllList[i]; + tagOwner.TagCollectionContainer.RemoveOneTagWithUpdatingFieldCardList(tagOwner, aIRemovedTagInformation.Tag, tagOwner.SelfField); + removedTagCollection.Add(aIRemovedTagInformation); + } + } + } + + private static void UpdateRemovedAttachTagInformation(this AIVirtualCard owner, AIVirtualCard source) + { + AIAttachedTagCollection attachedTags = owner.TagCollectionContainer.AttachedTags; + AIAttachedTagCollection attachedTags2 = source.TagCollectionContainer.AttachedTags; + if (attachedTags != null && attachedTags.HasAnyTag && attachedTags2 != null && attachedTags2.HasRemovedInfoCaches) + { + List removedTagCacheList = attachedTags2.RemovedTagCacheList; + for (int i = 0; i < removedTagCacheList.Count; i++) + { + AIPlayTag removingInfo = removedTagCacheList[i]; + AIRemoveTagUtility.RemoveTemporaryAttachedTag(owner, owner.SelfField, removingInfo, null); + } + removedTagCacheList.Clear(); + } + } + + private static void UpdateBarrierInfo(this AIVirtualCard card, AIVirtualCard source) + { + card.BarrierInfoCollection = source.BarrierInfoCollection.Clone(); + } + + private static void UpdateActivateCounter(this AIVirtualCard card, AIVirtualCard source) + { + if (card.TagCollectionContainer.HasTagCollection(TagCollectionType.ActivateCount) && source.TagCollectionContainer.HasTagCollection(TagCollectionType.ActivateCount)) + { + ActivateCountTagCollection activateCountTags = card.TagCollectionContainer.ActivateCountTags; + ActivateCountTagCollection activateCountTags2 = source.TagCollectionContainer.ActivateCountTags; + activateCountTags.UpdateCounterList(activateCountTags2.ActivateCounterList); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualFieldInitializeUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualFieldInitializeUtility.cs new file mode 100644 index 0000000..67f59f7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualFieldInitializeUtility.cs @@ -0,0 +1,29 @@ +namespace Wizard; + +public static class AIVirtualFieldInitializeUtility +{ + public static void FindBuildParameterAndApply(this AIVirtualCard self, AIVirtualFieldBuildParameterCollction fieldBuildParameter) + { + ReferableVirtualCardBuildParameterCollection referableCardBuildParameter = fieldBuildParameter.GetReferableCardBuildParameter(self); + if (referableCardBuildParameter != null) + { + self.GetInformationFromCardBuildParameter(referableCardBuildParameter); + } + } + + private static void GetInformationFromCardBuildParameter(this AIVirtualCard self, ReferableVirtualCardBuildParameterCollection cardBuildParameter) + { + self.BarrierInfoCollection.GetBarrierInfoFromPreviousField(cardBuildParameter.BarrierInfoCollection); + cardBuildParameter.AttachedTags.AttachTagToReceiver(self); + cardBuildParameter.RemovedTags.RemoveTagFromCard(self); + if (self.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenChangeInplay)) + { + self.TagCollectionContainer.ChangeInplayTags.UpdateIsActivatedInformation(cardBuildParameter.ChangeInplayTagIsActivatedInfoList, cardBuildParameter.AddedChangeInplayTagActivatedInfoIncrement); + } + if (self.TagCollectionContainer.HasTagCollection(TagCollectionType.ActivateCount)) + { + self.TagCollectionContainer.ActivateCountTags.UpdateCounterList(cardBuildParameter.ActivateCounterList); + } + self.SetOtherEvolveParameterFromBuildParameter(cardBuildParameter); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualFieldTagProcessExtension.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualFieldTagProcessExtension.cs new file mode 100644 index 0000000..9b11d38 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualFieldTagProcessExtension.cs @@ -0,0 +1,232 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIVirtualFieldTagProcessExtension +{ + public static void ExecuteWhenChangeInplayTags(this AIVirtualField field, List playPtn, AISituationInfo situation) + { + if (!field.CardListSet.HasWhenChangeInplayHolder) + { + return; + } + List whenChangeInplayHolders = field.CardListSet.WhenChangeInplayHolders; + for (int i = 0; i < whenChangeInplayHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = whenChangeInplayHolders[i]; + if (!aIVirtualCard.IsDead) + { + aIVirtualCard.ExecuteWhenChangeInplayTag(field, playPtn, situation); + } + } + } + + public static void UpdateTagInformationFromLatestAction(this AIVirtualField currentField, AIRealActionInformation latestAction, AIVirtualField beforeLatestActionField) + { + AIVirtualField aIVirtualField = new AIVirtualField(beforeLatestActionField, isLatestAction: true); + AISituationInfo aISituationInfo = latestAction.CreateSituationInfo(aIVirtualField); + if (aISituationInfo != null) + { + EnemyAI aI = currentField.AI; + List enemyHandCardList = currentField.GetEnemyHandCardList(); + for (int i = 0; i < enemyHandCardList.Count; i++) + { + AIVirtualCard aIVirtualCard = enemyHandCardList[i]; + aI.tokenManager.AddTokenFromId(aIVirtualCard.BaseId, aIVirtualCard.IsAlly); + } + aISituationInfo.SetLatestActionSimulationParameter(); + SimulateLatestAction(aISituationInfo, aIVirtualField); + currentField.UpdateFieldParameterFromLatestActionField(aIVirtualField); + AIGenerateTagUtility.ExecuteGenerateTag(aISituationInfo, currentField, aI.GenerateTagOwnerTable, aI.BattleInfoReceivedData.AttachedInfoReceiveCollection); + } + } + + private static AIVirtualCard FindSimilarCardFromSimulationField(AIVirtualCard card, AIVirtualField realField, AIVirtualField simulationField) + { + List list = null; + int num = -1; + if (card.IsInHand) + { + list = simulationField.AllyHandCards; + num = realField.AllyHandCards.IndexOf(card); + } + else if (card.IsOnField) + { + if (card.IsAlly) + { + list = simulationField.CardListSet.AllyClassAndInplayCards; + num = realField.CardListSet.AllyClassAndInplayCards.IndexOf(card); + } + else + { + list = simulationField.CardListSet.EnemyClassAndInplayCards; + num = realField.CardListSet.EnemyClassAndInplayCards.IndexOf(card); + } + } + if (list == null || num < 0 || num >= list.Count) + { + return null; + } + int num2 = 0; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsDead) + { + if (num2 < num) + { + num2++; + } + else if (num2 == num && aIVirtualCard.BaseId == card.BaseId) + { + return aIVirtualCard; + } + } + } + return null; + } + + private static AIVirtualCard FindSimilarCardFromEnemyHand(AIVirtualCard card, AIVirtualField realField, AIVirtualField simulationField) + { + List list = null; + int num = -1; + if (card.IsInHand) + { + list = simulationField.GetEnemyHandCardList(); + num = realField.GetEnemyHandCardList().IndexOf(card); + } + if (list == null || num < 0 || num >= list.Count) + { + return null; + } + int num2 = 0; + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (num2 < num && !aIVirtualCard.IsDead) + { + num2++; + } + else if (num2 == num && aIVirtualCard.BaseId == card.BaseId) + { + return aIVirtualCard; + } + } + return null; + } + + private static void SimulateLatestAction(AISituationInfo latestAction, AIVirtualField field) + { + switch (latestAction.ActionType) + { + case AIOperationType.PLAY: + { + PlaySimulationInfo playInfo = AIPlayCardSimulationUtility.CreatePlaySimulationInfo(latestAction.Actor, latestAction, field); + AIVirtualPlaySimulator.PlayCard((AIVirtualTargetSelectAction)latestAction, field, playInfo); + break; + } + case AIOperationType.EVOLVE: + AIVirtualEvolutionSimulator.ManualEvolve((AIVirtualTargetSelectAction)latestAction, field); + break; + case AIOperationType.ATTACK: + AIVirtualAttackSimulator.Attack((AIVirtualAttackInfo)latestAction, field); + break; + case AIOperationType.TURNEND: + { + AIVirtualTurnEndSimulator.TurnEnd((AIVirtualTurnEndInfo)latestAction, field); + AIVirtualTurnStartInfo aIVirtualTurnStartInfo = new AIVirtualTurnStartInfo(latestAction.Actor.IsAlly ? field.EnemyClass : field.AllyClass); + aIVirtualTurnStartInfo.SetLatestActionSimulationParameterFromPreAction(latestAction); + AIVirtualTurnStartSimulator.TurnStart(aIVirtualTurnStartInfo, field); + break; + } + case AIOperationType.FUSION: + AIVirtualFusionSimulator.Fusion((AIVirtualTargetSelectAction)latestAction, field); + break; + } + } + + private static void UpdateFieldParameterFromLatestActionField(this AIVirtualField field, AIVirtualField afterLatestActionField) + { + field.UpdateFieldInformationBeforeCardUpdating(afterLatestActionField); + for (int i = 0; i < field.CardListSet.AllReferableCards.Count; i++) + { + AIVirtualCard card = field.CardListSet.AllReferableCards[i]; + AIVirtualCard aIVirtualCard = FindSimilarCardFromSimulationField(card, field, afterLatestActionField); + if (aIVirtualCard != null) + { + card.UpdateCardInformation(aIVirtualCard); + } + } + for (int j = 0; j < field.GetEnemyHandCardList().Count; j++) + { + AIVirtualCard card2 = field.GetEnemyHandCardList()[j]; + AIVirtualCard aIVirtualCard2 = FindSimilarCardFromEnemyHand(card2, field, afterLatestActionField); + if (aIVirtualCard2 != null) + { + card2.UpdateCardInformation(aIVirtualCard2); + } + } + field.UpdateFieldInformationAfterCardUpdating(afterLatestActionField); + } + + private static void UpdateFieldInformationBeforeCardUpdating(this AIVirtualField currentField, AIVirtualField otherField) + { + currentField.SetParametersFromOtherField(otherField); + } + + private static void UpdateFieldInformationAfterCardUpdating(this AIVirtualField currentField, AIVirtualField otherField) + { + currentField.TagPreprocessContainer = otherField.TagPreprocessContainer.Clone(currentField); + currentField.DamageModifierCollection = otherField.DamageModifierCollection.Clone(currentField); + currentField.IsNoInstantAttackRecheck(); + } + + public static void ApplyAttackBonus(this AIVirtualField field, AIVirtualAttackInfo situation) + { + if (situation.IsUsePreCheck) + { + field.SimulationExtraBonus += situation.PreCheckInformation.AttackBonus; + } + else + { + field.SimulationExtraBonus += situation.Actor.GetAttackBonus(field.BestPlayPtn, situation); + } + } + + public static void ApplyClashBonus(this AIVirtualField field, AIVirtualAttackInfo situation) + { + AIVirtualCard actor = situation.Actor; + AIVirtualCard attackTarget = situation.AttackTarget; + if (attackTarget.IsUnit) + { + field.SimulationExtraBonus += actor.GetClashBonus(); + field.SimulationExtraBonus += attackTarget.GetClashBonus(); + } + } + + public static void ApplyBuffBonus(this AIVirtualField field, AIVirtualCard buffedCard, List playPtn, AISituationInfo situation) + { + field.SimulationExtraBonus += buffedCard.GetBuffBonus(playPtn, situation); + } + + public static void ExecuteWhenDamageTags(this AIVirtualField field, AIVirtualCard damagedTarget, int defaultDamage, List playPtn, AISituationInfo situation) + { + if (damagedTarget.Life <= 0) + { + return; + } + if (damagedTarget.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenDamaged)) + { + damagedTarget.TagCollectionContainer.DamagedTags.RegisterPassedConditionTags(damagedTarget, field, playPtn, situation); + } + List otherDamagedTagHolders = field.CardListSet.OtherDamagedTagHolders; + if (otherDamagedTagHolders != null) + { + for (int i = 0; i < otherDamagedTagHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = otherDamagedTagHolders[i]; + aIVirtualCard.TagCollectionContainer.OtherDamagedTags.RegisterPassedConditionTags(aIVirtualCard, damagedTarget, defaultDamage, field, playPtn, situation); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualFusionSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualFusionSimulator.cs new file mode 100644 index 0000000..5122058 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualFusionSimulator.cs @@ -0,0 +1,45 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIVirtualFusionSimulator +{ + public static void Fusion(AIVirtualTargetSelectAction situation, AIVirtualField field) + { + if (situation.ActionType != AIOperationType.FUSION) + { + AIConsoleUtility.LogError("AIVirtualFusionSimulator:Fusion() error!! situation is not [FUSION] ActionType!!!!!"); + return; + } + if (!situation.IsTargetExists(AIScriptTokenArgType.TARGET_SELECT)) + { + AIConsoleUtility.LogError("AIVirtualFusionSimulator:Fusion() error!! cannot find fusion ingredients!!!!!"); + return; + } + FusionMoveCard(situation, field); + AIVirtualCard actor = situation.Actor; + if (actor.TagCollectionContainer.HasTag(AIPlayTagType.FusionMetamorphose)) + { + actor.TagCollectionContainer.FusionMetamorphoseTags.ExecuteMetamorphose(actor, field, field.BestPlayPtn, situation); + } + } + + private static void FusionMoveCard(AIVirtualTargetSelectAction situation, AIVirtualField field) + { + List targets = situation.GetSituationTarget(AIScriptTokenArgType.TARGET_SELECT).Targets; + bool isAlly = situation.Actor.IsAlly; + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (isAlly) + { + field.RemoveAllyHandCard(aIVirtualCard); + } + else + { + field.RemoveEnemyHandCard(aIVirtualCard); + } + situation.Actor.FusionIngredients.AddFusionIngredient(aIVirtualCard, field.CurrentTurnCount); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualRemovalInfo.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualRemovalInfo.cs new file mode 100644 index 0000000..12337fe --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualRemovalInfo.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIVirtualRemovalInfo +{ + public bool IsFirstTargetSelected; + + public List Tags { get; private set; } + + public AIVirtualRemovalInfo(List tags) + { + Tags = tags; + IsFirstTargetSelected = false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIVirtualTurnStartSimulator.cs b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTurnStartSimulator.cs new file mode 100644 index 0000000..3879b8f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIVirtualTurnStartSimulator.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public static class AIVirtualTurnStartSimulator +{ + public static void TurnStart(AIVirtualTurnStartInfo situation, AIVirtualField field) + { + if (situation.ActionType != AIOperationType.TURNSTART) + { + AIConsoleUtility.LogError("AIVirtualTurnStartSimulator:TurnStart() error!! situation is not [TURNSTART] ActionType!!!!!"); + return; + } + field.TurnStartFieldProcess(situation); + List whenChangeInplayHolders = field.CardListSet.WhenChangeInplayHolders; + if (whenChangeInplayHolders != null) + { + for (int i = 0; i < whenChangeInplayHolders.Count; i++) + { + AIVirtualCard aIVirtualCard = whenChangeInplayHolders[i]; + if (!aIVirtualCard.IsDead && aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenChangeInplay)) + { + aIVirtualCard.TagCollectionContainer.ChangeInplayTags.ExecuteWhenTurnStart(aIVirtualCard, field, situation); + } + } + } + List turnStartTagHolders = field.CardListSet.TurnStartTagHolders; + if (turnStartTagHolders != null && turnStartTagHolders.Count > 0) + { + for (int j = 0; j < turnStartTagHolders.Count; j++) + { + AIVirtualCard aIVirtualCard2 = turnStartTagHolders[j]; + if (!aIVirtualCard2.IsDead && aIVirtualCard2.TagCollectionContainer.HasTagCollection(TagCollectionType.WhenTurnStart)) + { + AIScriptTokenArgType turnStartSide = GetTurnStartSide(aIVirtualCard2, situation); + aIVirtualCard2.TagCollectionContainer.TurnStartTags.RegisterConditionPassedTagActions(aIVirtualCard2, situation, turnStartSide); + } + } + } + field.TagPreprocessContainer.SimulateAllTurnStartInfo(situation.Actor.IsAlly, situation); + situation.ExecuteAllSkillProcess(); + } + + private static AIScriptTokenArgType GetTurnStartSide(AIVirtualCard owner, AIVirtualTurnStartInfo situation) + { + if (owner.IsAlly == situation.Actor.IsAlly) + { + return AIScriptTokenArgType.ALLY; + } + return AIScriptTokenArgType.OPPONENT; + } + + public static void TurnStartFieldProcess(this AIVirtualField field, AIVirtualTurnStartInfo situation) + { + field.ReverseAllCardIsSelfTurn(); + field.PlayedCardContainer.ClearInTurn(situation); + if (situation.Actor.IsAlly) + { + field.AllyTurnCount++; + field.AllyPpTotal = Math.Min(field.AllyPpTotal + 1, 10); + } + else + { + field.EnemyTurnCount++; + field.EnemyPpTotal = Math.Min(field.EnemyPpTotal + 1, 10); + } + if (!field.IsLatestActionField) + { + return; + } + for (int i = 0; i < field.CardListSet.AllReferableCards.Count; i++) + { + AIVirtualCard aIVirtualCard = field.CardListSet.AllReferableCards[i]; + if (aIVirtualCard.TagCollectionContainer.HasTagCollection(TagCollectionType.ActivateCount)) + { + bool isOwnerTurn = aIVirtualCard.IsAlly == situation.Actor.IsAlly; + aIVirtualCard.TagCollectionContainer.ActivateCountTags.ResetAllCounter(isOwnerTurn); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhiteRitualSimulationUtility.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhiteRitualSimulationUtility.cs new file mode 100644 index 0000000..23e4a30 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhiteRitualSimulationUtility.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; + +namespace Wizard; + +public static class AIWhiteRitualSimulationUtility +{ + public static void SimulateStack(AIVirtualCard stackOwner, AIVirtualField field, AISituationInfo situation, int defaultStack) + { + int num = defaultStack; + List list = (stackOwner.IsAlly ? field.AllyInplayCards : field.EnemyInplayCards); + if (list == null || list.Count <= 0) + { + stackOwner.SetWhiteRitual(num); + return; + } + for (int i = 0; i < list.Count; i++) + { + AIVirtualCard aIVirtualCard = list[i]; + if (!aIVirtualCard.IsDead && aIVirtualCard.IsAmulet && aIVirtualCard.IsStackWhiteRitual && aIVirtualCard.WhiteRitualCount > 0 && !aIVirtualCard.IsSameCard(stackOwner)) + { + aIVirtualCard.RemoveCard(situation, AIRemovalType.Banish, isFromSkill: true); + if (aIVirtualCard.IsDead) + { + num += aIVirtualCard.WhiteRitualCount; + } + } + } + stackOwner.SetWhiteRitual(num); + } + + public static bool AddWhiteRitualTargetCard(int count, AIVirtualCard target) + { + if (target == null) + { + AIConsoleUtility.LogError("AddWhiteRitualTargetCard : target is missing!"); + return false; + } + return target.AddWhiteRitual(count); + } + + public static void AddWhiteRitualSingle(int count, List targets) + { + if (targets == null || targets.Count <= 0) + { + AIConsoleUtility.LogError("AddWhiteRitualSingle : target is missing!"); + return; + } + for (int i = 0; i < targets.Count; i++) + { + AIVirtualCard aIVirtualCard = targets[i]; + if (!aIVirtualCard.IsIndependent && aIVirtualCard.WhiteRitualCount > 0 && AddWhiteRitualTargetCard(count, aIVirtualCard)) + { + break; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AIWhitefrostWhisperLogicArgument.cs b/SVSim.BattleEngine/Engine/Wizard/AIWhitefrostWhisperLogicArgument.cs new file mode 100644 index 0000000..2cc8dc1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AIWhitefrostWhisperLogicArgument.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class AIWhitefrostWhisperLogicArgument : AISelectLogicArgumentBase +{ + private const int WHITEFROST_WHISPER_DAMAGE = 1; + + public override AIScriptTokenArgType LogicType => AIScriptTokenArgType.WHITEFROST_WHISPER_LOGIC; + + public AIWhitefrostWhisperLogicArgument(List args) + : base(args) + { + } + + public override AIVirtualCard SelectSingleTarget(List candidates, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + float num = float.MinValue; + AIVirtualCard result = null; + for (int i = 0; i < candidates.Count; i++) + { + AIVirtualCard aIVirtualCard = candidates[i]; + if (aIVirtualCard.IsDead) + { + AIConsoleUtility.LogError("AIWhitefrostWhisperLogicArgument.SelectSingleTarget() error!! candidate is already dead!!!!!"); + continue; + } + float num2 = ((aIVirtualCard.Life >= aIVirtualCard.MaxLife) ? AIDamageSimulationUtility.GetDamageValueToCertainTarget(aIVirtualCard, 1, situation, playPtn, tagOwner.IsSpell) : ((!aIVirtualCard.IsIndependent && !aIVirtualCard.IsIndestructible) ? AIDestroySimulationUtility.CalcEvalDestroy(aIVirtualCard, playPtn, situation, useIgnoreBreak: false) : 0f)); + if (num2 > num) + { + num = num2; + result = aIVirtualCard; + } + } + return result; + } + + public override List SelectMultipleSelectedTargets(List candidates, int selectCount, AIVirtualCard tagOwner, AIVirtualField field, List playPtn, AISituationInfo situation, AISelectTargetPattern worstOrBest) + { + AIConsoleUtility.LogError("AIWhitefrostWhisperLogicArgument.SelectMultipleSelectedTargets() error!! Not implemented!!!!!"); + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AbortSoloPlayRecoveryTask.cs b/SVSim.BattleEngine/Engine/Wizard/AbortSoloPlayRecoveryTask.cs new file mode 100644 index 0000000..417be51 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AbortSoloPlayRecoveryTask.cs @@ -0,0 +1,9 @@ +namespace Wizard; + +public class AbortSoloPlayRecoveryTask : BaseTask +{ + public AbortSoloPlayRecoveryTask() + { + base.type = ApiType.Type.AbortSoloPlayRecovery; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AcceptAgreementTask.cs b/SVSim.BattleEngine/Engine/Wizard/AcceptAgreementTask.cs new file mode 100644 index 0000000..0c18e63 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AcceptAgreementTask.cs @@ -0,0 +1,73 @@ +namespace Wizard; + +public class AcceptAgreementTask : BaseTask +{ + private class Param : BaseParam + { + public int agreement_type; + + public int agreement_id; + } + + public enum Type + { + TOS = 1, + PrivacyPolicy, + KorAuthority + } + + private Type _agreedType; + + public static int _tosId; + + public static int _privacyPolicyId; + + public static int KorAuthorityId; + + public AcceptAgreementTask() + { + base.type = ApiType.Type.AcceptAgreement; + } + + public void SetParameter(Type agreedType) + { + _agreedType = agreedType; + Param param = new Param(); + param.agreement_type = (int)agreedType; + switch (agreedType) + { + case Type.TOS: + param.agreement_id = _tosId; + break; + case Type.PrivacyPolicy: + param.agreement_id = _privacyPolicyId; + break; + case Type.KorAuthority: + param.agreement_id = KorAuthorityId; + break; + } + base.Params = param; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + switch (_agreedType) + { + case Type.TOS: + PlayerStaticData._tosAgreementState = PlayerStaticData.AgreementState.Agreed; + break; + case Type.PrivacyPolicy: + PlayerStaticData._privacyPolicyAgreementState = PlayerStaticData.AgreementState.Agreed; + break; + case Type.KorAuthority: + PlayerStaticData.KorAuthorityAgreementState = PlayerStaticData.AgreementState.Agreed; + break; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AchievementReceiveRewardTask.cs b/SVSim.BattleEngine/Engine/Wizard/AchievementReceiveRewardTask.cs new file mode 100644 index 0000000..b8de1b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AchievementReceiveRewardTask.cs @@ -0,0 +1,36 @@ +namespace Wizard; + +public class AchievementReceiveRewardTask : BaseTask +{ + public class AchievementReceiveRewardTaskParam : BaseParam + { + public int achievement_type; + + public int level; + } + + public AchievementReceiveRewardTask() + { + base.type = ApiType.Type.AchievementReceiveReward; + } + + public void SetParameter(int achievement_type, int level) + { + AchievementReceiveRewardTaskParam achievementReceiveRewardTaskParam = new AchievementReceiveRewardTaskParam(); + achievementReceiveRewardTaskParam.achievement_type = achievement_type; + achievementReceiveRewardTaskParam.level = level; + base.Params = achievementReceiveRewardTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.MissionInfo.data = new MissionInfoDetail(base.ResponseData["data"]); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobby.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobby.cs new file mode 100644 index 0000000..c49b817 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobby.cs @@ -0,0 +1,205 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.ErrorDialog; + +namespace Wizard; + +public class ArenaCommonLobby : MonoBehaviour +{ + [SerializeField] + private BoxCollider _clickProtectionCollider; + + [SerializeField] + private UITexture _charaTexture; + + [SerializeField] + private GameObject _mainObjectRoot; + + [SerializeField] + private ArenaCommonLobbyBattleInfo _battleInfo; + + [SerializeField] + private ArenaCommonLobbyTreasureBoxInfo _treasureBoxInfo; + + [SerializeField] + private GameObject _buttonsRoot; + + [SerializeField] + private UIButton _decisionButton; + + [SerializeField] + private UILabel _decisionButtonLabel; + + private const ResourcesManager.AssetLoadPathType CHARA_TEXTURE_TYPE = ResourcesManager.AssetLoadPathType.ClassCharaBase; + + private const iTween.EaseType MOVE_EASE_TYPE = iTween.EaseType.easeOutExpo; + + private const float CHARA_MOVE_DIST = 4.6875f; + + private const float CHARA_MOVE_TIME = 0.5f; + + private const float MAIN_OBJECT_MOVE_DIST = 2.8125f; + + private const float MAIN_OBJECT_MOVE_TIME = 0.5f; + + private const float MAIN_OBJECT_MOVE_DELAY = 0.2f; + + private const float BUTTON_MOVE_DIST = 1.5625f; + + private const float BUTTON_MOVE_TIME = 0.5f; + + private const float BUTTON_MOVE_DELAY = 0.5f; + + private List _unloadAssetList = new List(); + + private GameObject _decisionButtonEffect; + + private bool _isDecisionButtonDark; + + private Vector3 _charaInitPos = Vector3.zero; + + private Vector3 _mainObjectInitPos = Vector3.zero; + + private Vector3 _buttonInitPos = Vector3.zero; + + public BoxCollider ClickProtectionCollider => _clickProtectionCollider; + + public ArenaCommonLobbyTreasureBoxInfo TreasureBoxInfo => _treasureBoxInfo; + + public GameObject ButtonsRoot => _buttonsRoot; + + public bool IsReady { get; private set; } + + public void Init(ArenaCommonLobbyInitParam initParam) + { + _clickProtectionCollider.gameObject.SetActive(value: false); + _charaInitPos = _charaTexture.transform.position; + _mainObjectInitPos = _mainObjectRoot.transform.position; + _buttonInitPos = _decisionButton.transform.position; + _charaTexture.transform.position = _charaInitPos + Vector3.right * 4.6875f; + _mainObjectRoot.transform.position = _mainObjectInitPos + Vector3.left * 2.8125f; + _decisionButton.transform.position = _buttonInitPos + Vector3.right * 1.5625f; + SystemText systemText = Data.SystemText; + int num = initParam.BattleResultList.Length; + bool battleExists = num < initParam.BattleMaxNum; + _decisionButtonLabel.text = (battleExists ? systemText.Get("Arena_0051", (num + 1).ToString()) : systemText.Get("Arena_0027")); + UIEventListener.Get(_decisionButton.gameObject).onClick = delegate + { + if (battleExists && initParam.BattleMaintenanceType.HasValue) + { + NetworkDefine.MAINTENANCE_TYPE value = initParam.BattleMaintenanceType.Value; + if (Data.MaintenanceCodeList.Contains(value)) + { + Wizard.ErrorDialog.Dialog.Create((int)value); + return; + } + } + (battleExists ? initParam.BattleButtonClickCallback : initParam.RewardReceiveButtonClickCallback)(); + }; + List loadAssetList = new List(); + List loadEndCallbackList = new List(); + ResourcesManager resMgr = Toolbox.ResourcesManager; + string strSkinId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(initParam.ClassId) + .skin_id.ToString(); + loadAssetList.Add(resMgr.GetAssetTypePath(strSkinId, ResourcesManager.AssetLoadPathType.ClassCharaBase)); + loadAssetList.Add(resMgr.GetAssetTypePath("cmn_ui_btn_1", ResourcesManager.AssetLoadPathType.Effect2D)); + ArenaCommonLobbyLoadRequest arenaCommonLobbyLoadRequest = _battleInfo.Init(initParam, _unloadAssetList); + loadAssetList.AddRange(arenaCommonLobbyLoadRequest.LoadAssetList); + loadEndCallbackList.Add(arenaCommonLobbyLoadRequest.LoadEndCallback); + arenaCommonLobbyLoadRequest = _treasureBoxInfo.Init(initParam, _unloadAssetList); + loadAssetList.AddRange(arenaCommonLobbyLoadRequest.LoadAssetList); + loadEndCallbackList.Add(arenaCommonLobbyLoadRequest.LoadEndCallback); + StartCoroutine(resMgr.LoadAssetGroupAsync(loadAssetList, delegate + { + _unloadAssetList.AddRange(loadAssetList); + for (int i = 0; i < loadEndCallbackList.Count; i++) + { + loadEndCallbackList[i](); + } + UIManager.GetInstance().AttachAtlas(base.gameObject); + _charaTexture.mainTexture = resMgr.LoadObject(resMgr.GetAssetTypePath(strSkinId, ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true)); + _decisionButtonEffect = EffectUtility.CreateEffect2D(new Effect2dCreateParam + { + Parent = _decisionButton.gameObject, + EffectName = "cmn_ui_btn_1", + ColorCode = eColorCodeId.DECISION_BTN_2_COLOR, + InitActive = !_isDecisionButtonDark, + UnloadAssetList = _unloadAssetList + }); + AppearAnimation(); + IsReady = true; + })); + } + + public void Final() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_unloadAssetList); + _unloadAssetList.Clear(); + } + + private void AppearAnimation() + { + StartCoroutine(AppearAnimationCoroutine()); + } + + private IEnumerator AppearAnimationCoroutine() + { + while (UIManager.GetInstance().isFading()) + { + yield return null; + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_WINDOW_MOVE); + iTween.MoveTo(_charaTexture.gameObject, iTween.Hash("position", _charaInitPos, "time", 0.5f, "islocal", false, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(_mainObjectRoot, iTween.Hash("position", _mainObjectInitPos, "time", 0.5f, "delay", 0.2f, "islocal", false, "easetype", iTween.EaseType.easeOutExpo)); + iTween.MoveTo(_decisionButton.gameObject, iTween.Hash("position", _buttonInitPos, "time", 0.5f, "delay", 0.5f, "islocal", false, "easetype", iTween.EaseType.easeOutExpo)); + } + + public void SetDecisionButtonToDark(bool isDark) + { + UIManager.SetObjectToGrey(_decisionButton.gameObject, isDark); + _decisionButtonEffect?.SetActive(!isDark); + _isDecisionButtonDark = isDark; + } + + public static void GenerateDeckCode(GenerateDeckCodeTask.SubmitDeckType deckType, int classId, int[] cardIdList, int[] phantomCardIdList = null) + { + GenerateDeckCodeTask generateDeckCodeTask = new GenerateDeckCodeTask(); + generateDeckCodeTask.SetParameter(classId, deckType, cardIdList, phantomCardIdList); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(generateDeckCodeTask, delegate + { + OpenDeckCodeGenerateCompleteDialog(); + }, null, null, encrypt: false)); + } + + private static DialogBase OpenDeckCodeGenerateCompleteDialog() + { + string deckCode = Data.GenerateDeckCode.deck_code; + SystemText text = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetTitleLabel(text.Get("Card_0120")); + dialogBase.SetText(text.Get("Card_0128", deckCode)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialogBase.SetButtonText(text.Get("Card_0133"), text.Get("Common_0008")); + dialogBase.onPushButton1 = delegate + { + NativePluginWrapper.SetStringToClipboard(deckCode); + UIManager.GetInstance().CreateConfirmationDialog(text.Get("Card_0132", deckCode)); + }; + return dialogBase; + } + + public static DialogBase OpenRetireConfirmDialog() + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Common_0051")); + dialogBase.SetText(systemText.Get("Arena_0026")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Dia_Arena_006_Button")); + return dialogBase; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyBattleInfo.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyBattleInfo.cs new file mode 100644 index 0000000..509c5b8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyBattleInfo.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ArenaCommonLobbyBattleInfo : MonoBehaviour +{ + [SerializeField] + private UIGrid _battleStateObjectsGrid; + + [SerializeField] + private ArenaCommonLobbyBattleStateObject _battleStateObjectOriginal; + + [SerializeField] + private UISprite _battleStateObjectsLine; + + [SerializeField] + private UILabel _winNumLabel; + + public ArenaCommonLobbyLoadRequest Init(ArenaCommonLobbyInitParam initParam, List unloadAssetList) + { + int maxNum = initParam.BattleMaxNum; + bool[] battleResultList = initParam.BattleResultList; + int num = battleResultList.Length; + ArenaCommonLobbyBattleStateObject[] stateObjectList = new ArenaCommonLobbyBattleStateObject[maxNum]; + for (int i = 0; i < maxNum; i++) + { + ArenaCommonLobbyBattleStateObject component = NGUITools.AddChild(_battleStateObjectsGrid.gameObject, _battleStateObjectOriginal.gameObject).GetComponent(); + stateObjectList[i] = component; + ArenaCommonLobbyBattleStateObject.eState state = ArenaCommonLobbyBattleStateObject.eState.None; + if (i < num) + { + state = (battleResultList[i] ? ArenaCommonLobbyBattleStateObject.eState.Won : ArenaCommonLobbyBattleStateObject.eState.Lost); + } + else if (i == num) + { + state = ArenaCommonLobbyBattleStateObject.eState.Next; + } + component.ChangeState(state); + component.SetTitleText(Data.SystemText.Get("Common_0103", (i + 1).ToString())); + } + _battleStateObjectsGrid.cellWidth = _battleStateObjectsLine.width / (maxNum - 1); + _battleStateObjectsGrid.Reposition(); + int battleWinNum = initParam.BattleWinNum; + _winNumLabel.text = battleWinNum.ToString(); + ArenaCommonLobbyLoadRequest arenaCommonLobbyLoadRequest = new ArenaCommonLobbyLoadRequest(); + bool loadExists = false; + if (battleWinNum > 0) + { + arenaCommonLobbyLoadRequest.LoadAssetList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_ui_orb_1", ResourcesManager.AssetLoadPathType.Effect2D)); + loadExists = true; + } + if (num - battleWinNum > 0) + { + arenaCommonLobbyLoadRequest.LoadAssetList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_ui_orb_2", ResourcesManager.AssetLoadPathType.Effect2D)); + loadExists = true; + } + arenaCommonLobbyLoadRequest.LoadEndCallback = delegate + { + if (loadExists) + { + for (int j = 0; j < maxNum; j++) + { + ArenaCommonLobbyBattleStateObject arenaCommonLobbyBattleStateObject = stateObjectList[j]; + bool isWon = arenaCommonLobbyBattleStateObject.IsWon; + if (isWon || arenaCommonLobbyBattleStateObject.IsLost) + { + EffectUtility.CreateEffect2D(new Effect2dCreateParam + { + Parent = arenaCommonLobbyBattleStateObject.gameObject, + EffectName = (isWon ? "cmn_ui_orb_1" : "cmn_ui_orb_2"), + ColorCode = (isWon ? eColorCodeId.WIN_ORB_EFFECT_COLOR : eColorCodeId.LOSE_ORB_EFFECT_COLOR), + InitActive = true, + UnloadAssetList = unloadAssetList + }); + } + } + } + }; + return arenaCommonLobbyLoadRequest; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyBattleStateObject.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyBattleStateObject.cs new file mode 100644 index 0000000..3fadf0b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyBattleStateObject.cs @@ -0,0 +1,57 @@ +using UnityEngine; + +namespace Wizard; + +public class ArenaCommonLobbyBattleStateObject : MonoBehaviour +{ + public enum eState + { + None, + Won, + Lost, + Next, + Max + } + + [SerializeField] + private GameObject _nextBattleMark; + + [SerializeField] + private UILabel _winLabel; + + [SerializeField] + private UILabel _loseLabel; + + [SerializeField] + private UISprite _stateIcon; + + [SerializeField] + private UILabel _titleLabel; + + private readonly string[] STATE_ICON_SPRITE_NAME_TABLE = new string[4] { "orb_empty", "orb_win", "orb_lose", "orb_empty" }; + + private readonly int[] STATE_ICON_SPRITE_SIZE_TABLE = new int[4] { 25, 70, 70, 70 }; + + public eState State { get; private set; } + + public bool IsWon => State == eState.Won; + + public bool IsLost => State == eState.Lost; + + public void ChangeState(eState state) + { + State = state; + _nextBattleMark.SetActive(state == eState.Next); + _winLabel.gameObject.SetActive(state == eState.Won); + _loseLabel.gameObject.SetActive(state == eState.Lost); + _stateIcon.spriteName = STATE_ICON_SPRITE_NAME_TABLE[(int)state]; + UISprite stateIcon = _stateIcon; + int width = (_stateIcon.height = STATE_ICON_SPRITE_SIZE_TABLE[(int)state]); + stateIcon.width = width; + } + + public void SetTitleText(string text) + { + _titleLabel.text = text; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyInitParam.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyInitParam.cs new file mode 100644 index 0000000..d0bb53c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyInitParam.cs @@ -0,0 +1,20 @@ +using System; + +namespace Wizard; + +public class ArenaCommonLobbyInitParam +{ + public int ClassId { get; set; } + + public int BattleMaxNum { get; set; } + + public int BattleWinNum { get; set; } + + public bool[] BattleResultList { get; set; } + + public Action BattleButtonClickCallback { get; set; } + + public Action RewardReceiveButtonClickCallback { get; set; } + + public NetworkDefine.MAINTENANCE_TYPE? BattleMaintenanceType { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyLoadRequest.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyLoadRequest.cs new file mode 100644 index 0000000..e3a0072 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyLoadRequest.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public class ArenaCommonLobbyLoadRequest +{ + public List LoadAssetList { get; set; } + + public Action LoadEndCallback { get; set; } + + public ArenaCommonLobbyLoadRequest() + { + LoadAssetList = new List(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyTreasureBoxInfo.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyTreasureBoxInfo.cs new file mode 100644 index 0000000..98ed6e6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaCommonLobbyTreasureBoxInfo.cs @@ -0,0 +1,94 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ArenaCommonLobbyTreasureBoxInfo : MonoBehaviour +{ + [Header("現在の宝箱")] + [SerializeField] + private GameObject _nowBoxTitleRoot; + + [SerializeField] + private UISprite _nowBoxSprite; + + [SerializeField] + private Transform _movePos; + + [Header("次の宝箱")] + [SerializeField] + private GameObject _nextBoxRoot; + + [SerializeField] + private UISprite _nextBoxSprite; + + private const float MOVE_TIME = 0.5f; + + private const float OPEN_ANIMATION_START_TIME = 0.8f; + + private const float OPEN_ANIMATION_TIME = 1.5f; + + private GameObject _openEffect; + + private Vector3 _backupNowBoxPos = Vector3.zero; + + private bool _backupNextBoxRootActive; + + public ArenaCommonLobbyLoadRequest Init(ArenaCommonLobbyInitParam initParam, List unloadAssetList) + { + int battleWinNum = initParam.BattleWinNum; + _nowBoxSprite.spriteName = $"box_2pick_{battleWinNum:D2}_close"; + bool flag = initParam.BattleResultList.Length < initParam.BattleMaxNum; + _nextBoxRoot.SetActive(flag); + if (flag) + { + _nextBoxSprite.spriteName = $"box_2pick_{battleWinNum + 1:D2}_close"; + } + ArenaCommonLobbyLoadRequest arenaCommonLobbyLoadRequest = new ArenaCommonLobbyLoadRequest(); + string effectName = $"cmn_arena_treasure_{battleWinNum + 1}"; + arenaCommonLobbyLoadRequest.LoadAssetList.Add(Toolbox.ResourcesManager.GetAssetTypePath(effectName, ResourcesManager.AssetLoadPathType.Effect2D)); + arenaCommonLobbyLoadRequest.LoadEndCallback = delegate + { + _openEffect = EffectUtility.CreateEffect2D(new Effect2dCreateParam + { + Parent = _nowBoxSprite.gameObject, + EffectName = effectName, + InitActive = false, + UnloadAssetList = unloadAssetList + }); + }; + return arenaCommonLobbyLoadRequest; + } + + public void OpenBox(Action animationEndCallback = null) + { + StartCoroutine(OpenBoxCoroutine(animationEndCallback)); + } + + private IEnumerator OpenBoxCoroutine(Action animationEndCallback) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_2PICK_BOX_OPEN); + _backupNowBoxPos = _nowBoxSprite.transform.position; + _backupNextBoxRootActive = _nextBoxRoot.activeSelf; + _nowBoxTitleRoot.SetActive(value: false); + _nextBoxRoot.SetActive(value: false); + iTween.MoveTo(_nowBoxSprite.gameObject, iTween.Hash("position", _movePos.position, "time", 0.5f, "islocal", false, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0.8f); + _nowBoxSprite.enabled = false; + _openEffect.SetActive(value: true); + yield return new WaitForSeconds(1.5f); + animationEndCallback.Call(); + } + + public void Reset() + { + _nowBoxTitleRoot.SetActive(value: true); + _nowBoxSprite.enabled = true; + _nowBoxSprite.transform.position = _backupNowBoxPos; + _nextBoxRoot.SetActive(_backupNextBoxRootActive); + _openEffect.SetActive(value: false); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ArenaConfigUpdateTask.cs b/SVSim.BattleEngine/Engine/Wizard/ArenaConfigUpdateTask.cs new file mode 100644 index 0000000..7b59da9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ArenaConfigUpdateTask.cs @@ -0,0 +1,24 @@ +namespace Wizard; + +public class ArenaConfigUpdateTask : BaseTask +{ + public class ArenaConfigUpdateTaskParam : BaseParam + { + public int use_challenge_two_pick_premium_card; + + public long challenge_two_pick_sleeve_id; + } + + public ArenaConfigUpdateTask() + { + base.type = ApiType.Type.ArenaConfigUpdate; + } + + public void SetParameter(bool useChallenge2pickPremiumCard, long useChallenge2pickSleeveId) + { + ArenaConfigUpdateTaskParam arenaConfigUpdateTaskParam = new ArenaConfigUpdateTaskParam(); + arenaConfigUpdateTaskParam.use_challenge_two_pick_premium_card = (useChallenge2pickPremiumCard ? 1 : 0); + arenaConfigUpdateTaskParam.challenge_two_pick_sleeve_id = useChallenge2pickSleeveId; + base.Params = arenaConfigUpdateTaskParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AvatarAbilityDetailDialog.cs b/SVSim.BattleEngine/Engine/Wizard/AvatarAbilityDetailDialog.cs new file mode 100644 index 0000000..c58d1b4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AvatarAbilityDetailDialog.cs @@ -0,0 +1,261 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Battle.View; +using Wizard.RoomMatch; + +namespace Wizard; + +public class AvatarAbilityDetailDialog : MonoBehaviour +{ + private const int KEYWORD_DIALOG_DEPTH = 20; + + private const int KEYWORD_PANEL_DEPTH = 25; + + private const int TEXT_COLLIDER_HEIGHT_OFFSET = 22; + + private const float PASSIVE_TEXT_OFFSET = 140f; + + private const int DEFAULT_LABEL_HEIGHT = 60; + + [SerializeField] + private UITexture _characterTexture; + + [SerializeField] + private UILabel _characterName; + + [SerializeField] + private UILabel _characterHBP; + + [SerializeField] + private UISprite _classIcon; + + [SerializeField] + private GameObject _itemRoot; + + [SerializeField] + private UILabel _passiveAbilityDescLabel; + + [SerializeField] + private List _abilityDescLabel = new List(); + + [SerializeField] + private GameObject _passiveKeyWordCollider; + + [SerializeField] + private List _keyWordCollider = new List(); + + [SerializeField] + private List _abilityItemRoot = new List(); + + [SerializeField] + private UIWidget _passiveAbilityRoot; + + [SerializeField] + private GameObject _thirdUnderLine; + + [SerializeField] + private List _costLabel = new List(); + + [SerializeField] + private List _signLabel = new List(); + + [SerializeField] + private UIScrollView _scrollView; + + private DeckData _deckData; + + private AvatarBattleInfo _avatarBattleInfo; + + private static DialogBase _avatarAbilityDialog; + + private static DialogBase _keywordDialog; + + private List _loadList = new List(); + + public static void Create(AvatarBattleInfo avatarBattleInfo, DeckData deck) + { + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/AvatarAbilityDetailDialog")) as GameObject; + string titleLabel = Data.SystemText.Get("HeroesBattle_0006"); + _avatarAbilityDialog = UIManager.GetInstance().CreateDialogClose(); + _avatarAbilityDialog.SetTitleLabel(titleLabel); + _avatarAbilityDialog.SetSize(DialogBase.Size.L); + _avatarAbilityDialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + _avatarAbilityDialog.SetObj(gameObject); + gameObject.GetComponent().Initialize(avatarBattleInfo, deck); + } + + private void Initialize(AvatarBattleInfo avatarBattleInfo, DeckData deck) + { + _deckData = deck; + _avatarBattleInfo = avatarBattleInfo; + _itemRoot.SetActive(value: false); + RoomBase.StartDialogLoading(); + UIManager.GetInstance().createInSceneCenterLoading(); + StartCoroutine(LoadResources(deck.GetSkinId(), delegate + { + StartCoroutine(SetResources()); + })); + } + + private IEnumerator SetResources() + { + ClassCharacterMasterData charaPrmByCharaId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(_deckData.GetSkinId()); + InitializeClassCharacter(_deckData.GetSkinId()); + InitializeDescLabel(_avatarBattleInfo); + _characterName.text = charaPrmByCharaId.chara_name; + _characterHBP.text = _avatarBattleInfo.Bonus.BattleStartFirstPlayerTurnBp.ToString(); + ClassCharaPrm.SetClassLabelSetting(_characterName, charaPrmByCharaId.clan); + _classIcon.spriteName = ClassCharaPrm.GetIconSpriteName(charaPrmByCharaId.clan); + _itemRoot.SetActive(value: true); + yield return null; + _scrollView.GetComponent().Reposition(); + _scrollView.ResetPosition(); + UIManager.GetInstance().closeInSceneCenterLoading(); + RoomBase.FinishDiloagLoading(); + } + + private void InitializeDescLabel(AvatarBattleInfo avatarBattleInfo) + { + string allAbilityText = avatarBattleInfo.Bonus.PassiveAbilityDesc; + string[] abilityDesc = avatarBattleInfo.Bonus.AbilityDesc; + foreach (string text in abilityDesc) + { + allAbilityText += text; + } + if (avatarBattleInfo.Bonus.PassiveAbilityDesc == string.Empty) + { + _passiveAbilityRoot.gameObject.SetActive(value: false); + _passiveAbilityRoot.transform.localPosition = new Vector3(0f, 140f, 0f); + } + else + { + _passiveAbilityDescLabel.SetWrapText(BattleCardBase.ConvertSkillDescriptionText(avatarBattleInfo.Bonus.PassiveAbilityDesc)); + UIEventListener.Get(_passiveAbilityDescLabel.gameObject).onClick = delegate + { + OnClickDescLabel(allAbilityText, _passiveAbilityDescLabel); + }; + UIEventListener.Get(_passiveKeyWordCollider).onPress = delegate(GameObject g, bool b) + { + BattlePlayerView.PressKeyWordColorChange(_passiveAbilityDescLabel, b); + }; + UIEventListener.Get(_passiveKeyWordCollider).onDragStart = delegate + { + BattlePlayerView.SetKeyWordLabelColor(_passiveAbilityDescLabel); + }; + _passiveAbilityRoot.height = _passiveAbilityDescLabel.height; + _passiveAbilityDescLabel.GetComponent().size = new Vector3(_passiveAbilityRoot.localSize.x, _passiveAbilityRoot.localSize.y + 22f, 0f); + } + if (avatarBattleInfo.Bonus.AbilityCosts.Length < 3 || avatarBattleInfo.Bonus.AbilityDesc.Length < 3) + { + _abilityItemRoot[2].gameObject.SetActive(value: false); + _thirdUnderLine.SetActive(value: false); + } + for (int num = 0; num < avatarBattleInfo.Bonus.AbilityDesc.Length; num++) + { + int textNum = num; + _abilityDescLabel[textNum].SetWrapText(BattleCardBase.ConvertSkillDescriptionText(avatarBattleInfo.Bonus.AbilityDesc[textNum])); + UIEventListener.Get(_abilityDescLabel[textNum].gameObject).onClick = delegate + { + OnClickDescLabel(allAbilityText, _abilityDescLabel[textNum]); + }; + UIEventListener.Get(_keyWordCollider[textNum]).onPress = delegate(GameObject g, bool b) + { + BattlePlayerView.PressKeyWordColorChange(_abilityDescLabel[textNum], b); + }; + UIEventListener.Get(_keyWordCollider[textNum]).onDragStart = delegate + { + BattlePlayerView.SetKeyWordLabelColor(_abilityDescLabel[textNum]); + }; + _abilityItemRoot[textNum].height = 60; + if (_abilityItemRoot[textNum].height < _abilityDescLabel[textNum].height) + { + _abilityItemRoot[textNum].height = _abilityDescLabel[textNum].height; + } + _abilityDescLabel[textNum].GetComponent().size = new Vector3(_abilityItemRoot[textNum].localSize.x, _abilityItemRoot[textNum].localSize.y + 22f, 0f); + _abilityDescLabel[textNum].GetComponent().center = new Vector3(-22f, 0f, 0f); + if (!int.TryParse(avatarBattleInfo.Bonus.AbilityCosts[textNum], out var result)) + { + _signLabel[textNum].text = "-"; + _costLabel[textNum].text = "X"; + } + else if (result != 0) + { + _signLabel[textNum].text = ((result < 0) ? "-" : "+"); + _costLabel[textNum].text = Mathf.Abs(result).ToString(); + } + else + { + _signLabel[textNum].text = string.Empty; + _costLabel[textNum].text = "0"; + _costLabel[textNum].transform.localPosition = new Vector3(0f, 2f, 0f); + } + } + } + + private void OnClickDescLabel(string abilityText, UILabel textLabel) + { + if (HasKeyword(abilityText)) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + IList keywords = BattleKeywordInfoListMgr.GetKeywords(abilityText); + _keywordDialog = BattlePlayerView.CreateKeyPanel(textLabel, keywords, CardMaster.CardMasterId.Default); + _keywordDialog.SetPanelDepth(20, isSetBackViewDepthImmediately: true); + _keywordDialog.GetComponentInChildren().SetPanelDepth(25); + } + } + + private bool HasKeyword(string skillText) + { + IList keywords = BattleKeywordInfoListMgr.GetKeywords(skillText); + bool result = false; + foreach (string item in keywords) + { + if (Data.Master.BattleKeyWordDic.ContainsKey(item)) + { + result = true; + break; + } + } + return result; + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadList); + _loadList.Clear(); + } + + public static bool LiveDialog() + { + return _avatarAbilityDialog != null; + } + + public static void CloseDialog() + { + _avatarAbilityDialog.Close(); + if (_keywordDialog != null) + { + _keywordDialog.Close(); + } + } + + private IEnumerator LoadResources(int skinId, Action callBack) + { + _loadList.Add(GetCharacterTexturePath(skinId, isFetch: false)); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadList, null)); + callBack.Call(); + } + + private string GetCharacterTexturePath(int skinId, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(skinId.ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail, isFetch); + } + + private void InitializeClassCharacter(int skinId) + { + _characterTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(GetCharacterTexturePath(skinId, isFetch: true)) as Texture; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/AvatarFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/AvatarFormatBehavior.cs new file mode 100644 index 0000000..a6540ba --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/AvatarFormatBehavior.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class AvatarFormatBehavior : IFormatBehavior +{ + public string Name => Data.SystemText.Get("HeroesBattle_0001"); + + public string SmallIconSpriteName => "icon_heroesbattle_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => false; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => false; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => Data.Master.CardSetNameMgr.GetListBasicAndPack(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => true; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsConventionMode => false; + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return false; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BGMManager.cs b/SVSim.BattleEngine/Engine/Wizard/BGMManager.cs new file mode 100644 index 0000000..a80e2ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BGMManager.cs @@ -0,0 +1,149 @@ +namespace Wizard; + +public class BGMManager +{ + private Bgm.BGM_TYPE _nextPlayBGM; + + private readonly Bgm.BGM_TYPE[] BATTLE_LIST = new Bgm.BGM_TYPE[2] + { + Bgm.BGM_TYPE.BATTLE, + Bgm.BGM_TYPE.SYS_WIN_LOOP + }; + + private readonly Bgm.BGM_TYPE[] ARENA_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.BATTLE_STANDBY }; + + private readonly Bgm.BGM_TYPE[] COLOSSEUM_FINAL_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.COLOSSEUM_FINAL }; + + private readonly Bgm.BGM_TYPE[] GRAND_PRIX_SPECIAL_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.GRANDPRIX_SPECIAL }; + + private readonly Bgm.BGM_TYPE[] GRAND_PRIX_SPECIAL_FINAL_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.GRANDPRIX_SPECIAL_FINAL }; + + private readonly Bgm.BGM_TYPE[] SEALED_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.SEALED }; + + private readonly Bgm.BGM_TYPE[] QUEST_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.QUEST }; + + private readonly Bgm.BGM_TYPE[] TITLE_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.TITLE }; + + private readonly Bgm.BGM_TYPE[] HOME_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.HOME }; + + private readonly Bgm.BGM_TYPE[] COMPETITION_LOBBY_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.COMPETITION_LOBBY }; + + private readonly Bgm.BGM_TYPE[] BINGO_LIST = new Bgm.BGM_TYPE[1] { Bgm.BGM_TYPE.BINGO }; + + private static BGMManager _instance; + + public static BGMManager Instance + { + get + { + if (_instance == null) + { + _instance = new BGMManager(); + } + return _instance; + } + } + + public static void Dispose() + { + if (_instance != null) + { + _instance = null; + } + } + + private BGMManager() + { + } + + public void RegistBgmByScene(UIManager.ViewScene currentScene, UIManager.ViewScene nextScene, UIManager.ChangeViewSceneParam param) + { + Bgm.BGM_TYPE[] nowBgmList = GetBgmList(currentScene); + Bgm.BGM_TYPE[] bgmList = GetBgmList(nextScene); + if (nowBgmList == bgmList && currentScene != UIManager.ViewScene.Battle && nextScene != UIManager.ViewScene.Battle) + { + return; + } + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + if (bgmList != null) + { + _nextPlayBGM = bgmList[0]; + for (int i = 0; i < bgmList.Length; i++) + { + UIManager.GetInstance().Increment_LockCountChangeView(); + soundMgr.LoadBGM(bgmList[i], delegate + { + UIManager.GetInstance().Decrement_LockCountChangeView(); + }); + } + } + if (nowBgmList == null) + { + return; + } + UIManager.GetInstance().Increment_LockCountChangeView(); + soundMgr.StopBGM(delegate + { + for (int j = 0; j < nowBgmList.Length; j++) + { + soundMgr.UnloadBGM(nowBgmList[j]); + } + UIManager.GetInstance().Decrement_LockCountChangeView(); + }); + } + + public void OnChangeSceneStart() + { + _nextPlayBGM = Bgm.BGM_TYPE.NONE; + } + + public void OnUnLockUIManager() + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(_nextPlayBGM); + } + + private Bgm.BGM_TYPE[] GetBgmList(UIManager.ViewScene scene) + { + switch (scene) + { + case UIManager.ViewScene.Battle: + return BATTLE_LIST; + case UIManager.ViewScene.TwoPick: + return ARENA_LIST; + case UIManager.ViewScene.Sealed: + case UIManager.ViewScene.SealedDeckEdit: + return SEALED_LIST; + case UIManager.ViewScene.QuestSelectionPage: + return QUEST_LIST; + case UIManager.ViewScene.SealedCardPackOpen: + return null; + case UIManager.ViewScene.BossRushLobby: + return GRAND_PRIX_SPECIAL_LIST; + case UIManager.ViewScene.Colosseum: + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + if (colosseumData.GetStageNoFromRoundId(colosseumData.Round) == ArenaColosseum.eStageNo.FinalStage) + { + return COLOSSEUM_FINAL_LIST; + } + return ARENA_LIST; + } + case UIManager.ViewScene.Title: + case UIManager.ViewScene.Prologue: + case UIManager.ViewScene.Ending: + case UIManager.ViewScene.LoginBonus: + case UIManager.ViewScene.FreePackCampaign: + return TITLE_LIST; + case UIManager.ViewScene.Scenario: + case UIManager.ViewScene.Scenario2: + return null; + case UIManager.ViewScene.Competition2Pick: + case UIManager.ViewScene.CompetitionLobby: + return COMPETITION_LOBBY_LIST; + case UIManager.ViewScene.Bingo: + return BINGO_LIST; + default: + return HOME_LIST; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BaseRoomBattleEnterRoomTask.cs b/SVSim.BattleEngine/Engine/Wizard/BaseRoomBattleEnterRoomTask.cs new file mode 100644 index 0000000..200b465 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BaseRoomBattleEnterRoomTask.cs @@ -0,0 +1,92 @@ +using LitJson; + +namespace Wizard; + +public class BaseRoomBattleEnterRoomTask : BaseTask +{ + public int result_reason; + + public int battlePoint; + + public int degreeId; + + public long emblemId; + + public string countryCode; + + public int rank; + + public string userName; + + public int viewerId; + + public bool isFriend; + + public string node_server_url; + + public int HighFormatRank { get; private set; } + + public bool IsOfficialUser { get; set; } + + public BattleParameter BattleParameterInstance { get; private set; } + + public bool IsEnableInviteGuild { get; private set; } + + public bool IsSameGuildMember { get; private set; } + + public bool IsJoinGuildOpponent { get; private set; } + + public bool IsJoinGuildOwn { get; private set; } + + public bool CanUseNonPossessionCard { get; set; } + + public string BattleID { get; private set; } + + public static void GetGuildResponse(JsonData response, out bool isSameGuild, out bool isOpponentJoinGuild, out bool isOwnJoinGuild) + { + int num = response["data"]["guild_id"].ToInt(); + int num2 = response["data"]["oppo_guild_id"].ToInt(); + isSameGuild = num > 0 && num == num2; + isOpponentJoinGuild = num2 > 0; + isOwnJoinGuild = num > 0; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + result_reason = jsonData["result_reason"].ToInt(); + if (result_reason == 0) + { + isFriend = jsonData["is_friend"].ToInt() == 1; + GetGuildResponse(base.ResponseData, out var isSameGuild, out var isOpponentJoinGuild, out var isOwnJoinGuild); + IsSameGuildMember = isSameGuild; + IsJoinGuildOpponent = isOpponentJoinGuild; + IsJoinGuildOwn = isOwnJoinGuild; + JsonData jsonData2 = jsonData["oppo_info"]; + viewerId = jsonData2["oppoId"].ToInt(); + battlePoint = jsonData2["battlePoint"].ToInt(); + degreeId = jsonData2["degreeId"].ToInt(); + emblemId = jsonData2["emblemId"].ToLong(); + countryCode = jsonData2["country_code"].ToString(); + rank = jsonData2["rank"].ToInt(); + HighFormatRank = jsonData2["max_rank"].ToInt(); + userName = jsonData2["userName"].ToString(); + IsOfficialUser = jsonData2["isOfficial"].ToInt() == 1; + BattleParameterInstance = BattleParameter.JsonToBattleParameter(jsonData); + node_server_url = jsonData["node_server_url"].ToString(); + IsEnableInviteGuild = jsonData.GetValueOrDefault("is_invitation_user", defaultValue: false); + CanUseNonPossessionCard = jsonData.GetValueOrDefault("is_enabled_all_card", defaultValue: false); + } + if (jsonData.TryGetValue("battle_id", out var value)) + { + BattleID = value.ToString(); + Data.LastRoomBattleId = BattleID; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BaseSelectBuyMeansDialog.cs b/SVSim.BattleEngine/Engine/Wizard/BaseSelectBuyMeansDialog.cs new file mode 100644 index 0000000..64efb9f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BaseSelectBuyMeansDialog.cs @@ -0,0 +1,200 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public abstract class BaseSelectBuyMeansDialog : MonoBehaviour +{ + private static readonly Vector3 BUY_OBJECTS_CENTER_POS = new Vector3(0f, -230f); + + private static readonly Vector3 BUY_OBJECTS_LEFT_POS = new Vector3(-140f, -230f); + + private static readonly Vector3 BUY_OBJECTS_RIGHT_POS = new Vector3(140f, -230f); + + [SerializeField] + private UILabel _labelDescription; + + [SerializeField] + private UIButton m_buttonRupy; + + [SerializeField] + private UIButton m_buttonCrystal; + + [SerializeField] + private UIButton _ticketButton; + + [SerializeField] + private GameObject _objectUnderLine; + + [SerializeField] + private UILabel m_labelRupyHaveNum; + + [SerializeField] + private UILabel m_labelCrystalHaveNum; + + [SerializeField] + private UILabel _labelTicketHaveNum; + + [SerializeField] + private UILabel m_labelRupyCostNum; + + [SerializeField] + private UILabel m_labelCrystalCostNum; + + [SerializeField] + private UILabel _labelTicketCostNum; + + [SerializeField] + private UILabel m_labelRupyHaveName; + + [SerializeField] + private UILabel m_labelCrystalHaveName; + + [SerializeField] + private UILabel m_labelRupyCostName; + + [SerializeField] + private UILabel m_labelCrystalCostName; + + [SerializeField] + private UILabel m_labelRupyBtnBuy; + + [SerializeField] + private UILabel m_labelCrystalBtnBuy; + + [SerializeField] + private UILabel _labelTicketButtonBuy; + + [SerializeField] + private UITexture _ticketIconTexture; + + private DialogBase m_dialog; + + private void Start() + { + SystemText systemText = Data.SystemText; + m_labelCrystalHaveName.text = systemText.Get("Shop_0064"); + m_labelRupyHaveName.text = systemText.Get("Shop_0065"); + m_labelCrystalCostName.text = systemText.Get("Shop_0061"); + m_labelRupyCostName.text = systemText.Get("Shop_0062"); + m_labelCrystalBtnBuy.text = systemText.Get("Shop_0098"); + m_labelRupyBtnBuy.text = systemText.Get("Shop_0097"); + } + + protected void SetDescriptionLabel(string text) + { + _labelDescription.text = text; + } + + protected string GetDescriptionText(ShopCommonSaleInfo info) + { + return Data.SystemText.Get("Shop_0047", info.name.Replace("\n", "")); + } + + protected void _Init(ShopCommonSaleInfo info, DialogBase dialog, Action onPushBuyCrystalBtnCallBack, Action onPushBuyRupyBtnCallBack, Action onPushTicketButtonCallBack) + { + SystemText systemText = Data.SystemText; + m_dialog = dialog; + _labelDescription.text = GetDescriptionText(info); + if (_ticketButton != null) + { + _ticketButton.gameObject.SetActive(value: false); + } + if (info.isFree) + { + m_buttonCrystal.gameObject.SetActive(value: false); + m_buttonRupy.gameObject.SetActive(value: false); + UILabel labelDescription = _labelDescription; + labelDescription.text = labelDescription.text + "\n" + systemText.Get("Shop_0103"); + _objectUnderLine.SetActive(value: false); + } + else if (info.costCrystal.HasValue && info.costRupy.HasValue) + { + m_buttonCrystal.gameObject.SetActive(value: true); + m_buttonCrystal.gameObject.transform.localPosition = BUY_OBJECTS_RIGHT_POS; + _SetCrystalBuyObjects(info.costCrystal.Value, onPushBuyCrystalBtnCallBack); + m_buttonRupy.gameObject.SetActive(value: true); + m_buttonRupy.gameObject.transform.localPosition = BUY_OBJECTS_LEFT_POS; + _SetRupyBuyObjects(info.costRupy.Value, onPushBuyRupyBtnCallBack); + UILabel labelDescription2 = _labelDescription; + labelDescription2.text = labelDescription2.text + "\n" + systemText.Get("Shop_0107"); + } + else if (info.costCrystal.HasValue) + { + m_buttonCrystal.gameObject.SetActive(value: true); + m_buttonCrystal.gameObject.transform.localPosition = BUY_OBJECTS_CENTER_POS; + _SetCrystalBuyObjects(info.costCrystal.Value, onPushBuyCrystalBtnCallBack); + m_buttonRupy.gameObject.SetActive(value: false); + } + else if (info.costTicket.HasValue) + { + m_buttonRupy.gameObject.SetActive(value: false); + m_buttonCrystal.gameObject.SetActive(value: false); + _ticketButton.gameObject.SetActive(value: true); + _ticketButton.gameObject.transform.localPosition = BUY_OBJECTS_CENTER_POS; + if (_ticketIconTexture != null && info.costTicketItemId.HasValue) + { + _ticketIconTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(ShopCommonUtility.GetTicketIconPath(info.costTicketItemId.Value.ToString(), isFetch: true)); + } + SetTicketButtonObjects(info, onPushTicketButtonCallBack); + } + else + { + m_buttonRupy.gameObject.SetActive(value: true); + m_buttonRupy.gameObject.transform.localPosition = BUY_OBJECTS_CENTER_POS; + _SetRupyBuyObjects(info.costRupy.Value, onPushBuyRupyBtnCallBack); + m_buttonCrystal.gameObject.SetActive(value: false); + } + } + + private void SetTicketButtonObjects(ShopCommonSaleInfo info, Action onPushTicketButtonCallBack) + { + _labelTicketHaveNum.text = info.haveTicketNum.Value.ToString(); + _labelTicketCostNum.text = info.costTicket.Value.ToString(); + ShopCommonUtility.SetButtonLabelStyle(_ticketButton, _labelTicketButtonBuy); + _ticketButton.onClick.Clear(); + _ticketButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + onPushTicketButtonCallBack(); + m_dialog.CloseWithoutSelect(); + })); + } + + private void _SetCrystalBuyObjects(int costCrystal, Action onPushButtonCrystal) + { + m_labelCrystalHaveNum.text = PlayerStaticData.UserCrystalCount.ToString(); + m_labelCrystalCostNum.text = costCrystal.ToString(); + ShopCommonUtility.SetButtonLabelStyle(m_buttonCrystal, m_labelCrystalBtnBuy); + m_buttonCrystal.onClick.Clear(); + m_buttonCrystal.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + onPushButtonCrystal(); + m_dialog.CloseWithoutSelect(); + })); + } + + private void _SetRupyBuyObjects(int costRupy, Action onPushButtonRupy) + { + m_labelRupyHaveNum.text = PlayerStaticData.UserRupyCount.ToString(); + m_labelRupyCostNum.text = costRupy.ToString(); + if (PlayerStaticData.UserRupyCount >= costRupy) + { + m_buttonRupy.isEnabled = true; + } + else + { + m_buttonRupy.isEnabled = false; + } + ShopCommonUtility.SetButtonLabelStyle(m_buttonRupy, m_labelRupyBtnBuy); + m_buttonRupy.onClick.Clear(); + m_buttonRupy.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + onPushButtonRupy(); + m_dialog.CloseWithoutSelect(); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassProduct.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassProduct.cs new file mode 100644 index 0000000..4394804 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassProduct.cs @@ -0,0 +1,40 @@ +using Cute; + +namespace Wizard; + +public class BattlePassProduct +{ + public int Id { get; private set; } + + public int SeasonId { get; private set; } + + public string Name { get; private set; } + + public string Description { get; private set; } + + public int PriceInCrystal { get; private set; } + + public ShopExpirtyInfo ExpirtyInfo { get; private set; } + + public BattlePassProduct(int id, int seasonId, string name, int priceInCrystal, string description, ShopExpirtyInfo expirtyInfo) + { + Id = id; + SeasonId = seasonId; + Name = name; + PriceInCrystal = priceInCrystal; + Description = description; + ExpirtyInfo = expirtyInfo; + } + + public string GetPosterTexturePath(bool isFetch) + { + string path = $"{SeasonId}_{Id}_battle_pass_buy_confirm"; + return Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.BattlePass, isFetch); + } + + public string GetDetailPosterTexturePath(bool isFetch) + { + string path = $"{SeasonId}_{Id}_battle_pass_detail"; + return Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.BattlePass, isFetch); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseDialog.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseDialog.cs new file mode 100644 index 0000000..1980dd5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseDialog.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class BattlePassPurchaseDialog : MonoBehaviour +{ + private const string PATH_DIALOG_PREFAB = "UI/layoutParts/BattlePass/DialogBattlePassPurchase"; + + [SerializeField] + private UILabel _descriptionLabel; + + [SerializeField] + private UILabel _haveCrystalNumLabel; + + [SerializeField] + private BattlePassPurchaseProductView _productViewOriginal; + + [SerializeField] + private UIGrid _productViewGrid; + + [SerializeField] + private PurchaseConfirm _prefabPurchaseConfirmDialog; + + private DialogBase _dialogBattlePassPurchase; + + private List _loadedResourceList; + + private Action _battlePassViewUpdate; + + public static void Create(Action battlePassViewUpdate = null) + { + BattlePassPurchaseInfoTask task = new BattlePassPurchaseInfoTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(Data.SystemText.Get("BattlePass_0002")); + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/BattlePass/DialogBattlePassPurchase")) as GameObject; + dialogBase.SetObj(gameObject); + gameObject.GetComponent().Initialize(task.PurchaseInfo, dialogBase, battlePassViewUpdate); + })); + } + + public void Initialize(BattlePassPurchaseInfo battlePassPurchaseInfo, DialogBase dialog, Action battlePassViewUpdate) + { + _battlePassViewUpdate = battlePassViewUpdate; + _dialogBattlePassPurchase = dialog; + _productViewOriginal.gameObject.SetActive(value: false); + _loadedResourceList = new List(); + SetViewUI(battlePassPurchaseInfo); + } + + private void OnDestroy() + { + UnloadResources(); + } + + private void SetViewUI(BattlePassPurchaseInfo battlePassPurchaseInfo) + { + _descriptionLabel.text = battlePassPurchaseInfo.Description; + _haveCrystalNumLabel.text = PlayerStaticData.UserCrystalCount.ToString(); + LoadResources(battlePassPurchaseInfo, delegate + { + foreach (BattlePassProduct product in battlePassPurchaseInfo.ProductList) + { + GameObject obj = NGUITools.AddChild(_productViewGrid.gameObject, _productViewOriginal.gameObject); + obj.GetComponent().SetView(product, OnClickPoster, OnClickBuyButton); + obj.SetActive(value: true); + } + _productViewGrid.Reposition(); + }); + } + + private void LoadResources(BattlePassPurchaseInfo purchaseInfo, Action onFinishLoad) + { + UIManager.GetInstance().createInSceneCenterLoading(); + List loadPassList = new List(); + foreach (BattlePassProduct product in purchaseInfo.ProductList) + { + loadPassList.Add(product.GetPosterTexturePath(isFetch: false)); + } + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadPassList, delegate + { + _loadedResourceList.AddRange(loadPassList); + UIManager.GetInstance().closeInSceneCenterLoading(); + onFinishLoad.Call(); + })); + } + + private void UnloadResources() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList = null; + } + + private void OnClickPoster(BattlePassProduct product) + { + BattlePassProductDetailDialog.Create(product); + } + + private void OnClickBuyButton(BattlePassProduct product) + { + if (PlayerStaticData.UserCrystalCount < product.PriceInCrystal) + { + ShopCommonUtility.CreateCrystalShortagePopup(); + } + else + { + CreateBuyConfirmDialog(product); + } + } + + private void CreateBuyConfirmDialog(BattlePassProduct product) + { + DialogBase dialogBase = ShopCommonUtility.CreateBasePopupPurchaseConfirm(new EventDelegate(delegate + { + ConnectBuyBattlePass(product); + })); + PurchaseConfirm purchaseConfirm = UnityEngine.Object.Instantiate(_prefabPurchaseConfirmDialog); + dialogBase.SetObj(purchaseConfirm.gameObject); + dialogBase.SetTitleLabel(Data.SystemText.Get("BattlePass_0004")); + string purchaseText = Data.SystemText.Get("Shop_0101", product.Name); + purchaseConfirm.SetClystalConfirmDialog(product.PriceInCrystal, purchaseText, PlayerStaticData.UserCrystalCount, product.ExpirtyInfo); + _dialogBattlePassPurchase.Close(); + } + + private void ConnectBuyBattlePass(BattlePassProduct product) + { + BattlePassBuyTask task = new BattlePassBuyTask(); + task.SetParameter(product.SeasonId, product.Id); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + OnSuccessBuyBattlePass(product, task.RewardList); + })); + } + + private void OnSuccessBuyBattlePass(BattlePassProduct product, List rewardList) + { + MyPageMenu.Instance.UpdateCrystalCount(); + DialogBase dialogBase = ShopCommonUtility.CreatePurchaseSuccess(product.Name); + _battlePassViewUpdate.Call(); + if (rewardList != null && rewardList.Count > 0) + { + dialogBase.OnClose = delegate + { + OpenRewardReceiveDialog(rewardList); + }; + } + if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.MyPage)) + { + MyPageMenu.Instance.HomeMenu.HideAndRepositionSubBanner("battle_pass_buy"); + } + } + + private void OpenRewardReceiveDialog(List rewardList) + { + UIManager.GetInstance().createInSceneCenterLoading(); + DialogCreator.CreateRewardReceiveDialog(rewardList).SetTitleLabel(Data.SystemText.Get("BattlePass_0005")); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseInfo.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseInfo.cs new file mode 100644 index 0000000..7969b2b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseInfo.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class BattlePassPurchaseInfo +{ + public string Description { get; private set; } + + public List ProductList { get; private set; } + + public BattlePassPurchaseInfo(string description, List productList) + { + Description = description; + ProductList = productList; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseProductView.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseProductView.cs new file mode 100644 index 0000000..7a11cdb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassPurchaseProductView.cs @@ -0,0 +1,33 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class BattlePassPurchaseProductView : MonoBehaviour +{ + [SerializeField] + private UITexture _posterTexture; + + [SerializeField] + private UIButton _buyBtn; + + [SerializeField] + private UILabel _priceLabel; + + public void SetView(BattlePassProduct product, Action onClickPoster, Action onClickBuyBtn) + { + _posterTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(product.GetPosterTexturePath(isFetch: true)) as Texture; + _priceLabel.text = product.PriceInCrystal.ToString(); + UIEventListener.Get(_posterTexture.gameObject).onClick = delegate + { + onClickPoster.Call(product); + }; + _buyBtn.onClick.Clear(); + _buyBtn.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + onClickBuyBtn.Call(product); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BattlePassUtility.cs b/SVSim.BattleEngine/Engine/Wizard/BattlePassUtility.cs new file mode 100644 index 0000000..b05311e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BattlePassUtility.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class BattlePassUtility +{ + public static int BattlePassMaxLevel = BattlePassLevelInfoList.Keys.Max(); + + private static Dictionary BattlePassLevelInfoList => Data.Load.data.BattlePassLevelInfoList; + + public static int BattlePassMaxPoint => BattlePassLevelInfoList[BattlePassMaxLevel].RequiredPoint; + + public static int NextLevelRequiredPoint(int level) + { + if (level != BattlePassMaxLevel) + { + return BattlePassLevelInfoList[level + 1].RequiredPoint - BattlePassLevelInfoList[level].RequiredPoint; + } + return 0; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BingoSelectBuyNumPopup.cs b/SVSim.BattleEngine/Engine/Wizard/BingoSelectBuyNumPopup.cs new file mode 100644 index 0000000..95aecb9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BingoSelectBuyNumPopup.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections; +using UnityEngine; +using Wizard.Bingo; + +namespace Wizard; + +public class BingoSelectBuyNumPopup : SelectBuyNumPopupBase +{ + [SerializeField] + private UILabel _sheetLabel; + + [SerializeField] + private UILabel _sheetNumLabel; + + [SerializeField] + private UILabel _remainedLabel; + + [SerializeField] + private UILabel _remainedNumLabel; + + [SerializeField] + private CenteringUIWidget _line1; + + [SerializeField] + private CenteringUIWidget _line2; + + protected override string _labelBuyNumPurchaseBtnTextId => "Bingo_0018"; + + public void Init(DialogBase dialog, int ableBuyNum, int openedNum, BingoInfoTask.BingoInfoData bingoInfoData, Action OnClickPurchase) + { + _dialog = dialog; + _gachaCostPerPack = 1; + _ableBuyNum = ableBuyNum; + InitBuyMeansDisplays(bingoInfoData, openedNum); + UpdateBuyNumDisplays(); + UIEventListener.Get(_buttonPlus.gameObject).onPress = base.OnPressToPlusBtn; + UIEventListener.Get(_buttonMinus.gameObject).onPress = base.OnPressToMinusBtn; + UIEventListener.Get(_buttonMax.gameObject).onClick = delegate + { + OnBtnMax(); + }; + UIEventListener.Get(_buttonPurchase.gameObject).onClick = delegate + { + dialog.Close(); + OnClickPurchase(_buyNum); + }; + } + + private void InitBuyMeansDisplays(BingoInfoTask.BingoInfoData bingoInfoData, int openedNum) + { + _buyPackLabel.text = Data.SystemText.Get("Bingo_0026"); + _sheetLabel.text = Data.SystemText.Get("Bingo_0027"); + _sheetNumLabel.text = Data.SystemText.Get("Bingo_0028", bingoInfoData.SheetNum.ToString()); + _remainedLabel.text = Data.SystemText.Get("Bingo_0029"); + _remainedNumLabel.text = Data.SystemText.Get("Bingo_0030", (bingoInfoData.MaxSquareNum - openedNum).ToString()); + UIManager.GetInstance().StartCoroutine(LineReposition()); + _labelCostNamePurchaseBtn.text = Data.SystemText.Get("Bingo_0019"); + _labelHaveItemName.text = Data.SystemText.Get("Bingo_0016"); + _labelHaveNumItems.text = bingoInfoData.BingoTicketNum.ToString(); + _labelCostPerPack.text = Data.SystemText.Get("Bingo_0017", bingoInfoData.BingoDrawCost.ToString()); + } + + private IEnumerator LineReposition() + { + _sheetLabel.ProcessText(); + _sheetNumLabel.ProcessText(); + _remainedLabel.ProcessText(); + _remainedNumLabel.ProcessText(); + yield return null; + _line1.Reposition(); + _line2.Reposition(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BossRushClearDeckListTask.cs b/SVSim.BattleEngine/Engine/Wizard/BossRushClearDeckListTask.cs new file mode 100644 index 0000000..b6616e5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BossRushClearDeckListTask.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class BossRushClearDeckListTask : BaseTask +{ + public List DeckList { get; private set; } = new List(); + + public Dictionary> AbilityDictionary { get; private set; } = new Dictionary>(); + + public BossRushClearDeckListTask() + { + base.type = ApiType.Type.BossRushClearDeckList; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + for (int i = 0; i < jsonData.Count; i++) + { + JsonData jsonData2 = jsonData[i]; + DeckData deckData = new DeckData(Data.ParseApiFormat(jsonData2["deck_format"].ToInt())); + deckData.Initialize(jsonData2); + deckData.SetDeckID(jsonData2["challenge_count_num"].ToInt()); + DeckList.Add(deckData); + JsonData jsonData3 = jsonData2["special_ability_list"]; + List list = new List(); + for (int j = 0; j < jsonData3.Count; j++) + { + list.Add(new BossRushLobbyAbilityData(jsonData3[j])); + } + AbilityDictionary.Add(deckData.GetDeckID(), list); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BossRushFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/BossRushFinishTask.cs new file mode 100644 index 0000000..3b0dcc3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BossRushFinishTask.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using LitJson; +using Wizard.Battle.Recovery; + +namespace Wizard; + +public class BossRushFinishTask : BaseTask +{ + public class BossRushFinishTaskParam : BaseParam + { + public int current_life; + + public int max_life; + + public int quest_stage_id; + + public int deck_no; + + public bool is_win; + + public int deck_format; + + public bool is_prebuild_deck; + + public bool is_trial_deck; + + public int total_turn; + + public int turn_state; + + public Dictionary mission; + + public string recovery_data; + + public string[] prosessing_time_data; + } + + private bool _isWin; + + public BossRushFinishTask() + { + base.type = ApiType.Type.BossRushFinish; + } + + public void SetParameter(int currentLife, int maxLife, int quest_stage_id, int deck_no, bool is_win, Format format, bool isPreBuildDeck, bool isTrialDeck, bool isFirst, int totalTurn) + { + _isWin = is_win; + BossRushFinishTaskParam bossRushFinishTaskParam = new BossRushFinishTaskParam(); + bossRushFinishTaskParam.current_life = Math.Max(0, currentLife); + bossRushFinishTaskParam.max_life = Math.Max(0, maxLife); + bossRushFinishTaskParam.quest_stage_id = quest_stage_id; + bossRushFinishTaskParam.deck_no = deck_no; + bossRushFinishTaskParam.is_win = is_win; + bossRushFinishTaskParam.deck_format = Data.FormatConvertApi(format); + bossRushFinishTaskParam.is_prebuild_deck = isPreBuildDeck; + bossRushFinishTaskParam.is_trial_deck = isTrialDeck; + bossRushFinishTaskParam.turn_state = ((!isFirst) ? 1 : 0); + bossRushFinishTaskParam.total_turn = totalTurn; + BattleManagerBase ins = BattleManagerBase.GetIns(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + BattlePlayerPair battlePlayerPair = ins.GetBattlePlayerPair(isPlayer: true); + BattleCardBase selfClass = ins.GetBattlePlayer(isPlayer: true).Class; + if (dataMgr.RecoveryData == null) + { + dataMgr.SetRecoveryData(RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json")); + } + bossRushFinishTaskParam.recovery_data = dataMgr.RecoveryData.ToJson(); + bossRushFinishTaskParam.mission = dataMgr.MissionNecessaryInformation.GetMissionNecessaryInfo(battlePlayerPair, selfClass); + base.Params = bossRushFinishTaskParam; + } + + protected override int Parse() + { + GameMgr.GetIns().GetDataMgr().ClearSpecialBattleSettingInfo(); + int num = base.Parse(); + if (num != 1) + { + DeleteRecoveryFileIfBattleAlreadyEnded(num); + return num; + } + Data.QuestFinish.data = new QuestFinishDetail(); + Data.QuestFinish.data._responseData = base.ResponseData; + JsonData jsonData = base.ResponseData["data"]; + if (base.type == ApiType.Type.QuestPuzzleFinish) + { + Data.QuestFinish.data.PuzzleQuestInfo = new PuzzleQuestInfo(jsonData); + } + Data.QuestFinish.data.get_class_chara_experience = jsonData["get_class_experience"].ToInt(); + Data.QuestFinish.data.class_chara_experience = jsonData["class_experience"].ToInt(); + Data.QuestFinish.data.class_chara_level = jsonData["class_level"].ToInt(); + Data.QuestFinish.data.CurrentPoint = jsonData["current_point"].ToInt(); + Data.QuestFinish.data.AddPoint = jsonData["add_point"].ToInt(); + Data.QuestFinish.data.ClassBonusPoint = jsonData["class_bonus_point"].ToInt(); + Data.QuestFinish.data.FormatBonusPoint = jsonData["format_bonus_point"].ToInt(); + Data.QuestFinish.data.CommonMissionClearInfoList = new List(); + Data.QuestFinish.data.CharacterMissionClearInfoList = new List(); + Data.QuestFinish.data.WinBonusPoint = jsonData.GetValueOrDefault("win_bonus_point", 0); + Data.QuestFinish.data.WinCount = jsonData.GetValueOrDefault("win_count", 0); + Data.QuestFinish.data.WinCountForWinBonusPoint = jsonData.GetValueOrDefault("required_win_count_for_win_bonus_point", 0); + Data.QuestFinish.data.WinBonusPointStatus = (QuestFinishDetail.WinBonusStatus)jsonData.GetValueOrDefault("win_bonus_point_status", 0); + Data.QuestFinish.data.NecessaryPointList = new List(); + int num2 = 0; + for (int i = 0; i < jsonData["point_reward_list"].Count; i++) + { + int num3 = jsonData["point_reward_list"][i]["point"].ToInt(); + Data.QuestFinish.data.NecessaryPointList.Add(num3 - num2); + num2 = num3; + } + Data.QuestFinish.data.CurrentLife = jsonData["current_life"].ToInt(); + Data.QuestFinish.data.MaxLife = jsonData["max_life"].ToInt(); + Data.QuestFinish.data.NecessaryPointList.Add(-1); + Data.QuestFinish.data.IsSpecialResult = jsonData.GetValueOrDefault("is_special_result", defaultValue: false); + Data.QuestFinish.data.IsSpecialEffect = jsonData.GetValueOrDefault("is_special_effect", defaultValue: false); + int val = 9999; + Data.QuestFinish.data.BossRushShortestTurn = Math.Min(jsonData.GetValueOrDefault("shortest_clear_turns", 0), val); + Data.QuestFinish.data.BossRushTotalTurn = Math.Min(jsonData.GetValueOrDefault("total_turns", 0), val); + if (_isWin) + { + Data.QuestFinish.data.IsEnableBossRushShortestTurn = true; + } + else + { + Data.QuestFinish.data.IsEnableBossRushShortestTurn = Data.QuestFinish.data.BossRushShortestTurn != 0; + } + if (Data.QuestFinish.data.BossRushShortestTurn == 0 && _isWin) + { + Data.QuestFinish.data.IsBossRushNewRecord = true; + } + else if (_isWin && Data.QuestFinish.data.BossRushTotalTurn < Data.QuestFinish.data.BossRushShortestTurn) + { + Data.QuestFinish.data.IsBossRushNewRecord = true; + Data.QuestFinish.data.BossRushShortestTurn = Data.QuestFinish.data.BossRushTotalTurn; + } + if (Data.QuestFinish.data.BossRushTotalTurn > 0 && Data.QuestFinish.data.BossRushShortestTurn == 0) + { + Data.QuestFinish.data.BossRushShortestTurn = Data.QuestFinish.data.BossRushTotalTurn; + } + JsonData data = base.ResponseData["data"]["achieved_info"]; + Data.QuestFinish.data.AchievedInfo.Read(data); + Data.QuestFinish.data.HomeDialogData = new MyPageHomeDialogData(jsonData, "battle_dialog_list"); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BossRushHiddenBattleFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/BossRushHiddenBattleFinishTask.cs new file mode 100644 index 0000000..02860a9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BossRushHiddenBattleFinishTask.cs @@ -0,0 +1,130 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Battle.Recovery; + +namespace Wizard; + +public class BossRushHiddenBattleFinishTask : BaseTask +{ + public class BossRushHiddenBattleFinishTaskParam : BaseParam + { + public bool is_win; + + public int deck_no; + + public int deck_format; + + public int class_id; + + public int enemy_class_id; + + public int total_turn; + + public int turn_state; + + public int evolve_count; + + public Dictionary mission; + + public string recovery_data; + + public string[] prosessing_time_data; + + public bool is_prebuild_deck; + + public bool is_trial_deck; + + public int challenge_count_num; + } + + public BossRushHiddenBattleFinishTask() + { + base.type = ApiType.Type.BossRushHiddenBattleFinish; + } + + public void SetParameter(int quest_stage_id, int deck_no, bool is_win, Format format, bool isPreBuildDeck, bool isTrialDeck, bool isFirst, int totalTurn) + { + BattleManagerBase ins = BattleManagerBase.GetIns(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + BossRushHiddenBattleFinishTaskParam bossRushHiddenBattleFinishTaskParam = new BossRushHiddenBattleFinishTaskParam(); + bossRushHiddenBattleFinishTaskParam.is_win = is_win; + bossRushHiddenBattleFinishTaskParam.deck_no = deck_no; + bossRushHiddenBattleFinishTaskParam.deck_format = Data.FormatConvertApi(format); + bossRushHiddenBattleFinishTaskParam.class_id = dataMgr.GetPlayerClassId(); + bossRushHiddenBattleFinishTaskParam.enemy_class_id = dataMgr.GetEnemyClassId(); + bossRushHiddenBattleFinishTaskParam.total_turn = totalTurn; + bossRushHiddenBattleFinishTaskParam.turn_state = ((!isFirst) ? 1 : 0); + bossRushHiddenBattleFinishTaskParam.evolve_count = ins.BattlePlayer._cumulativeEvolutionCount; + bossRushHiddenBattleFinishTaskParam.is_prebuild_deck = isPreBuildDeck; + bossRushHiddenBattleFinishTaskParam.is_trial_deck = isTrialDeck; + bossRushHiddenBattleFinishTaskParam.challenge_count_num = deck_no; + BattlePlayerPair battlePlayerPair = ins.GetBattlePlayerPair(isPlayer: true); + BattleCardBase selfClass = ins.GetBattlePlayer(isPlayer: true).Class; + if (dataMgr.RecoveryData == null) + { + dataMgr.SetRecoveryData(RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json")); + } + bossRushHiddenBattleFinishTaskParam.recovery_data = dataMgr.RecoveryData.ToJson(); + bossRushHiddenBattleFinishTaskParam.mission = dataMgr.MissionNecessaryInformation.GetMissionNecessaryInfo(battlePlayerPair, selfClass); + base.Params = bossRushHiddenBattleFinishTaskParam; + } + + protected override int Parse() + { + GameMgr.GetIns().GetDataMgr().ClearSpecialBattleSettingInfo(); + int num = base.Parse(); + if (num != 1) + { + DeleteRecoveryFileIfBattleAlreadyEnded(num); + return num; + } + Data.QuestFinish.data = new QuestFinishDetail(); + Data.QuestFinish.data._responseData = base.ResponseData; + JsonData jsonData = base.ResponseData["data"]; + Data.QuestFinish.data.get_class_chara_experience = jsonData["get_class_experience"].ToInt(); + Data.QuestFinish.data.class_chara_experience = jsonData["class_experience"].ToInt(); + Data.QuestFinish.data.class_chara_level = jsonData["class_level"].ToInt(); + Data.QuestFinish.data.CurrentPoint = (jsonData.Keys.Contains("current_point") ? jsonData["current_point"].ToInt() : 0); + Data.QuestFinish.data.AddPoint = (jsonData.Keys.Contains("add_point") ? jsonData["add_point"].ToInt() : 0); + Data.QuestFinish.data.CommonMissionClearInfoList = new List(); + if (jsonData.Keys.Contains("clear_mission_list") && jsonData["clear_mission_list"].Keys.Contains("common_mission")) + { + JsonData jsonData2 = jsonData["clear_mission_list"]["common_mission"]; + for (int i = 0; i < jsonData2.Count; i++) + { + Data.QuestFinish.data.CommonMissionClearInfoList.Add(new QuestFinishDetail.MissionClearInfo(jsonData2[i]["name"].ToString(), jsonData2[i]["point"].ToInt())); + } + } + Data.QuestFinish.data.CharacterMissionClearInfoList = new List(); + if (jsonData.Keys.Contains("clear_mission_list") && jsonData["clear_mission_list"].Keys.Contains("character_mission")) + { + JsonData jsonData3 = jsonData["clear_mission_list"]["character_mission"]; + for (int j = 0; j < jsonData3.Count; j++) + { + Data.QuestFinish.data.CharacterMissionClearInfoList.Add(new QuestFinishDetail.MissionClearInfo(jsonData3[j]["name"].ToString(), jsonData3[j]["point"].ToInt())); + } + } + Data.QuestFinish.data.AddPoint = Data.QuestFinish.data.AddPoint - Data.QuestFinish.data.GetTotalCommonMissionClearPoint() - Data.QuestFinish.data.GetTotalCharacterMissionClearPoint(); + Data.QuestFinish.data.NecessaryPointList = new List(); + if (jsonData.Keys.Contains("point_reward_list")) + { + int num2 = 0; + for (int k = 0; k < jsonData["point_reward_list"].Count; k++) + { + int num3 = jsonData["point_reward_list"][k]["point"].ToInt(); + Data.QuestFinish.data.NecessaryPointList.Add(num3 - num2); + num2 = num3; + } + } + Data.QuestFinish.data.NecessaryPointList.Add(-1); + JsonData data = jsonData["achieved_info"]; + Data.QuestFinish.data.AchievedInfo.Read(data); + Data.QuestFinish.data.HomeDialogData = new MyPageHomeDialogData(jsonData, "battle_dialog_list"); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(jsonData["reward_list"]); + if (jsonData.Keys.Contains("hidden_boss_reward_list")) + { + _ = jsonData["hidden_boss_reward_list"]; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/BossRushHiddenBattleStartTask.cs b/SVSim.BattleEngine/Engine/Wizard/BossRushHiddenBattleStartTask.cs new file mode 100644 index 0000000..f4944a4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/BossRushHiddenBattleStartTask.cs @@ -0,0 +1,70 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class BossRushHiddenBattleStartTask : BaseTask +{ + private DeckData _deck; + + public QuestBossData QuestBossData { get; private set; } + + public List PlayerSkillList { get; private set; } + + public BossRushHiddenBattleStartTask(DeckData deck, List abilityList) + { + base.type = ApiType.Type.BossRushHiddenBattleStart; + _deck = deck; + PlayerSkillList = new List(); + for (int i = 0; i < abilityList.Count; i++) + { + BossRushLobbyAbilityData bossRushLobbyAbilityData = abilityList[i]; + BossRushSpecialSkill item = new BossRushSpecialSkill(bossRushLobbyAbilityData.DisplayCardId, bossRushLobbyAbilityData.Name, bossRushLobbyAbilityData.Skill, bossRushLobbyAbilityData.SkillDescText, bossRushLobbyAbilityData.IsFoil); + PlayerSkillList.Add(item); + } + } + + protected override int Parse() + { + int num = base.Parse(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.ClearSpecialBattleSettingInfo(); + if (num != 1) + { + return num; + } + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.SecretBossQuest; + Data.CurrentFormat = _deck.Format; + DeckListUtility.DataMgrSaveLastSelectDeckData(_deck); + dataMgr.Load(); + CardMaster.SetBattleCardMasterId(FormatBehaviorManager.GetDefaultBehaviour(_deck.Format).CardMasterId); + QuestBossData = new QuestBossData(base.ResponseData["data"]["hidden_boss_info"]); + BossRushSpecialSkill enemySkill = new BossRushSpecialSkill(-1, QuestBossData.Name, QuestBossData.Skill, QuestBossData.SkillDescText, isFoil: false); + BossRushBattleData bossRushBattleData = new BossRushBattleData(QuestBossData, PlayerSkillList, enemySkill); + dataMgr.SetBossRushBattleData(bossRushBattleData); + dataMgr.SetEnemyCharaId(dataMgr.BossRushBattleData.CharaId); + dataMgr.SetStoryBgmID(dataMgr.BossRushBattleData.BgmId); + dataMgr.SetSoroPlay3DFieldID(dataMgr.BossRushBattleData.Battle3dFieldID); + dataMgr.SetEnemySleeveId(3000011L); + int playerMaxLife = GetPlayerMaxLife(); + dataMgr.SetSpecialBattleSetting(null, playerLife: playerMaxLife, playerMaxLife: playerMaxLife, enemyMaxLife: QuestBossData.Life, playerSkill: string.Join(",", PlayerSkillList.Select((BossRushSpecialSkill s) => s.SkillText).ToList()), enemySkill: QuestBossData.Skill, playerPp: 0, enemyPp: 0, idOverrideBattleLogText: ""); + if (base.ResponseData["data"].Keys.Contains("mission_parameter")) + { + dataMgr.SetMissionNecessaryInformation(base.ResponseData["data"]["mission_parameter"]); + } + return num; + } + + private int GetPlayerMaxLife() + { + int num = 20; + for (int i = 0; i < PlayerSkillList.Count(); i++) + { + if (PlayerSkillList.ElementAt(i).OriginalCardId == 117031020) + { + num += 5; + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardSelectDialog.cs b/SVSim.BattleEngine/Engine/Wizard/CardSelectDialog.cs new file mode 100644 index 0000000..59fa720 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardSelectDialog.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class CardSelectDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _instructionLabel; + + [SerializeField] + private UIGrid _objectsGrid; + + [SerializeField] + private CardSelectDialogObject _objectOriginal; + + [SerializeField] + private GameObject _pageChangeButtonsRoot; + + [SerializeField] + private UIButton _previousPageButton; + + [SerializeField] + private UIButton _nextPageButton; + + [SerializeField] + private UIEventListener _dragCollider; + + [SerializeField] + private GameObject _paginationDotsRoot; + + [SerializeField] + private PaginationDots _paginationDotsPrefab; + + [SerializeField] + private GameObject _cardDetailRoot; + + private const int FIRST_PAGE_NO = 1; + + private const int MAX_NUM_PER_PAGE = 3; + + private const float DRAG_THRESHOLD = 70f; + + private int _activePageNo = 1; + + private int _pageNum; + + private List _unloadAssetList = new List(); + + private CardSelectDialogObject[] _dialogObjectList; + + private List _cardObjectList; + + private PaginationDots _paginationDots; + + private CardDetailUI _cardDetailDialog; + + private bool _isLoopPage; + + private bool _isDrag; + + public bool IsReady { get; private set; } + + public void Init(List cardList, Action selectCallback, string instructionText) + { + _instructionLabel.text = instructionText; + StartCoroutine(InitCoroutine(cardList, selectCallback)); + } + + private IEnumerator InitCoroutine(List cardList, Action selectCallback) + { + _pageChangeButtonsRoot.SetActive(value: false); + yield return StartCoroutine(CreateCardObjectCoroutine(cardList)); + CreateDialogObject(selectCallback); + CreateCardDetailDialog(); + _pageNum = (cardList.Count - 1) / 3 + 1; + bool flag = _pageNum > 1; + _pageChangeButtonsRoot.SetActive(flag); + _dragCollider.gameObject.SetActive(flag); + _paginationDotsRoot.SetActive(flag); + if (flag) + { + UIEventListener.Get(_previousPageButton.gameObject).onClick = delegate + { + PreviousPage(); + }; + UIEventListener.Get(_nextPageButton.gameObject).onClick = delegate + { + NextPage(); + }; + _dragCollider.onDragStart = OnDragStart; + _dragCollider.onDrag = OnDrag; + _paginationDots = NGUITools.AddChild(_paginationDotsRoot, _paginationDotsPrefab.gameObject).GetComponent(); + _paginationDots.Init(_pageNum, 16, 26, 1); + } + SetActivePage(1); + IsReady = true; + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_unloadAssetList); + _unloadAssetList.Clear(); + } + + private IEnumerator CreateCardObjectCoroutine(List cardList) + { + bool isCreated = false; + UIManager.GetInstance().CardLoadSelect(null, cardList, base.gameObject.layer, is2D: true, delegate + { + List cardList2DObjs = UIManager.GetInstance().getCardList2DObjs(); + _cardObjectList = new List(cardList2DObjs); + cardList2DObjs.Clear(); + List cardListAssetPathList = Toolbox.ResourcesManager.CardListAssetPathList; + _unloadAssetList.AddRange(new List(cardListAssetPathList)); + cardListAssetPathList.Clear(); + isCreated = true; + }); + while (!isCreated) + { + yield return null; + } + } + + private void CreateDialogObject(Action selectCallback) + { + int count = _cardObjectList.Count; + _dialogObjectList = new CardSelectDialogObject[count]; + for (int i = 0; i < count; i++) + { + CardSelectDialogObject cardSelectDialogObject = (_dialogObjectList[i] = NGUITools.AddChild(_objectsGrid.gameObject, _objectOriginal.gameObject).GetComponent()); + UIBase_CardManager.CardObjData cardObjData = _cardObjectList[i]; + UIEventListener.Get(cardSelectDialogObject.DecisionButton.gameObject).onClick = delegate + { + selectCallback(cardObjData.ids); + }; + GameObject cardObject = cardObjData.CardObj; + CardListTemplate component = cardObject.GetComponent(); + component.SetParentAndResetPos(cardSelectDialogObject.CardObjectRoot.transform); + component.transform.localScale = Vector3.one; + component.HideNum(); + UIEventListener uIEventListener = component.AddColliderToFrame(); + uIEventListener.onClick = delegate + { + _cardDetailDialog.OnPushCardDetailOn(cardObject); + }; + uIEventListener.onDragStart = OnDragStart; + uIEventListener.onDrag = OnDrag; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + cardSelectDialogObject.PossessionNumLabel.text = string.Format(Data.SystemText.Get("Sealed_RewardCardSelect_0005"), dataMgr.GetPossessionCardNum(cardObjData.ids, isIncludingSpotCard: false).ToString(), dataMgr.SpotCardData.ExistsSpotCard(cardObjData.ids) ? $"[fcd24a]+{dataMgr.SpotCardData.GetSpotCardNum(cardObjData.ids).ToString()}[-]" : string.Empty); + } + _objectsGrid.Reposition(); + } + + private void CreateCardDetailDialog() + { + _cardDetailDialog = DialogCreator.CreateCardDetailDialog(_cardDetailRoot, "Detail"); + _cardDetailDialog.gameObject.SetActive(value: false); + } + + private void SetActivePage(int pageNo) + { + _activePageNo = pageNo; + _paginationDots?.SetActivePageNumber(pageNo); + if (!_isLoopPage) + { + _previousPageButton.gameObject.SetActive(pageNo != 1); + _nextPageButton.gameObject.SetActive(pageNo != _pageNum); + } + for (int i = 0; i < _dialogObjectList.Length; i++) + { + GameObject gameObject = _dialogObjectList[i].gameObject; + bool flag = i / 3 + 1 == pageNo; + if (flag) + { + gameObject.SetActive(value: false); + } + gameObject.SetActive(flag); + } + Vector3 localPosition = _objectsGrid.transform.localPosition; + if (pageNo == 1) + { + _objectsGrid.transform.localPosition = new Vector3(0f, localPosition.y, localPosition.z); + _objectsGrid.pivot = UIWidget.Pivot.Center; + } + else + { + _objectsGrid.transform.localPosition = new Vector3(0f - _objectsGrid.cellWidth, localPosition.y, localPosition.z); + _objectsGrid.pivot = UIWidget.Pivot.Left; + } + _objectsGrid.Reposition(); + } + + private void PreviousPage() + { + bool flag = _activePageNo == 1; + if (!flag || _isLoopPage) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + SetActivePage(flag ? _pageNum : (_activePageNo - 1)); + } + } + + private void NextPage() + { + bool flag = _activePageNo == _pageNum; + if (!flag || _isLoopPage) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + SetActivePage(flag ? 1 : (_activePageNo + 1)); + } + } + + private void OnDragStart(GameObject g) + { + _isDrag = true; + } + + private void OnDrag(GameObject g, Vector2 vec) + { + if (_isDrag) + { + if (vec.x >= 70f) + { + _isDrag = false; + PreviousPage(); + } + else if (vec.x <= -70f) + { + _isDrag = false; + NextPage(); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardSelectDialogObject.cs b/SVSim.BattleEngine/Engine/Wizard/CardSelectDialogObject.cs new file mode 100644 index 0000000..3b947c5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardSelectDialogObject.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +namespace Wizard; + +public class CardSelectDialogObject : MonoBehaviour +{ + [SerializeField] + private GameObject _cardObjectRoot; + + [SerializeField] + private UILabel _possessionNumLabel; + + [SerializeField] + private UIButton _decisionButton; + + public GameObject CardObjectRoot => _cardObjectRoot; + + public UILabel PossessionNumLabel => _possessionNumLabel; + + public UIButton DecisionButton => _decisionButton; +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardSleeveDetailWindow.cs b/SVSim.BattleEngine/Engine/Wizard/CardSleeveDetailWindow.cs new file mode 100644 index 0000000..e77eae4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardSleeveDetailWindow.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.SleevePurchase; + +namespace Wizard; + +public class CardSleeveDetailWindow : MonoBehaviour +{ + private const int GRID_CELL_WIDTH_BOUNDARY_COUNT = 5; + + private const int GRID_CELL_WIDTH_DEFAULT = 182; + + private const int GRID_CELL_WIDTH_5_ITEMS = 160; + + [SerializeField] + private UIGrid _rewardGrid; + + [SerializeField] + private GameObject _specialLayoutParent; + + [SerializeField] + private UILabel _labelDescription; + + [SerializeField] + private CardSleeveRewardView _cardSleeveRewardView; + + public void SetData(SleeveProductInfo productInfo, Dictionary cardPool) + { + string description = Data.SystemText.Get("Shop_0102", productInfo.saleInfo.name.Replace("\n", "")); + SetData(productInfo.rewardInfoList, description, cardPool); + } + + public void SetData(List rewardInfoList, string description, Dictionary cardPool) + { + _labelDescription.text = description; + GameObject parent = (_cardSleeveRewardView.IsSpecialLayout(rewardInfoList) ? _specialLayoutParent : _rewardGrid.gameObject); + _cardSleeveRewardView.SetRewardItems(rewardInfoList, parent, cardPool); + if (rewardInfoList.Count >= 5) + { + _rewardGrid.cellWidth = 160f; + } + else + { + _rewardGrid.cellWidth = 182f; + } + _rewardGrid.Reposition(); + _cardSleeveRewardView.CheckSpecialLayout(parent, rewardInfoList); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardSleeveRewardItem.cs b/SVSim.BattleEngine/Engine/Wizard/CardSleeveRewardItem.cs new file mode 100644 index 0000000..7acab58 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardSleeveRewardItem.cs @@ -0,0 +1,96 @@ +using Cute; +using UnityEngine; + +namespace Wizard; + +public class CardSleeveRewardItem : MonoBehaviour +{ + [SerializeField] + private UITexture _rewardTexture; + + [SerializeField] + private UILabel _rewardLabel; + + [SerializeField] + private UILabel _alreadyGetLabel; + + [SerializeField] + private GameObject _cardObjectParent; + + [SerializeField] + private GameObject _cardMask; + + public UITexture RewardTexture => _rewardTexture; + + public ShopCommonRewardInfo Info { get; private set; } + + public GameObject CardObjectParent => _cardObjectParent; + + public void SetReward(ShopCommonRewardInfo rewardInfo) + { + Info = rewardInfo; + if (RewardTexture != null) + { + if (rewardInfo.Type == 6) + { + Sleeve sleeve = Data.Master.SleeveMgr.Get(rewardInfo.UserGoodsId); + UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(RewardTexture, sleeve.sleeve_id); + } + else if (rewardInfo.Type == 7) + { + string rewardImagePath = ShopCommonUtility.GetRewardImagePath(rewardInfo, isFetch: true); + RewardTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(rewardImagePath); + RewardTexture.material = null; + } + else + { + _ = rewardInfo.Type; + _ = 5; + } + } + if (_rewardLabel != null) + { + if (rewardInfo.Type == 5) + { + CardParameter cardParameterFromId = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId((int)rewardInfo.UserGoodsId); + _rewardLabel.SetWrapText(cardParameterFromId.CardName); + } + else + { + _rewardLabel.SetWrapText(ShopCommonUtility.GetRewardDetailName(rewardInfo)); + } + } + } + + public void SetArleadyGetVisible(bool visible) + { + if (!(_alreadyGetLabel == null)) + { + _alreadyGetLabel.gameObject.SetActive(visible); + if (RewardTexture != null) + { + UIManager.SetObjectToGrey(RewardTexture.gameObject, visible); + } + if (_cardMask != null) + { + _cardMask.SetActive(visible); + } + } + } + + public void ChangeNameLabelPosition(Vector3 localPosition) + { + if (_rewardLabel != null) + { + _rewardLabel.transform.localPosition = localPosition; + } + } + + public void ChangeNameLabelWidth(int width) + { + if (_rewardLabel != null) + { + _rewardLabel.width = width; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CardSleeveRewardView.cs b/SVSim.BattleEngine/Engine/Wizard/CardSleeveRewardView.cs new file mode 100644 index 0000000..24eaf40 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CardSleeveRewardView.cs @@ -0,0 +1,315 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +public class CardSleeveRewardView : MonoBehaviour +{ + private const int MAX_VIEW_REWARD = 5; + + private readonly Vector3[] SPECIAL_LAYOUT_POSITION = new Vector3[5] + { + new Vector3(-303f, 0f, 0f), + new Vector3(-122f, 46f, 0f), + new Vector3(-51f, -51f, 0f), + new Vector3(127f, 0f, 0f), + new Vector3(303f, 0f, 0f) + }; + + private readonly Vector3[] SPECIAL_LAYOUT_SCALE = new Vector3[5] + { + Vector3.one, + new Vector3(0.9f, 0.9f, 1f), + new Vector3(0.9f, 0.9f, 1f), + Vector3.one, + Vector3.one + }; + + private readonly int[] LABEL_OVERRIDE_INDEX = new int[2] { 1, 2 }; + + private readonly Vector3[] LABEL_OVERRIDE_POSITION = new Vector3[2] + { + new Vector3(38f, -181f, 0f), + new Vector3(-41f, -124f, 0f) + }; + + private readonly int[] LABEL_OVERRIDE_WIDTH = new int[2] { 170, 170 }; + + [SerializeField] + private CardSleeveRewardItem _sleeveItemOriginal; + + [SerializeField] + private CardSleeveRewardItem _emblemItemOriginal; + + [SerializeField] + private CardSleeveRewardItem _cardItemOriginal; + + [SerializeField] + private bool _enableAlreadyGetCheck; + + [SerializeField] + private bool _isEnablePremiumShader; + + [SerializeField] + private bool _isEnableCardClickCollider; + + [SerializeField] + private int _cardDepthOffset; + + [SerializeField] + private bool _isEnableHaveCardCount = true; + + private List _cloneCardList = new List(); + + [SerializeField] + private GameObject _cardDetailPrefab; + + private static int DetailLayer; + + private CardDetailUI _cardDetail; + + private List _sleeveItemList = new List(); + + private List _emblemItemList = new List(); + + private List _cardItemList = new List(); + + public List SetRewardItems(List infoList, GameObject parent, Dictionary cardPool) + { + List viewRewardList = GetViewRewardList(infoList); + List list = SortRewardList(viewRewardList); + HideAllItems(); + int num = 0; + int num2 = 0; + List list2 = new List(); + int num3 = 0; + for (int i = 0; i < list.Count; i++) + { + CardSleeveRewardItem cardSleeveRewardItem = null; + switch ((UserGoods.Type)list[i].Type) + { + case UserGoods.Type.Card: + cardSleeveRewardItem = CreateCard(parent, viewRewardList[i], num3++, cardPool); + break; + case UserGoods.Type.Sleeve: + if (num < _sleeveItemList.Count) + { + cardSleeveRewardItem = _sleeveItemList[num]; + } + else + { + cardSleeveRewardItem = NGUITools.AddChild(parent, _sleeveItemOriginal.gameObject).GetComponent(); + cardSleeveRewardItem.transform.localPosition = new Vector3(cardSleeveRewardItem.transform.localPosition.x, cardSleeveRewardItem.transform.localPosition.y, 10f); + _sleeveItemList.Add(cardSleeveRewardItem); + } + if (_enableAlreadyGetCheck) + { + cardSleeveRewardItem.SetArleadyGetVisible(Data.Master.SleeveMgr.Get(list[i].UserGoodsId).IsAcquired); + } + num++; + break; + case UserGoods.Type.Emblem: + if (num2 < _emblemItemList.Count) + { + cardSleeveRewardItem = _emblemItemList[num2]; + } + else + { + cardSleeveRewardItem = NGUITools.AddChild(parent, _emblemItemOriginal.gameObject).GetComponent(); + _emblemItemList.Add(cardSleeveRewardItem); + } + if (_enableAlreadyGetCheck) + { + Emblem emblem = Data.Master.EmblemMgr.Get(list[i].UserGoodsId); + cardSleeveRewardItem.SetArleadyGetVisible(emblem.IsAcquired); + } + num2++; + break; + } + if (cardSleeveRewardItem != null) + { + if (list[i].Type != 5) + { + cardSleeveRewardItem.gameObject.SetActive(value: true); + } + cardSleeveRewardItem.SetReward(list[i]); + list2.Add(cardSleeveRewardItem); + } + } + return list2; + } + + public bool IsSpecialLayout(List infoList) + { + List viewRewardList = GetViewRewardList(infoList); + SortRewardList(viewRewardList); + int num = viewRewardList.Count((ShopCommonRewardInfo reward) => reward.Type == 6); + int num2 = viewRewardList.Count((ShopCommonRewardInfo reward) => reward.Type == 7); + int num3 = viewRewardList.Count((ShopCommonRewardInfo reward) => reward.Type == 5); + if (num == 1 && num2 == 2) + { + return num3 == 2; + } + return false; + } + + public void CheckSpecialLayout(GameObject parent, List infoList) + { + if (!IsSpecialLayout(infoList)) + { + return; + } + List viewRewardList = GetViewRewardList(infoList); + List list = SortRewardList(viewRewardList); + for (int i = 0; i < SPECIAL_LAYOUT_POSITION.Length; i++) + { + Transform child = parent.transform.GetChild(i); + child.localPosition = SPECIAL_LAYOUT_POSITION[i]; + child.localScale = SPECIAL_LAYOUT_SCALE[i]; + } + for (int j = 0; j < LABEL_OVERRIDE_INDEX.Length; j++) + { + int index = LABEL_OVERRIDE_INDEX[j]; + CardSleeveRewardItem component = parent.transform.GetChild(index).gameObject.GetComponent(); + if (component != null) + { + component.ChangeNameLabelPosition(LABEL_OVERRIDE_POSITION[j]); + component.ChangeNameLabelWidth(LABEL_OVERRIDE_WIDTH[j]); + component.SetReward(list[index]); + } + } + } + + private void Start() + { + InitializeCardDetail(); + } + + private CardSleeveRewardItem CreateCard(GameObject parent, ShopCommonRewardInfo viewReward, int cardCount, Dictionary cardPool) + { + CardSleeveRewardItem cardSleeveRewardItem; + if (cardCount < _cardItemList.Count) + { + cardSleeveRewardItem = _cardItemList[cardCount]; + } + else + { + cardSleeveRewardItem = NGUITools.AddChild(parent, _cardItemOriginal.gameObject).GetComponent(); + cardSleeveRewardItem.transform.localPosition = new Vector3(cardSleeveRewardItem.transform.localPosition.x, cardSleeveRewardItem.transform.localPosition.y, 10f); + _cardItemList.Add(cardSleeveRewardItem); + } + cardSleeveRewardItem.gameObject.SetActive(value: true); + UIBase_CardManager.CardObjData cardObjOriginal = cardPool[(int)viewReward.UserGoodsId]; + GameObject gameObject = NGUITools.AddChild(cardSleeveRewardItem.CardObjectParent, cardObjOriginal.CardObj); + gameObject.SetActive(value: true); + _cloneCardList.Add(gameObject); + CardListTemplate component = gameObject.GetComponent(); + component.AddDepth(_cardDepthOffset); + if (!_isEnablePremiumShader) + { + component.ReplaceMaterialToTexture(); + } + int possessionCardNum = GameMgr.GetIns().GetDataMgr().GetPossessionCardNum((int)viewReward.UserGoodsId, isIncludingSpotCard: false); + if (_isEnableHaveCardCount) + { + component.SetNum(viewReward.Num); + } + else + { + component.HideNum(); + } + component._newLabel.gameObject.SetActive(value: false); + if (_enableAlreadyGetCheck) + { + bool flag = possessionCardNum > 0; + cardSleeveRewardItem.SetArleadyGetVisible(flag); + UIManager.SetObjectToGrey(gameObject, flag); + component._frameSprite.depth = component._frameSprite.depth + 1; + } + component.RotationOnlyIconVisible = CardMaster.GetInstance(CardMaster.CardMasterId.Default).GetCardParameterFromId(cardObjOriginal.ids).IsResurgentCard; + if (_isEnableCardClickCollider) + { + GameObject obj = component._frameSprite.gameObject; + obj.AddComponent().size = component._frameSprite.localSize; + UIEventListener uIEventListener = UIEventListener.Get(obj); + uIEventListener.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(uIEventListener.onClick, (UIEventListener.VoidDelegate)delegate + { + if (_cardDetail != null) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_CARD_INFO); + _cardDetail.IsShowFlavorTextButton = false; + _cardDetail.IsShowEvolutionButton = false; + _cardDetail.IsShowVoiceButton = false; + _cardDetail.gameObject.SetActive(value: true); + _cardDetail.ShowCardDetail(cardObjOriginal.CardObj); + } + }); + } + return cardSleeveRewardItem; + } + + private void InitializeCardDetail() + { + if (!(_cardDetailPrefab == null)) + { + DetailLayer = LayerMask.NameToLayer("Detail"); + _cardDetail = UnityEngine.Object.Instantiate(_cardDetailPrefab).GetComponent(); + _cardDetail.transform.parent = base.transform; + _cardDetail.transform.localPosition = Vector3.zero; + _cardDetail.transform.localScale = Vector3.one; + _cardDetail.Initialize(DetailLayer, CardMaster.CardMasterId.Default); + _cardDetail.IsShowFlavorTextButton = true; + _cardDetail.IsShowVoiceButton = true; + _cardDetail.IsShowEvolutionButton = true; + _cardDetail.gameObject.SetActive(value: false); + } + } + + private List GetViewRewardList(List infoList) + { + List list = new List(); + for (int i = 0; i < infoList.Count && i < 5; i++) + { + list.Add(infoList[i]); + } + return list; + } + + private List SortRewardList(List infoList) + { + List list = new List(); + list.AddRange(infoList.FindAll((ShopCommonRewardInfo info) => info.Type == 6)); + list.AddRange(infoList.FindAll((ShopCommonRewardInfo info) => info.Type == 7)); + list.AddRange(infoList.FindAll((ShopCommonRewardInfo info) => info.Type == 5)); + return list; + } + + private void HideAllItems() + { + _sleeveItemOriginal.gameObject.SetActive(value: false); + _emblemItemOriginal.gameObject.SetActive(value: false); + if (_cardItemOriginal != null) + { + _cardItemOriginal.gameObject.SetActive(value: false); + } + for (int i = 0; i < _sleeveItemList.Count; i++) + { + _sleeveItemList[i].gameObject.SetActive(value: false); + } + for (int j = 0; j < _emblemItemList.Count; j++) + { + _emblemItemList[j].gameObject.SetActive(value: false); + } + foreach (CardSleeveRewardItem cardItem in _cardItemList) + { + cardItem.gameObject.SetActive(value: false); + } + foreach (GameObject cloneCard in _cloneCardList) + { + UnityEngine.Object.Destroy(cloneCard); + } + _cloneCardList.Clear(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChapterSelectButton.cs b/SVSim.BattleEngine/Engine/Wizard/ChapterSelectButton.cs new file mode 100644 index 0000000..f00c2c4 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChapterSelectButton.cs @@ -0,0 +1,235 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChapterSelectButton : MonoBehaviour +{ + [SerializeField] + private UIButton _button; + + [SerializeField] + private UISprite _notSelectMask; + + [SerializeField] + private UISprite _clearMask; + + [SerializeField] + private UILabel _clearLabel; + + [SerializeField] + private UILabel _chapterNo; + + [SerializeField] + private UILabel _chapterName; + + [SerializeField] + private UIMarquee _chapterNameMarquee; + + [SerializeField] + private UITexture _bg; + + [SerializeField] + private GameObject _tapEffectLocator; + + [SerializeField] + private UIDragScrollView _dragScrollView; + + private StoryChapterData _chapterData; + + private const float CHAPTERLIST_SCALE_ACTIVE = 1f; + + private const float CHAPTERLIST_SCALE_NOTACTIVE = 0.75f; + + private const float CHAPTERLIST_ALPHA_ACTIVE = 1f; + + private const float CHAPTERLIST_ALPHA_NOTACTIVE = 0.85f; + + private const int CHAPTERLIST_DEPTH_ACTIVE = 4; + + private const int CHAPTERLIST_DEPTH_NOTACTIVE = 3; + + private const float CHAPTERLIST_X_IN_CIRCLE = 190f; + + private const float CHAPTERLIST_X_OUT_CIRCLE = 530f; + + private const float CHAPTER_TITLE_WIDTH = 324f; + + public Action OnClick { get; set; } + + public GameObject TapEffectLocator => _tapEffectLocator; + + public Transform ClearLabelTransform => _clearLabel.transform; + + private void Start() + { + _button.onClick.Add(new EventDelegate(delegate + { + OnClick.Call(); + })); + } + + public void SetScrollEnable(bool enable) + { + _dragScrollView.enabled = enable; + } + + public void SetClearVisible(bool visible) + { + _clearLabel.gameObject.SetActive(visible); + } + + public static string GetHeaderPath(StoryChapterData chapterData, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath("story_chapter_header_" + chapterData.ChapterButtonBgId.ToString("00"), ResourcesManager.AssetLoadPathType.StoryChapterHeader, isFetch); + } + + public void OnStartClearEffect() + { + _clearLabel.gameObject.SetActive(value: true); + _clearLabel.enabled = false; + } + + public void OnFinishClearEffect() + { + _clearLabel.enabled = true; + } + + public void UpdateClearState(StoryChapterData.ChapterClearStatus clearState) + { + AreaSelectUtility.SetClearLabelColor(_clearLabel, clearState); + } + + public void SetChapterData(StoryChapterData chapterData, AreaSelectUI parent, UIScrollView scrollView) + { + _chapterData = chapterData; + _dragScrollView.scrollView = scrollView; + _bg.mainTexture = Toolbox.ResourcesManager.LoadObject(GetHeaderPath(chapterData, isFetch: true)); + _bg.gameObject.SetActive(value: true); + _notSelectMask.gameObject.SetActive(value: false); + UpdateClearState(chapterData.ClearStatus); + _clearLabel.gameObject.SetActive(chapterData.IsPlayedChapter); + if (chapterData.IsMaintenanceChapter) + { + Color color = _chapterName.color; + UIManager.SetObjectToGrey(base.gameObject, b: true); + _chapterName.color = color; + _chapterName.text = Data.SystemText.Get("System_0022"); + _chapterNo.text = string.Empty; + } + else + { + string chapterTitleStory = parent.GetChapterTitleStory(chapterData.ChapterId); + int num = chapterTitleStory.IndexOf(' '); + _chapterNo.text = chapterTitleStory.Substring(0, num + 1); + _chapterName.text = chapterTitleStory.Substring(num + 1); + _chapterNameMarquee.SetWidthOfNeedsToScroll(324f - (float)_chapterNo.width); + _chapterNameMarquee.Reset(); + } + } + + public void UpdateSelectStatus(int SelectChapterIndex, int selfIndex, AreaSelectUI parent, bool isinterpscale, UIScrollView scrollView) + { + bool flag = selfIndex == SelectChapterIndex; + int num = 0; + float num2 = 0f; + if (flag) + { + num = 4; + num2 = 1f; + } + else + { + num = 3; + num2 = 0.85f; + } + bool flag2 = parent.IsUseChapterListClearedMask && _chapterData.IsCleared; + if (!_chapterData.IsMaintenanceChapter) + { + Color color = new Color(1f, 1f, 1f, 1f); + color.a = num2; + _bg.color = color; + _notSelectMask.color = color; + _chapterNo.color = color; + _chapterName.color = color; + _clearLabel.color = color; + } + if (_bg.gameObject.activeSelf != flag) + { + _bg.gameObject.SetActive(flag); + SetMarqueeEnable(flag); + } + if (_notSelectMask.gameObject.activeSelf == flag) + { + _notSelectMask.gameObject.SetActive(!flag); + } + if (_clearMask.gameObject.activeSelf != flag2) + { + _clearMask.gameObject.SetActive(flag2); + } + UpdateInterpsScale(isinterpscale, flag); + Vector3 localPosition = base.transform.localPosition; + float num3 = Mathf.Abs(localPosition.y + scrollView.transform.localPosition.y); + float num4 = 200f; + if (num3 < num4) + { + float num5 = num4 - Mathf.Sqrt(num4 * num4 - num3 * num3); + num5 *= 2.5f; + localPosition.x = 190f + num5; + } + else + { + localPosition.x = 530f + num4; + } + base.transform.localPosition = localPosition; + _bg.depth = num; + _notSelectMask.depth = num; + } + + public void SetMarqueeEnable(bool enable) + { + if (enable) + { + _chapterNameMarquee.StartMarquee(); + } + else + { + _chapterNameMarquee.Reset(); + } + } + + private void UpdateInterpsScale(bool isinterpscale, bool isSelected) + { + float num = (isSelected ? 1f : 0.75f); + if (isinterpscale) + { + Vector3 localScale = base.transform.localScale; + if (localScale.x < num) + { + localScale.x += Time.deltaTime; + if (localScale.x >= num) + { + localScale.x = num; + } + } + else if (localScale.x > num) + { + localScale.x -= Time.deltaTime; + if (localScale.x <= num) + { + localScale.x = num; + } + } + localScale.y = localScale.x; + base.transform.localScale = localScale; + } + else + { + Vector3 localScale2 = base.transform.localScale; + localScale2.x = num; + localScale2.y = num; + base.transform.localScale = localScale2; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChapterSelectSphere.cs b/SVSim.BattleEngine/Engine/Wizard/ChapterSelectSphere.cs new file mode 100644 index 0000000..03dccc0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChapterSelectSphere.cs @@ -0,0 +1,151 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChapterSelectSphere : MonoBehaviour +{ + [SerializeField] + private UIButton _button; + + [SerializeField] + private UISprite _bodySprite; + + [SerializeField] + private UISprite _arrowDownSprite; + + [SerializeField] + private UISprite _arrowUpSprite; + + private float _arrowAlpha = 1f; + + private bool _isArrowAlphaDown = true; + + private const float ARROW_ANIMATION_SPEED = 1f; + + private const float SCROLL_ROTATE_REVISION = 7f; + + public Action OnClick { get; set; } + + public bool IsScrollUpEnable { get; set; } + + public bool IsScrollDownEnable { get; set; } + + private void Start() + { + _button.onClick.Add(new EventDelegate(delegate + { + OnClick.Call(); + })); + } + + public void UpdateChapterSelectStatus(bool isChapterSelectVisible, bool isSelectEnable) + { + _bodySprite.spriteName = GetBodySpriteName(isChapterSelectVisible, isSelectEnable); + _arrowUpSprite.spriteName = GetArrowSpriteName(isChapterSelectVisible, IsScrollUpEnable); + _arrowDownSprite.spriteName = GetArrowSpriteName(isChapterSelectVisible, IsScrollDownEnable); + _arrowUpSprite.alpha = ((isChapterSelectVisible && IsScrollUpEnable) ? _arrowAlpha : 1f); + _arrowDownSprite.alpha = ((isChapterSelectVisible && IsScrollDownEnable) ? _arrowAlpha : 1f); + } + + public void OnSelectChapter(bool isChapterSelectEnable) + { + _arrowUpSprite.spriteName = GetArrowSpriteName(isChapterSelectEnable, IsScrollUpEnable); + _arrowDownSprite.spriteName = GetArrowSpriteName(isChapterSelectEnable, IsScrollDownEnable); + _arrowUpSprite.alpha = (IsScrollUpEnable ? _arrowAlpha : 1f); + _arrowDownSprite.alpha = (IsScrollDownEnable ? _arrowAlpha : 1f); + } + + public void UpdateArrowAlpha() + { + if (UpdatePingPongByDeltaTime(ref _arrowAlpha, 0f, 1f, 1f, _isArrowAlphaDown)) + { + _isArrowAlphaDown = !_isArrowAlphaDown; + } + if (IsScrollUpEnable) + { + _arrowUpSprite.alpha = _arrowAlpha; + } + if (IsScrollDownEnable) + { + _arrowDownSprite.alpha = _arrowAlpha; + } + } + + public void UpdateRotationOnScroll(float areaY, int chapterCount) + { + iTween.Stop(_bodySprite.gameObject); + float z = 0f; + float num = 80f; + float num2 = 50f; + if (areaY >= (float)chapterCount * num - num2) + { + z = (float)chapterCount * num - num2 - areaY; + z /= 7f; + z *= -1f; + } + else if (areaY <= 0f - num2) + { + z = areaY; + z /= 7f; + } + iTween.RotateUpdate(_bodySprite.gameObject, new Vector3(0f, 0f, z), 0.2f); + } + + public void ResetRotationOnScroll() + { + iTween.Init(_bodySprite.gameObject); + iTween.RotateTo(_bodySprite.gameObject, iTween.Hash("z", 0, "time", 1.35f, "easetype", iTween.EaseType.easeOutElastic)); + } + + private string GetArrowSpriteName(bool isChapterSelectEnable, bool isscrollenable) + { + if (isChapterSelectEnable) + { + if (isscrollenable) + { + return "arrow_jog_01"; + } + return "arrow_jog_02"; + } + return "arrow_jog_03"; + } + + private string GetBodySpriteName(bool isChapterSelectEnable, bool isChapterListSwitchEnable) + { + if (isChapterListSwitchEnable) + { + if (isChapterSelectEnable) + { + return "btn_jog_01_core"; + } + return "btn_jog_03_core"; + } + return "btn_jog_03_core"; + } + + private static bool UpdatePingPongByDeltaTime(ref float val, float min, float max, float speed, bool isdown) + { + bool result = false; + if (isdown) + { + val -= speed * Time.deltaTime; + if (val < min) + { + val = min; + result = true; + } + } + else + { + val += speed * Time.deltaTime; + if (val > max) + { + val = max; + result = true; + } + } + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/Chat.cs b/SVSim.BattleEngine/Engine/Wizard/Chat.cs new file mode 100644 index 0000000..300e066 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/Chat.cs @@ -0,0 +1,419 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class Chat : UIBase +{ + public enum eRequestDirection + { + OLD = 1, + NEW, + BOTH + } + + private const int MAX_PAST_MESSAGE_REQUEST = 30; + + private int _pastMessageRequestCnt; + + private IChatSettings _chatSettings; + + [SerializeField] + private ChatConnectController _chatConnectController; + + [SerializeField] + private ChatLogUI _chatLogUI; + + [SerializeField] + private ChatSendTextUI _chatSendTextUI; + + [SerializeField] + private ChatSendStampUI _sendStampUI; + + [SerializeField] + private UIEventListener _sendUICloseArea; + + [SerializeField] + private RewardBase _rewardBase; + + private bool _isPastLogComplete; + + private int _pastVisibleMessageCnt; + + private bool _isInitComplete; + + public Action OnAddNewChatMessage { get; set; } + + public Action> OnMissionCleared { get; set; } + + public void Init(IChatSettings chatSettings, List chatActionUIList, List stampList, NetworkDefine.MAINTENANCE_TYPE maintenanceType, Action OnFinish) + { + _chatSettings = chatSettings; + _chatConnectController.Init(PollingChatLog, OnConnectResultError); + _chatSendTextUI.Init(SendTextMessage, OnOpenTextInputUI, OnCloseTextInputUI); + UIManager.SetObjectToGrey(_chatSendTextUI.gameObject, Data.MaintenanceCodeList.Contains(maintenanceType)); + _sendStampUI.Init(SendStamp, OnOpenStampUI, OnCloseStampUI, stampList); + _chatLogUI.Init(chatSettings, _chatConnectController, stampList); + foreach (IChatActionUI chatActionUI in chatActionUIList) + { + chatActionUI.Init(_chatSettings, _chatConnectController, _chatLogUI, AddNewChatLogAfterSendChat); + } + UIEventListener sendUICloseArea = _sendUICloseArea; + sendUICloseArea.onClick = (UIEventListener.VoidDelegate)Delegate.Combine(sendUICloseArea.onClick, (UIEventListener.VoidDelegate)delegate + { + _chatSendTextUI.CloseInputUI(isClearText: false); + _sendStampUI.CloseStampList(); + }); + StartConnectChatInfo(delegate(ChatInfo chatInfo) + { + _isInitComplete = true; + OnFinish.Call(chatInfo); + }); + } + + public void ReadyClose() + { + _chatConnectController.Close(); + } + + public void ExecuteClose() + { + _chatLogUI.CloseChatLogView(); + UnityEngine.Object.Destroy(base.gameObject); + } + + private void OnConnectResultError() + { + UIManager.GetInstance().CloseNotLatestDialogAll(); + _chatLogUI.CloseDeckView(); + } + + private void OnOpenTextInputUI(ChatOpenCloseAnimation openCloseAnim) + { + _sendStampUI.CloseStampList(); + _chatLogUI.ChangeLogViewSizeByInputUIAnimation(openCloseAnim); + } + + private void OnCloseTextInputUI(ChatOpenCloseAnimation openCloseAnim) + { + if (!_sendStampUI.IsOpen) + { + _chatLogUI.ChangeLogViewSizeByInputUIAnimation(openCloseAnim); + } + } + + private void SendTextMessage(string text) + { + ChatPostTask chatPostTask = new ChatPostTask(_chatSettings.ApiSettings.ApiChatPost); + chatPostTask.SetParameter(0, text); + _chatConnectController.StartConnectCommon(chatPostTask, delegate + { + _chatConnectController.PausePolling(); + _chatSendTextUI.CloseInputUI(isClearText: true, delegate + { + AddNewChatLogAfterSendChat(); + _chatConnectController.ResumePolling(); + }); + }); + } + + private void OnOpenStampUI(ChatOpenCloseAnimation openCloseAnim) + { + _chatSendTextUI.CloseInputUI(isClearText: false); + _chatLogUI.ChangeLogViewSizeByInputUIAnimation(openCloseAnim); + } + + private void OnCloseStampUI(ChatOpenCloseAnimation openCloseAnim) + { + if (!_chatSendTextUI.IsOpen) + { + _chatLogUI.ChangeLogViewSizeByInputUIAnimation(openCloseAnim); + } + } + + private void SendStamp(int id) + { + ChatPostTask task = new ChatPostTask(_chatSettings.ApiSettings.ApiChatPost); + task.SetParameter(1, id.ToString()); + _chatConnectController.StartConnectCommon(task, delegate + { + _chatConnectController.PausePolling(); + _sendStampUI.CloseStampList(delegate + { + AddNewChatLogAfterSendChat(); + _chatConnectController.ResumePolling(); + }); + if (task.AchievedInfo != null && task.AchievedInfo._rewards.Count > 0) + { + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Story_0029")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, _rewardBase.gameObject).GetComponent(); + for (int num = 0; num < task.AchievedInfo._rewards.Count; num++) + { + component.AddReward(task.AchievedInfo._rewards[num]); + } + List messages = new List(); + for (int num2 = 0; num2 < task.AchievedInfo._missions.Count; num2++) + { + messages.Add(task.AchievedInfo._missions[num2].achieved_message); + } + dialogBase.OnClose = delegate + { + if (OnMissionCleared != null) + { + OnMissionCleared(messages); + } + }; + component.EndCreate(); + } + }); + } + + private void AddNewChatLogAfterSendChat() + { + AddNewChatLog(delegate + { + _chatLogUI.MoveNewMessagePosition(); + }); + } + + private bool GetCanUpdateUI() + { + if (UIManager.GetInstance().isOpenDialog()) + { + return false; + } + if (_chatLogUI.IsShowDeckView()) + { + return false; + } + return true; + } + + private void Update() + { + if (!_chatLogUI.IsEnableUpdateUI && GetCanUpdateUI()) + { + _chatLogUI.SetEnableUpdateUI(); + } + } + + private void PollingChatLog() + { + AddNewChatLog(null, isPolling: true); + } + + private void StartConnectChatInfo(Action callbackOnSuccess) + { + int value = PlayerPrefsWrapper.GetValue(_chatSettings.PlayerPrefsKeyLatestReadChatMessageId); + if (value >= 0) + { + CreateChatLogReadMessage(value, callbackOnSuccess); + } + else + { + CreateChatLog(callbackOnSuccess); + } + } + + private void CreateChatLogReadMessage(int latestMessageId, Action callbackOnSuccess) + { + ChatGetMessagesTask task = new ChatGetMessagesTask(_chatSettings.ApiSettings.ApiChatMessages); + task.SetParameter(latestMessageId, eRequestDirection.BOTH, 3); + _chatConnectController.StartConnectCommon(task, delegate + { + ChatInfo chatInfo = task.ChatInfo; + _chatConnectController.UpdatePollingInterval(chatInfo.WaitInterval); + int unreadMessageId = -1; + List visibleMessageList = chatInfo.VisibleMessageList; + if (visibleMessageList.Count > 0) + { + int messageId = visibleMessageList.Last().MessageId; + if (latestMessageId != messageId) + { + int num = visibleMessageList.FindIndex((ChatMessageInfo x) => x.MessageId == latestMessageId) + 1; + if (num > 0 && visibleMessageList.Count > num) + { + unreadMessageId = visibleMessageList[num].MessageId; + } + SaveReadLatestId(messageId); + } + } + _pastVisibleMessageCnt += chatInfo.VisibleMessageList.Count; + _chatLogUI.CreateChatLogView(chatInfo.MessageList, OnInitializeOldestLog, delegate + { + if (CheckNeedsPastVisibleMessage(chatInfo)) + { + AddPastChatLog(delegate + { + _chatLogUI.ResetScrollDefaultPosition(unreadMessageId); + callbackOnSuccess.Call(chatInfo); + }); + } + else + { + callbackOnSuccess.Call(chatInfo); + } + }, unreadMessageId); + }); + } + + private void CreateChatLog(Action callbackOnSuccess) + { + ChatGetMessagesTask task = new ChatGetMessagesTask(_chatSettings.ApiSettings.ApiChatMessages); + task.SetParameterLatestLog(3); + _chatConnectController.StartConnectCommon(task, delegate + { + ChatInfo chatInfo = task.ChatInfo; + _chatConnectController.UpdatePollingInterval(chatInfo.WaitInterval); + if (chatInfo.VisibleMessageList.Count > 0) + { + SaveReadLatestId(chatInfo.VisibleMessageList.Last().MessageId); + } + _pastVisibleMessageCnt += chatInfo.VisibleMessageList.Count; + _chatLogUI.CreateChatLogView(chatInfo.MessageList, OnInitializeOldestLog, delegate + { + if (CheckNeedsPastVisibleMessage(chatInfo)) + { + AddPastChatLog(delegate + { + _chatLogUI.ResetScrollDefaultPosition(); + callbackOnSuccess.Call(chatInfo); + }); + } + else + { + callbackOnSuccess.Call(chatInfo); + } + }); + }); + } + + private void OnInitializeOldestLog() + { + if (_isInitComplete) + { + AddPastChatLog(); + } + } + + private bool CheckNeedsPastVisibleMessage(ChatInfo chatInfo) + { + if (_pastMessageRequestCnt > 30) + { + ResetPastMessageCnt(); + return false; + } + bool num = NeedsPastMessage(chatInfo); + if (!num) + { + ResetPastMessageCnt(); + } + return num; + } + + private bool NeedsPastMessage(ChatInfo chatInfo) + { + if (_isPastLogComplete) + { + return false; + } + if (!chatInfo.IsIncludeInvisibleMessage) + { + return false; + } + if (_pastVisibleMessageCnt > 10) + { + return false; + } + return true; + } + + private void ResetPastMessageCnt() + { + _pastVisibleMessageCnt = 0; + _pastMessageRequestCnt = 0; + } + + private void AddNewChatLog(Action callbackOnSuccess = null, bool isPolling = false) + { + ChatGetMessagesTask task = new ChatGetMessagesTask(_chatSettings.ApiSettings.ApiChatMessages); + _chatConnectController.ResetPolling(); + if (_chatLogUI.ChatAllLogList.Count > 0) + { + int messageId = _chatLogUI.ChatAllLogList.Last().MessageId; + task.SetParameter(messageId, eRequestDirection.NEW, _chatConnectController.PollingInterval); + } + else + { + task.SetParameterLatestLog(_chatConnectController.PollingInterval); + } + _chatConnectController.StartConnectCommon(task, delegate + { + ChatInfo chatInfo = task.ChatInfo; + _chatConnectController.UpdatePollingInterval(chatInfo.WaitInterval); + if (chatInfo.MessageList.Count <= 0) + { + callbackOnSuccess.Call(); + } + else + { + if (chatInfo.VisibleMessageList.Count > 0) + { + SaveReadLatestId(chatInfo.VisibleMessageList.Last().MessageId); + } + _chatLogUI.AddChatLogView(chatInfo, eRequestDirection.NEW, GetCanUpdateUI(), callbackOnSuccess); + OnAddNewChatMessage.Call(chatInfo); + } + }, isPolling); + } + + private void AddPastChatLog(Action onFinish = null) + { + if (_isPastLogComplete) + { + ResetPastMessageCnt(); + onFinish.Call(); + return; + } + int messageId = _chatLogUI.ChatAllLogList[0].MessageId; + ChatGetMessagesTask task = new ChatGetMessagesTask(_chatSettings.ApiSettings.ApiChatMessages); + task.SetParameter(messageId, eRequestDirection.OLD, _chatConnectController.PollingInterval); + _chatConnectController.StartConnectCommon(task, delegate + { + _pastMessageRequestCnt++; + ChatInfo chatInfo = task.ChatInfo; + if (chatInfo.MessageList.Count <= 0) + { + _isPastLogComplete = true; + } + _chatConnectController.UpdatePollingInterval(chatInfo.WaitInterval); + _chatLogUI.AddChatLogView(chatInfo, eRequestDirection.OLD); + _pastVisibleMessageCnt += chatInfo.VisibleMessageList.Count; + if (CheckNeedsPastVisibleMessage(chatInfo)) + { + AddPastChatLog(onFinish); + } + else + { + onFinish.Call(); + } + }); + } + + private void SaveReadLatestId(int latestMessageId) + { + PlayerPrefsWrapper.SetValue(_chatSettings.PlayerPrefsKeyLatestReadChatMessageId, latestMessageId); + } + + public void StartConnectCommon(NetworkTask task, Action callbackOnSuccess, bool isPolling = false) + { + _chatConnectController.StartConnectCommon(task, callbackOnSuccess, isPolling); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatConnectController.cs b/SVSim.BattleEngine/Engine/Wizard/ChatConnectController.cs new file mode 100644 index 0000000..c7bdd6e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatConnectController.cs @@ -0,0 +1,192 @@ +using System; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.ErrorDialog; + +namespace Wizard; + +public class ChatConnectController : MonoBehaviour +{ + public const int DEFAULT_POLLING_TIME = 3; + + private const int INVALID_POLLING_TIME = 0; + + private static readonly int[] ERROR_CODE_NOT_STOP_POLLING = new int[1] { 207 }; + + private bool _isPausePolling; + + private bool _isConnectPolling; + + private float _pollingIntervalCount; + + private bool _isActiveCenterLoading; + + private static bool _isOpenChat = false; + + private Action _eventOnPolling; + + private Action _onConnectResultError; + + public int PollingInterval { get; private set; } = 3; + + public void Init(Action eventOnPolling, Action onConnectResultError) + { + _isOpenChat = true; + _eventOnPolling = eventOnPolling; + _onConnectResultError = onConnectResultError; + UpdatePollingInterval(3); + ResetPolling(); + } + + public void Close() + { + if (_isConnectPolling) + { + SetActiveCenterLoading(isActive: true, force: false); + } + StopPolling(); + _isOpenChat = false; + } + + public void StopPolling() + { + PollingInterval = 0; + _pollingIntervalCount = 0f; + } + + public void ResetPolling() + { + ResumePolling(); + _pollingIntervalCount = 0f; + } + + public void PausePolling() + { + _isPausePolling = true; + } + + public void ResumePolling() + { + _isPausePolling = false; + } + + public void UpdatePollingInterval(int intervalTime) + { + PollingInterval = intervalTime; + } + + private void OnDestroy() + { + _isOpenChat = false; + } + + private void Update() + { + UpdatePolling(); + } + + private void UpdatePolling() + { + if (PollingInterval == 0 || _isPausePolling) + { + return; + } + _pollingIntervalCount += Time.deltaTime; + if ((float)PollingInterval <= _pollingIntervalCount) + { + if (Toolbox.NetworkManager.isConnect || NetworkUI.GetInstance().IsOpenErrorDialog()) + { + ResetPolling(); + } + else + { + _eventOnPolling.Call(); + } + } + } + + public void StartConnectCommon(NetworkTask task, Action callbackOnSuccess, bool isPolling = false) + { + Action action = null; + Action action2 = null; + if (isPolling) + { + task.SkipCuteTimeOutPopup(); + task.SkipCuteHttpStatusErrorPopup(); + task.SkipAllCuteResultCodeCheckErrorPopup(); + _isConnectPolling = true; + action = OnConnectFailureErrorPolling; + action2 = OnConnectResultErrorPolling; + } + else + { + SetActiveCenterLoading(isActive: true); + action = OnConnectFailureError; + action2 = OnConnectResultError; + } + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate(NetworkTask.ResultCode code) + { + if (isPolling) + { + _isConnectPolling = false; + } + else + { + SetActiveCenterLoading(isActive: false); + } + if (_isOpenChat) + { + callbackOnSuccess.Call(code); + } + }, action, action2, encrypt: true, useJson: false, !isPolling)); + } + + private void OnConnectFailureErrorPolling(NetworkTask.ResultCode code) + { + _isConnectPolling = false; + ResetPolling(); + } + + private void OnConnectResultErrorPolling(int error) + { + if (_isOpenChat) + { + Wizard.ErrorDialog.Dialog.Create(error); + } + _isConnectPolling = false; + StopPolling(); + _onConnectResultError.Call(); + } + + private void OnConnectFailureError(NetworkTask.ResultCode code) + { + SetActiveCenterLoading(isActive: false); + } + + private void OnConnectResultError(int error) + { + SetActiveCenterLoading(isActive: false); + if (!ERROR_CODE_NOT_STOP_POLLING.Contains(error)) + { + StopPolling(); + } + _onConnectResultError.Call(); + } + + private void SetActiveCenterLoading(bool isActive, bool force = true) + { + if (_isActiveCenterLoading != isActive) + { + _isActiveCenterLoading = isActive; + if (isActive) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: false, notCollider: false, force); + } + else + { + UIManager.GetInstance().closeInSceneCenterLoading(force); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatDeckView.cs b/SVSim.BattleEngine/Engine/Wizard/ChatDeckView.cs new file mode 100644 index 0000000..80c6851 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatDeckView.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatDeckView : MonoBehaviour +{ + private const int DEPTH_CONFIRM_DIALOG = 100; + + [SerializeField] + private GameObject _deckViewPrefab; + + [SerializeField] + private GameObject _cardDetailPrefab; + + private GameObject _deckViewObj; + + private UICardList _uiCardList; + + private GameObject _cardDetailObj; + + private CardDetailUI _cardDetail; + + private List _loadCardAssetList; + + private IChatApiSettings _chatApiSettings; + + private ChatConnectController _chatConnectCtr; + + private Action _actionCloseChatLogContent; + + private Action _onOpen; + + private Action _onClose; + + private Action>> _onDeleteDeckSuccess; + + public void Init(IChatApiSettings chatApiSettings, ChatConnectController chatConnectCtr, Action actionCloseChatLogContent) + { + _chatApiSettings = chatApiSettings; + _chatConnectCtr = chatConnectCtr; + _actionCloseChatLogContent = actionCloseChatLogContent; + } + + public bool IsShowDeckCardView() + { + if (_deckViewObj == null) + { + return false; + } + return _deckViewObj.activeSelf; + } + + public void ShowDeckViewByDeckLog(ChatMessageInfo.DeckLogData deckLogData, Action onOpen = null, Action onClose = null, Action>> onDeleteDeckSuccess = null) + { + _onDeleteDeckSuccess = onDeleteDeckSuccess; + ShowDeckViewByDeckData(deckLogData.DeckData, onOpen, onClose, deckLogData.IsAbleDeleteDeck); + if (deckLogData.IsAbleDeleteDeck) + { + _uiCardList.SetRedButtonOnClickCallBack(Data.SystemText.Get("Guild_Chat_0034"), delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + CreateConfirmDialogDeleteDeckLog(deckLogData); + }); + } + } + + public void ShowDeckViewByDeckData(DeckData deck, Action onOpen, Action onClose, bool isActiveRedButton, bool isActiveDeckIntroductionObj = true) + { + _onOpen = onOpen; + _onClose = onClose; + string text = "Detail"; + if (_cardDetailObj == null) + { + _cardDetailObj = NGUITools.AddChild(base.gameObject, _cardDetailPrefab); + _cardDetail = _cardDetailObj.GetComponent(); + _cardDetail.Initialize(LayerMask.NameToLayer(text), CardMaster.CardMasterId.Default); + _cardDetailObj.SetActive(value: false); + } + if (_deckViewObj == null) + { + _deckViewObj = UnityEngine.Object.Instantiate(_deckViewPrefab); + _uiCardList = _deckViewObj.GetComponent(); + _uiCardList.Init(base.gameObject, _cardDetail, null, CloseDeckView, text, in_DetailCameraUse: true, null, 40); + _deckViewObj.SetActive(value: false); + } + _uiCardList.SetEnableRedButton(isActiveRedButton); + UIManager.GetInstance().createInSceneCenterLoading(); + StartCoroutine(CardLoadCoroutine(deck, !isActiveDeckIntroductionObj, isActiveDeckIntroductionObj)); + } + + public void CloseDeckView() + { + if (IsShowDeckCardView()) + { + _deckViewObj.SetActive(value: false); + if (_loadCardAssetList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList); + _loadCardAssetList.Clear(); + } + _onClose.Call(); + _onOpen = null; + _onClose = null; + } + } + + private IEnumerator CardLoadCoroutine(DeckData deck, bool showQRCode, bool isActiveDeckIntroductionObj) + { + IList cardIdList = deck.GetCardIdList(); + _uiCardList.RemoveData(); + _loadCardAssetList = _uiCardList.GetLoadFileList(cardIdList as List); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadCardAssetList, null)); + _uiCardList.SetDeck(deck, null); + _uiCardList.UpdateShortageRedEther(); + _uiCardList.SetShortageCardVisible(_uiCardList.IsEnableShortageCardVisible); + if (showQRCode) + { + _uiCardList.SetQRSmallTexture(); + } + _uiCardList.SetActiveDeckIntroductionObj(isActiveDeckIntroductionObj); + yield return null; + _deckViewObj.SetActive(value: true); + UIManager.GetInstance().closeInSceneCenterLoading(); + _onOpen.Call(); + } + + private void CreateConfirmDialogDeleteDeckLog(ChatMessageInfo.DeckLogData deckLogData) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn); + dialogBase.SetTitleLabel(Data.SystemText.Get("Guild_Chat_0035")); + dialogBase.SetText(Data.SystemText.Get("Guild_Chat_0036")); + dialogBase.SetButtonText(Data.SystemText.Get("Guild_Chat_0037")); + dialogBase.SetPanelDepth(100); + dialogBase.onPushButton1 = delegate + { + DeleteDeckLog(deckLogData.DeckData.Format, deckLogData.MessageId); + }; + } + + private void DeleteDeckLog(Format format, int messageId) + { + CloseDeckView(); + ChatDeleteDeckTask task = new ChatDeleteDeckTask(_chatApiSettings.ApiChatDeleteDeck); + task.SetParameter(Data.FormatConvertApi(format), messageId); + _chatConnectCtr.StartConnectCommon(task, delegate + { + CreateCompleteDialogDeleteDeckLog(); + _actionCloseChatLogContent.Call(messageId); + _onDeleteDeckSuccess.Call(format, task.DictDeckLogList); + }); + } + + private void CreateCompleteDialogDeleteDeckLog() + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetText(Data.SystemText.Get("Guild_Chat_0038")); + dialogBase.SetPanelDepth(100); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatInfo.cs b/SVSim.BattleEngine/Engine/Wizard/ChatInfo.cs new file mode 100644 index 0000000..1d66a08 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatInfo.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; + +namespace Wizard; + +public class ChatInfo +{ + public GatheringMatchedRoom GatheringMatchedRoom; + + public List MessageList { get; private set; } + + public List VisibleMessageList { get; private set; } + + public bool IsIncludeInvisibleMessage { get; private set; } + + public int WaitInterval { get; private set; } + + public ChatInfo(JsonData json) + { + initialize(); + ParseJsonData(json); + } + + private void initialize() + { + MessageList = new List(); + WaitInterval = 0; + GatheringMatchedRoom = null; + } + + private void ParseJsonData(JsonData json) + { + List list = new List(); + JsonData jsonData = json["users"]; + for (int i = 0; i < jsonData.Count; i++) + { + list.Add(new ChatUserInfo(jsonData[i])); + } + JsonData jsonData2 = json["chat_message"]; + for (int j = 0; j < jsonData2.Count; j++) + { + ChatMessageInfo chatMessageInfo = new ChatMessageInfo(jsonData2[j], list); + if (chatMessageInfo.UserInfo != null && (chatMessageInfo.MessageType != ChatMessageInfo.eMessageType.ROOM_MATCH || chatMessageInfo.RoomData == null || chatMessageInfo.UserInfo.ViewerId != PlayerStaticData.UserViewerID)) + { + MessageList.Add(new ChatMessageInfo(jsonData2[j], list)); + } + } + VisibleMessageList = MessageList.Where((ChatMessageInfo message) => message.IsVisibleMessage).ToList(); + IsIncludeInvisibleMessage = MessageList.Any((ChatMessageInfo message) => !message.IsVisibleMessage); + WaitInterval = json["wait_interval"].ToInt(); + if (json.Keys.Contains("matched_room_id")) + { + GatheringMatchedRoom = new GatheringMatchedRoom(json["matched_room_id"].ToString()); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatLogContentBase.cs b/SVSim.BattleEngine/Engine/Wizard/ChatLogContentBase.cs new file mode 100644 index 0000000..cc1dc3a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatLogContentBase.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public abstract class ChatLogContentBase : MonoBehaviour +{ + protected IChatSettings _chatSettings; + + protected ChatConnectController _chatConnectCtr; + + protected ChatLogUI.PartsForPlate _partsForPlate; + + public abstract List ListMessagetType { get; } + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectCtr, ChatLogUI.PartsForPlate partsForPlate) + { + _chatSettings = chatSettings; + _chatConnectCtr = chatConnectCtr; + _partsForPlate = partsForPlate; + OnInit(); + } + + protected virtual void OnInit() + { + } + + public abstract void SetData(ChatMessageInfo messageInfo); + + public abstract Vector2 GetSize(ChatMessageInfo messageInfo); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatLogPartsNotice.cs b/SVSim.BattleEngine/Engine/Wizard/ChatLogPartsNotice.cs new file mode 100644 index 0000000..146f82b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatLogPartsNotice.cs @@ -0,0 +1,45 @@ +using UnityEngine; + +namespace Wizard; + +public class ChatLogPartsNotice : MonoBehaviour +{ + private const int PADDING_NOTICE_MESSAGE_AND_FRAME = 42; + + [SerializeField] + private UILabel _labelEndNotice; + + [SerializeField] + private UILabel _labelShareNotice; + + public void SetText(string text, bool isEnd) + { + _labelEndNotice.gameObject.SetActive(isEnd); + _labelShareNotice.gameObject.SetActive(!isEnd); + if (isEnd) + { + _labelEndNotice.text = text; + } + else + { + _labelShareNotice.text = text; + } + } + + public Vector2 GetSize(string text, bool isEnd) + { + UILabel uILabel = _labelShareNotice; + if (isEnd) + { + uILabel = _labelEndNotice; + } + string text2 = uILabel.text; + uILabel.InitializeFont(); + uILabel.text = text; + uILabel.ProcessText(); + int num = 42 + uILabel.width; + int height = uILabel.height; + uILabel.text = text2; + return new Vector2(num, height); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatLogPlate.cs b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlate.cs new file mode 100644 index 0000000..2146550 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlate.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatLogPlate : UIBase +{ + private const int MARGIN_UNREAD_MESSAGE = 26; + + [SerializeField] + private Transform _layoutRoot; + + [SerializeField] + private ChatLogPlateLayoutMember _layoutOwn; + + [SerializeField] + private ChatLogPlateLayoutMember _layoutOtherMember; + + [SerializeField] + private ChatLogPlateLayoutNoMember _layoutNoMember; + + [SerializeField] + private GameObject _unreadMessageUI; + + private ChatMessageInfo _messageInfo; + + private Func, bool> _funcIsLoadedResources; + + public int GetHeightSize(ChatMessageInfo messageInfo, bool isUnreadMessage) + { + int num = (int)GetDisplayByMessageInfo(messageInfo).GetPlateSize(messageInfo).y; + if (isUnreadMessage) + { + num += 26; + } + return num; + } + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, ChatLogUI.PartsForPlate partsForPlate, Func, bool> funcIsLoadedResources) + { + _funcIsLoadedResources = funcIsLoadedResources; + _layoutOwn.Init(chatSettings, chatConnectController, partsForPlate); + _layoutOtherMember.Init(chatSettings, chatConnectController, partsForPlate); + _layoutNoMember.Init(chatSettings, chatConnectController, partsForPlate); + } + + public void SetData(ChatMessageInfo messageInfo, bool isUnreadMessage) + { + ClearDisplay(); + if (messageInfo != null) + { + _messageInfo = messageInfo; + UpdateUnreadMessage(isUnreadMessage); + UpdateDisplay(); + } + } + + private void ClearDisplay() + { + _layoutRoot.localPosition = Vector3.zero; + _unreadMessageUI.gameObject.SetActive(value: false); + _layoutOwn.ClearDisplay(); + _layoutOwn.gameObject.SetActive(value: false); + _layoutOtherMember.ClearDisplay(); + _layoutOtherMember.gameObject.SetActive(value: false); + _layoutNoMember.ClearDisplay(); + _layoutNoMember.gameObject.SetActive(value: false); + } + + private ChatLogPlateLayoutBase GetDisplayByMessageInfo(ChatMessageInfo info) + { + ChatLogPlateLayoutBase result = null; + switch (info.TalkerType) + { + case ChatMessageInfo.eTalkerType.NO_MEMBER: + result = _layoutNoMember; + break; + case ChatMessageInfo.eTalkerType.OTHER: + result = _layoutOtherMember; + break; + case ChatMessageInfo.eTalkerType.OWN: + result = _layoutOwn; + break; + } + return result; + } + + private void UpdateUnreadMessage(bool isUnreadMessage) + { + _unreadMessageUI.gameObject.SetActive(isUnreadMessage); + if (isUnreadMessage) + { + _layoutRoot.localPosition = Vector3.down * 26f; + } + else + { + _layoutRoot.localPosition = Vector3.zero; + } + } + + private void UpdateDisplay() + { + ChatLogPlateLayoutBase logDisplay = GetDisplayByMessageInfo(_messageInfo); + logDisplay.gameObject.SetActive(value: true); + logDisplay.SetDisplayBeforeLoad(_messageInfo); + StartCoroutine(CheckResouceLoaded(_messageInfo.MessageId, _messageInfo.GetResourcePathList(), delegate + { + logDisplay.SetDisplayAfterLoad(_messageInfo); + })); + } + + private IEnumerator CheckResouceLoaded(int messageId, List checkResourceList, Action onLoadEndCallback) + { + while (true) + { + if (_messageInfo.MessageId != messageId) + { + yield break; + } + if (_funcIsLoadedResources.Call(checkResourceList)) + { + break; + } + yield return null; + } + onLoadEndCallback.Call(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutBase.cs b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutBase.cs new file mode 100644 index 0000000..76b89dd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutBase.cs @@ -0,0 +1,91 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public abstract class ChatLogPlateLayoutBase : MonoBehaviour +{ + protected ChatConnectController _chatConnectController; + + [SerializeField] + private List _listLogContent; + + private Dictionary _contentList; + + public abstract Vector2 GetPlateSize(ChatMessageInfo messageInfo); + + protected abstract void OnClearDisplay(); + + protected abstract void OnSetDisplayBeforeLoad(ChatMessageInfo messageInfo); + + protected abstract void OnSetDisplayAfterLoad(ChatMessageInfo messageInfo); + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, ChatLogUI.PartsForPlate partsForPlate) + { + _chatConnectController = chatConnectController; + InitContentList(chatSettings, partsForPlate); + } + + public void ClearDisplay() + { + ClearAllContentDisplay(); + OnClearDisplay(); + } + + public void SetDisplayBeforeLoad(ChatMessageInfo messageInfo) + { + OnSetDisplayBeforeLoad(messageInfo); + } + + public void SetDisplayAfterLoad(ChatMessageInfo messageInfo) + { + SetContentDisplay(messageInfo); + OnSetDisplayAfterLoad(messageInfo); + } + + protected Vector2 GetContentSize(ChatMessageInfo messageInfo) + { + return GetContent(messageInfo.MessageType).GetSize(messageInfo); + } + + private void SetContentDisplay(ChatMessageInfo messageInfo) + { + ChatLogContentBase content = GetContent(messageInfo.MessageType); + content.gameObject.SetActive(value: true); + content.SetData(messageInfo); + } + + private void InitContentList(IChatSettings chatSettings, ChatLogUI.PartsForPlate partsForPlate) + { + _contentList = new Dictionary(); + foreach (ChatLogContentBase item in _listLogContent) + { + foreach (ChatMessageInfo.eMessageType item2 in item.ListMessagetType) + { + _contentList[item2] = item; + } + } + foreach (KeyValuePair content in _contentList) + { + content.Value.Init(chatSettings, _chatConnectController, partsForPlate); + } + } + + private ChatLogContentBase GetContent(ChatMessageInfo.eMessageType messageType) + { + _contentList.TryGetValue(messageType, out var value); + return value; + } + + private void ClearAllContentDisplay() + { + foreach (KeyValuePair content in _contentList) + { + ChatLogContentBase value = content.Value; + if (value != null) + { + value.gameObject.SetActive(value: false); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutMember.cs b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutMember.cs new file mode 100644 index 0000000..9a9afc3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutMember.cs @@ -0,0 +1,76 @@ +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatLogPlateLayoutMember : ChatLogPlateLayoutBase +{ + private readonly Vector2 BASE_SIZE_WITHOUT_CONTENT_DISPLAY = new Vector2(100f, 29f); + + private readonly Vector2 MIN_SIZE_SPRITE_FRAME = new Vector2(48f, 39f); + + [SerializeField] + private UISprite _spriteFrame; + + [SerializeField] + private UITexture _textureEmblem; + + [SerializeField] + private UILabel _labelUserName; + + [SerializeField] + private UILabel _labelSendTime; + + [SerializeField] + private ChatLogPartsNotice _noticeUI; + + public override Vector2 GetPlateSize(ChatMessageInfo messageInfo) + { + Vector2 result = GetContentSize(messageInfo) + BASE_SIZE_WITHOUT_CONTENT_DISPLAY; + result.y = Mathf.Max(result.y, _textureEmblem.height); + return result; + } + + protected override void OnClearDisplay() + { + _spriteFrame.gameObject.SetActive(value: false); + _textureEmblem.enabled = false; + _labelUserName.gameObject.SetActive(value: false); + _labelSendTime.gameObject.SetActive(value: false); + _noticeUI.gameObject.SetActive(value: false); + } + + protected override void OnSetDisplayBeforeLoad(ChatMessageInfo messageInfo) + { + SetUserDisplay(messageInfo); + } + + protected override void OnSetDisplayAfterLoad(ChatMessageInfo messageInfo) + { + SetUserEmblem(messageInfo.UserInfo.EmblemId); + SetDisplayFrame(messageInfo); + } + + private void SetDisplayFrame(ChatMessageInfo messageInfo) + { + _spriteFrame.gameObject.SetActive(value: true); + Vector2 contentSize = GetContentSize(messageInfo); + _spriteFrame.width = Mathf.Max((int)MIN_SIZE_SPRITE_FRAME.x, (int)contentSize.x); + _spriteFrame.height = Mathf.Max((int)MIN_SIZE_SPRITE_FRAME.y, (int)contentSize.y); + } + + private void SetUserDisplay(ChatMessageInfo messageInfo) + { + _labelUserName.text = messageInfo.UserInfo.Name; + _labelUserName.gameObject.SetActive(value: true); + _labelSendTime.text = messageInfo.GetCreateTimeText(); + _labelSendTime.gameObject.SetActive(value: true); + } + + private void SetUserEmblem(long emblemId) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(emblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true); + _textureEmblem.enabled = true; + _textureEmblem.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath) as Texture; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutNoMember.cs b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutNoMember.cs new file mode 100644 index 0000000..d34368d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatLogPlateLayoutNoMember.cs @@ -0,0 +1,36 @@ +using UnityEngine; + +namespace Wizard; + +public class ChatLogPlateLayoutNoMember : ChatLogPlateLayoutBase +{ + [SerializeField] + private UISprite _spriteBG; + + public override Vector2 GetPlateSize(ChatMessageInfo messageInfo) + { + return GetContentSize(messageInfo); + } + + protected override void OnClearDisplay() + { + _spriteBG.gameObject.SetActive(value: true); + } + + protected override void OnSetDisplayBeforeLoad(ChatMessageInfo messageInfo) + { + SetDisplayBG(messageInfo); + } + + protected override void OnSetDisplayAfterLoad(ChatMessageInfo messageInfo) + { + } + + private void SetDisplayBG(ChatMessageInfo messageInfo) + { + _spriteBG.gameObject.SetActive(value: true); + Vector2 plateSize = GetPlateSize(messageInfo); + _spriteBG.width = (int)plateSize.x; + _spriteBG.height = (int)plateSize.y; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatLogUI.cs b/SVSim.BattleEngine/Engine/Wizard/ChatLogUI.cs new file mode 100644 index 0000000..a721acd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatLogUI.cs @@ -0,0 +1,511 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatLogUI : MonoBehaviour +{ + public class PartsForPlate + { + public ChatDeckView DeckView { get; private set; } + + public PartsForPlate(ChatDeckView chatDeckView) + { + DeckView = chatDeckView; + } + } + + public const int INVALID_UNREAD_MESSAGE_ID = -1; + + public const int SCROLL_OBJECT_NUM = 10; + + private const int SCROLL_OBJECT_MARGIN = 10; + + [SerializeField] + private UIButton _buttonToNewMessage; + + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private UIWrapVariableContentVertical _wrapVariableContent; + + [SerializeField] + private UIScrollBarWrapContent _scrollBarWrapContent; + + [SerializeField] + private WrapVariableContentsScrollBarSize _wrapContentScrollBarSize; + + private UIPanel _panelScrollView; + + private float _startBaseClipRegionY; + + private float _startBaseClipRegionW; + + private ChatLogPlate _logPlateOriginal; + + private ChatLogPlate _logPlateForSizeCalcDummyObject; + + private List _plateList = new List(); + + private List _loadedResourceList = new List(); + + [SerializeField] + private ChatDeckView _chatDeckView; + + private bool _isCreateFinish; + + private Action _onInitializeOldestLog; + + private int _unreadMessageId; + + private int _oldUnreadMessageId = -1; + + private List _dependOpenCloseAnimationList = new List(); + + private float _scrollViewBasePosY; + + private bool _isFollowingAnimation; + + private Coroutine _bottomScrollViewAnimationCoroutin; + + private float _bottomScrollViewAnimationDistance; + + private IChatSettings _chatSettings; + + private ChatConnectController _chatConnectController; + + private List _stampList; + + private PartsForPlate _partsForPlate; + + public bool IsEnableUpdateUI { get; private set; } + + public List ChatVisibleLogList { get; private set; } = new List(); + + public List ChatAllLogList { get; private set; } = new List(); + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, List stampList) + { + _chatSettings = chatSettings; + _chatConnectController = chatConnectController; + _stampList = stampList; + _logPlateOriginal = chatSettings.PrefabChatLogPlate; + _chatDeckView.Init(chatSettings.ApiSettings, chatConnectController, CloseChatLogContent); + _partsForPlate = new PartsForPlate(_chatDeckView); + } + + public void ShowDeckViewByDeckLog(ChatMessageInfo.DeckLogData deckLogData, Action onOpen = null, Action onClose = null, Action>> onDeleteDeckSuccess = null) + { + _chatDeckView.ShowDeckViewByDeckLog(deckLogData, onOpen, onClose, onDeleteDeckSuccess); + } + + public void ShowDeckViewByDeckData(DeckData deck, Action onOpen, Action onClose, bool isActiveRedButton, bool isActiveDeckIntroductionObj) + { + _chatDeckView.ShowDeckViewByDeckData(deck, onOpen, onClose, isActiveRedButton, isActiveDeckIntroductionObj); + } + + public void CloseDeckView() + { + _chatDeckView.CloseDeckView(); + } + + public bool IsShowDeckView() + { + return _chatDeckView.IsShowDeckCardView(); + } + + public void CreateChatLogView(List messageList, Action onInitializeOldestLog, Action onFinCallBack, int unreadMessageId = -1) + { + _onInitializeOldestLog = onInitializeOldestLog; + _panelScrollView = _scrollView.GetComponent(); + Vector4 baseClipRegion = _panelScrollView.baseClipRegion; + _startBaseClipRegionY = baseClipRegion.y; + _startBaseClipRegionW = baseClipRegion.w; + _buttonToNewMessage.onClick.Clear(); + _buttonToNewMessage.onClick.Add(new EventDelegate(delegate + { + MoveNewMessagePosition(); + })); + _buttonToNewMessage.gameObject.SetActive(value: false); + _unreadMessageId = unreadMessageId; + AddChatLogInfo(messageList, Chat.eRequestDirection.OLD); + List chatLogAssetPathList = GetChatLogAssetPathList(ChatVisibleLogList); + for (int num = 0; num < _stampList.Count; num++) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(_stampList[num].ToString(), ResourcesManager.AssetLoadPathType.Stamp); + chatLogAssetPathList.Add(assetTypePath); + } + LoadResources(chatLogAssetPathList, delegate + { + CreateScrollView(ChatVisibleLogList); + ResetScrollDefaultPosition(unreadMessageId); + onFinCallBack.Call(); + _isCreateFinish = true; + }); + } + + public void CloseChatLogView() + { + UnloadResources(); + } + + public void ResetScrollDefaultPosition(int unreadMessageId = -1) + { + int centerIndex = Mathf.Max(ChatVisibleLogList.Count - 1, 0); + if (unreadMessageId != -1) + { + int num = ChatVisibleLogList.FindIndex((ChatMessageInfo log) => log.MessageId == unreadMessageId); + if (num >= 0) + { + centerIndex = num; + } + } + _wrapVariableContent.ResetScrollPositionByIndex(centerIndex); + } + + public void SetEnableUpdateUI() + { + if (IsEnableUpdateUI) + { + return; + } + IsEnableUpdateUI = true; + if (_oldUnreadMessageId != -1) + { + UpdateChatLogSizeByIndex(ChatVisibleLogList.FindIndex((ChatMessageInfo info) => info.MessageId == _oldUnreadMessageId)); + _oldUnreadMessageId = -1; + } + _wrapContentScrollBarSize.ContentUpdate(); + _wrapVariableContent.WrapContent(); + } + + public void AddChatLogView(ChatInfo chatInfo, Chat.eRequestDirection eDirection, bool in_enableUpdateUI = true, Action onFinCallBack = null) + { + if (chatInfo.MessageList.Count <= 0) + { + onFinCallBack.Call(); + return; + } + AddChatLogInfo(chatInfo.MessageList, eDirection); + if (chatInfo.VisibleMessageList.Count <= 0) + { + onFinCallBack.Call(); + return; + } + if (eDirection == Chat.eRequestDirection.NEW && IsEnableUpdateUI && !in_enableUpdateUI) + { + _oldUnreadMessageId = _unreadMessageId; + _unreadMessageId = chatInfo.VisibleMessageList[0].MessageId; + } + IsEnableUpdateUI = in_enableUpdateUI; + bool flag = _wrapVariableContent.IsBottom(); + List chatLogAssetPathList = GetChatLogAssetPathList(chatInfo.VisibleMessageList); + LoadResources(chatLogAssetPathList); + AddScrollPlate(chatInfo.VisibleMessageList, eDirection); + if (eDirection == Chat.eRequestDirection.NEW && flag && IsEnableUpdateUI) + { + MoveNewMessagePosition(); + } + onFinCallBack.Call(); + } + + public void MoveNewMessagePosition() + { + if (_wrapVariableContent.IsScrollEnableSize()) + { + _wrapVariableContent.ResetScrollPositionBottomEasing(); + } + } + + public void ChangeLogViewSizeByInputUIAnimation(ChatOpenCloseAnimation sendUIAnimation) + { + _scrollBarWrapContent.gameObject.SetActive(value: false); + _buttonToNewMessage.gameObject.SetActive(value: false); + if (!_dependOpenCloseAnimationList.Contains(sendUIAnimation)) + { + _dependOpenCloseAnimationList.Add(sendUIAnimation); + } + if (_dependOpenCloseAnimationList.All((ChatOpenCloseAnimation x) => x.IsAnimationStartFromOpenedOrClosed)) + { + _isFollowingAnimation = IsEnableFollowAnimation(); + float num = (_isFollowingAnimation ? GetDependOpenCloseAnimationHeight() : 0f); + _scrollViewBasePosY = _scrollView.transform.localPosition.y - num; + if (_isFollowingAnimation && _bottomScrollViewAnimationCoroutin == null) + { + _bottomScrollViewAnimationCoroutin = StartCoroutine(CalcHeightBottomScrollViewAnimation()); + } + } + } + + private IEnumerator CalcHeightBottomScrollViewAnimation() + { + float distance = _wrapVariableContent.GetDistanceBetweenBottomItemAndScrollBottomPos(); + float durationTime = _dependOpenCloseAnimationList.Max((ChatOpenCloseAnimation x) => x.AnimationTime); + _bottomScrollViewAnimationDistance = 0f; + CustomEasing easing = new CustomEasing(CustomEasing.eType.outQuad, 0f, distance, durationTime); + while (easing.IsMoving) + { + _bottomScrollViewAnimationDistance = easing.GetCurVal(Time.deltaTime); + yield return null; + } + _bottomScrollViewAnimationDistance = distance; + _bottomScrollViewAnimationCoroutin = null; + } + + private void CloseChatLogContent(int messageId) + { + int num = ChatVisibleLogList.FindIndex((ChatMessageInfo log) => log.MessageId == messageId); + if (num >= 0) + { + ChatVisibleLogList[num].CloseContent(); + UpdateChatLogSizeByIndex(num); + } + } + + private void UpdateChatLogSizeByIndex(int index) + { + if (index >= 0 && ChatVisibleLogList.Count >= index) + { + _wrapVariableContent.UpdateItemSize(index, GetHeightPlateSize(ChatVisibleLogList[index])); + _wrapContentScrollBarSize.ContentUpdate(); + } + } + + private bool IsEnableFollowAnimation() + { + if (!_wrapVariableContent.IsScrollEnableSize()) + { + return false; + } + if (!_wrapVariableContent.IsBottom()) + { + return false; + } + if (_wrapVariableContent.TopOverflowItemSize() < GetDependOpenCloseAnimationHeight()) + { + return false; + } + return true; + } + + private float GetDependOpenCloseAnimationHeight() + { + float num = 0f; + foreach (ChatOpenCloseAnimation dependOpenCloseAnimation in _dependOpenCloseAnimationList) + { + float num2 = num; + num2 = ((!dependOpenCloseAnimation.IsMoving) ? ((!dependOpenCloseAnimation.IsOpen) ? 0f : dependOpenCloseAnimation.OpenHeight) : dependOpenCloseAnimation.CurrentPosHeight); + num = Mathf.Max(num, num2); + } + return num; + } + + private void Update() + { + UpdateButtonToNewMessage(); + } + + private void UpdateButtonToNewMessage() + { + if (IsEnableUpdateUI && _dependOpenCloseAnimationList.Count <= 0) + { + _buttonToNewMessage.gameObject.SetActive(!_wrapVariableContent.IsBottom()); + } + } + + private void LateUpdate() + { + if (IsUpdateLogViewSize()) + { + UpdateLogViewSizeDependAnimation(); + } + } + + private bool IsUpdateLogViewSize() + { + return _dependOpenCloseAnimationList.Any((ChatOpenCloseAnimation x) => x.IsMoving || !x.IsOpen); + } + + private void UpdateLogViewSizeDependAnimation() + { + float dependOpenCloseAnimationHeight = GetDependOpenCloseAnimationHeight(); + Vector4 baseClipRegion = _panelScrollView.baseClipRegion; + baseClipRegion.y = _startBaseClipRegionY + dependOpenCloseAnimationHeight * 0.5f; + baseClipRegion.w = _startBaseClipRegionW - dependOpenCloseAnimationHeight; + _panelScrollView.baseClipRegion = baseClipRegion; + float num = _scrollViewBasePosY; + if (_isFollowingAnimation) + { + num += dependOpenCloseAnimationHeight + _bottomScrollViewAnimationDistance; + } + _wrapVariableContent.MoveScrollPanel(num); + _dependOpenCloseAnimationList.RemoveAll((ChatOpenCloseAnimation x) => !x.IsMoving && !x.IsOpen); + _scrollBarWrapContent.gameObject.SetActive(_dependOpenCloseAnimationList.Count == 0 && _wrapVariableContent.IsScrollEnableSize()); + } + + private void AddChatLogInfo(List addChatLogList, Chat.eRequestDirection eDirection) + { + if (eDirection == Chat.eRequestDirection.OLD) + { + for (int num = addChatLogList.Count - 1; num >= 0; num--) + { + ChatAllLogList.Insert(0, addChatLogList[num]); + } + } + else + { + ChatAllLogList.AddRange(addChatLogList); + } + ChatVisibleLogList = ChatAllLogList.Where((ChatMessageInfo log) => log.IsVisibleMessage).ToList(); + } + + private List GetChatLogAssetPathList(List logList) + { + List list = new List(); + List list2 = new List(); + for (int i = 0; i < logList.Count; i++) + { + list.AddRange(logList[i].GetResourcePathList()); + } + list = list.Distinct().ToList(); + for (int j = 0; j < list.Count; j++) + { + string item = list[j]; + if (!_loadedResourceList.Contains(item)) + { + list2.Add(item); + } + } + return list2; + } + + private void LoadResources(List resourcePathList, Action callBack = null) + { + if (resourcePathList.Count <= 0) + { + callBack.Call(); + return; + } + UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(resourcePathList, delegate + { + _loadedResourceList.AddRange(resourcePathList); + callBack.Call(); + })); + } + + private void CreateScrollView(List addChatLogList) + { + _wrapVariableContent.gameObject.SetActive(value: false); + _scrollBarWrapContent.m_WrapContents = _wrapVariableContent; + _scrollBarWrapContent.gameObject.SetActive(value: true); + _scrollView.gameObject.SetActive(value: true); + _wrapVariableContent.Init(10, 0, 0, OnInitializeItem); + _wrapVariableContent.gameObject.SetActive(value: true); + if (ChatVisibleLogList.Count > 0) + { + AddScrollPlate(addChatLogList, Chat.eRequestDirection.OLD); + } + } + + private void AddScrollPlate(List addChatLogList, Chat.eRequestDirection eDirection) + { + List list = new List(); + foreach (ChatMessageInfo addChatLog in addChatLogList) + { + int heightPlateSize = GetHeightPlateSize(addChatLog); + if (heightPlateSize > 0) + { + list.Add(heightPlateSize); + } + } + _wrapVariableContent.AddItemList(list, eDirection == Chat.eRequestDirection.NEW); + if (_plateList.Count < 10) + { + _wrapVariableContent.enabled = true; + for (int i = _plateList.Count; i < ChatVisibleLogList.Count && i < 10; i++) + { + ChatLogPlate item = CreateLogPlate(_wrapVariableContent.gameObject); + _plateList.Add(item); + } + for (int j = 0; j < _plateList.Count; j++) + { + _plateList[j].gameObject.SetActive(value: true); + } + _wrapVariableContent.SortBasedOnScrollMovement(); + if (!_wrapVariableContent.IsScrollEnableSize()) + { + _scrollView.ResetPosition(); + } + } + if (IsEnableUpdateUI) + { + _wrapContentScrollBarSize.ContentUpdate(); + _wrapVariableContent.WrapContent(); + } + } + + private int GetHeightPlateSize(ChatMessageInfo logInfo) + { + if (_logPlateForSizeCalcDummyObject == null) + { + _logPlateForSizeCalcDummyObject = CreateLogPlate(base.gameObject); + _logPlateForSizeCalcDummyObject.gameObject.SetActive(value: false); + } + return _logPlateForSizeCalcDummyObject.GetHeightSize(logInfo, logInfo.MessageId == _unreadMessageId) + 10; + } + + private ChatLogPlate CreateLogPlate(GameObject rootObj) + { + ChatLogPlate component = NGUITools.AddChild(rootObj, _logPlateOriginal.gameObject).GetComponent(); + component.Init(_chatSettings, _chatConnectController, _partsForPlate, IsLoadedResources); + return component; + } + + private void OnInitializeItem(GameObject go, int wrapIndex, int realIndex) + { + int num = -realIndex; + if (num >= ChatVisibleLogList.Count || num < 0) + { + go.SetActive(value: false); + return; + } + go.SetActive(value: true); + ChatMessageInfo chatMessageInfo = ChatVisibleLogList[num]; + go.GetComponent().SetData(chatMessageInfo, chatMessageInfo.MessageId == _unreadMessageId); + if (num == 0 && _isCreateFinish) + { + _onInitializeOldestLog.Call(); + } + } + + private void OnDestroy() + { + UnloadResources(); + } + + private bool IsLoadedResources(List checkResourceList) + { + for (int i = 0; i < checkResourceList.Count; i++) + { + if (!_loadedResourceList.Contains(checkResourceList[i])) + { + return false; + } + } + return true; + } + + private void UnloadResources() + { + if (_loadedResourceList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatMessageInfo.cs b/SVSim.BattleEngine/Engine/Wizard/ChatMessageInfo.cs new file mode 100644 index 0000000..24b536e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatMessageInfo.cs @@ -0,0 +1,411 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using LitJson; + +namespace Wizard; + +public class ChatMessageInfo +{ + public class RoomMatchData + { + public string RoomId { get; private set; } + + public BattleParameter BattleParameterInstance { get; private set; } + + public bool IsWatchEnabled { get; private set; } + + public RoomMatchData(JsonData json) + { + RoomId = json["room_id"].ToString(); + BattleParameterInstance = BattleParameter.JsonToBattleParameter(json); + IsWatchEnabled = json["is_watch_enabled"].ToInt() == 1; + } + } + + public class DeckLogData + { + public int MessageId { get; private set; } + + public bool IsAbleDeleteDeck { get; private set; } + + public DeckData DeckData { get; private set; } + + public DeckLogData(JsonData jsonData) + { + Format format = Data.ParseApiFormat(jsonData["deck_format"].ToInt()); + DeckData = new DeckData(format, DeckAttributeType.CustomDeck); + DeckData.Initialize(jsonData); + DeckData.SetDeckSleeveID(3000011L); + DeckData.SetSkinId(DeckData.GetSkinId(isDefaultSkin: true)); + MessageId = jsonData["message_id"].ToInt(); + IsAbleDeleteDeck = jsonData["delete_permission_exists"].ToBoolean(); + } + + public static List ParseDeckDataList(JsonData jsonDeckList) + { + List list = new List(); + for (int i = 0; i < jsonDeckList.Count; i++) + { + list.Add(new DeckLogData(jsonDeckList[i])); + } + return list; + } + + public static List ConvertDeckDataList(List deckLogDataList) + { + return deckLogDataList.ConvertAll((DeckLogData log) => log.DeckData); + } + + public static DeckLogData GetDeckLogDataByDeckId(List deckLogDataList, int deckId) + { + return deckLogDataList.Find((DeckLogData data) => data.DeckData.GetDeckID() == deckId); + } + } + + public class GatheringWinnerUsers + { + public List WinnerList { get; private set; } = new List(); + + public GatheringWinnerUsers(string message, List chatUserList) + { + if (message == "") + { + return; + } + string[] array = message.Split(','); + foreach (string s in array) + { + ChatUserInfo item = null; + if (int.TryParse(s, out var viewerId)) + { + item = chatUserList.First((ChatUserInfo data) => data.ViewerId == viewerId); + } + WinnerList.Add(item); + } + } + } + + public class GatheringTournamentRoomData + { + public RoomMatchData RoomData { get; private set; } + + public ChatUserInfo User1 { get; private set; } + + public ChatUserInfo User2 { get; private set; } + + public bool IsMyselfMathcedRoom + { + get + { + if (!User1.IsMyself()) + { + return User2.IsMyself(); + } + return true; + } + } + + public GatheringTournamentRoomData(JsonData jsonData, List chatUserList) + { + RoomData = new RoomMatchData(jsonData["room"]); + int viewerId1 = jsonData["viewer_id1"].ToInt(); + int viewerId2 = jsonData["viewer_id2"].ToInt(); + User1 = chatUserList.First((ChatUserInfo data) => data.ViewerId == viewerId1); + User2 = chatUserList.First((ChatUserInfo data) => data.ViewerId == viewerId2); + } + } + + public enum eMessageType + { + NORMAL = 0, + STAMP = 1, + DECK = 2, + JOIN = 3, + LEAVE = 4, + REPLAY = 5, + CHANGE_LEADER = 6, + CHANGE_SUB_LEADER = 7, + CREATE_GUILD = 8, + REMOVE = 9, + ROOM_MATCH = 10, + DESCRIPTION = 11, + GATHERING_CREATE = 12, + GATHERING_JOIN = 13, + GATHERING_LEAVE = 14, + GATHERING_REMOVE = 15, + GATHERING_BATTLE_START = 16, + GATHERING_BATTLE_END = 17, + GATHERING_TOURNAMENT_ROOM = 18, + INVALID_VALUE = -1 + } + + public enum eTalkerType + { + INVALID, + NO_MEMBER, + OWN, + OTHER + } + + public bool IsVisibleMessage { get; private set; } = true; + + public bool IsCloseContent { get; private set; } + + public eTalkerType TalkerType + { + get + { + eTalkerType result = eTalkerType.INVALID; + switch (MessageType) + { + case eMessageType.JOIN: + case eMessageType.LEAVE: + case eMessageType.CHANGE_LEADER: + case eMessageType.CHANGE_SUB_LEADER: + case eMessageType.CREATE_GUILD: + case eMessageType.REMOVE: + case eMessageType.DESCRIPTION: + case eMessageType.GATHERING_CREATE: + case eMessageType.GATHERING_JOIN: + case eMessageType.GATHERING_LEAVE: + case eMessageType.GATHERING_REMOVE: + case eMessageType.GATHERING_BATTLE_START: + case eMessageType.GATHERING_BATTLE_END: + case eMessageType.GATHERING_TOURNAMENT_ROOM: + result = eTalkerType.NO_MEMBER; + break; + case eMessageType.NORMAL: + case eMessageType.STAMP: + case eMessageType.DECK: + case eMessageType.REPLAY: + case eMessageType.ROOM_MATCH: + result = ((ViewerId != PlayerStaticData.UserViewerID) ? eTalkerType.OTHER : eTalkerType.OWN); + break; + } + return result; + } + } + + public int ViewerId { get; private set; } + + public ChatUserInfo UserInfo { get; private set; } + + public int MessageId { get; private set; } + + public eMessageType MessageType { get; private set; } + + public string Message { get; private set; } + + public int CreateTime { get; private set; } + + public int StampId { get; private set; } + + public ReplayInfoItem ReplayInfo { get; private set; } + + public DeckLogData DeckInfo { get; private set; } + + public RoomMatchData RoomData { get; private set; } + + public GatheringWinnerUsers GatheringWinnerUsersInfo { get; private set; } + + public GatheringTournamentRoomData GatheringTournamentRoom { get; private set; } + + public ChatMessageInfo(eMessageType messageType) + { + initialize(); + MessageType = messageType; + } + + public ChatMessageInfo(JsonData messageData, List userList) + { + initialize(); + ParseMessageData(messageData, userList); + } + + public string GetCreateTimeText() + { + return ConvertTime.DateTimeToAgoText(ConvertTime.ToLocalByDateTime(ConvertTime.UnixTimeToDateTime(CreateTime))); + } + + public List GetResourcePathList() + { + List loadPath = new List(); + switch (MessageType) + { + case eMessageType.STAMP: + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(StampId.ToString(), ResourcesManager.AssetLoadPathType.Stamp)); + break; + case eMessageType.DECK: + if (DeckInfo != null) + { + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(DeckInfo.DeckData.GetDeckSleeveID()); + Sleeve sleeve = Data.Master.SleeveMgr.Get(existingSleeveId); + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture)); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve); + } + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(DeckInfo.DeckData.GetSkinId().ToString(), ResourcesManager.AssetLoadPathType.DeckListTexture)); + } + break; + case eMessageType.REPLAY: + if (ReplayInfo != null) + { + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(UserInfo.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_S)); + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(ReplayInfo.OpponentEmblemId, ResourcesManager.AssetLoadPathType.Emblem_S)); + } + break; + case eMessageType.GATHERING_BATTLE_END: + foreach (ChatUserInfo winner in GatheringWinnerUsersInfo.WinnerList) + { + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(winner.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_S)); + } + break; + case eMessageType.GATHERING_TOURNAMENT_ROOM: + if (GatheringTournamentRoom != null) + { + loadPath.AddRange(GatheringTournamentRoom.User1.GetResourcePathList()); + loadPath.AddRange(GatheringTournamentRoom.User2.GetResourcePathList()); + } + break; + } + if ((TalkerType == eTalkerType.OWN || TalkerType == eTalkerType.OTHER) && UserInfo != null) + { + loadPath.AddRange(UserInfo.GetResourcePathList()); + } + return loadPath.Distinct().ToList(); + } + + public void CloseContent() + { + IsCloseContent = true; + ReplayInfo = null; + DeckInfo = null; + RoomData = null; + GatheringTournamentRoom = null; + } + + private void initialize() + { + ViewerId = 0; + MessageId = 0; + MessageType = eMessageType.NORMAL; + Message = null; + CreateTime = 0; + StampId = 0; + ReplayInfo = null; + DeckInfo = null; + } + + private void ParseMessageData(JsonData json, List userList) + { + ViewerId = json["viewer_id"].ToInt(); + MessageId = json["message_id"].ToInt(); + int num = json["message_type"].ToInt(); + if (Enum.IsDefined(typeof(eMessageType), num)) + { + MessageType = (eMessageType)num; + } + CreateTime = json["create_time"].ToInt(); + switch (MessageType) + { + case eMessageType.NORMAL: + Message = json["message"].ToString(); + break; + case eMessageType.STAMP: + StampId = json["message"].ToInt(); + break; + case eMessageType.REPLAY: + ParseReplayData(json); + break; + case eMessageType.DECK: + ParseDeckData(json); + break; + case eMessageType.ROOM_MATCH: + ParseRoomMatchData(json); + break; + case eMessageType.GATHERING_BATTLE_END: + GatheringWinnerUsersInfo = new GatheringWinnerUsers(json["message"].ToString(), userList); + break; + case eMessageType.GATHERING_TOURNAMENT_ROOM: + ParseGatheringTournamentRoomData(json, userList); + break; + } + SetUserInfo(userList); + } + + private void ParseReplayData(JsonData json) + { + if (json.Keys.Contains("replay")) + { + JsonData jsonData = json["replay"]; + if (jsonData == null) + { + ReplayInfo = null; + CloseContent(); + } + else + { + ReplayInfo = new ReplayInfoItem(jsonData); + } + } + } + + private void ParseDeckData(JsonData json) + { + if (json.Keys.Contains("deck")) + { + JsonData jsonData = json["deck"]; + if (jsonData == null) + { + DeckInfo = null; + CloseContent(); + } + else + { + DeckInfo = new DeckLogData(jsonData); + } + } + } + + private void ParseRoomMatchData(JsonData json) + { + if (json.Keys.Contains("room")) + { + JsonData jsonData = json["room"]; + if (jsonData == null) + { + RoomData = null; + CloseContent(); + } + else + { + RoomData = new RoomMatchData(jsonData); + } + } + } + + private void ParseGatheringTournamentRoomData(JsonData json, List userList) + { + if (json.Keys.Contains("room")) + { + IsVisibleMessage = json["viewer_id1"].ToInt() == PlayerStaticData.UserViewerID || json["viewer_id2"].ToInt() == PlayerStaticData.UserViewerID; + if (json["room"] == null) + { + GatheringTournamentRoom = null; + CloseContent(); + } + else + { + GatheringTournamentRoom = new GatheringTournamentRoomData(json, userList); + } + } + } + + private void SetUserInfo(List userList) + { + UserInfo = userList.Find((ChatUserInfo x) => x.ViewerId == ViewerId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatOpenCloseAnimation.cs b/SVSim.BattleEngine/Engine/Wizard/ChatOpenCloseAnimation.cs new file mode 100644 index 0000000..777b43b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatOpenCloseAnimation.cs @@ -0,0 +1,187 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatOpenCloseAnimation : MonoBehaviour +{ + public enum eState + { + CLOSED, + OPENED, + CLOSING, + OPENING + } + + public const float CLOSE_HEIGHT = 0f; + + [SerializeField] + private GameObject _animationObj; + + [SerializeField] + private bool _isActiveUpdate; + + [SerializeField] + private float _openPositionY; + + [SerializeField] + private float _closePositionY = -60f; + + [SerializeField] + private float _openAnimationTime = 0.3f; + + [SerializeField] + private float _closeAnimationTime = 0.2f; + + private Coroutine _coroutinAnimation; + + public eState State { get; private set; } + + public bool IsOpen + { + get + { + if (State != eState.OPENED) + { + return State == eState.OPENING; + } + return true; + } + } + + public bool IsMoving { get; private set; } + + public float CurrentPosHeight => _animationObj.transform.localPosition.y - _closePositionY; + + public float OpenHeight => _openPositionY - _closePositionY; + + public float AnimationTime + { + get + { + if (!IsOpen) + { + return _closeAnimationTime; + } + return _openAnimationTime; + } + } + + public bool IsAnimationStartFromOpenedOrClosed + { + get + { + if (State != eState.OPENING || !Mathf.Approximately(CurrentPosHeight, 0f)) + { + if (State == eState.CLOSING) + { + return Mathf.Approximately(CurrentPosHeight, OpenHeight); + } + return false; + } + return true; + } + } + + public void Init(bool isOpenedDefault) + { + ChangeOpenedClosedState(isOpenedDefault); + } + + public void ToggleStateAndStartAnimation() + { + switch (State) + { + case eState.CLOSED: + case eState.CLOSING: + StartOpenAnimation(); + break; + case eState.OPENED: + case eState.OPENING: + StartCloseAnimation(); + break; + } + } + + public void StartCloseAnimation(Action onAnimationEndCallBack = null) + { + if (IsOpen) + { + if (_coroutinAnimation != null) + { + StopCoroutine(_coroutinAnimation); + } + _coroutinAnimation = StartCoroutine(CloseAnimation(onAnimationEndCallBack)); + } + } + + public void StartOpenAnimation() + { + if (!IsOpen) + { + if (_coroutinAnimation != null) + { + StopCoroutine(_coroutinAnimation); + } + _animationObj.SetActive(value: true); + _coroutinAnimation = StartCoroutine(OpenAnimation()); + } + } + + private IEnumerator OpenAnimation() + { + State = eState.OPENING; + Vector3 basePos = _animationObj.transform.localPosition; + IsMoving = true; + float durationTime = _openAnimationTime * (1f - CurrentPosHeight / OpenHeight); + CustomEasing easing = new CustomEasing(CustomEasing.eType.outQuad, basePos.y, _openPositionY, durationTime); + while (easing.IsMoving) + { + yield return null; + float curVal = easing.GetCurVal(Time.deltaTime); + _animationObj.transform.localPosition = new Vector3(basePos.x, curVal, basePos.z); + if (State != eState.OPENING) + { + yield break; + } + } + IsMoving = false; + ChangeOpenedClosedState(isOpened: true); + } + + private IEnumerator CloseAnimation(Action onAnimationEndCallBack) + { + State = eState.CLOSING; + Vector3 basePos = _animationObj.transform.localPosition; + IsMoving = true; + float durationTime = _closeAnimationTime * CurrentPosHeight / OpenHeight; + CustomEasing easing = new CustomEasing(CustomEasing.eType.outQuad, basePos.y, _closePositionY, durationTime); + while (easing.IsMoving) + { + yield return null; + float curVal = easing.GetCurVal(Time.deltaTime); + _animationObj.transform.localPosition = new Vector3(basePos.x, curVal, basePos.z); + if (State != eState.CLOSING) + { + yield break; + } + } + IsMoving = false; + ChangeOpenedClosedState(isOpened: false); + onAnimationEndCallBack.Call(); + } + + private void ChangeOpenedClosedState(bool isOpened) + { + State = (isOpened ? eState.OPENED : eState.CLOSED); + Vector3 localPosition = _animationObj.transform.localPosition; + float y = (isOpened ? _openPositionY : _closePositionY); + _animationObj.transform.localPosition = new Vector3(localPosition.x, y, localPosition.z); + if (_isActiveUpdate) + { + _animationObj.SetActive(isOpened); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatReplayListDialog.cs b/SVSim.BattleEngine/Engine/Wizard/ChatReplayListDialog.cs new file mode 100644 index 0000000..9d32d3a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatReplayListDialog.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatReplayListDialog : MonoBehaviour +{ + [SerializeField] + private SimpleScrollViewUI _replayListScrollView; + + [SerializeField] + private UILabel _labelNoReplay; + + private List _listReplayInfoItem; + + private Action _onClickReplaySendBtn; + + private List _loadedResourceList = new List(); + + public void Init(List listReplayInfoItem, Action onClickReplaySendBtn) + { + _listReplayInfoItem = listReplayInfoItem; + _onClickReplaySendBtn = onClickReplaySendBtn; + CreateReplayList(); + } + + private void CreateReplayList() + { + bool flag = _listReplayInfoItem.Count <= 0; + _replayListScrollView.SetVisiable(!flag); + _labelNoReplay.gameObject.SetActive(flag); + if (!flag) + { + LoadResources(delegate + { + _replayListScrollView.CreateScrollView(_listReplayInfoItem.Count, OnInitializeContent); + }); + } + } + + private void OnInitializeContent(int index, GameObject plate) + { + ReplayInfoItem replayInfo = _listReplayInfoItem[index]; + plate.GetComponent().SetData(replayInfo, delegate + { + _onClickReplaySendBtn.Call(replayInfo); + }); + } + + private void LoadResources(Action callBack = null) + { + UIManager.GetInstance().createInSceneCenterLoading(); + List list = new List(); + foreach (ReplayInfoItem item in _listReplayInfoItem) + { + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentEmblemId, ResourcesManager.AssetLoadPathType.Emblem_S)); + if (!string.IsNullOrEmpty(item.OpponentCountryCode)) + { + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentCountryCode, ResourcesManager.AssetLoadPathType.Country_S)); + } + } + List loadPathList = list.Distinct().Except(_loadedResourceList).ToList(); + if (loadPathList.Count > 0) + { + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadPathList, delegate + { + _loadedResourceList.AddRange(loadPathList); + UIManager.GetInstance().closeInSceneCenterLoading(); + callBack.Call(); + })); + } + } + + private void UnloadResources() + { + if (_loadedResourceList.Count > 0) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList); + _loadedResourceList.Clear(); + } + } + + private void OnDestroy() + { + UnloadResources(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatReplaySendConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/ChatReplaySendConfirmDialog.cs new file mode 100644 index 0000000..8660a0c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatReplaySendConfirmDialog.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace Wizard; + +public class ChatReplaySendConfirmDialog : MonoBehaviour +{ + [SerializeField] + private ReplayContentView _replayInfoView; + + public void SetData(string ownName, long ownEmblemId, ReplayInfoItem replayInfoItem) + { + _replayInfoView.SetData(replayInfoItem); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatSendDeckUI.cs b/SVSim.BattleEngine/Engine/Wizard/ChatSendDeckUI.cs new file mode 100644 index 0000000..79d3122 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatSendDeckUI.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatSendDeckUI : MonoBehaviour, IChatActionUI +{ + private const int DEPTH_DECK_SHARE_CONFIRM_DIALOG = 15; + + [SerializeField] + private UIButton _buttonDeckShare; + + [SerializeField] + private DeckDecisionUI _prefabDeckDecisionUI; + + private DeckSelectUIDialog _deckSelectUIDialog; + + private IChatApiSettings _chatApiSettings; + + private ChatConnectController _chatConnectController; + + private Action _eventOnSendDeckSuccess; + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, ChatLogUI chatLogUI, Action actionAddNewChatLogAfterSendChat) + { + _chatApiSettings = chatSettings.ApiSettings; + _chatConnectController = chatConnectController; + _eventOnSendDeckSuccess = actionAddNewChatLogAfterSendChat; + _buttonDeckShare.onClick.Clear(); + _buttonDeckShare.onClick.Add(new EventDelegate(delegate + { + OnClickDeckShareButton(); + })); + } + + private void OnClickDeckShareButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + DeckMyListTask task = new DeckMyListTask(); + task.SetParameter(Format.All); + _chatConnectController.StartConnectCommon(task, delegate + { + List deckGroupList = task.DeckGroupListData.DeckGroupList.Where((DeckGroup deckGroup) => deckGroup.AttributeType == DeckAttributeType.CustomDeck).ToList(); + Format format = (Format)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.LAST_SELECT_DECK_FORMAT); + if (format == Format.Avatar) + { + format = Format.Rotation; + } + DeckSelectUIDialog.eFormatChangeUIType formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.NormalFormatOnly; + if (Prerelease.Status != Prerelease.eStatus.NONE) + { + formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.WithPrerotation; + } + else if (DeckListUtility.DeckGroupDataBaseClone().Any((DeckGroup deckgroup) => deckgroup.DeckFormat == Format.Crossover)) + { + formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.WithCrossover; + } + else if (Data.MyRotationAllInfo.IsMyRotationEnable) + { + formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.WithMyRotation; + } + _deckSelectUIDialog = DeckSelectUIDialog.Create(Data.SystemText.Get("Guild_Chat_0011"), new DeckGroupListData(deckGroupList), format, formatChangeUIType, isVisibleCreateNew: false, delegate(DialogBase dialogDeckList, DeckData deckData) + { + CreateDeckSelectConfirmDialog(deckData); + }); + }); + } + + private void CreateDeckSelectConfirmDialog(DeckData deckData) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonText(systemText.Get("Common_0004"), systemText.Get("Card_0083")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialogBase.SetPanelDepth(15); + DeckDecisionUI deckDecisionUI = UnityEngine.Object.Instantiate(_prefabDeckDecisionUI); + deckDecisionUI.SetText(systemText.Get("Guild_Chat_0012"), deckData.GetDeckName()); + deckDecisionUI.SetDeckData(deckData, null); + dialogBase.SetObj(deckDecisionUI.gameObject); + dialogBase.onPushButton2 = deckDecisionUI.OnClickCreateCardList; + dialogBase.ClickSe_Btn2 = Se.TYPE.SYS_BTN_DECIDE; + dialogBase.isNotCloseWindowButton2 = true; + deckDecisionUI.DeckName = deckData.GetDeckName(); + dialogBase.onPushButton1 = delegate + { + OnDecideDeck(deckData); + _deckSelectUIDialog.Close(); + }; + } + + private void OnDecideDeck(DeckData deckData) + { + ChatAddDeckTask chatAddDeckTask = new ChatAddDeckTask(_chatApiSettings.ApiChatAddDeck); + int deckFormat = Data.FormatConvertApi(deckData.Format); + int deckID = deckData.GetDeckID(); + chatAddDeckTask.SetParameter(deckFormat, deckID); + _chatConnectController.StartConnectCommon(chatAddDeckTask, delegate + { + _eventOnSendDeckSuccess.Call(); + }); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatSendReplayListUI.cs b/SVSim.BattleEngine/Engine/Wizard/ChatSendReplayListUI.cs new file mode 100644 index 0000000..93139cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatSendReplayListUI.cs @@ -0,0 +1,53 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatSendReplayListUI +{ + private const int DEPTH_REPLAY_SHARE_CONFIRM_DIALOG = 15; + + private ChatReplayListDialog _prefabReplayShareDialog; + + private ChatReplaySendConfirmDialog _prefabReplaySendConfirmDialog; + + private Action _onDecideReplay; + + private DialogBase _dialogReplayList; + + public ChatSendReplayListUI(ChatReplayListDialog prefabReplayShareDialog, ChatReplaySendConfirmDialog prefabReplaySendConfirmDialog, Action onDecideDeck) + { + _prefabReplayShareDialog = prefabReplayShareDialog; + _prefabReplaySendConfirmDialog = prefabReplaySendConfirmDialog; + _onDecideReplay = onDecideDeck; + } + + public void CreateReplayListDialog() + { + _dialogReplayList = UIManager.GetInstance().CreateDialogClose(); + _dialogReplayList.SetSize(DialogBase.Size.XL); + _dialogReplayList.SetTitleLabel(Data.SystemText.Get("OtherTop_0033")); + _dialogReplayList.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + ChatReplayListDialog chatReplayListDialog = UnityEngine.Object.Instantiate(_prefabReplayShareDialog); + _dialogReplayList.SetObj(chatReplayListDialog.gameObject); + chatReplayListDialog.Init(Data.ReplayInfo.Items, CreateReplaySelectConfirmDialog); + } + + private void CreateReplaySelectConfirmDialog(ReplayInfoItem infoItem) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetTitleLabel(Data.SystemText.Get("Guild_Chat_0003")); + dialogBase.SetButtonText(Data.SystemText.Get("Guild_Chat_0026")); + dialogBase.SetPanelDepth(15); + ChatReplaySendConfirmDialog chatReplaySendConfirmDialog = UnityEngine.Object.Instantiate(_prefabReplaySendConfirmDialog); + dialogBase.SetObj(chatReplaySendConfirmDialog.gameObject); + chatReplaySendConfirmDialog.SetData(PlayerStaticData.UserName, PlayerStaticData.UserEmblemID, infoItem); + dialogBase.onPushButton1 = delegate + { + _onDecideReplay.Call(infoItem); + _dialogReplayList.Close(); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatSendReplayUI.cs b/SVSim.BattleEngine/Engine/Wizard/ChatSendReplayUI.cs new file mode 100644 index 0000000..c34bf41 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatSendReplayUI.cs @@ -0,0 +1,58 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatSendReplayUI : MonoBehaviour, IChatActionUI +{ + [SerializeField] + private UIButton _buttonReplayShare; + + [SerializeField] + private ChatReplayListDialog _prefabReplayShareDialog; + + [SerializeField] + private ChatReplaySendConfirmDialog _prefabReplaySendConfirmDialog; + + private ChatSendReplayListUI _chatSendReplayListUI; + + private IChatApiSettings _chatApiSettings; + + private ChatConnectController _chatConnectController; + + private Action _eventOnSendRepleySuccess; + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, ChatLogUI chatLogUI, Action actionAddNewChatLogAfterSendChat) + { + _chatApiSettings = chatSettings.ApiSettings; + _chatConnectController = chatConnectController; + _eventOnSendRepleySuccess = actionAddNewChatLogAfterSendChat; + _chatSendReplayListUI = new ChatSendReplayListUI(_prefabReplayShareDialog, _prefabReplaySendConfirmDialog, OnDecideReplay); + _buttonReplayShare.onClick.Clear(); + _buttonReplayShare.onClick.Add(new EventDelegate(delegate + { + OnClickReplayShareButton(); + })); + } + + private void OnClickReplayShareButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ReplayInfoTask task = new ReplayInfoTask(); + _chatConnectController.StartConnectCommon(task, delegate + { + _chatSendReplayListUI.CreateReplayListDialog(); + }); + } + + private void OnDecideReplay(ReplayInfoItem infoItem) + { + ChatAddReplayTask chatAddReplayTask = new ChatAddReplayTask(_chatApiSettings.ApiChatAddReplay); + chatAddReplayTask.SetParameter(infoItem.BattleId); + _chatConnectController.StartConnectCommon(chatAddReplayTask, delegate + { + _eventOnSendRepleySuccess.Call(); + }); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatSendStampUI.cs b/SVSim.BattleEngine/Engine/Wizard/ChatSendStampUI.cs new file mode 100644 index 0000000..0f4408b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatSendStampUI.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatSendStampUI : MonoBehaviour +{ + private const int SCROLL_OBJECT_NUM = 8; + + [SerializeField] + private UIButton _buttonShowStampList; + + [SerializeField] + private ChatOpenCloseAnimation _uiOpenCloseAnimation; + + [SerializeField] + private UITexture _stampObjOrigin; + + [SerializeField] + protected UIScrollView _scrollView; + + [SerializeField] + private UIWrapMuchContent _wrapContent; + + [SerializeField] + private WrapContentsScrollBarSizeByDirection _wrapContentsScrollBarSize; + + private List _listStampUITexture = new List(8); + + private Action _onCloseStampListUI; + + private Action _OnClickStamp; + + private List _stampList; + + public bool IsOpen => _uiOpenCloseAnimation.IsOpen; + + public void Init(Action onClickStamp, Action onOpenStampListUI, Action onCloseStampListUI, List stampList) + { + _stampList = stampList; + _onCloseStampListUI = onCloseStampListUI; + _OnClickStamp = onClickStamp; + _uiOpenCloseAnimation.Init(isOpenedDefault: false); + _buttonShowStampList.onClick.Clear(); + _buttonShowStampList.onClick.Add(new EventDelegate(delegate + { + _uiOpenCloseAnimation.ToggleStateAndStartAnimation(); + if (_uiOpenCloseAnimation.IsOpen) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + ResetStampListScroll(); + onOpenStampListUI.Call(_uiOpenCloseAnimation); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_OFF); + _onCloseStampListUI.Call(_uiOpenCloseAnimation); + } + })); + CreateStampList(); + } + + public void CloseStampList(Action onAnimationEndCallBack = null) + { + if (IsOpen) + { + _uiOpenCloseAnimation.StartCloseAnimation(onAnimationEndCallBack); + _onCloseStampListUI.Call(_uiOpenCloseAnimation); + } + } + + private void Update() + { + if (_uiOpenCloseAnimation.State == ChatOpenCloseAnimation.eState.OPENING) + { + for (int i = 0; i < 8; i++) + { + _listStampUITexture[i].MarkAsChanged(); + } + } + } + + private void CreateStampList() + { + SetupScrollView(); + } + + private void SetupScrollView() + { + _listStampUITexture.Clear(); + for (int i = 0; i < 8; i++) + { + UITexture component = NGUITools.AddChild(_wrapContent.gameObject, _stampObjOrigin.gameObject).GetComponent(); + _listStampUITexture.Add(component); + } + _stampObjOrigin.gameObject.SetActive(value: false); + _wrapContent.onInitializeItem = OnInitializeItem; + _wrapContent.minIndex = 0; + _wrapContent.maxIndex = _stampList.Count - 1; + ResetStampListScroll(); + } + + private void OnInitializeItem(GameObject go, int wrapIndex, int realIndex) + { + if (_uiOpenCloseAnimation.IsOpen) + { + go.SetActive(value: true); + int id = _stampList[realIndex]; + Texture mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(id.ToString(), ResourcesManager.AssetLoadPathType.Stamp, isfetch: true)) as Texture; + go.GetComponent().mainTexture = mainTexture; + UIEventListener.Get(go).onClick = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + _OnClickStamp(id); + }; + } + } + + private void ResetStampListScroll() + { + _wrapContent.SortBasedOnScrollMovement(); + _scrollView.ResetPosition(); + _wrapContent.WrapContent(); + _wrapContentsScrollBarSize.ContentUpdate(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatSendTextUI.cs b/SVSim.BattleEngine/Engine/Wizard/ChatSendTextUI.cs new file mode 100644 index 0000000..61287b8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatSendTextUI.cs @@ -0,0 +1,85 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatSendTextUI : MonoBehaviour +{ + [SerializeField] + private UIButton _buttonStartInput; + + [SerializeField] + private ChatOpenCloseAnimation _uiOpenCloseAnimation; + + [SerializeField] + private UIButton _buttonSendMessage; + + [SerializeField] + private UIInputWizard _uiInputPC; + + [SerializeField] + private UIInputWizard _uiInputMobile; + + private UIInputWizard _uiInput; + + private Action _onCloseInputUI; + + public bool IsOpen => _uiOpenCloseAnimation.IsOpen; + + public void Init(Action onSendTextMessage, Action onOpenInputUI, Action onCloseStampListUI) + { + _uiInput = _uiInputPC; + _uiInputMobile.gameObject.SetActive(value: false); + _uiOpenCloseAnimation.Init(isOpenedDefault: false); + _onCloseInputUI = onCloseStampListUI; + _buttonStartInput.onClick.Clear(); + _buttonStartInput.onClick.Add(new EventDelegate(delegate + { + _uiOpenCloseAnimation.ToggleStateAndStartAnimation(); + if (_uiOpenCloseAnimation.IsOpen) + { + UICamera.selectedObject = _uiInput.gameObject; + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + onOpenInputUI.Call(_uiOpenCloseAnimation); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_OFF); + _onCloseInputUI.Call(_uiOpenCloseAnimation); + } + })); + _uiInput.onSubmit.Clear(); + _uiInput.onSubmit.Add(new EventDelegate(delegate + { + _uiInput.value = _uiInput.value.Replace("\n", ""); + })); + _uiInput.onDeselect.Clear(); + _uiInput.onDeselect.Add(new EventDelegate(delegate + { + _uiInput.value = _uiInput.value.Replace("\n", ""); + })); + _buttonSendMessage.onClick.Clear(); + _buttonSendMessage.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + if (!(_uiInput.value == string.Empty)) + { + onSendTextMessage.Call(_uiInput.value); + } + })); + } + + public void CloseInputUI(bool isClearText, Action onAnimationEndCallBack = null) + { + if (IsOpen) + { + if (isClearText) + { + _uiInput.value = string.Empty; + } + _uiOpenCloseAnimation.StartCloseAnimation(onAnimationEndCallBack); + _onCloseInputUI.Call(_uiOpenCloseAnimation); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatShareDeckUI.cs b/SVSim.BattleEngine/Engine/Wizard/ChatShareDeckUI.cs new file mode 100644 index 0000000..7266d86 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatShareDeckUI.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ChatShareDeckUI : MonoBehaviour, IChatActionUI +{ + [SerializeField] + private UIButton _btnDeckLogList; + + private IChatApiSettings _chatApiSettings; + + private ChatConnectController _chatConnectCtr; + + private ChatLogUI _chatLogUI; + + private DialogBase _dialogDeckList; + + private Dictionary> _deckLogDataListFormatDict = new Dictionary>(); + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectCtr, ChatLogUI chatLogUI, Action actionAddNewChatLogAfterSendChat) + { + _chatApiSettings = chatSettings.ApiSettings; + _chatConnectCtr = chatConnectCtr; + _chatLogUI = chatLogUI; + _btnDeckLogList.onClick.Clear(); + _btnDeckLogList.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ShowDeckLogList(); + })); + } + + private void ShowDeckLogList() + { + ChatDeckLogTask task = new ChatDeckLogTask(_chatApiSettings.ApiChatDeckLog); + _chatConnectCtr.StartConnectCommon(task, delegate + { + Format defaultFormat = Format.Rotation; + if (task.DeckLogListRotation.Count <= 0) + { + if (task.DeckLogListUnlimited.Count > 0) + { + defaultFormat = Format.Unlimited; + } + else if (Prerelease.Status != Prerelease.eStatus.NONE && task.DeckLogListPreRotation.Count > 0) + { + defaultFormat = Format.PreRotation; + } + else if (Data.Crossover.IsWithinAnyPeriod && task.DeckLogListCrossover.Count > 0) + { + defaultFormat = Format.Crossover; + } + else if (Data.MyRotationAllInfo.IsMyRotationEnable && task.DeckLogListMyRotation != null && task.DeckLogListMyRotation.Count > 0) + { + defaultFormat = Format.MyRotation; + } + } + UpdateDeckLogListAndCreateDialog(task.DeckLogListRotation, task.DeckLogListUnlimited, task.DeckLogListPreRotation, task.DeckLogListCrossover, task.DeckLogListMyRotation, defaultFormat); + }); + } + + private void CreateDialogDeckList(Format format) + { + DeckData deckData = null; + List list = new List(); + foreach (KeyValuePair> item in _deckLogDataListFormatDict) + { + if (item.Value.Count <= 0) + { + continue; + } + List list2 = ChatMessageInfo.DeckLogData.ConvertDeckDataList(item.Value); + if (deckData == null) + { + deckData = list2.FirstOrDefault((DeckData deck) => deck.IsUsable()); + } + int num = list2.Count % 9; + if (num > 0) + { + int num2 = 9 - num; + for (int num3 = 0; num3 < num2; num3++) + { + list2.Add(new DeckData(item.Key)); + } + } + list.Add(new DeckGroup(list2, item.Key, DeckAttributeType.CustomDeck)); + } + DeckGroupListData deckGroupListData = new DeckGroupListData(list); + deckGroupListData.ForceVisiblePreRotation(Prerelease.Status != Prerelease.eStatus.NONE); + DeckSelectUIDialog.eFormatChangeUIType formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.NormalFormatOnly; + if (Prerelease.Status != Prerelease.eStatus.NONE) + { + formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.WithPrerotation; + } + else if (DeckListUtility.DeckGroupDataBaseClone().Any((DeckGroup deckgroup) => deckgroup.DeckFormat == Format.Crossover)) + { + formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.WithCrossover; + } + else if (Data.MyRotationAllInfo.IsMyRotationEnable) + { + formatChangeUIType = DeckSelectUIDialog.eFormatChangeUIType.WithMyRotation; + } + DeckSelectUI.InitOptions initOptions = new DeckSelectUI.InitOptions + { + PrimaryFirstDisplayDeck = deckData + }; + if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Jpn.ToString()) + { + initOptions.LongTextTitlePosition = 34; + } + DeckSelectUIDialog deckSelectUIDialog = DeckSelectUIDialog.Create(Data.SystemText.Get("Guild_Chat_0013"), deckGroupListData, format, formatChangeUIType, isVisibleCreateNew: false, delegate(DialogBase dialogDeckList, DeckData deck) + { + ShowDeckViewFromDeckLog(deck); + }, initOptions); + _dialogDeckList = deckSelectUIDialog.Dialog; + } + + private void ShowDeckViewFromDeckLog(DeckData deck) + { + ChatMessageInfo.DeckLogData deckLogDataByDeckId = ChatMessageInfo.DeckLogData.GetDeckLogDataByDeckId(_deckLogDataListFormatDict[deck.Format], deck.GetDeckID()); + _chatLogUI.ShowDeckViewByDeckLog(deckLogDataByDeckId, delegate + { + if (_dialogDeckList != null) + { + _dialogDeckList.SetDisp(inDisp: false); + _dialogDeckList.SetActive(inActive: false); + } + }, delegate + { + if (_dialogDeckList != null) + { + _dialogDeckList.SetActive(inActive: true); + _dialogDeckList.SetDisp(inDisp: true); + } + }, delegate(Format format, Dictionary> dictDeckLogList) + { + if (_dialogDeckList != null) + { + _dialogDeckList.SetActive(inActive: true); + _dialogDeckList.Close(); + _deckLogDataListFormatDict = dictDeckLogList; + CreateDialogDeckList(format); + } + }); + } + + private void UpdateDeckLogListAndCreateDialog(List deckLogListRotation, List deckLogListUnlimited, List deckLogListPreRotation, List deckLogListCrossover, List deckLogListMyRotation, Format defaultFormat) + { + _deckLogDataListFormatDict[Format.Rotation] = deckLogListRotation; + _deckLogDataListFormatDict[Format.Unlimited] = deckLogListUnlimited; + _deckLogDataListFormatDict[Format.PreRotation] = deckLogListPreRotation; + if (deckLogListCrossover != null) + { + _deckLogDataListFormatDict[Format.Crossover] = deckLogListCrossover; + } + if (deckLogListMyRotation != null) + { + _deckLogDataListFormatDict[Format.MyRotation] = deckLogListMyRotation; + } + CreateDialogDeckList(defaultFormat); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ChatUserInfo.cs b/SVSim.BattleEngine/Engine/Wizard/ChatUserInfo.cs new file mode 100644 index 0000000..2c625aa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ChatUserInfo.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; +using Cute; +using LitJson; + +namespace Wizard; + +public class ChatUserInfo +{ + public int ViewerId { get; private set; } + + public string Name { get; private set; } + + public long EmblemId { get; private set; } + + public long DegreeId { get; private set; } + + public ChatUserInfo(JsonData json) + { + initialize(); + ParseJsonData(json); + } + + public bool IsMyself() + { + return ViewerId == PlayerStaticData.UserViewerID; + } + + public List GetResourcePathList() + { + List list = new List(); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M)); + list.AddRange(DegreeHelper.GetDegreeResourceList(DegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false)); + return list; + } + + private void initialize() + { + ViewerId = 0; + Name = null; + EmblemId = 0L; + DegreeId = 0L; + } + + private void ParseJsonData(JsonData json) + { + ViewerId = json["viewer_id"].ToInt(); + Name = json["name"].ToString(); + EmblemId = json["emblem_id"].ToLong(); + DegreeId = json["degree_id"].ToLong(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ClassSelectionPage.cs b/SVSim.BattleEngine/Engine/Wizard/ClassSelectionPage.cs new file mode 100644 index 0000000..3709292 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ClassSelectionPage.cs @@ -0,0 +1,612 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Convention; +using Cute; +using UnityEngine; +using Wizard.DeckCardEdit; +using Wizard.Story; + +namespace Wizard; + +public class ClassSelectionPage : UIBase +{ + public enum eMode + { + StorySelect, + PracticeSelect, + DeckEdit + } + + [SerializeField] + private ClassInfoParts _selectClassInfo; + + [SerializeField] + private UILabel _storyProgressLabel; + + [SerializeField] + private UILabel _storyAnnotationLabel; + + [SerializeField] + private UILabel _selectClassDescriptionLabel; + + [SerializeField] + private UITexture _selectCharaTexture; + + [SerializeField] + private UISprite _selectMarkSprite; + + [SerializeField] + private UIGrid _classButtonGrid; + + [SerializeField] + private ClassSelectionButton _classButtonParts; + + [SerializeField] + private UIButton _decideButton; + + [SerializeField] + private GameObject _effectDecideButton; + + [SerializeField] + private GameObject _selectMarkMainClass; + + [SerializeField] + private GameObject _selectMarkSubClass; + + [SerializeField] + private Vector3 _charaMoveStartPos = new Vector3(252f, -50f, 0f); + + [SerializeField] + private Vector3 _charaMoveEndPos = new Vector3(282f, -50f, 0f); + + [SerializeField] + private iTween.EaseType _charaMoveEaseType = iTween.EaseType.linear; + + [SerializeField] + private float _charaMoveTime = 0.1f; + + [SerializeField] + private GameObject _useSubClassMessageObj; + + private List _classCharacterMasterDatas = new List(); + + private List _loadPathList = new List(); + + private ClassCharacterMasterData _selectCharaMasterData; + + private CardBasePrm.ClanType _selectMainClass = CardBasePrm.ClanType.NONE; + + private CardBasePrm.ClanType _selectSubClass = CardBasePrm.ClanType.NONE; + + private CardBasePrm.ClanType _displayClass = CardBasePrm.ClanType.NONE; + + private List _notificationIconClassList = new List(); + + private List _classSelectionButtonList = new List(); + + private string _lastChapterClearTextId; + + private ClassSelectionPageParam SceneParam => UIManager.GetInstance().GetSceneParam(UIManager.ViewScene.ClassSelectionPage); + + private bool _useSubClass => FormatBehaviorManager.GetDefaultBehaviour(SceneParam.Format).UseSubClass; + + public eMode Mode => SceneParam.Mode; + + public List UsedClassIdList => SceneParam.UsedClassIdList; + + private SelectedStoryInfo SelectedStoryInfo => Data.SelectedStoryInfo; + + public override bool IsUseCommonBackground() + { + return false; + } + + public override void onFirstStart() + { + base.IsShowFooterMenu = true; + base.onFirstStart(); + } + + protected override void onOpen() + { + base.onOpen(); + Init(); + } + + protected override void onClose() + { + Final(); + base.onClose(); + } + + private void Init() + { + if (SceneParam.Mode != eMode.DeckEdit || !DeckListUI.IsSpecialFormatPeriodError(SceneParam.Format)) + { + _classButtonParts.gameObject.SetActive(value: false); + InitTopBar(); + InitFooter(); + InitMessage(); + StartCoroutine(InitClassSelection()); + } + } + + private void Final() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadPathList); + _loadPathList.Clear(); + } + + private void InitTopBar() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 1; + changeViewSceneParam.IsCutCardMotion = true; + UIManager.GetInstance().RemoveNowSceneBackButtonParameter(); + if (Mode == eMode.PracticeSelect) + { + changeViewSceneParam.OnFinishChangeView = delegate + { + MyPageMenu.Instance.GoToPracticeTypeSelect(); + }; + } + UIManager.GetInstance().CreateTopBar(base.gameObject, GetTopBarText(), UIManager.ViewScene.MyPage, MoneyDraw: false, changeViewSceneParam).gameObject.layer = LayerMask.NameToLayer("MyPage"); + } + + private string GetTopBarText() + { + SystemText systemText = Data.SystemText; + switch (Mode) + { + case eMode.StorySelect: + return systemText.Get("Story_0001"); + case eMode.PracticeSelect: + return systemText.Get("Story_0016"); + case eMode.DeckEdit: + if (!_useSubClass) + { + return systemText.Get("Story_0001"); + } + return systemText.Get("Story_0078"); + default: + return string.Empty; + } + } + + private void InitFooter() + { + UIManager instance = UIManager.GetInstance(); + switch (Mode) + { + case eMode.StorySelect: + instance.setBackScene(base.gameObject, UIManager.ViewScene.StorySelectionWorld); + instance._Footer.UpdateCurrentIndex(1); + instance._Footer.UpdateSoloPlayBadgeIcon(); + break; + case eMode.PracticeSelect: + instance.setBackScene(base.gameObject, UIManager.ViewScene.MyPage); + instance._Footer.UpdateCurrentIndex(1); + break; + case eMode.DeckEdit: + if (!Offline.IsConventionMode) + { + instance._Footer.UpdateCurrentIndex(4); + } + instance.setBackScene(base.gameObject, UIManager.ViewScene.DeckList); + break; + } + } + + private void InitMessage() + { + _useSubClassMessageObj.SetActive(_useSubClass); + } + + private IEnumerator InitClassSelection() + { + BaseTask task = null; + switch (Mode) + { + case eMode.StorySelect: + ResetSelectedStoryInfo(); + task = new StoryLeaderSelectTask(SelectedStoryInfo); + break; + case eMode.PracticeSelect: + task = new PracticeInfoTask(); + break; + } + if (task != null) + { + StartCoroutine(Toolbox.NetworkManager.Connect(task)); + while (!task.isServerResultCodeOK()) + { + yield return null; + } + } + if (Mode == eMode.PracticeSelect) + { + _notificationIconClassList.AddRange(Data.PracticeDataMgr.CampaignClassIdList); + } + if (Mode == eMode.StorySelect) + { + _classCharacterMasterDatas = Data.StoryLeaderSelect.LeaderCharaIds.Select((int charaId) => GetCharaPrmByCharaId(charaId)).ToList(); + } + else + { + int num = 9; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + for (int num2 = 1; num2 < num; num2++) + { + _classCharacterMasterDatas.Add(dataMgr.GetCharaPrmByClassId(num2, Mode == eMode.DeckEdit)); + } + } + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + foreach (ClassCharacterMasterData classCharacterMasterData in _classCharacterMasterDatas) + { + _loadPathList.Add(resourcesManager.GetAssetTypePath(classCharacterMasterData.skin_id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaButton)); + _loadPathList.Add(resourcesManager.GetAssetTypePath(classCharacterMasterData.skin_id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaBase)); + } + _loadPathList.Add(resourcesManager.GetAssetTypePath("empty", ResourcesManager.AssetLoadPathType.ClassCharaButton)); + yield return StartCoroutine(resourcesManager.LoadAssetGroupAsync(_loadPathList, null)); + CreateClassButton(); + UIEventListener.Get(_decideButton.gameObject).onClick = OnDecideButtonClick; + SetActiveDecideButton(!_useSubClass); + UIManager.GetInstance().OnReadyViewScene(isFadein: true, null, OnFinishFadeIn); + } + + private void SetActiveDecideButton(bool isActive) + { + UIManager.SetObjectToGrey(_decideButton.gameObject, !isActive); + _effectDecideButton.SetActive(isActive); + } + + private void SetUnselectedButtonGrayout(bool isGrayout) + { + List usedClass = new List(); + if (UsedClassIdList != null) + { + usedClass.AddRange(UsedClassIdList); + } + _classSelectionButtonList.Where((ClassSelectionButton x) => !usedClass.Contains(x.ClassCharacterMasterData.class_id) && x.ClassCharacterMasterData.class_id != (int)_selectMainClass && x.ClassCharacterMasterData.class_id != (int)_selectSubClass).ToList().ForEach(delegate(ClassSelectionButton button) + { + UIManager.SetObjectToGrey(button.gameObject, isGrayout); + }); + } + + private ClassCharacterMasterData GetCharaPrmByCharaId(int charaId) + { + return GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(charaId); + } + + private void CreateClassButton() + { + ClassSelectionButton classButton = null; + switch (Mode) + { + case eMode.PracticeSelect: + case eMode.DeckEdit: + classButton = CreateClassButtonPracticeAndDeckEdit(); + _storyAnnotationLabel.gameObject.SetActive(value: false); + _storyProgressLabel.gameObject.SetActive(value: false); + break; + case eMode.StorySelect: + classButton = CreateClassButtonStory(); + _storyAnnotationLabel.gameObject.SetActive(Data.StoryLeaderSelect.DataList.Count < Data.StoryLeaderSelect.LeaderCount); + break; + } + _classButtonGrid.Reposition(); + _selectMarkSprite.gameObject.SetActive(!_useSubClass); + _selectMarkMainClass.SetActive(value: false); + _selectMarkSubClass.SetActive(value: false); + SelectClass(classButton); + } + + private ClassSelectionButton CreateClassButtonPracticeAndDeckEdit() + { + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + ClassSelectionButton classSelectionButton = null; + foreach (ClassCharacterMasterData classCharacterMasterData in _classCharacterMasterDatas) + { + bool flag = UsedClassIdList.Contains(classCharacterMasterData.class_id); + GameObject gameObject = NGUITools.AddChild(_classButtonGrid.gameObject, _classButtonParts.gameObject); + _classSelectionButtonList.Add(gameObject.GetComponent()); + gameObject.SetActive(value: true); + ClassSelectionButton component = gameObject.GetComponent(); + component.Init(classCharacterMasterData, resourcesManager.LoadObject(resourcesManager.GetAssetTypePath(classCharacterMasterData.skin_id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaButton, isfetch: true)), OnClickClassButton, isShowStoryClearLabel: false, flag, _notificationIconClassList.Contains(classCharacterMasterData.class_id)); + if (classSelectionButton == null && !flag) + { + classSelectionButton = component; + } + } + return classSelectionButton; + } + + private ClassSelectionButton CreateClassButtonStory() + { + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + ClassSelectionButton classSelectionButton = null; + int i = 0; + for (int leaderCount = Data.StoryLeaderSelect.LeaderCount; i < leaderCount; i++) + { + GameObject obj = NGUITools.AddChild(_classButtonGrid.gameObject, _classButtonParts.gameObject); + obj.SetActive(value: true); + ClassSelectionButton component = obj.GetComponent(); + if (i < _classCharacterMasterDatas.Count) + { + ClassCharacterMasterData classCharacterMasterData = _classCharacterMasterDatas[i]; + StoryLeaderSelectData storyLeaderSelectDataByClassID = GetStoryLeaderSelectDataByClassID(classCharacterMasterData.class_id); + component.Init(classCharacterMasterData, resourcesManager.LoadObject(resourcesManager.GetAssetTypePath(classCharacterMasterData.skin_id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaButton, isfetch: true)), OnClickClassButton, storyLeaderSelectDataByClassID.IsFinished, isShowUsedLabel: false, showNotificationIcon: false); + if (classSelectionButton == null) + { + classSelectionButton = component; + } + } + else + { + component.InitEmpty(); + } + } + return classSelectionButton; + } + + private void OnClickClassButton(ClassSelectionButton classButton) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + if (_useSubClass) + { + SelectClassForUseSubClass(classButton); + } + else + { + SelectClass(classButton); + } + } + + private void SelectClass(ClassSelectionButton classButton) + { + if (_selectCharaMasterData == classButton.ClassCharacterMasterData) + { + return; + } + _selectCharaMasterData = classButton.ClassCharacterMasterData; + _selectMarkSprite.transform.position = classButton.transform.position; + ViewClassCharaInfo(_selectCharaMasterData); + if (Mode == eMode.StorySelect && !GetStoryLeaderSelectDataByClassID(_selectCharaMasterData.class_id).IsFinished) + { + string currentChapter = GetStoryLeaderSelectDataByClassID(_selectCharaMasterData.class_id).CurrentChapter; + string text = UIUtil.ExtractStringNumber(currentChapter).ToString(); + string value = UIUtil.ExtractStringAlphabet(currentChapter); + string text2 = ""; + if (!text.Equals(currentChapter)) + { + StringBuilder tempStringBuilder = UIUtil.GetTempStringBuilder(); + tempStringBuilder.Append("Route_"); + tempStringBuilder.Append(SelectedStoryInfo.SectionId.ToString()).Append("_"); + tempStringBuilder.Append(_selectCharaMasterData.chara_id.ToString()).Append("_"); + tempStringBuilder.Append(value); + text2 = Data.SystemText.Get(tempStringBuilder.ToString()) + " " + text; + } + else + { + text2 = currentChapter; + } + _storyProgressLabel.text = Data.SystemText.Get("Story_0050", text2.ToString()); + _storyProgressLabel.gameObject.SetActive(value: true); + } + else + { + _storyProgressLabel.gameObject.SetActive(value: false); + } + } + + private void SelectClassForUseSubClass(ClassSelectionButton classButton) + { + CardBasePrm.ClanType clan = classButton.ClassCharacterMasterData.clan; + if (_selectMainClass == clan) + { + _selectMarkMainClass.gameObject.SetActive(value: false); + _selectMainClass = CardBasePrm.ClanType.NONE; + SetUnselectedButtonGrayout(isGrayout: false); + SetActiveDecideButton(isActive: false); + } + else if (_selectSubClass == clan) + { + _selectMarkSubClass.gameObject.SetActive(value: false); + _selectSubClass = CardBasePrm.ClanType.NONE; + SetActiveDecideButton(isActive: false); + SetUnselectedButtonGrayout(isGrayout: false); + } + else if (!IsCompleteSelectClass()) + { + if (_selectMainClass == CardBasePrm.ClanType.NONE) + { + _selectMainClass = clan; + _selectMarkMainClass.transform.position = classButton.transform.position; + _selectMarkMainClass.gameObject.SetActive(value: true); + } + else if (_selectSubClass == CardBasePrm.ClanType.NONE) + { + _selectSubClass = clan; + _selectMarkSubClass.transform.position = classButton.transform.position; + _selectMarkSubClass.gameObject.SetActive(value: true); + } + ViewClassCharaInfo(classButton.ClassCharacterMasterData); + SetActiveDecideButton(IsCompleteSelectClass()); + SetUnselectedButtonGrayout(IsCompleteSelectClass()); + } + bool IsCompleteSelectClass() + { + if (_selectMainClass != CardBasePrm.ClanType.NONE) + { + return _selectSubClass != CardBasePrm.ClanType.NONE; + } + return false; + } + } + + private void ViewClassCharaInfo(ClassCharacterMasterData charaData) + { + if (charaData.clan != _displayClass) + { + _displayClass = charaData.clan; + _selectClassInfo.InitByCharaPrm(charaData); + _selectClassDescriptionLabel.SetWrapText(Data.SystemText.Get("Class_Selection_" + charaData.class_id.ToString("D4"))); + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + _selectCharaTexture.mainTexture = resourcesManager.LoadObject(resourcesManager.GetAssetTypePath(charaData.skin_id.ToString(), ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true)); + GameObject obj = _selectCharaTexture.gameObject; + iTween.Stop(obj); + obj.transform.localPosition = _charaMoveStartPos; + iTween.MoveTo(obj, iTween.Hash("position", _charaMoveEndPos, "time", _charaMoveTime, "islocal", true, "easetype", _charaMoveEaseType)); + } + } + + private void OnDecideButtonClick(GameObject g) + { + switch (Mode) + { + case eMode.StorySelect: + SelectedStoryInfo.SetSectionChara(_selectCharaMasterData); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + UIManager.GetInstance().ChangeViewScene(SelectedStoryInfo.ChapterSelectionView); + break; + case eMode.PracticeSelect: + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ShowSelectDifficultyDialog(); + break; + case eMode.DeckEdit: + OnDecideButtonDeckEditMode(); + break; + } + } + + private void OnDecideButtonDeckEditMode() + { + if (SceneParam.Format == Format.MyRotation) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + MyRotationPeriodSelectDialog.Create(null, (CardBasePrm.ClanType)_selectCharaMasterData.class_id, delegate(MyRotationInfo myRotationData) + { + OnDecideClassDeckEditMode(myRotationData); + }); + } + else + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + OnDecideClassDeckEditMode(null); + } + } + + private void OnDecideClassDeckEditMode(MyRotationInfo myRotationInfo) + { + if (_useSubClass) + { + DeckCardEditUI.ClassSet = new ClassSet(_selectMainClass, _selectSubClass); + } + else + { + DeckCardEditUI.ClassSet = new ClassSet((CardBasePrm.ClanType)_selectCharaMasterData.class_id); + } + DeckCardEditUI.MyRotationInfo = myRotationInfo; + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + if (!Offline.IsConventionMode) + { + changeViewSceneParam.IsUpdateFooterMenuTexture = true; + } + changeViewSceneParam.OnChange = delegate + { + UIManager.GetInstance().GetUiBaseOfCurrentScene(); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.DeckCardEdit, changeViewSceneParam); + } + + private StoryLeaderSelectData GetStoryLeaderSelectDataByClassID(int classId) + { + return Data.StoryLeaderSelect.DataList.Find((StoryLeaderSelectData data) => data.ClassId == classId); + } + + private void ShowSelectDifficultyDialog() + { + int enemyClassId = _selectCharaMasterData.class_id; + List practiceDataList = Data.PracticeDataMgr.GetClassDataList(enemyClassId); + if (practiceDataList.Count <= 0) + { + return; + } + int num = -1; + List list = new List(); + for (int i = 0; i < practiceDataList.Count; i++) + { + list.Add(practiceDataList[i].Text); + if (num < 0 && !practiceDataList[i].IsMaintenance) + { + num = i; + } + } + if (num < 0) + { + num = 0; + } + DialogBase dia = null; + int selectIndex = num; + Action selectCallback = delegate(int selectIdx) + { + selectIndex = selectIdx; + UIManager.SetObjectToGrey(dia.button1.gameObject, practiceDataList[selectIndex].IsMaintenance); + }; + dia = DrumrollDialog.Create(list, num, selectCallback); + dia.SetTitleLabel(Data.SystemText.Get("Story_0022")); + dia.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dia.onPushButton1 = delegate + { + UIManager.GetInstance().createInSceneCenterLoading(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.Load(); + dataMgr.SetEnemyCharaId(enemyClassId); + PracticeData practiceData = practiceDataList[selectIndex]; + PracticeAISettingData settingData = Data.Master.PracticeAISettingList.GetSettingData(enemyClassId, practiceData.AIDeckLevel); + Data.Master.LoadAICsv(new AICsvLoadingInfo(settingData.DeckId, settingData.StyleId, settingData.EmoteId), delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + dataMgr.SetCurrentEnemyDeckDataFromAIDeck(enemyClassId, settingData.Difficulty, settingData.LogicLevel, settingData.MaxLife, settingData.DeckId, settingData.StyleId, settingData.EmoteId, useInnerEmote: true); + dataMgr.LoadEnemyClassData(); + dataMgr.PracticeDifficultyDegreeId = practiceData.DegreeId; + dataMgr.SetSoroPlay3DFieldID(practiceData.Battle3dFieldId); + GameMgr.GetIns().GetDataMgr().Practice3DfieldId = practiceData.Battle3dFieldId; + dia.CloseWithoutSelect(); + PracticeStartTask task = new PracticeStartTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + IsShow_CardIntroduction = true + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Battle, param); + })); + }); + }; + dia.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + } + + private void OnFinishFadeIn() + { + if (Mode == eMode.StorySelect && _lastChapterClearTextId != null) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetTitleLabel(systemText.Get("Common_0021")); + dialogBase.SetButtonText(systemText.Get("Common_0004")); + dialogBase.SetText(systemText.Get(_lastChapterClearTextId)); + _lastChapterClearTextId = null; + } + } + + private void ResetSelectedStoryInfo() + { + _lastChapterClearTextId = SelectedStoryInfo.LastChapterClearTextId; + SelectedStoryInfo.ClearInfoForLeaderSelectionScene(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ClassSelectionPageParam.cs b/SVSim.BattleEngine/Engine/Wizard/ClassSelectionPageParam.cs new file mode 100644 index 0000000..aa5c756 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ClassSelectionPageParam.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class ClassSelectionPageParam +{ + public ClassSelectionPage.eMode Mode { get; private set; } + + public Format Format { get; private set; } + + public ConventionInfo ConventionInfo { get; private set; } + + public List UsedClassIdList { get; private set; } + + public static ClassSelectionPageParam CreateStorySelect() + { + return new ClassSelectionPageParam(ClassSelectionPage.eMode.StorySelect, Format.Max, null, new List()); + } + + public static ClassSelectionPageParam CreatePracticeSelect() + { + return new ClassSelectionPageParam(ClassSelectionPage.eMode.PracticeSelect, Format.Max, null, new List()); + } + + public static ClassSelectionPageParam CreateDeckEdit(Format format, ConventionInfo conventionInfo, List usedClassIdList) + { + return new ClassSelectionPageParam(ClassSelectionPage.eMode.DeckEdit, format, conventionInfo, usedClassIdList); + } + + private ClassSelectionPageParam(ClassSelectionPage.eMode mode, Format format, ConventionInfo conventionInfo, List usedClassIdList) + { + Mode = mode; + Format = format; + ConventionInfo = conventionInfo; + UsedClassIdList = usedClassIdList; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ClassSkinSelectBuyMeansDialog.cs b/SVSim.BattleEngine/Engine/Wizard/ClassSkinSelectBuyMeansDialog.cs new file mode 100644 index 0000000..86f8446 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ClassSkinSelectBuyMeansDialog.cs @@ -0,0 +1,39 @@ +using System; +using Cute; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +namespace Wizard; + +public class ClassSkinSelectBuyMeansDialog : BaseSelectBuyMeansDialog +{ + [SerializeField] + private SkinProductDetail _skinProductDetail; + + [SerializeField] + private UITexture _leaderSkinTicketIcon; + + public void Init(SkinSeriesPurchaseInfo sInfo, DialogBase dialog, Action onPushBuyCrystalBtnCallBack, Action onPushBuyRupyBtnCallBack, Action onPushBuyTicketButtonCallBack) + { + _Init(sInfo.saleInfo, dialog, onPushBuyCrystalBtnCallBack, onPushBuyRupyBtnCallBack, onPushBuyTicketButtonCallBack); + _skinProductDetail.SetMultiProductDetail(sInfo); + if (sInfo.saleInfo.costTicketItemId.HasValue) + { + _leaderSkinTicketIcon.mainTexture = Toolbox.ResourcesManager.LoadObject(ShopCommonUtility.GetTicketIconPath(sInfo.saleInfo.costTicketItemId.Value.ToString(), isFetch: true)); + } + } + + public void Init(SkinProductInfo pInfo, DialogBase dialog, Action onPushBuyCrystalBtnCallBack, Action onPushBuyRupyBtnCallBack, Action onPushBuyTicketButtonCallBack) + { + _Init(pInfo.saleInfo, dialog, onPushBuyCrystalBtnCallBack, onPushBuyRupyBtnCallBack, onPushBuyTicketButtonCallBack); + if (pInfo.rewardInfoList.FindIndex((ShopCommonRewardInfo rewardInfo) => rewardInfo.IsAlreadyGet) >= 0) + { + SetDescriptionLabel(Data.SystemText.Get("Shop_0238", GetDescriptionText(pInfo.saleInfo))); + } + _skinProductDetail.SetSingleProductDetail(pInfo); + if (pInfo.IsEnableBuyTicket) + { + _leaderSkinTicketIcon.mainTexture = Toolbox.ResourcesManager.LoadObject(ShopCommonUtility.GetTicketIconPath(pInfo.saleInfo.costTicketItemId.Value.ToString(), isFetch: true)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ColosseumBattleFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/ColosseumBattleFinishTask.cs new file mode 100644 index 0000000..5ec923a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ColosseumBattleFinishTask.cs @@ -0,0 +1,35 @@ +namespace Wizard; + +public class ColosseumBattleFinishTask : FinishTaskBase +{ + public ColosseumBattleFinishTask() + { + if (!Data.ArenaData.ColosseumData.IsRankMatching) + { + base.type = ApiType.Type.ColosseumBattleFinish; + } + else + { + base.type = ApiType.Type.ColosseumBattleFinishRankMatch; + } + Data.ColosseumBattleFinish = null; + } + + protected override int Parse() + { + int num = base.Parse(); + if (IsEffectiveErrorCode(num)) + { + return num; + } + Data.ColosseumBattleFinish = new ColosseumBattleFinish(); + if (!IsResponseDataExist(base.ResponseData)) + { + return num; + } + ColosseumBattleFinishDetail colosseumBattleFinishDetail = new ColosseumBattleFinishDetail(); + Data.ColosseumBattleFinish.data = colosseumBattleFinishDetail; + new BattleFinishResponsProcessing().Processing(base.ResponseData, colosseumBattleFinishDetail); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ColosseumDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard/ColosseumDoMatchingTask.cs new file mode 100644 index 0000000..5e5f994 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ColosseumDoMatchingTask.cs @@ -0,0 +1,41 @@ +namespace Wizard; + +public class ColosseumDoMatchingTask : DoMatchingBase +{ + public ColosseumDoMatchingTask() + { + if (!Data.ArenaData.ColosseumData.IsRankMatching) + { + base.type = ApiType.Type.ColosseumDoMatching; + } + else + { + base.type = ApiType.Type.ColosseumDoMatchingRankMatch; + } + } + + public override void SetParameter(int deck_no, int need_init, int log, bool includeCardMasterHash = false) + { + includeCardMasterHash = includeCardMasterHash || need_init == 1; + if (Data.ArenaData.ColosseumData.IsRankMatching) + { + need_init = 0; + } + base.SetParameter(deck_no, need_init, log, includeCardMasterHash); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + SettingDoMatchingData(); + if (Data.DoMatchingDetail.data.matchingState == 3008) + { + Data.ArenaData.ColosseumData.IsRankMatching = true; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ColosseumEntryInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/ColosseumEntryInfoTask.cs new file mode 100644 index 0000000..9091b3a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ColosseumEntryInfoTask.cs @@ -0,0 +1,207 @@ +using System; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class ColosseumEntryInfoTask : BaseTask +{ + public ColosseumEntryInfoTask() + { + base.type = ApiType.Type.ColosseumEntryInfo; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + JsonData colosseumOwnStatus = jsonData["colosseum_status"]; + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + if (jsonData.Keys.Contains("is_unfinished_entry_exists")) + { + colosseumData.isJoin = jsonData["is_unfinished_entry_exists"].ToBoolean(); + } + else + { + colosseumData.isJoin = false; + } + if (jsonData.Keys.Contains("is_allowed_free_entry")) + { + colosseumData.IsFreeEntry = jsonData["is_allowed_free_entry"].ToBoolean(); + } + else + { + colosseumData.IsFreeEntry = false; + } + if (jsonData.Keys.Contains("fee_list")) + { + colosseumData.rupyCost = jsonData["fee_list"]["rupy_cost"].ToInt(); + colosseumData.ticketCost = jsonData["fee_list"]["ticket_cost"].ToInt(); + colosseumData.crystalCost = jsonData["fee_list"]["crystal_cost"].ToInt(); + } + if (jsonData.Keys.Contains("deck_format") || !colosseumData.isJoin) + { + colosseumData.IsDeckEntry = false; + } + else + { + colosseumData.IsDeckEntry = true; + } + if (jsonData.Keys.Contains("is_able_to_join_round_3") && !jsonData["is_able_to_join_round_3"].ToBoolean()) + { + colosseumData.Round = ArenaColosseum.eRound.Lose; + colosseumData.NextRound = ArenaColosseum.eRound.Lose; + } + if (jsonData.Keys.Contains("is_already_entry_final_round")) + { + colosseumData.IsFinalRoundTry = jsonData["is_already_entry_final_round"].ToBoolean(); + } + else + { + colosseumData.IsFinalRoundTry = false; + } + SetColosseumInfo(base.ResponseData); + SetColosseumOwnStatus(colosseumOwnStatus); + if (jsonData.Keys.Contains("is_deck_deleted")) + { + colosseumData.IsDeckDeleted = true; + } + else + { + colosseumData.IsDeckDeleted = false; + } + if (colosseumData.IsTwoPickRule && !colosseumData.IsDeckEntry) + { + if (jsonData.Keys.Contains("two_pick_status")) + { + colosseumData.EntryStatus = (ArenaColosseum.eEntryStatus)jsonData["two_pick_status"].ToInt(); + } + else + { + colosseumData.EntryStatus = ArenaColosseum.eEntryStatus.TwoPickClassSelect; + } + } + else + { + colosseumData.EntryStatus = ArenaColosseum.eEntryStatus.SetUpComplete; + } + return num; + } + + public static void SetColosseumInfo(JsonData responseData) + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + JsonData jsonData = responseData["data"]["colosseum_info"]; + colosseumData.IsColosseumPeriod = jsonData["is_colosseum_period"].ToBoolean(); + if (colosseumData.IsColosseumPeriod) + { + colosseumData.ApiRuleParseAndSet(jsonData["deck_format"].ToInt()); + colosseumData.IsNormalTwoPick = jsonData["is_normal_two_pick"].ToString() == "1"; + colosseumData.Name = jsonData["colosseum_name"].ToString(); + colosseumData.IsRoundPeriod = jsonData["is_round_period"].ToBoolean(); + colosseumData.ColorCodeId = jsonData["is_special_mode"].ToString(); + if (jsonData.TryGetValue("card_pool_name", out var value)) + { + colosseumData.CardPool = value.ToString(); + } + if (colosseumData.IsRoundPeriod) + { + colosseumData.StageNo = (ArenaColosseum.eStageNo)jsonData["now_round"].ToInt(); + colosseumData.RemainingUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["end_time"].ToString())); + string text = ConvertTime.ToLocal(DateTime.Parse(jsonData["start_time"].ToString())); + string text2 = ConvertTime.ToLocal(DateTime.Parse(jsonData["end_time"].ToString())); + colosseumData.NowRoundTimeText = Data.SystemText.Get("Colosseum_0033", text, text2); + } + else + { + colosseumData.RemainingUnixTime = ConvertTime.DateTimeToUnixTime(DateTime.Parse(jsonData["start_time"].ToString())); + colosseumData.Name = jsonData["colosseum_name"].ToString(); + colosseumData.StageNo = (ArenaColosseum.eStageNo)jsonData["next_round"].ToInt(); + string text3 = ConvertTime.ToLocal(DateTime.Parse(jsonData["start_time"].ToString())); + colosseumData.NowRoundTimeText = Data.SystemText.Get("Colosseum_0063", text3); + } + colosseumData.RemainingSinceTime = Time.realtimeSinceStartup; + colosseumData.RemainingServerUnixTime = responseData["data_headers"]["servertime"].ToDouble(); + colosseumData.NeedsFirstTips = jsonData.GetValueOrDefault("is_display_tips", 0) == 1; + colosseumData.ColosseumId = jsonData.GetValueOrDefault("colosseum_id", 0); + colosseumData.ChaoseTipsId = jsonData.GetValueOrDefault("tips_id", 0); + colosseumData.CanUseNonPossessionCard = jsonData.GetValueOrDefault("is_all_card_enabled", 0) == 1; + colosseumData.ExpirtyInfo = new ShopExpirtyInfo(jsonData["sales_period_info"]); + if (jsonData.TryGetValue("strategy_pick_num", out var value2)) + { + colosseumData.ChaosNum = value2.ToInt(); + Data.Master.LoadColosseumChaosBattleInfo(colosseumData.ChaosNum); + Data.Master.SetColosseumClassInfomationOrder(colosseumData.ChaosNum); + } + } + } + + public static void SetColosseumOwnStatus(JsonData status) + { + ArenaColosseum colosseumData = Data.ArenaData.ColosseumData; + if (status.Count != 0) + { + if (status.Keys.Contains("rest_entry_num")) + { + if (status["rest_entry_num"].ToInt() != 0) + { + colosseumData.IsRetry = true; + colosseumData.RetryRemainingNum = status["rest_entry_num"].ToInt(); + } + else + { + colosseumData.IsRetry = false; + colosseumData.RetryRemainingNum = 0; + } + } + else + { + colosseumData.IsRetry = false; + } + if (status.Keys.Contains("now_round_id")) + { + colosseumData.Round = (ArenaColosseum.eRound)status["now_round_id"].ToInt(); + colosseumData.ServerRoundId = status["now_round_id"].ToInt(); + } + if (status.Keys.Contains("is_last_day")) + { + colosseumData.IsLastDay = status["is_last_day"].ToBoolean(); + } + else + { + colosseumData.IsLastDay = false; + } + if (status.Keys.Contains("next_round_id")) + { + colosseumData.NextRound = (ArenaColosseum.eRound)status["next_round_id"].ToInt(); + } + if (colosseumData.NextRound == ArenaColosseum.eRound.FinalNotAdvance) + { + if (colosseumData.IsRoundPeriod) + { + colosseumData.NextRound = ArenaColosseum.eRound.Undecided; + } + else + { + colosseumData.NextRound = ArenaColosseum.eRound.Lose; + } + } + if (status.Keys.Contains("is_champion")) + { + colosseumData.IsClear = status["is_champion"].ToBoolean(); + if (colosseumData.IsClear) + { + colosseumData.Name = status["colosseum_name"].ToString(); + } + } + } + else + { + colosseumData.IsRetry = false; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleDoMatchingTask.cs new file mode 100644 index 0000000..f2940ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleDoMatchingTask.cs @@ -0,0 +1,25 @@ +namespace Wizard; + +public class CompetitionBattleDoMatchingTask : DoMatchingBase +{ + public CompetitionBattleDoMatchingTask(int deckNo, int needInit, int log) + { + base.type = (Data.ArenaData.CompetitionData.IsRankMatching ? ApiType.Type.CompetitionBattleDoMatchingRankMatch : ApiType.Type.CompetitionBattleDoMatching); + base.SetParameter(deckNo, needInit, log); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + SettingDoMatchingData(); + if (Data.DoMatchingDetail.data.matchingState == 3012) + { + Data.ArenaData.CompetitionData.IsRankMatching = true; + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinishTask.cs new file mode 100644 index 0000000..f53a1cd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionBattleFinishTask.cs @@ -0,0 +1,35 @@ +namespace Wizard; + +public class CompetitionBattleFinishTask : FinishTaskBase +{ + public CompetitionBattleFinishTask() + { + if (Data.ArenaData.CompetitionData.IsRankMatching) + { + base.type = ApiType.Type.CompetitionBattleFinishRankMatch; + } + else + { + base.type = ApiType.Type.CompetitionBattleFinish; + } + Data.CompetitionBattleFinish = null; + } + + protected override int Parse() + { + int num = base.Parse(); + if (IsEffectiveErrorCode(num)) + { + return num; + } + Data.CompetitionBattleFinish = new CompetitionBattleFinish(); + if (!IsResponseDataExist(base.ResponseData)) + { + return num; + } + CompetitionBattleFinishDetail detailData = Data.CompetitionBattleFinish.DetailData; + new BattleFinishResponsProcessing().Processing(base.ResponseData, detailData); + detailData.IsChampion = base.ResponseData["data"].GetValueOrDefault("is_champion", defaultValue: false); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionCardPanel.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionCardPanel.cs new file mode 100644 index 0000000..af45aa9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionCardPanel.cs @@ -0,0 +1,174 @@ +using System.Collections; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class CompetitionCardPanel : MyPageCardPanel +{ + [SerializeField] + private UILabel _infoNextTimeLabel; + + [SerializeField] + private UILabel _infoTitleLabel; + + [SerializeField] + private UILabel _infoTimeLabel; + + [SerializeField] + private CompetitionEntry _competitionEntry; + + [SerializeField] + private GameObject _competitionEntryRoot; + + [SerializeField] + private GameObject _competitionBadge; + + [SerializeField] + private UISprite _panelLineSprite; + + [SerializeField] + private string _competitionCardPanelPath; + + [SerializeField] + private string _competition2PickCardPanelPath; + + private const int SECONDS_PER_MINUTE = 60; + + private static readonly Color PanelLineColor = new Color(64f / 85f, 2f / 15f, 2f / 15f); + + private bool _firstInitialize; + + private string _cardPanelPath; + + public bool IsEntry { get; set; } + + public bool IsEntryTimeEnd { get; set; } + + private void OnEnable() + { + PanelImageUpdate(); + } + + public override string GetResourcePath(bool isfetch) + { + _cardPanelPath = ((Data.ArenaData.CompetitionData.DeckFormat == Format.TwoPick) ? _competition2PickCardPanelPath : _competitionCardPanelPath); + return Toolbox.ResourcesManager.GetAssetTypePath(_cardPanelPath, ResourcesManager.AssetLoadPathType.CardMenu, isfetch); + } + + public void Update() + { + SetPanelLineColor(); + if (Data.ArenaData.CompetitionData != null) + { + if (_competitionEntryRoot.gameObject.activeSelf) + { + _competitionBadge.SetActive(value: false); + } + else + { + _competitionBadge.SetActive(Data.MyPageNotifications.data.IsCompetitionBadge); + } + } + } + + public void PanelImageUpdate(bool callEntryMenuUpdate = true) + { + ArenaCompetition competitionData = Data.ArenaData.CompetitionData; + SystemText systemText = Data.SystemText; + if (!_firstInitialize) + { + _firstInitialize = true; + IsEntryTimeEnd = competitionData.IsEntryTimeEnd; + } + base.TitleLabel.text = competitionData.CompetitionName; + string text = null; + double num = 0.0; + double num2 = competitionData.RemainingServerUnixTime + (double)Time.realtimeSinceStartup - (double)competitionData.RemainingSinceTime; + bool flag = Data.ArenaData.CompetitionData.RestEntryCount == 0 && Data.ArenaData.CompetitionData.IsRewardReceived; + bool flag2 = !IsEntry && !IsEntryTimeEnd && !flag; + if (flag2) + { + if (Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithFree) + { + _infoTitleLabel.text = systemText.Get("Competition_0064"); + } + else + { + _infoTitleLabel.text = systemText.Get("Competition_0009"); + } + num = competitionData.EntryRemainingUnixTime - num2; + _infoNextTimeLabel.text = systemText.Get("Competition_0070"); + } + else + { + if (IsEntry && Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithFree) + { + if (competitionData.FreebieStatus == ArenaCompetition.FreebieStatusType.InFreeBattle) + { + _infoTitleLabel.text = systemText.Get("Competition_0071"); + _infoNextTimeLabel.text = systemText.Get("Competition_0070"); + } + else if (competitionData.FreebieStatus == ArenaCompetition.FreebieStatusType.CanPermanentEntry) + { + _infoTitleLabel.text = systemText.Get("Competition_0009"); + _infoNextTimeLabel.text = systemText.Get("Competition_0048"); + } + else + { + _infoTitleLabel.text = systemText.Get("Competition_0010"); + _infoNextTimeLabel.text = systemText.Get("Competition_0049"); + } + } + else + { + _infoTitleLabel.text = systemText.Get("Competition_0010"); + _infoNextTimeLabel.text = systemText.Get("Competition_0049"); + } + num = competitionData.RemainingUnixTime - num2; + } + if (!(num <= 0.0)) + { + text = ((num < 3600.0) ? systemText.Get("Colosseum_0058", ((int)(num / 60.0) + 1).ToString()) : ((!(num < 86400.0)) ? systemText.Get("Colosseum_0044", ((int)(num / 86400.0)).ToString()) : systemText.Get("Colosseum_0057", ((int)(num / 3600.0)).ToString()))); + } + else + { + text = systemText.Get("Colosseum_0058", "0"); + if (flag2) + { + IsEntryTimeEnd = true; + PanelImageUpdate(); + return; + } + } + float seconds = (float)(60.0 - num2 % 60.0); + StartCoroutine(PanelImageUpdateTimer(seconds)); + _infoTimeLabel.text = text; + if (callEntryMenuUpdate) + { + _competitionEntry.EntryMenuUpdate(IsEntryTimeEnd); + } + } + + private IEnumerator PanelImageUpdateTimer(float seconds) + { + yield return new WaitForSeconds(seconds); + PanelImageUpdate(); + } + + private void OnApplicationPause(bool pause) + { + if (!pause) + { + PanelImageUpdate(); + } + } + + private void SetPanelLineColor() + { + if (_panelLineSprite.color == Color.white) + { + _panelLineSprite.color = PanelLineColor; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionCheckPeriodTask.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionCheckPeriodTask.cs new file mode 100644 index 0000000..638c03b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionCheckPeriodTask.cs @@ -0,0 +1,9 @@ +namespace Wizard; + +public class CompetitionCheckPeriodTask : BaseTask +{ + public CompetitionCheckPeriodTask() + { + base.type = ApiType.Type.CompetitionCheckPeriod; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionEntry.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionEntry.cs new file mode 100644 index 0000000..35398a9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionEntry.cs @@ -0,0 +1,484 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class CompetitionEntry : ArenaEntryBase +{ + private const int CARD_LIST_SORT_ORDER = 100; + + private const int CARD_DETAIL_SORT_ORDER = 110; + + [SerializeField] + private UIButton _buttonFreeBattle; + + [SerializeField] + private GameObject _detailPrefab; + + [SerializeField] + private UIButton _detailButton; + + [SerializeField] + private GameObject _costRoot; + + [SerializeField] + private UILabel _periodTimeTitleLabel; + + [SerializeField] + private UILabel _periodTimeLabel; + + [SerializeField] + private UILabel _ownBeforeStatusLabel; + + [SerializeField] + private UILabel _ownAfterStatusLabel; + + [SerializeField] + private UILabel _formatLabel; + + [SerializeField] + private UILabel _retryNumberLabel; + + [SerializeField] + public GameObject CompetitionEntryCompleteDialog; + + [SerializeField] + private GameObject _beforeEntryHeadLine; + + [SerializeField] + private GameObject _afterEntryHeadLine; + + [SerializeField] + private GameObject _competitionBadge; + + [SerializeField] + private GameObject _freeEntryBadge; + + public bool _isEntryTimeEnd; + + public bool IsEnableUpdate = true; + + public Action EntryAction; + + private ArenaCompetition.EntryStatusType _entryStatus; + + private int _restChallengeCount; + + private int _restEntryCount; + + private const float GLAY_SCALE = 0.33f; + + private Color baseStatusTextColor; + + private Color grayStatusTextColor; + + private const float NO_FREE_BATTLE_STATUS_LABEL_POSITION_X = 3f; + + private const float NO_FREE_BATTLE_STATUS_LABEL_POSITION_Y = 47f; + + private const int NO_FREE_BATTLE_TEXT_FONT_SIZE = 22; + + private const int LONG_TEXT_FONT_SIZE = 21; + + private bool _isEntry => _entryStatus != ArenaCompetition.EntryStatusType.NotEntry; + + private bool IsCompetitionComplete + { + get + { + if (_restEntryCount == 0 && Data.ArenaData.CompetitionData.IsRewardReceived) + { + return _entryStatus == ArenaCompetition.EntryStatusType.NotEntry; + } + return false; + } + } + + private bool IsEnableEntry + { + get + { + if (!_isEntry && !_isEntryTimeEnd) + { + return !IsCompetitionComplete; + } + return false; + } + } + + private void Awake() + { + _isCompetition = true; + IsEnableUpdate = true; + baseStatusTextColor = _ownAfterStatusLabel.color; + grayStatusTextColor = new Color(baseStatusTextColor.r * 0.33f, baseStatusTextColor.g * 0.33f, baseStatusTextColor.b * 0.33f, 255f); + EntryBaseInit(_costRoot); + } + + protected override void EntryBaseInit(GameObject costRootObject) + { + base.EntryBaseInit(costRootObject); + _entryDialogTitleText = Data.SystemText.Get("Competition_0017"); + _resumeFunc = Resume; + _isJoinFunc = IsJoin; + _freeBattleFunc = FreeBattle; + _isFreeBattleCompetition = IsFreeBattleCompetition; + _detailButton.onClick.Clear(); + _detailButton.onClick.Add(new EventDelegate(OnClickDetailButton)); + } + + protected override void EntryDialogCreate(GameObject inDialogObject) + { + CompetitionEntryDialog component = inDialogObject.GetComponent(); + component.SetRewardInfoEntryConfirm(); + component.CompleteEntryHandler = SetMyPageCompetitionReload; + component.CompleteJoinHandler = AdmissionCompetitionNotFree; + } + + private void EntryAndAdmissionCompetition() + { + CompetitionEntryTask competitionEntryTask = new CompetitionEntryTask(); + competitionEntryTask.SetParameter(ArenaData.eARENA_PAY.Crystal); + StartCoroutine(Toolbox.NetworkManager.Connect(competitionEntryTask, delegate + { + CompetitionUpdateEntryResumeButton(); + AdmissionCompetition(isFreeBattleJoin: true); + })); + } + + private void Resume() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + if (Data.ArenaData.CompetitionData.DeckFormat == Format.TwoPick) + { + if (_entryStatus == ArenaCompetition.EntryStatusType.NotChallenge) + { + AdmissionCompetition(isFreeBattleJoin: false); + } + else if (Data.ArenaData.CompetitionData.IsCompletedTwoPickDeck < 1) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Competition2Pick); + } + else + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.CompetitionLobby); + } + return; + } + switch (_entryStatus) + { + case ArenaCompetition.EntryStatusType.NotChallenge: + AdmissionCompetition(isFreeBattleJoin: false); + break; + case ArenaCompetition.EntryStatusType.NotRegistDeck: + DeckListOpen(); + break; + case ArenaCompetition.EntryStatusType.InBattle: + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.CompetitionLobby); + break; + } + } + + private void FreeBattle() + { + EntryAndAdmissionCompetition(); + } + + private bool IsJoin() + { + return _entryStatus != ArenaCompetition.EntryStatusType.NotEntry; + } + + private bool IsBeforePermanentEntry() + { + if (Data.ArenaData.CompetitionData.FreebieStatus < ArenaCompetition.FreebieStatusType.PermanentEntryDone) + { + return !IsCompetitionComplete; + } + return false; + } + + protected override IEnumerator _InitCoroutine() + { + _buttonFreeBattle.onClick.Clear(); + _buttonFreeBattle.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + _freeBattleFunc(); + })); + return base._InitCoroutine(); + } + + protected override void UpdateEntryResumeButton() + { + base.UpdateEntryResumeButton(); + _buttonFreeBattle.gameObject.SetActive(value: false); + if (_isCompetition && _isFreeBattleCompetition != null && _isFreeBattleCompetition()) + { + ButtonEntry.gameObject.SetActive(value: false); + ButtonResume.gameObject.SetActive(value: false); + _buttonFreeBattle.gameObject.SetActive(value: true); + } + } + + private bool IsFreeBattleCompetition() + { + if (Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithCost) + { + return false; + } + double num = Data.ArenaData.CompetitionData.RemainingServerUnixTime + (double)Time.realtimeSinceStartup - (double)Data.ArenaData.CompetitionData.RemainingSinceTime; + bool flag = Data.ArenaData.CompetitionData.EntryRemainingUnixTime - num < 0.0; + if (Data.ArenaData.CompetitionData.FreebieStatus == ArenaCompetition.FreebieStatusType.InFreeBattle && _entryStatus == ArenaCompetition.EntryStatusType.NotEntry && _restEntryCount > 0 && !flag) + { + return !IsCompetitionComplete; + } + return false; + } + + public void EntryMenuUpdate(bool isEntryTimeEnd) + { + _isEntryTimeEnd = isEntryTimeEnd; + Initialize(); + } + + private void Initialize() + { + ArenaCompetition competitionData = Data.ArenaData.CompetitionData; + SystemText systemText = Data.SystemText; + _isFreeEntry = false; + if (IsEnableUpdate) + { + IsEnableUpdate = false; + _entryStatus = competitionData.EntryStatus; + _restChallengeCount = competitionData.RestChallangeCount; + _restEntryCount = competitionData.RestEntryCount; + } + bool flag = competitionData.CompetitionId <= PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID); + Data.MyPageNotifications.data.IsCompetitionBadge = !competitionData.IsRewardReceived && _entryStatus == ArenaCompetition.EntryStatusType.NotEntry && !_isEntryTimeEnd && !flag; + UIManager.GetInstance()._Footer.UpdateArenaBadgeIcon(); + UpdateMenu(); + if (Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithCost) + { + _costRoot.SetActive(value: true); + _ownBeforeStatusLabel.transform.localPosition = new Vector3(3f, 47f, 0f); + } + UpdateCompetitionEntryBadge(); + _freeEntryBadge.SetActive(Data.MyPageNotifications.data.IsCompetitionBadge); + ButtonEntry.GetComponentInChildren().text = systemText.Get("Competition_0012"); + UILabel componentInChildren = ButtonResume.GetComponentInChildren(); + bool flag2 = _entryStatus == ArenaCompetition.EntryStatusType.NotRegistDeck || _entryStatus == ArenaCompetition.EntryStatusType.InBattle; + componentInChildren.text = (flag2 ? systemText.Get("Arena_0024") : systemText.Get("Arena_0034")); + _buttonFreeBattle.GetComponentInChildren().text = systemText.Get("Competition_0065"); + string text = ""; + text = competitionData.DeckFormat switch + { + Format.TwoPick => systemText.Get("Arena_0002"), + Format.Rotation => systemText.Get("Common_0154"), + _ => systemText.Get("Common_0155"), + }; + _formatLabel.text = systemText.Get("Colosseum_0054", text) + systemText.Get("Colosseum_0093"); + _beforeEntryHeadLine.SetActive(IsEnableEntry); + _afterEntryHeadLine.SetActive(!IsEnableEntry); + bool flag3 = true; + bool flag4 = true; + bool flag5 = false; + double num = Data.ArenaData.CompetitionData.RemainingServerUnixTime + (double)Time.realtimeSinceStartup - (double)Data.ArenaData.CompetitionData.RemainingSinceTime; + bool flag6 = Data.ArenaData.CompetitionData.EntryRemainingUnixTime - num < 0.0; + bool flag7 = IsJoin() || (flag6 && competitionData.FreebieChallengeCount > 0 && !competitionData.IsEntry); + _periodTimeTitleLabel.text = (flag7 ? systemText.Get("Competition_0029") : systemText.Get("Competition_0028")); + _periodTimeLabel.text = (flag7 ? competitionData.NowRoundTimeText : competitionData.EntryTimeText); + if (IsEnableEntry) + { + if (IsFreeBattleCompetition()) + { + _ownBeforeStatusLabel.text = systemText.Get("Competition_0063", competitionData.MaxFreebieChallengeCount.ToString()); + _ownBeforeStatusLabel.fontSize = 21; + _retryNumberLabel.text = systemText.Get("Competition_0024"); + flag3 = true; + } + else + { + _ownBeforeStatusLabel.text = systemText.Get("Competition_0073", Data.ArenaData.CompetitionData.RestEntryCount.ToString()); + _ownBeforeStatusLabel.fontSize = 22; + flag3 = true; + } + } + else + { + string freeEntryText = string.Empty; + if (!_isEntry && _isEntryTimeEnd) + { + freeEntryText = systemText.Get("Competition_0025"); + flag3 = false; + flag5 = true; + } + else if (competitionData.IsChampion) + { + freeEntryText = systemText.Get("Colosseum_0038", competitionData.CompetitionName); + flag3 = _entryStatus != ArenaCompetition.EntryStatusType.NotEntry; + flag5 = true; + } + else if (_restChallengeCount == 0) + { + freeEntryText = (IsCompetitionComplete ? systemText.Get("Competition_0026") : systemText.Get("Colosseum_0051")); + flag3 = _entryStatus != ArenaCompetition.EntryStatusType.NotEntry; + flag4 = IsCompetitionComplete; + flag5 = true; + } + else if (Data.ArenaData.CompetitionData.CostType == ArenaCompetition.EntryCostType.EntryWithFree) + { + flag5 = TryGetFreeEntryStatusText(out freeEntryText); + flag4 = !flag2; + } + if (!flag5) + { + freeEntryText = systemText.Get("Colosseum_0050", _restChallengeCount.ToString()); + flag4 = !flag2; + } + _ownAfterStatusLabel.text = freeEntryText; + } + _ownAfterStatusLabel.color = (flag4 ? baseStatusTextColor : grayStatusTextColor); + UIManager.SetObjectToGrey(ButtonEntry.gameObject, !flag3); + UIManager.SetObjectToGrey(ButtonResume.gameObject, !flag3); + } + + protected override void UpdateCompetitionEntryBadge() + { + base.UpdateCompetitionEntryBadge(); + _competitionBadge.SetActive(Data.MyPageNotifications.data.IsCompetitionBadge); + } + + public void AdmissionCompetition(bool isFreeBattleJoin) + { + CompetitionJoinTask task = new CompetitionJoinTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + Data.MyPageNotifications.data.IsCompetitionBadge = false; + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.COMPETITION_JOIN_BUTTON_LATEST_ID, Data.ArenaData.CompetitionData.CompetitionId); + _entryStatus = ArenaCompetition.EntryStatusType.NotRegistDeck; + if (!isFreeBattleJoin) + { + _restChallengeCount--; + } + Initialize(); + if (Data.ArenaData.CompetitionData.DeckFormat == Format.TwoPick) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Competition2Pick); + } + else + { + DeckListOpen(); + } + })); + } + + public void DeckListOpen() + { + UpdateEntryResumeButton(); + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.CompetitionNormal; + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(Data.ArenaData.CompetitionData.DeckFormat); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + DeckSelectUIDialog.Create(Data.SystemText.Get("Competition_0006"), task.DeckGroupListData, Data.ArenaData.CompetitionData.DeckFormat, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: true, CreateDeckSelectConfirmDialog); + })); + } + + private void CreateDeckSelectConfirmDialog(DialogBase dialogDeckList, DeckData deck) + { + if (!deck.IsUsable()) + { + InCompleteDeckDecideDialog.Create(dialogDeckList, deck); + return; + } + CompleteDeckDecideDialog completeDeckDecideDialog = CompleteDeckDecideDialog.CreateForSingleDeck(dialogDeckList, deck, showSimpleStageOption: true, delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckSetAndMoveCompetition(deck); + }); + completeDeckDecideDialog.DecisionUI.CardDetailCustomize = delegate(CardDetailUI detailUI) + { + detailUI.IsShowFlavorTextButton = false; + detailUI.IsShowVoiceButton = false; + detailUI.IsShowEvolutionButton = false; + detailUI.SetSortOrder(110); + }; + completeDeckDecideDialog.DecisionUI.CardListCustomize = delegate(UICardList uiCardList) + { + uiCardList.SetPanelSortOrder(100); + }; + completeDeckDecideDialog.DecisionUI.gameObject.GetComponent().alpha = 0f; + DeckDecisionCompetition deckDecisionCompetition = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject("UI/DeckList/DeckDecisionCompetition", isServerResources: false)); + completeDeckDecideDialog.Dialog.SetObj(deckDecisionCompetition.gameObject); + deckDecisionCompetition.Init(deck); + completeDeckDecideDialog.DecisionUI.transform.SetParent(deckDecisionCompetition.transform.parent.transform); + } + + private void DeckSetAndMoveCompetition(DeckData inDeckData) + { + Data.ArenaData.CompetitionData.DeckList.Clear(); + Data.ArenaData.CompetitionData.DeckList.Add(inDeckData); + bool isPublished = PlayerPrefsWrapper.GetBool(PlayerPrefsWrapper.COMPETITION_PUBLISHED_SETTING); + CompetitionRegisterDeckTask competitionRegisterDeckTask = new CompetitionRegisterDeckTask(); + competitionRegisterDeckTask.SetParameter(new List { inDeckData }, isPublished); + StartCoroutine(Toolbox.NetworkManager.Connect(competitionRegisterDeckTask, delegate + { + _entryStatus = ArenaCompetition.EntryStatusType.InBattle; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.CompetitionLobby); + })); + } + + public void CompetitionUpdateEntryResumeButton() + { + _restEntryCount = Data.ArenaData.CompetitionData.RestEntryCount; + _restChallengeCount = Data.ArenaData.CompetitionData.RestChallangeCount; + _entryStatus = ArenaCompetition.EntryStatusType.NotChallenge; + EntryAction(); + } + + public void OnClickDetailButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + GameObject gameObject = UnityEngine.Object.Instantiate(_detailPrefab); + dialogBase.SetObj(gameObject); + gameObject.GetComponent().Init(dialogBase, Data.ArenaData.CompetitionData, _isEntry); + } + + private bool TryGetFreeEntryStatusText(out string freeEntryText) + { + ArenaCompetition competitionData = Data.ArenaData.CompetitionData; + SystemText systemText = Data.SystemText; + freeEntryText = string.Empty; + bool result = true; + if (competitionData.FreebieStatus == ArenaCompetition.FreebieStatusType.InFreeBattle) + { + freeEntryText = systemText.Get("Competition_0072", competitionData.FreebieChallengeCount.ToString()); + } + else if (competitionData.FreebieStatus == ArenaCompetition.FreebieStatusType.CanPermanentEntry) + { + freeEntryText = systemText.Get("Competition_0073", _restChallengeCount.ToString()); + } + else + { + result = false; + } + return result; + } + + private void AdmissionCompetitionNotFree() + { + AdmissionCompetition(isFreeBattleJoin: false); + } + + private void SetMyPageCompetitionReload() + { + CompetitionUpdateEntryResumeButton(); + Initialize(); + UpdateEntryResumeButton(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CompetitionUtility.cs b/SVSim.BattleEngine/Engine/Wizard/CompetitionUtility.cs new file mode 100644 index 0000000..d7a7372 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CompetitionUtility.cs @@ -0,0 +1,13 @@ +namespace Wizard; + +public static class CompetitionUtility +{ + public static FirstTips.TipsType GetCompetitionTipsType(ArenaColosseum.eRule competitionRule) + { + if (competitionRule == ArenaColosseum.eRule.TwoPick) + { + return FirstTips.TipsType.CompetitionTwoPick; + } + return FirstTips.TipsType.CompetitionVer2; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConfigUpdateFoilPreferredTask.cs b/SVSim.BattleEngine/Engine/Wizard/ConfigUpdateFoilPreferredTask.cs new file mode 100644 index 0000000..26e28c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConfigUpdateFoilPreferredTask.cs @@ -0,0 +1,21 @@ +namespace Wizard; + +public class ConfigUpdateFoilPreferredTask : BaseTask +{ + public class ConfigUpdateFoilPreferredTaskParam : BaseParam + { + public int is_foil_preferred; + } + + public ConfigUpdateFoilPreferredTask() + { + base.type = ApiType.Type.ConfigUpdateFoilPreferred; + } + + public void SetParameter(bool isFoilPreferred) + { + ConfigUpdateFoilPreferredTaskParam configUpdateFoilPreferredTaskParam = new ConfigUpdateFoilPreferredTaskParam(); + configUpdateFoilPreferredTaskParam.is_foil_preferred = (isFoilPreferred ? 1 : 0); + base.Params = configUpdateFoilPreferredTaskParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConfigUpdatePrizePreferredTask.cs b/SVSim.BattleEngine/Engine/Wizard/ConfigUpdatePrizePreferredTask.cs new file mode 100644 index 0000000..340409d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConfigUpdatePrizePreferredTask.cs @@ -0,0 +1,21 @@ +namespace Wizard; + +public class ConfigUpdatePrizePreferredTask : BaseTask +{ + public class ConfigUpdatePrizePreferredTaskParam : BaseParam + { + public int is_prize_preferred; + } + + public ConfigUpdatePrizePreferredTask() + { + base.type = ApiType.Type.ConfigUpdatePrizePreferred; + } + + public void SetParameter(bool isPrizePreferred) + { + ConfigUpdatePrizePreferredTaskParam configUpdatePrizePreferredTaskParam = new ConfigUpdatePrizePreferredTaskParam(); + configUpdatePrizePreferredTaskParam.is_prize_preferred = (isPrizePreferred ? 1 : 0); + base.Params = configUpdatePrizePreferredTaskParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConventionCrossoverFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/ConventionCrossoverFormatBehavior.cs new file mode 100644 index 0000000..53e334a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConventionCrossoverFormatBehavior.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class ConventionCrossoverFormatBehavior : IFormatBehavior +{ + private ConventionDeckList _conventionDeckList; + + public string Name => UIUtil.GetFormatName(Format.Crossover); + + public string SmallIconSpriteName => "icon_crossover_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.Crossover; + + public bool ExistsRestrictedCard => true; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => false; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => true; + + public bool IsConventionMode => true; + + public List AvailableCardSetNameList => (from id in Data.Crossover.CardSetIdList.Distinct() + select Data.Master.CardSetNameMgr.Get(id.ToString())).ToList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => false; + + public ConventionCrossoverFormatBehavior(ConventionDeckList conventionDeckList) + { + _conventionDeckList = conventionDeckList; + } + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return _conventionDeckList.CardPool; + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + if (_conventionDeckList.CardPool.ContainsKey(cardId)) + { + return _conventionDeckList.CardPool[cardId]; + } + return 0; + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return new Dictionary(_conventionDeckList.CardPool); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return DataMgr.GetPossessionBaseCardNum(baseCardId, _conventionDeckList.CardPool, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConventionMyRotationFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/ConventionMyRotationFormatBehavior.cs new file mode 100644 index 0000000..6db49c0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConventionMyRotationFormatBehavior.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class ConventionMyRotationFormatBehavior : IFormatBehavior +{ + private ConventionDeckList _conventionDeckList; + + public string Name => Data.SystemText.Get("Common_0178"); + + public string SmallIconSpriteName => "icon_myrotation_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.MY_ROTATION; + + public bool ExistsRestrictedCard => true; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => false; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => (from id in Data.Load.data.RotationCardSetList.Distinct() + select Data.Master.CardSetNameMgr.Get(id.ToString())).ToList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => false; + + public bool IsConventionMode => true; + + public ConventionMyRotationFormatBehavior(ConventionDeckList conventionDeckList) + { + _conventionDeckList = conventionDeckList; + } + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return _conventionDeckList.CardPool; + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + if (_conventionDeckList.CardPool.ContainsKey(cardId)) + { + return _conventionDeckList.CardPool[cardId]; + } + return 0; + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return new Dictionary(_conventionDeckList.CardPool); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return DataMgr.GetPossessionBaseCardNum(baseCardId, _conventionDeckList.CardPool, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConventionRotationFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/ConventionRotationFormatBehavior.cs new file mode 100644 index 0000000..5bd39ea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConventionRotationFormatBehavior.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class ConventionRotationFormatBehavior : IFormatBehavior +{ + private ConventionDeckList _conventionDeckList; + + public string Name => Data.SystemText.Get("Common_0154"); + + public string SmallIconSpriteName => "icon_timesliprotation_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => false; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => false; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => (from id in Data.Load.data.RotationCardSetList.Distinct() + select Data.Master.CardSetNameMgr.Get(id.ToString())).ToList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => false; + + public bool IsConventionMode => true; + + public ConventionRotationFormatBehavior(ConventionDeckList conventionDeckList) + { + _conventionDeckList = conventionDeckList; + } + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return _conventionDeckList.CardPool; + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + if (_conventionDeckList.CardPool.ContainsKey(cardId)) + { + return _conventionDeckList.CardPool[cardId]; + } + return 0; + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return new Dictionary(_conventionDeckList.CardPool); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return DataMgr.GetPossessionBaseCardNum(baseCardId, _conventionDeckList.CardPool, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConventionUnlimitedFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/ConventionUnlimitedFormatBehavior.cs new file mode 100644 index 0000000..9f36459 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConventionUnlimitedFormatBehavior.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class ConventionUnlimitedFormatBehavior : IFormatBehavior +{ + private ConventionDeckList _conventionDeckList; + + public string Name => Data.SystemText.Get("Common_0155"); + + public string SmallIconSpriteName => "icon_unlimited_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => true; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => false; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => Data.Master.CardSetNameMgr.GetListBasicAndPack(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => false; + + public bool IsConventionMode => true; + + public ConventionUnlimitedFormatBehavior(ConventionDeckList conventionDeckList) + { + _conventionDeckList = conventionDeckList; + } + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return _conventionDeckList.CardPool; + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + if (_conventionDeckList.CardPool.ContainsKey(cardId)) + { + return _conventionDeckList.CardPool[cardId]; + } + return 0; + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return new Dictionary(_conventionDeckList.CardPool); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return DataMgr.GetPossessionBaseCardNum(baseCardId, _conventionDeckList.CardPool, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ConvertValue.cs b/SVSim.BattleEngine/Engine/Wizard/ConvertValue.cs new file mode 100644 index 0000000..6f81ce3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ConvertValue.cs @@ -0,0 +1,19 @@ +namespace Wizard; + +public static class ConvertValue +{ + public static int ToInt(object obj) + { + return int.Parse(obj.ToString()); + } + + public static long ToLong(object obj) + { + return long.Parse(obj.ToString()); + } + + public static bool ToBool(object obj) + { + return bool.Parse(obj.ToString()); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CrossoverFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/CrossoverFormatBehavior.cs new file mode 100644 index 0000000..84ed884 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CrossoverFormatBehavior.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class CrossoverFormatBehavior : IFormatBehavior +{ + public string Name => UIUtil.GetFormatName(Format.Crossover); + + public string SmallIconSpriteName => "icon_crossover_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.Crossover; + + public bool ExistsRestrictedCard => true; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => true; + + public bool IsConventionMode => false; + + public List AvailableCardSetNameList => (from id in Data.Crossover.CardSetIdList.Distinct() + select Data.Master.CardSetNameMgr.Get(id.ToString())).ToList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/CrossoverReceiveRankRewardTask.cs b/SVSim.BattleEngine/Engine/Wizard/CrossoverReceiveRankRewardTask.cs new file mode 100644 index 0000000..0639536 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/CrossoverReceiveRankRewardTask.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class CrossoverReceiveRankRewardTask : BaseTask +{ + private class QuestRewardReceiveTaskParam : BaseParam + { + public int reward_id; + } + + public List ReceivedRewardList { get; private set; } + + public CrossoverReceiveRankRewardTask() + { + base.type = ApiType.Type.CrossoverReceiveRankReward; + } + + public void SetParameter(int rewardId) + { + QuestRewardReceiveTaskParam questRewardReceiveTaskParam = new QuestRewardReceiveTaskParam + { + reward_id = rewardId + }; + base.Params = questRewardReceiveTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + ReceivedRewardList = new List(); + JsonData jsonData2 = jsonData["total_receive_count_list"]; + for (int i = 0; i < jsonData2.Count; i++) + { + ReceivedRewardList.Add(new ReceivedReward(jsonData2[i])); + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(jsonData["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckConventionUpdateTask.cs b/SVSim.BattleEngine/Engine/Wizard/DeckConventionUpdateTask.cs new file mode 100644 index 0000000..791a1f9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckConventionUpdateTask.cs @@ -0,0 +1,114 @@ +namespace Wizard; + +public class DeckConventionUpdateTask : BaseTask +{ + public class DeckConventionUpdateTaskParam : BaseParam + { + public string tournament_id; + + public int deck_no; + + public int class_id; + + public int leader_skin_id; + + public bool is_random_leader_skin; + + public int[] leader_skin_id_list; + + public long sleeve_id; + + public string deck_name; + + public int is_delete; + + public string rotation_id; + + public int[] card_id_array; + } + + public class DeckConventionUpdateTaskParamWithSubClass : BaseParam + { + public string tournament_id; + + public int deck_no; + + public int class_id; + + public int sub_class_id; + + public int leader_skin_id; + + public bool is_random_leader_skin; + + public int[] leader_skin_id_list; + + public long sleeve_id; + + public string deck_name; + + public int is_delete; + + public int[] card_id_array; + } + + private const int IS_DECK_DELETE_OFF = 0; + + private const int IS_DECK_DELETE_ON = 1; + + private ConventionDeckList _deckList; + + public AchievedInfo AchievedInfo { get; private set; } + + public DeckConventionUpdateTask() + { + base.type = ApiType.Type.DeckUpdateConvention; + } + + public void SetParameter(int deck_no, int class_id, int leader_skin_id, bool isRandomLeaderSkin, int[] leaderSkinIdList, long sleeve_id, string deck_name, bool is_delete, int[] card_id_array, string rotationId, ConventionDeckList deckList) + { + _deckList = deckList; + DeckConventionUpdateTaskParam deckConventionUpdateTaskParam = new DeckConventionUpdateTaskParam(); + deckConventionUpdateTaskParam.tournament_id = _deckList.Conventioninfo.Id; + deckConventionUpdateTaskParam.deck_no = deck_no; + deckConventionUpdateTaskParam.class_id = class_id; + deckConventionUpdateTaskParam.leader_skin_id = leader_skin_id; + deckConventionUpdateTaskParam.is_random_leader_skin = isRandomLeaderSkin; + deckConventionUpdateTaskParam.leader_skin_id_list = leaderSkinIdList; + deckConventionUpdateTaskParam.sleeve_id = sleeve_id; + deckConventionUpdateTaskParam.deck_name = deck_name; + deckConventionUpdateTaskParam.is_delete = (is_delete ? 1 : 0); + deckConventionUpdateTaskParam.card_id_array = card_id_array; + deckConventionUpdateTaskParam.rotation_id = (string.IsNullOrEmpty(rotationId) ? string.Empty : rotationId); + base.Params = deckConventionUpdateTaskParam; + } + + public void SetParameterWithSubClass(int deck_no, int class_id, int subClassId, int leader_skin_id, bool isRandomLeaderSkin, int[] leaderSkinIdList, long sleeve_id, string deck_name, bool is_delete, int[] card_id_array, ConventionDeckList deckList) + { + _deckList = deckList; + DeckConventionUpdateTaskParamWithSubClass deckConventionUpdateTaskParamWithSubClass = new DeckConventionUpdateTaskParamWithSubClass(); + deckConventionUpdateTaskParamWithSubClass.tournament_id = _deckList.Conventioninfo.Id; + deckConventionUpdateTaskParamWithSubClass.deck_no = deck_no; + deckConventionUpdateTaskParamWithSubClass.class_id = class_id; + deckConventionUpdateTaskParamWithSubClass.sub_class_id = subClassId; + deckConventionUpdateTaskParamWithSubClass.leader_skin_id = leader_skin_id; + deckConventionUpdateTaskParamWithSubClass.is_random_leader_skin = isRandomLeaderSkin; + deckConventionUpdateTaskParamWithSubClass.leader_skin_id_list = leaderSkinIdList; + deckConventionUpdateTaskParamWithSubClass.sleeve_id = sleeve_id; + deckConventionUpdateTaskParamWithSubClass.deck_name = deck_name; + deckConventionUpdateTaskParamWithSubClass.is_delete = (is_delete ? 1 : 0); + deckConventionUpdateTaskParamWithSubClass.card_id_array = card_id_array; + base.Params = deckConventionUpdateTaskParamWithSubClass; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + _deckList.ParseDeckListJson(base.ResponseData["data"]["user_deck_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckDetailDialog.cs b/SVSim.BattleEngine/Engine/Wizard/DeckDetailDialog.cs new file mode 100644 index 0000000..487075d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckDetailDialog.cs @@ -0,0 +1,719 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.DeckCardEdit; +using Wizard.UI.Dialog.ImageSelection; + +namespace Wizard; + +public class DeckDetailDialog : MonoBehaviour +{ + private enum eTaskType + { + Normal, + Convention, + Gathering + } + + private const int CHARACTER_NAME_SMALL_SIZE = 31; + + [SerializeField] + private UILabel _deckNameLabel; + + [SerializeField] + private UIButton _deckNameEditButton; + + [SerializeField] + private UIButton _deckCodeCreateButton; + + [SerializeField] + private UITexture _skinTexture; + + [SerializeField] + private ClassInfoParts _skinInfo; + + [SerializeField] + private UIButton _skinChangeButton; + + [SerializeField] + private UISprite _skinRandomIcon; + + [SerializeField] + private UITexture[] _sleeveTextureList; + + [SerializeField] + private UIButton _sleeveChangeButton; + + [SerializeField] + private CostCurveUI _costCurve; + + [SerializeField] + private ImageSelection _skinSelectionPrefab; + + [SerializeField] + private FilteringSleeveSelection _sleeveSelectionPrefab; + + [SerializeField] + private FlexibleGrid _classDisplayGrid; + + private const int DECKNAME_EDIT_DIALOG_DEPTH = 400; + + private const int DECKCODE_COPY_DIALOG_DEPTH = 400; + + private const int SKIN_SELECTION_DIALOG_DEPTH = 400; + + private const int SLEEVE_SELECTION_DIALOG_DEPTH = 400; + + private const int SKIN_RANDOM_SELECT_DIALOG_DEPTH = 600; + + private const long INVALID_SLEEVE_ID = -1L; + + private const string SKIN_SELECTED_RANDOM_KEY = "skin_random"; + + private const int CLASS_DISPLAY_WIDTH_MAX = 375; + + private Action _onDeckUpdateSuccess; + + private DeckData _deck; + + private ImageSelection _skinSelection; + + private List _loadSkinPathList = new List(); + + private int _currentSkinId; + + private string _currentSkinPath; + + private List _selectRandomSkinIdList; + + private List _loadedSleeveId = new List(); + + private List _loadedSleeveTexturePath = new List(); + + private ConventionDeckList _conventionDeckList; + + private List _usableSkinList; + + private List _loadedVoiceCueSheetList = new List(); + + private FilteringImageSelection _sleeveSelection; + + private bool _isChangingSleeve; + + private long _oldSleeveId = -1L; + + private Action _startConnectDeckNameUpdateTask; + + private Action _startConnectDeckSkinUpdateTask; + + private Action> _startConnectDeckRandomSkinUpdateTask; + + private Action _startConnectDeckSleeveUpdateTask; + + public DeckData Deck => _deck; + + public void Initialize(DeckData deck, Action onDeckUpdateSuccess, List loadedVoiceList, ConventionDeckList conventionDeckList) + { + eTaskType taskType = ((conventionDeckList != null) ? eTaskType.Convention : eTaskType.Normal); + InitializeCommon(deck, taskType, onDeckUpdateSuccess, loadedVoiceList, conventionDeckList); + } + + public void InitializeForGathering(DeckData deck, bool IsEntryDeckOnly, Action onDeckUpdateSuccess, List loadedVoiceList) + { + eTaskType taskType = (IsEntryDeckOnly ? eTaskType.Gathering : eTaskType.Normal); + InitializeCommon(deck, taskType, onDeckUpdateSuccess, loadedVoiceList, null); + } + + private void InitializeCommon(DeckData deck, eTaskType taskType, Action onDeckUpdateSuccess, List loadedVoiceList, ConventionDeckList conventionDeckList) + { + _deck = deck; + _onDeckUpdateSuccess = onDeckUpdateSuccess; + _loadedVoiceCueSheetList = loadedVoiceList; + _conventionDeckList = conventionDeckList; + CardMaster.CardMasterId cardMasterId = FormatBehaviorManager.Create(deck.Format, conventionDeckList).CardMasterId; + UpdateDeckName(); + UpdateSkin(); + _costCurve.Initialize(cardMasterId); + _costCurve.Refresh(_deck.GetCardIdList().ToArray()); + UIManager.SetObjectToGrey(_deckCodeCreateButton.gameObject, !_deck.GetDeckIsComplete()); + if (_deck.Format == Format.Avatar) + { + DisableEditDeck(); + } + SetActionDeckUpdateTasks(taskType); + UIEventListener.Get(_deckNameEditButton.gameObject).onClick = OnClickDeckNameEditButton; + UIEventListener.Get(_deckCodeCreateButton.gameObject).onClick = OnClickDeckCodeCreateButton; + UIEventListener.Get(_skinChangeButton.gameObject).onClick = OnClickSkinChangeButton; + UIEventListener.Get(_sleeveChangeButton.gameObject).onClick = OnClickSleeveChangeButton; + if (CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Kor.ToString() || CustomPreference.GetTextLanguage() == Global.LANG_TYPE.Cht.ToString()) + { + _skinInfo.SetCharacterNameHeight(31); + } + LoadSleeve(_deck.GetDeckSleeveID(), delegate + { + StartCoroutine(UpdateSleeveTexture()); + }); + InitSleeveSelection(); + } + + private void SetActionDeckUpdateTasks(eTaskType type) + { + switch (type) + { + case eTaskType.Normal: + _startConnectDeckNameUpdateTask = delegate(string newDeckName) + { + DeckNameUpdateTask deckNameUpdateTask = new DeckNameUpdateTask(); + deckNameUpdateTask.SetParameter(_deck.GetDeckID(), newDeckName, _deck.Format); + StartCoroutine(Toolbox.NetworkManager.Connect(deckNameUpdateTask, delegate + { + OnSuccessDeckNameUpdate(newDeckName); + })); + }; + _startConnectDeckSkinUpdateTask = delegate(int skinId) + { + DeckLeaderSkinUpdateTask deckLeaderSkinUpdateTask = new DeckLeaderSkinUpdateTask(); + deckLeaderSkinUpdateTask.SetParameter(_deck.GetDeckID(), skinId, _deck.Format); + StartCoroutine(Toolbox.NetworkManager.Connect(deckLeaderSkinUpdateTask, delegate + { + OnSuccessChangeSkin(skinId); + })); + }; + _startConnectDeckRandomSkinUpdateTask = delegate(List skinIdList) + { + DeckRandomLeaderSkinUpdateTask task = new DeckRandomLeaderSkinUpdateTask(); + task.SetParameter(_deck.Format, _deck.GetDeckID(), skinIdList.ToArray()); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + OnSuccessChangeRandomSkin(task.SelectedSkinId, skinIdList); + })); + }; + _startConnectDeckSleeveUpdateTask = delegate(long sleeveId) + { + DeckUpdateSleeveTask deckUpdateSleeveTask = new DeckUpdateSleeveTask(); + deckUpdateSleeveTask.SetParameter(_deck.GetDeckID(), sleeveId, _deck.Format); + StartCoroutine(Toolbox.NetworkManager.Connect(deckUpdateSleeveTask, delegate + { + OnSuccessChangeSleeve(sleeveId); + })); + }; + break; + case eTaskType.Convention: + _startConnectDeckNameUpdateTask = delegate(string newDeckName) + { + DeckConventionNameUpdateTask deckConventionNameUpdateTask = new DeckConventionNameUpdateTask(); + deckConventionNameUpdateTask.SetParameter(_deck.GetDeckID(), newDeckName, _conventionDeckList); + StartCoroutine(Toolbox.NetworkManager.Connect(deckConventionNameUpdateTask, delegate + { + OnSuccessDeckNameUpdate(newDeckName); + })); + }; + _startConnectDeckSkinUpdateTask = delegate(int skinId) + { + DeckConventionLeaderSkinUpdateTask deckConventionLeaderSkinUpdateTask = new DeckConventionLeaderSkinUpdateTask(); + deckConventionLeaderSkinUpdateTask.SetParameter(_deck.GetDeckID(), skinId, _conventionDeckList); + StartCoroutine(Toolbox.NetworkManager.Connect(deckConventionLeaderSkinUpdateTask, delegate + { + OnSuccessChangeSkin(skinId); + })); + }; + _startConnectDeckRandomSkinUpdateTask = delegate(List skinIdList) + { + DeckConventionRandomLeaderSkinUpdateTask task = new DeckConventionRandomLeaderSkinUpdateTask(); + task.SetParameter(_deck.GetDeckID(), skinIdList.ToArray(), _conventionDeckList); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + OnSuccessChangeRandomSkin(task.SelectedSkinId, skinIdList); + })); + }; + _startConnectDeckSleeveUpdateTask = delegate(long sleeveId) + { + DeckConventionUpdateSleeveTask deckConventionUpdateSleeveTask = new DeckConventionUpdateSleeveTask(); + deckConventionUpdateSleeveTask.SetParameter(_deck.GetDeckID(), sleeveId, _conventionDeckList); + StartCoroutine(Toolbox.NetworkManager.Connect(deckConventionUpdateSleeveTask, delegate + { + OnSuccessChangeSleeve(sleeveId); + })); + }; + break; + case eTaskType.Gathering: + _startConnectDeckNameUpdateTask = delegate(string newDeckName) + { + GatheringUpdateDeckName gatheringUpdateDeckName = new GatheringUpdateDeckName(); + gatheringUpdateDeckName.SetParameter(_deck.GetDeckID(), newDeckName); + StartCoroutine(Toolbox.NetworkManager.Connect(gatheringUpdateDeckName, delegate + { + OnSuccessDeckNameUpdate(newDeckName); + })); + }; + _startConnectDeckSkinUpdateTask = delegate(int skinId) + { + GatheringUpdateDeckLeaderSkin gatheringUpdateDeckLeaderSkin = new GatheringUpdateDeckLeaderSkin(); + gatheringUpdateDeckLeaderSkin.SetParameter(_deck.GetDeckID(), skinId); + StartCoroutine(Toolbox.NetworkManager.Connect(gatheringUpdateDeckLeaderSkin, delegate + { + OnSuccessChangeSkin(skinId); + })); + }; + _startConnectDeckRandomSkinUpdateTask = delegate(List skinIdList) + { + GatheringUpdateDeckRandomLeaderSkinTask task = new GatheringUpdateDeckRandomLeaderSkinTask(); + task.SetParameter(_deck.GetDeckID(), skinIdList.ToArray()); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + OnSuccessChangeRandomSkin(task.SelectedSkinId, skinIdList); + })); + }; + _startConnectDeckSleeveUpdateTask = delegate(long sleeveId) + { + GatheringUpdateDeckSleeve gatheringUpdateDeckSleeve = new GatheringUpdateDeckSleeve(); + gatheringUpdateDeckSleeve.SetParameter(_deck.GetDeckID(), sleeveId); + StartCoroutine(Toolbox.NetworkManager.Connect(gatheringUpdateDeckSleeve, delegate + { + OnSuccessChangeSleeve(sleeveId); + })); + }; + break; + } + } + + public void SetDeck(DeckData deck) + { + _deck = deck; + } + + public int GetDeckId() + { + return _deck.GetDeckID(); + } + + public void Final() + { + if (_currentSkinPath != null) + { + Toolbox.ResourcesManager.RemoveAsset(_currentSkinPath); + _currentSkinPath = null; + } + Toolbox.ResourcesManager.RemoveAssetGroup(_loadSkinPathList); + _loadSkinPathList.Clear(); + UnloadAllSleeves(); + } + + private void OnClickDeckNameEditButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + string oldDeckName = _deck.GetDeckName(); + SystemText systemText = Data.SystemText; + DialogBase dialogBase = InputDialog.Create(30, 24); + dialogBase.SetTitleLabel(systemText.Get("Card_0011")); + UILabel[] labels = dialogBase.InputAreaObjs.labels; + dialogBase.onPushButton1 = delegate + { + string text = labels[0].text; + if (string.IsNullOrEmpty(text)) + { + text = oldDeckName; + } + if (oldDeckName != text) + { + _startConnectDeckNameUpdateTask.Call(text); + } + }; + dialogBase.SetPanelDepth(400); + labels[0].text = oldDeckName; + labels[2].text = systemText.Get("Card_0012"); + labels[3].text = systemText.Get("Common_0401", 24.ToString()); + } + + private void OnSuccessDeckNameUpdate(string deckName) + { + _deck.SetDeckName(deckName); + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Dia_DeckEdit_003_Title")); + dialogBase.SetText(systemText.Get("Card_0014")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(400); + SaveLastEditDeck(); + _onDeckUpdateSuccess.Call(); + DeckCardEditUI.CurrentDeckName = _deck.GetDeckName(); + UpdateDeckName(); + } + + public void UpdateDeckName() + { + _deckNameLabel.text = _deck.GetDeckName(); + } + + private void OnClickDeckCodeCreateButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + GenerateDeckCodeTask generateDeckCodeTask = new GenerateDeckCodeTask(); + SetGenerateDeckCodeTask(generateDeckCodeTask); + StartCoroutine(Toolbox.NetworkManager.Connect(generateDeckCodeTask, OnSuccessCreateDeckCode, null, null, encrypt: false)); + } + + private void SetGenerateDeckCodeTask(GenerateDeckCodeTask task) + { + IFormatBehavior defaultBehaviour = FormatBehaviorManager.GetDefaultBehaviour(_deck.Format); + if (defaultBehaviour.UseSubClass) + { + task.SetParameter(_deck.GetDeckClassID(), _deck.GetDeckSubClassID(), defaultBehaviour.DeckCodeType, _deck.GetCardIdList().ToArray()); + } + else if (_deck.Format == Format.MyRotation) + { + task.SetParameterMyRotation(_deck, defaultBehaviour.DeckCodeType); + } + else + { + task.SetParameter(_deck.GetDeckClassID(), GenerateDeckCodeTask.SubmitDeckType.NORMAL, _deck.GetCardIdList().ToArray()); + } + } + + private void OnSuccessCreateDeckCode(NetworkTask.ResultCode code) + { + string deckCode = Data.GenerateDeckCode.deck_code; + SystemText text = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetPanelDepth(400); + dialogBase.SetTitleLabel(text.Get("Card_0120")); + dialogBase.SetText(text.Get("Card_0128", deckCode)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialogBase.SetButtonText(text.Get("Card_0133"), text.Get("Common_0008")); + dialogBase.onPushButton1 = delegate + { + NativePluginWrapper.SetStringToClipboard(deckCode); + UIManager.GetInstance().CreateConfirmationDialog(text.Get("Card_0132", deckCode)).SetPanelDepth(400); + }; + } + + private void OnClickSkinChangeButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + StartCoroutine(OpenSkinSelectionDialog()); + } + + private IEnumerator OpenSkinSelectionDialog() + { + yield return StartCoroutine(CreateSkinSelection()); + string key = (_deck.IsSkinRandom ? "skin_random" : _deck.GetRawSkinId().ToString()); + int displayPage = _skinSelection.SelectItemWithKey(key); + _skinSelection.SetDisplayPage(displayPage); + DialogBase dialogBase = DialogBase.CreateImageSelectionDialog(_skinSelection, "Profile_0029", DialogBase.Size.L); + dialogBase.SetPanelDepth(400); + dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate + { + string selectedItemKey = _skinSelection.GetSelectedItemKey(); + if (selectedItemKey == "skin_random") + { + if (!_deck.IsSkinRandom || !_deck.SelectRandomSkinIdList.SequenceEqual(_selectRandomSkinIdList)) + { + _startConnectDeckRandomSkinUpdateTask.Call(_selectRandomSkinIdList); + } + } + else + { + int num = int.Parse(selectedItemKey); + if (_deck.IsSkinRandom || (!string.IsNullOrEmpty(selectedItemKey) && _deck.GetRawSkinId() != num)) + { + _startConnectDeckSkinUpdateTask.Call(num); + } + } + }); + List initSelectRandomSkinIdList = new List(_selectRandomSkinIdList); + dialogBase.onCloseWithoutSelect = (Action)Delegate.Combine(dialogBase.onCloseWithoutSelect, (Action)delegate + { + _selectRandomSkinIdList = initSelectRandomSkinIdList; + }); + } + + private IEnumerator CreateSkinSelection() + { + if (!(_skinSelection != null)) + { + CreateSkinSelectionMain(); + UIManager uiMgr = UIManager.GetInstance(); + uiMgr.createInSceneCenterLoading(); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadSkinPathList, null)); + uiMgr.closeInSceneCenterLoading(); + } + } + + private void CreateSkinSelectionMain() + { + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + ResourcesManager.AssetLoadPathType type = ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail; + SystemText systemText = Data.SystemText; + _skinSelection = NGUITools.AddChild(base.gameObject, _skinSelectionPrefab.gameObject).GetComponent(); + _skinSelection.gameObject.SetActive(value: false); + _skinSelection.Create(400); + _skinSelection.AddItem(0.ToString(), null, isSelectable: true, null, null, null, isDisplaySprite: true, string.Empty, new string[2] + { + systemText.Get("Profile_0017"), + systemText.Get("Card_0182") + }, null); + _selectRandomSkinIdList = new List(_deck.SelectRandomSkinIdList); + if (_selectRandomSkinIdList.Contains(0)) + { + _selectRandomSkinIdList.Remove(0); + _selectRandomSkinIdList.Add(GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(_deck.GetDeckClassID()) + .skin_id); + _selectRandomSkinIdList.Sort(); + } + _skinSelection.AddItem("skin_random", null, isSelectable: true, null, null, null, isDisplaySprite: true, string.Empty, new string[2] + { + systemText.Get("Card_0256"), + systemText.Get("Card_0257") + }, null, delegate + { + CreateRandomSkinSelectDialog(); + }); + int classId = _deck.GetDeckClassID(); + _usableSkinList = Data.Master.ClassCharacterList.Where((ClassCharacterMasterData x) => x.is_usable && x.IsAcquired && x.class_id == classId).ToList(); + for (int num = 0; num < _usableSkinList.Count; num++) + { + ClassCharacterMasterData charaPrm = _usableSkinList[num]; + string text = charaPrm.skin_id.ToString(); + _skinSelection.AddItem(text, null, isSelectable: true, () => charaPrm.IsNew, null, resourcesManager.GetAssetTypePath(text, type, isfetch: true), isDisplaySprite: false, charaPrm.chara_name, null, delegate + { + charaPrm.UnsetNew(); + }); + _loadSkinPathList.Add(resourcesManager.GetAssetTypePath(text, type)); + } + } + + private void CreateRandomSkinSelectDialog() + { + SelectRandomSkinDialog.Create(_usableSkinList.Select((ClassCharacterMasterData x) => x.skin_id).ToList(), _selectRandomSkinIdList, delegate(List idList) + { + _selectRandomSkinIdList = idList; + }).SetPanelDepth(600); + } + + private void OnSuccessChangeSkin(int skinId) + { + _deck.SetSkinId(skinId); + _deck.IsSkinRandom = false; + SuccessChangeSkin(); + } + + private void OnSuccessChangeRandomSkin(int skinId, List skinRandomIdList) + { + _deck.SetSkinId(skinId); + _deck.IsSkinRandom = true; + _deck.SelectRandomSkinIdList = skinRandomIdList; + SuccessChangeSkin(); + } + + private void SuccessChangeSkin() + { + SaveLastEditDeck(); + _onDeckUpdateSuccess.Call(); + UpdateSkin(); + DeckCardEditUI.CurrentDeckData = _deck; + StopVoice(); + GameMgr.GetIns().GetSoundMgr().PlayVoice(ClassCharaPrm.EmotionType.LEADER_SELECT, _deck.GetSkinId(), _loadedVoiceCueSheetList); + } + + private void StopVoice() + { + SoundMgr soundMgr = GameMgr.GetIns().GetSoundMgr(); + if (soundMgr.IsVoicePlaying()) + { + soundMgr.StopVoiceAll(0f); + } + } + + private void UpdateSkin() + { + int currentSkinId = _currentSkinId; + int newSkinId = _deck.GetSkinId(); + GameMgr.GetIns().GetDataMgr().GetClassPrm(_deck.GetDeckClassID()); + _skinRandomIcon.gameObject.SetActive(_deck.IsVisibleRandomIcon()); + if (newSkinId != currentSkinId) + { + ResourcesManager resMgr = Toolbox.ResourcesManager; + if (_currentSkinPath != null) + { + resMgr.RemoveAsset(_currentSkinPath); + } + ResourcesManager.AssetLoadPathType skinLoadType = ResourcesManager.AssetLoadPathType.ClassCharaSkinThumbnail; + _currentSkinId = newSkinId; + _currentSkinPath = resMgr.GetAssetTypePath(newSkinId.ToString(), skinLoadType); + _skinInfo.InitClassByDeckData(_deck); + if (FormatBehaviorManager.GetDefaultBehaviour(_deck.Format).UseSubClass) + { + _skinInfo.SetSubClass((CardBasePrm.ClanType)_deck.GetDeckSubClassID()); + } + UIUtil.AdjustClassInfoPartsSize(_skinInfo, _classDisplayGrid, 375); + UIManager uiMgr = UIManager.GetInstance(); + uiMgr.createInSceneCenterLoading(); + _skinTexture.mainTexture = null; + StartCoroutine(resMgr.LoadAssetGroupAsync(new List { _currentSkinPath }, delegate + { + uiMgr.closeInSceneCenterLoading(); + _skinTexture.mainTexture = resMgr.LoadObject(resMgr.GetAssetTypePath(newSkinId.ToString(), skinLoadType, isfetch: true)) as Texture; + })); + } + } + + private void OnClickSleeveChangeButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().createInSceneCenterLoading(); + OpenSleeveSelectionDialog(); + } + + private void LoadSleeve(long sleeveId, Action onFinish = null) + { + List first = CollectSleeveResourcePaths(sleeveId); + List loadPathList = first.Except(_loadedSleeveTexturePath).ToList(); + if (loadPathList.Count == 0) + { + onFinish.Call(); + return; + } + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadPathList, delegate + { + _loadedSleeveId.Add(sleeveId); + _loadedSleeveTexturePath.AddRange(loadPathList); + onFinish.Call(); + })); + } + + private void UnloadSleeve(long sleeveId) + { + List list = CollectSleeveResourcePaths(sleeveId); + _loadedSleeveId.Remove(sleeveId); + _loadedSleeveTexturePath = _loadedSleeveTexturePath.Except(list).ToList(); + Toolbox.ResourcesManager.RemoveAssetGroup(list); + } + + private void UnloadAllSleeves() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedSleeveTexturePath); + _loadedSleeveId.Clear(); + _loadedSleeveTexturePath.Clear(); + } + + private List CollectSleeveResourcePaths(long sleeveId) + { + sleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(sleeveId); + string path = sleeveId.ToString(); + List loadPath = new List(); + loadPath.Add(Toolbox.ResourcesManager.GetAssetTypePath(path, ResourcesManager.AssetLoadPathType.SleeveTexture)); + Sleeve sleeve = Data.Master.SleeveMgr.Get(sleeveId); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve); + } + return loadPath; + } + + private void InitSleeveSelection() + { + _sleeveSelection = NGUITools.AddChild(base.gameObject, _sleeveSelectionPrefab.gameObject).GetComponent(); + _sleeveSelection.gameObject.SetActive(value: false); + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + List acquiredList = Data.Master.SleeveMgr.GetAcquiredList(); + List list = Data.Master.SleeveCategoryIdDic.Values.OrderBy((SleeveCategory category) => category.Id).ToList(); + _sleeveSelection.Initialize(acquiredList.Count, list.Count); + foreach (SleeveCategory item in list) + { + _sleeveSelection.AddSeries(item.Id, item.Name); + } + foreach (Sleeve sleeve in acquiredList) + { + string key = sleeve.sleeve_id.ToString(); + long existingSleeveId = Toolbox.ResourcesManager.GetExistingSleeveId(sleeve.sleeve_id); + Sleeve sleeve2 = Data.Master.SleeveMgr.Get(existingSleeveId); + List loadPath = new List(); + loadPath.Add(resourcesManager.GetAssetTypePath(existingSleeveId.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture)); + if (sleeve2.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().AddPremireSleevePath(ref loadPath, sleeve2); + } + _sleeveSelection.AddItem(key, sleeve._categoryId, isSelectable: true, loadPath, null, isDisplaySprite: false, sleeve.sleeve_name, null, () => sleeve.IsNew, delegate + { + Data.Master.SleeveMgr.UnsetNew(sleeve.sleeve_id); + }, null, null, sleeve.IsFavorite); + } + _sleeveSelection.SelectItemWithKey(_deck.GetDeckSleeveID().ToString()); + } + + private void OpenSleeveSelectionDialog() + { + _isChangingSleeve = false; + DialogBase dialogBase = DialogBase.CreateFilteringImageSelectionDialog(_sleeveSelection, "Card_0146"); + dialogBase.SetPanelDepth(400); + dialogBase.onPushButton1 = (Action)Delegate.Combine(dialogBase.onPushButton1, (Action)delegate + { + if (long.TryParse(_sleeveSelection.GetSelectedItemKey(), out var result)) + { + _oldSleeveId = _deck.GetDeckSleeveID(); + if (result != _oldSleeveId) + { + LoadSleeve(result); + _startConnectDeckSleeveUpdateTask.Call(result); + _isChangingSleeve = true; + } + } + }); + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + if (!_isChangingSleeve) + { + OnCloseSleeveSelection(); + } + }); + } + + private void OnSuccessChangeSleeve(long sleeveId) + { + _deck.SetDeckSleeveID(sleeveId); + _isChangingSleeve = false; + MyPageMenu.SetEnableReloadCard(); + SaveLastEditDeck(); + _onDeckUpdateSuccess.Call(); + StartCoroutine(UpdateSleeveTexture()); + DeckCardEditUI.CurrentDeckData = _deck; + } + + private void OnCloseSleeveSelection() + { + _sleeveSelection.SelectItemWithKey(_deck.GetDeckSleeveID().ToString()); + } + + private IEnumerator UpdateSleeveTexture() + { + long sleeveId = _deck.GetDeckSleeveID(); + while (!_loadedSleeveId.Contains(sleeveId)) + { + yield return null; + } + for (int i = 0; i < _sleeveTextureList.Length; i++) + { + UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(_sleeveTextureList[i], sleeveId); + } + if (_oldSleeveId != sleeveId && _oldSleeveId != -1) + { + UnloadSleeve(_oldSleeveId); + } + } + + private void SaveLastEditDeck() + { + DeckListUtility.SaveLastSelectDeck(_deck.GetDeckID(), isDefaultDeck: false, isTrialDeck: false, _deck.Format); + } + + private void DisableEditDeck() + { + UIManager.SetObjectToGrey(_deckCodeCreateButton.gameObject, b: true); + UIManager.SetObjectToGrey(_deckNameEditButton.gameObject, b: true); + UIManager.SetObjectToGrey(_sleeveChangeButton.gameObject, b: true); + UIManager.SetObjectToGrey(_skinChangeButton.gameObject, b: true); + } + } diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckIntroductionTask.cs b/SVSim.BattleEngine/Engine/Wizard/DeckIntroductionTask.cs new file mode 100644 index 0000000..d27edea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckIntroductionTask.cs @@ -0,0 +1,130 @@ +using System.Collections; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class DeckIntroductionTask : BaseTask +{ + public class IntroductionData + { + public DeckData Deck { get; private set; } + + public string PlayerName { get; private set; } + + public string Detail { get; private set; } + + public int TopCardId { get; private set; } + + public IntroductionData(DeckData deck, string playerName, string detail, int topCardId) + { + Deck = deck; + PlayerName = playerName; + Detail = detail; + TopCardId = topCardId; + } + } + + public class IntroductionDataTaskParam : BaseParam + { + public int series_id; + } + + public List _result = new List(); + + public Dictionary AlternativeFormatAndSeries; + + public List ResultDeckSeriesIdList { get; private set; } + + public List ResultDeckSeriesNameList { get; private set; } + + public List IsTimeSlipRotationList { get; private set; } + + public int DisplaySeriesId { get; private set; } + + public Format DisplayFormat { get; private set; } + + public void SetParameter(int series_id) + { + IntroductionDataTaskParam introductionDataTaskParam = new IntroductionDataTaskParam(); + introductionDataTaskParam.series_id = series_id; + base.Params = introductionDataTaskParam; + } + + public DeckIntroductionTask() + { + base.type = ApiType.Type.DeckIntroduction; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + DisplaySeriesId = jsonData["series_id"].ToInt(); + DisplayFormat = Data.ParseApiFormat(jsonData["display_format"].ToInt()); + JsonData jsonData2 = jsonData["display_deck_list"]; + for (int i = 0; i < jsonData2.Count; i++) + { + JsonData jsonData3 = jsonData2[i]; + DeckData deckData = new DeckData(); + deckData.Initialize(jsonData3); + string playerName = jsonData3["player_name"].ToString(); + string detail = jsonData3["introduction"].ToString(); + int topCardId = jsonData3["thumbnail_card_id"].ToInt(); + IntroductionData item = new IntroductionData(deckData, playerName, detail, topCardId); + _result.Add(item); + } + ResultDeckSeriesIdList = new List(); + ResultDeckSeriesNameList = new List(); + IsTimeSlipRotationList = new List(); + JsonData jsonData4 = jsonData["series_list"]; + for (int j = 0; j < jsonData4.Count; j++) + { + JsonData jsonData5 = jsonData4[j]; + int item2 = jsonData5["series_id"].ToInt(); + string item3 = jsonData5["series_name"].ToString(); + bool item4 = jsonData5["is_ts_rotation"].ToInt() == 1; + ResultDeckSeriesIdList.Add(item2); + ResultDeckSeriesNameList.Add(item3); + IsTimeSlipRotationList.Add(item4); + } + if (jsonData.TryGetValue("alternative_list", out var value)) + { + AlternativeFormatAndSeries = new Dictionary(); + foreach (JsonData item5 in (IEnumerable)value) + { + Format key = Data.ParseApiFormat(item5["alternative_format"].ToInt()); + AlternativeFormatAndSeries[key] = item5["alternative_series_name"].ToString(); + } + } + return num; + } + + public bool IsExistClass(CardBasePrm.ClanType classType, Format format) + { + for (int i = 0; i < _result.Count; i++) + { + if (_result[i].Deck.GetDeckClassID() == (int)classType && _result[i].Deck.Format == format) + { + return true; + } + } + return false; + } + + public bool IsExistFormat(Format format) + { + for (int i = 0; i < _result.Count; i++) + { + if (_result[i].Deck.Format == format) + { + return true; + } + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckListUI.cs b/SVSim.BattleEngine/Engine/Wizard/DeckListUI.cs new file mode 100644 index 0000000..5881207 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckListUI.cs @@ -0,0 +1,581 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.DeckCardEdit; +using Wizard.ErrorDialog; + +namespace Wizard; + +public class DeckListUI : UIBase +{ + public const int DECK_DETAIL_DIALOG_DEPTH = 100; + + private const int TOP_BAR_WIDTH = 420; + + private const int TOP_BAR_WIDTH_CONVENTION = 400; + + [SerializeField] + private DeckListMenuUI _deckListMenuPrefab; + + private DeckListMenuUI _deckListMenu; + + [SerializeField] + private GameObject _rootDeckListMenuUI; + + [SerializeField] + private DeckDetailDialog _deckDetailDialogPrefab; + + private DeckDetailDialog _deckDetailDialog; + + [SerializeField] + private UICardList _deckPreviewPrefab; + + private UICardList _deckPreview; + + [SerializeField] + private CardDetailUI _cardDetailPrefab; + + private CardDetailUI _cardDetail; + + private List _loadCardList; + + private IFormatBehavior _formatBehavior; + + private DeckData _deleteDefaultSelectDeck; + + public Action OnGetConventionDeckList; + + private ConventionDeckList _conventionDeckList; + + private DeckGroup _deckGroup; + + private TopBar _topBar; + + private readonly List _loadedVoiceList = new List(); + + private static readonly Dictionary SPECIAL_FORMAT_PERIOD_ERROR = new Dictionary + { + { + Format.Crossover, + 5801 + }, + { + Format.MyRotation, + 5802 + } + }; + + private DeckListUIParam SceneParam => UIManager.GetInstance().GetSceneParam(UIManager.ViewScene.DeckList); + + public static void ChangeSceneToDeckList(Format format, UIManager.ChangeViewSceneParam param = null, ConventionInfo conventionInfo = null) + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.DeckList, param, new DeckListUIParam(format, conventionInfo)); + } + + public static bool IsSpecialFormatPeriodError(Format format) + { + if (!CheckSpecialFormatPeriod(format)) + { + Wizard.ErrorDialog.Dialog.Create(SPECIAL_FORMAT_PERIOD_ERROR[format]); + return true; + } + return false; + } + + public static bool CheckSpecialFormatPeriod(Format format) + { + return format switch + { + Format.MyRotation => Data.MyRotationAllInfo.IsMyRotationEnable, + Format.Crossover => Data.Crossover.IsWithinAnyPeriod, + _ => true, + }; + } + + public override void onFirstStart() + { + if (!CheckSpecialFormatPeriod(SceneParam.Format)) + { + Wizard.ErrorDialog.Dialog.Create(SPECIAL_FORMAT_PERIOD_ERROR[SceneParam.Format]); + return; + } + base.IsShowFooterMenu = true; + UIManager.GetInstance()._Footer.SetAllButtonEnableColorChange(isEnable: true); + _ = Data.SystemText; + base.onFirstStart(); + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 4; + changeViewSceneParam.IsCutCardMotion = true; + DeckListUIParam sceneParam = SceneParam; + if (sceneParam.ConventionInfo == null) + { + changeViewSceneParam.OnFinishChangeView = delegate + { + MyPageMenu.Instance.GoToCardDeck(); + }; + } + UIManager.GetInstance().RemoveNowSceneBackButtonParameter(); + if (sceneParam.ConventionInfo != null) + { + changeViewSceneParam.MyPageMenuIndex = 3; + if (sceneParam.ConventionInfo.Status == ConventionInfo.ConventionStatus.GameStart) + { + changeViewSceneParam.OnFinishChangeView = delegate + { + MyPageMenu.Instance.GoToConventionActionMenu(sceneParam.ConventionInfo); + }; + } + else + { + changeViewSceneParam.OnFinishChangeView = delegate + { + MyPageMenu.Instance.GoToConventionListMenu(); + }; + } + _topBar = UIManager.GetInstance().CreateTopBar(base.gameObject, string.Empty, UIManager.ViewScene.MyPage, MoneyDraw: true, changeViewSceneParam); + } + else + { + _ = string.Empty; + if (sceneParam.Format == Format.MyRotation) + { + UIManager.GetInstance().CheckFirstTips(FirstTips.TipsType.MyRotationDeck); + } + _topBar = UIManager.GetInstance().CreateTopBar(base.gameObject, string.Empty, UIManager.ViewScene.MyPage, MoneyDraw: true, changeViewSceneParam); + } + UIManager.GetInstance().SetLayerRecursive(_topBar.transform, LayerMask.NameToLayer("MyPage")); + } + + private void UpdateTopBarText() + { + SystemText systemText = Data.SystemText; + int num = 0; + foreach (DeckData deckData in _deckGroup.DeckDataList) + { + if (!deckData.IsNoCard()) + { + num++; + } + } + if (SceneParam.ConventionInfo != null) + { + string text = systemText.Get("Arena_0058") + " " + UIUtil.GetFormatName(SceneParam.Format); + if (SceneParam.Format == Format.Rotation && num <= 1) + { + _topBar.SetTitleLabel(text, isWideMode: true); + return; + } + _topBar.SetTitleLabel(text, isWideMode: false); + _topBar.SetTitleLabelWidth(400); + return; + } + string text2 = string.Empty; + switch (SceneParam.Format) + { + case Format.Rotation: + text2 = systemText.Get("Card_0001"); + break; + case Format.Unlimited: + text2 = systemText.Get("Card_0187"); + break; + case Format.PreRotation: + text2 = systemText.Get("Card_0233"); + break; + case Format.Crossover: + text2 = systemText.Get("Card_0292"); + break; + case Format.MyRotation: + text2 = systemText.Get("Card_0297"); + break; + } + if (SceneParam.Format == Format.Rotation && num <= 1) + { + _topBar.SetTitleLabel(text2, isWideMode: true); + return; + } + _topBar.SetTitleLabel(text2, isWideMode: false); + _topBar.SetTitleLabelWidth(420); + } + + protected override void onOpen() + { + base.onOpen(); + InitializeDeckList(delegate + { + UpdateTopBarText(); + StartCoroutine(WaitForCommonBackGround(delegate + { + UIManager.GetInstance().OnReadyViewScene(isFadein: true); + })); + }); + } + + protected override void onClose() + { + _deckListMenu.OnSelectDeck -= OnSelectDeck; + if (_loadedVoiceList.Count > 0) + { + GameMgr.GetIns().GetSoundMgr().StopVoiceAll(0f); + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedVoiceList); + _loadedVoiceList.Clear(); + } + base.onClose(); + } + + private IEnumerator WaitForCommonBackGround(Action onComplete) + { + while (!CommonBackGround.Instance.IsFinishLod) + { + yield return null; + } + while (!CommonBackGround.Instance.IsFinishEffectLoading()) + { + yield return null; + } + onComplete?.Invoke(); + } + + public override bool IsUseCommonBackground() + { + return true; + } + + private void InitializeDeckList(Action callback) + { + DisplayEditDeckListLoad(delegate(DeckGroup deckGroup) + { + _deckGroup = deckGroup; + bool enableFirstViewLastUseDeck = SceneParam.ConventionInfo == null; + _deckListMenu = NGUITools.AddChild(_rootDeckListMenuUI, _deckListMenuPrefab.gameObject).GetComponent(); + _deckListMenu.Initialize(_deckGroup, GetEditState(), OnSelectDeck, OnMultiDeckDelete, OnLongPressMultiDeckDelete, CreateDeckDeleteTask, CreateSaveDeckOrderTask, IsVisibleCreateNewButton(), enableFirstViewLastUseDeck, callback); + if (SceneParam.ConventionInfo == null) + { + _formatBehavior = FormatBehaviorManager.GetDefaultBehaviour(SceneParam.Format); + } + }, isNeedDeckListUpdateAPI: true); + } + + private void ReloadDeckList(bool isNeedDeckListUpdateAPI) + { + DisplayEditDeckListLoad(delegate(DeckGroup deckGroup) + { + _deckGroup = deckGroup; + _deckListMenu.UpdateDeckList(_deckGroup, null); + if (_deckDetailDialog != null) + { + _deckDetailDialog.SetDeck(GetDeckById(_deckDetailDialog.GetDeckId())); + } + UpdateTopBarText(); + }, isNeedDeckListUpdateAPI); + } + + private DeckData GetDeckById(int deckId) + { + if (SceneParam.ConventionInfo != null) + { + return _conventionDeckList.DeckList[deckId]; + } + return _deckGroup.DeckDataList.FirstOrDefault((DeckData deck) => deck.GetDeckID() == deckId); + } + + private BaseTask CreateDeckDeleteTask(List deleteDeckNoList) + { + if (SceneParam.ConventionInfo != null) + { + ConventionDeckDeleteTask conventionDeckDeleteTask = new ConventionDeckDeleteTask(); + conventionDeckDeleteTask.SetParameter(SceneParam.ConventionInfo.Id, deleteDeckNoList.ToArray(), _deckGroup.DeckFormat); + return conventionDeckDeleteTask; + } + DeckDeleteTask deckDeleteTask = new DeckDeleteTask(); + deckDeleteTask.SetParameter(deleteDeckNoList.ToArray(), _deckGroup.DeckFormat); + return deckDeleteTask; + } + + private BaseTask CreateSaveDeckOrderTask(List deckOrderList) + { + if (SceneParam.ConventionInfo != null) + { + ConventionDeckOrderTask conventionDeckOrderTask = new ConventionDeckOrderTask(); + conventionDeckOrderTask.SetParameter(SceneParam.ConventionInfo.Id, deckOrderList.ToArray(), _deckGroup.DeckFormat); + return conventionDeckOrderTask; + } + DeckOrderTask deckOrderTask = new DeckOrderTask(); + deckOrderTask.SetParameter(deckOrderList.ToArray(), _deckGroup.DeckFormat); + return deckOrderTask; + } + + private bool IsVisibleCreateNewButton() + { + if (SceneParam.ConventionInfo != null && SceneParam.ConventionInfo.Status == ConventionInfo.ConventionStatus.GameStart) + { + return false; + } + if (_deckGroup.DeckFormat == Format.PreRotation && Prerelease.Status == Prerelease.eStatus.DISPLAY_DECK_ONLY) + { + return false; + } + return true; + } + + private DeckListMenuUI.eEditState GetEditState() + { + DeckListMenuUI.eEditState result = DeckListMenuUI.eEditState.CanEdit; + if (SceneParam.ConventionInfo != null && SceneParam.ConventionInfo.Status == ConventionInfo.ConventionStatus.GameStart) + { + result = DeckListMenuUI.eEditState.Lock; + } + else if (SceneParam.Format == Format.PreRotation && Prerelease.Status == Prerelease.eStatus.DISPLAY_DECK_ONLY) + { + result = DeckListMenuUI.eEditState.DeleteOnly; + } + return result; + } + + private void DisplayEditDeckListLoad(Action onSuccessWithDeckGroup, bool isNeedDeckListUpdateAPI) + { + if (SceneParam.ConventionInfo != null) + { + DeckConventionInfoTask conventionDeckTask = new DeckConventionInfoTask(); + conventionDeckTask.SetParameter(0, SceneParam.ConventionInfo); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(conventionDeckTask, delegate + { + _conventionDeckList = conventionDeckTask.DeckList; + _formatBehavior = FormatBehaviorManager.Create(SceneParam.Format, _conventionDeckList); + DeckGroup arg = new DeckGroup(_conventionDeckList.DeckList.Values.ToList(), SceneParam.ConventionInfo.BattleParameterInstance.DeckFormat, DeckAttributeType.CustomDeck); + onSuccessWithDeckGroup.Call(arg); + })); + } + else if (isNeedDeckListUpdateAPI) + { + DeckMyListTask deckMyListTask = new DeckMyListTask(); + deckMyListTask.SetParameter(SceneParam.Format); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(deckMyListTask, delegate + { + onSuccessWithDeckGroup.Call(GetCustomDeckGroup()); + })); + } + else + { + onSuccessWithDeckGroup.Call(GetCustomDeckGroup()); + } + DeckGroup GetCustomDeckGroup() + { + return (from deckGroup in DeckListUtility.DeckGroupDataBaseClone() + where deckGroup.AttributeType == DeckAttributeType.CustomDeck + select deckGroup).FirstOrDefault((DeckGroup deckGroup) => deckGroup.DeckFormat == SceneParam.Format); + } + } + + private void OnSelectDeck(DeckData deck) + { + if (deck != null) + { + _deleteDefaultSelectDeck = _deckListMenu.GetDeckDataSamePage(deck); + if (deck.IsNoCard()) + { + DeckCreateMenuUI.ShowDeckCreateMenu(deck, _conventionDeckList); + } + else + { + CreateDeckDetailDialog(deck, _deckListMenu.EditState); + } + } + } + + private void CreateDeckDetailDialog(DeckData deck, DeckListMenuUI.eEditState editState) + { + _deckDetailDialog = UnityEngine.Object.Instantiate(_deckDetailDialogPrefab); + _deckDetailDialog.gameObject.SetActive(value: true); + _deckDetailDialog.Initialize(deck, delegate + { + ReloadDeckList(isNeedDeckListUpdateAPI: false); + }, _loadedVoiceList, _conventionDeckList); + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(); + dialog.SetSize(DialogBase.Size.M); + dialog.SetPanelDepth(100); + dialog.SetTitleLabel(""); + dialog.SetObj(_deckDetailDialog.gameObject); + DialogBase dialogBase = dialog; + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + _deckDetailDialog.Final(); + }); + SystemText text = Data.SystemText; + Action onPushButton = delegate + { + DeckCardEditUI.SetDeckEditParameter(_deckDetailDialog.Deck, _conventionDeckList); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.DeckCardEdit); + }; + Action onPushButton2 = delegate + { + dialog.CloseWithoutSelect(); + DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose(); + dialogBase2.SetTitleLabel(text.Get("Dia_DeckEdit_001_Title")); + dialogBase2.SetText(text.Get("Card_0009")); + dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn); + dialogBase2.SetButtonText(text.Get("Card_0104")); + dialogBase2.onPushButton1 = delegate + { + DeleteDeck(deck); + }; + }; + Action action = delegate + { + ShowDeckViewer(deck); + }; + if (deck.IsDefaultDeck()) + { + dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_RedBtn_GrayBtn); + dialog.SetButtonText(text.Get("Card_0007"), text.Get("Card_0008"), text.Get("Card_0083")); + dialog.SetButtonDisable(isEnableOK: true, isEnableCancel: true); + dialog.ClickSe_Btn3 = Se.TYPE.SYS_BTN_DECIDE; + dialog.onPushButton3 = action; + return; + } + switch (editState) + { + case DeckListMenuUI.eEditState.CanEdit: + dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_RedBtn_GrayBtn); + dialog.SetButtonText(text.Get("Card_0007"), text.Get("Card_0008"), text.Get("Card_0083")); + dialog.onPushButton1 = onPushButton; + dialog.onPushButton2 = onPushButton2; + dialog.ClickSe_Btn3 = Se.TYPE.SYS_BTN_DECIDE; + dialog.onPushButton3 = action; + break; + case DeckListMenuUI.eEditState.DeleteOnly: + dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_RedBtn_GrayBtn); + dialog.SetButtonText(text.Get("Card_0007"), text.Get("Card_0008"), text.Get("Card_0083")); + dialog.SetButtonDisable(isEnableOK: true); + dialog.onPushButton2 = onPushButton2; + dialog.ClickSe_Btn3 = Se.TYPE.SYS_BTN_DECIDE; + dialog.onPushButton3 = action; + break; + case DeckListMenuUI.eEditState.Lock: + dialog.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialog.SetButtonText(text.Get("Card_0083")); + dialog.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE; + dialog.onPushButton1 = action; + break; + } + } + + private void DeleteDeck(DeckData deck) + { + MyPageMenu.SetEnableReloadCard(); + int deckID = deck.GetDeckID(); + int deckClassID = deck.GetDeckClassID(); + if (SceneParam.ConventionInfo != null) + { + DeckConventionUpdateTask deckConventionUpdateTask = new DeckConventionUpdateTask(); + deckConventionUpdateTask.SetParameter(deckID, deckClassID, 0, isRandomLeaderSkin: false, null, 3000011L, "", is_delete: true, null, deck.MyRotationId, _conventionDeckList); + StartCoroutine(Toolbox.NetworkManager.Connect(deckConventionUpdateTask, OnSuccessDeckDelete)); + return; + } + DeckUpdateTask deckUpdateTask = new DeckUpdateTask(); + deckUpdateTask.SetParameter(deckID, deckClassID, 0, isRandomLeaderSkin: false, null, 3000011L, "", is_delete: true, null, SceneParam.Format, deck.MyRotationId); + StartCoroutine(Toolbox.NetworkManager.Connect(deckUpdateTask, delegate + { + DeckInfoTask deckInfoTask = new DeckInfoTask(); + deckInfoTask.SetParameter(Format.All); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(deckInfoTask, OnSuccessDeckDelete)); + })); + } + + private void ShowDeleteSuccessDialog() + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("Dia_DeckEdit_002_Title")); + dialogBase.SetText(systemText.Get("Card_0010")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + } + + private void OnSuccessDeckDelete(NetworkTask.ResultCode code) + { + ShowDeleteSuccessDialog(); + if (_deleteDefaultSelectDeck != null) + { + DeckListUtility.SaveLastSelectDeck(_deleteDefaultSelectDeck.GetDeckID(), _deleteDefaultSelectDeck.IsDefaultDeck(), _deleteDefaultSelectDeck.IsDeckAttributeMatch(DeckAttributeType.TrialDeck), _deleteDefaultSelectDeck.Format); + } + else + { + DeckListUtility.ClearLastSelectDeck(SceneParam.Format); + } + ReloadDeckList(isNeedDeckListUpdateAPI: true); + } + + private void ShowDeckViewer(DeckData deck) + { + CheckTimeSlipRotationPeriodTask task = new CheckTimeSlipRotationPeriodTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + StartCoroutine(ShowDeckViewerBody(deck)); + })); + } + + private IEnumerator ShowDeckViewerBody(DeckData deck) + { + UIManager.GetInstance().createInSceneCenterLoading(); + if (_deckPreview == null) + { + _deckPreview = UnityEngine.Object.Instantiate(_deckPreviewPrefab); + _deckPreview.transform.parent = base.transform; + _deckPreview.transform.localPosition = Vector3.zero; + _deckPreview.transform.localScale = Vector3.one; + _cardDetail = UnityEngine.Object.Instantiate(_cardDetailPrefab); + _cardDetail.transform.parent = _deckPreview.transform; + _cardDetail.transform.localPosition = Vector3.zero; + _cardDetail.transform.localScale = Vector3.one; + _cardDetail.gameObject.SetActive(value: false); + _cardDetail.Initialize(LayerMask.NameToLayer("Detail"), _formatBehavior.CardMasterId, _formatBehavior); + _cardDetail.IsShowFlavorTextButton = true; + _cardDetail.IsShowVoiceButton = true; + _cardDetail.IsShowEvolutionButton = true; + yield return null; + } + _deckPreview.gameObject.SetActive(value: false); + List cardIdList = deck.GetCardIdList(); + _loadCardList = _deckPreview.GetLoadFileList(cardIdList); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadCardList, null)); + UIManager.GetInstance().closeInSceneCenterLoading(); + _deckPreview.gameObject.SetActive(value: true); + _deckPreview.SetActive(in_Active: false); + string deckName = deck.GetDeckName(); + _deckPreview.Init(null, _cardDetail, deckName, HideDeckViewer, "Detail", in_DetailCameraUse: true, (CardBasePrm.ClanType)deck.GetDeckClassID(), 40); + _deckPreview.SetShareButtonUse(isUse: true); + _deckPreview.SetDeck(deck, _conventionDeckList); + if (QRCodeUtility.IsShowQRCode(_deckPreview, _formatBehavior, deck.Format)) + { + _deckPreview.SetQRSmallTexture(); + } + else if (_formatBehavior.CanShowQRCode) + { + _deckPreview.SetQRCodeButtonToGray(); + } + yield return null; + _deckPreview.SetActive(in_Active: true); + } + + private void HideDeckViewer() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardList); + _deckPreview.RemoveData(); + _deckPreview.gameObject.SetActive(value: false); + _deckListMenu.EnableDrag = true; + } + + private void OnMultiDeckDelete() + { + ReloadDeckList(isNeedDeckListUpdateAPI: true); + } + + private void OnLongPressMultiDeckDelete(DeckData deck) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ShowDeckViewer(deck); + _deckListMenu.EnableDrag = false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckListUIParam.cs b/SVSim.BattleEngine/Engine/Wizard/DeckListUIParam.cs new file mode 100644 index 0000000..ea05cdd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckListUIParam.cs @@ -0,0 +1,14 @@ +namespace Wizard; + +public class DeckListUIParam +{ + public Format Format { get; private set; } + + public ConventionInfo ConventionInfo { get; private set; } + + public DeckListUIParam(Format format, ConventionInfo conventionInfo) + { + Format = format; + ConventionInfo = conventionInfo; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckUtil.cs b/SVSim.BattleEngine/Engine/Wizard/DeckUtil.cs new file mode 100644 index 0000000..91e4ff7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckUtil.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace Wizard; + +public class DeckUtil +{ + public static string CreateDefaultDeckName(ClassSet classSet, bool useSubClass, ICollection otherDeckNames, Format format, MyRotationInfo myRotationInfo) + { + return CreateUniqueDeckName(CreateBaseDeckName(classSet, useSubClass, format, myRotationInfo), otherDeckNames); + } + + private static string CreateBaseDeckName(ClassSet classSet, bool useSubClass, Format format, MyRotationInfo myRotationInfo) + { + if (format == Format.MyRotation) + { + return Data.SystemText.Get("MyRotation_ID_02", UIUtil.GetMyRotationDefaultDeckClassName(classSet.MainClass), myRotationInfo.LastPackText); + } + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + if (useSubClass) + { + return $"{UIUtil.GetShortClassName(classSet.MainClass)}/{UIUtil.GetShortClassName(classSet.SubClass)}"; + } + if (format == Format.Rotation) + { + string shortName = Data.Master.CardSetNameMgr.Get(Data.Load.data.RotationLatestCardPackId.ToString()).ShortName; + return Data.SystemText.Get("MyRotation_ID_02", UIUtil.GetMyRotationDefaultDeckClassName(classSet.MainClass), shortName); + } + return dataMgr.GetClanNameByKey((int)classSet.MainClass); + } + + private static string CreateUniqueDeckName(string baseName, ICollection otherDeckNames) + { + int num = 2; + string text = baseName; + while (otherDeckNames.Contains(text)) + { + text = $"{baseName} ({num++})"; + } + return text; + } + + public static bool IsDefaultDeckName(ClassSet classSet, bool useSubClass, string deckName, Format format, MyRotationInfo myRotationInfo) + { + string text = CreateBaseDeckName(classSet, useSubClass, format, myRotationInfo); + if (!deckName.StartsWith(text, StringComparison.Ordinal)) + { + return false; + } + string text2 = deckName.Substring(text.Length); + if (text2.Length == 0) + { + return true; + } + Match match = Regex.Match(text2, "^\\s\\(([0-9]+)\\)$"); + if (!match.Success) + { + return false; + } + if (!int.TryParse(match.Groups[1].Value, out var result)) + { + return false; + } + return result >= 2; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/DeckViewHelper.cs b/SVSim.BattleEngine/Engine/Wizard/DeckViewHelper.cs new file mode 100644 index 0000000..6cbc3ab --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/DeckViewHelper.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class DeckViewHelper : MonoBehaviour +{ + [SerializeField] + private GameObject _cardDetailPrefab; + + [SerializeField] + private GameObject _deckViewPrefab; + + private List _loadCardAssetList; + + private UICardList _uiCardList; + + private int _detailLayer; + + private CardDetailUI _cardDetail; + + private bool _isEnableShareButton = true; + + public UICardList UICardList => _uiCardList; + + public void Initialize(string detailLayerName = "Detail") + { + _detailLayer = LayerMask.NameToLayer(detailLayerName); + _cardDetail = UnityEngine.Object.Instantiate(_cardDetailPrefab).GetComponent(); + _cardDetail.transform.parent = base.transform; + _cardDetail.transform.localPosition = Vector3.zero; + _cardDetail.transform.localScale = Vector3.one; + _cardDetail.Initialize(_detailLayer, CardMaster.CardMasterId.Default); + SetEnableFlavorVoiceEvolution(enable: false); + _cardDetail.gameObject.SetActive(value: false); + _uiCardList = UnityEngine.Object.Instantiate(_deckViewPrefab).GetComponent(); + _uiCardList.Init(base.gameObject, _cardDetail, null, CloseDeckView, detailLayerName, in_DetailCameraUse: true, null, 40); + _uiCardList.SetActive(in_Active: false); + } + + public void SetDetailCameraEnable(bool enable) + { + _uiCardList.SetCameraEnable(enable); + } + + public void SetEnableDeckShareButton(bool enable) + { + _uiCardList.SetShareButtonUse(enable); + _isEnableShareButton = enable; + } + + public void SetEnableFlavorVoiceEvolution(bool enable) + { + _cardDetail.IsShowFlavorTextButton = enable; + _cardDetail.IsShowVoiceButton = enable; + _cardDetail.IsShowEvolutionButton = enable; + } + + public void ShowDeckView(DeckData deck) + { + UIManager.GetInstance().createInSceneCenterLoading(); + StartCoroutine(LoadDeckCard(deck, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + _uiCardList.SetDeck(deck, null); + _uiCardList.SetShareButtonUse(_isEnableShareButton); + _uiCardList.SetQRSmallTexture(); + StartCoroutine(WaitSingleFrame(delegate + { + _uiCardList.SetActive(in_Active: true); + })); + })); + } + + private IEnumerator WaitSingleFrame(Action onFinish) + { + yield return null; + onFinish.Call(); + } + + private IEnumerator LoadDeckCard(DeckData deck, Action onFinish) + { + IList cardIdList = deck.GetCardIdList(); + _uiCardList.RemoveData(); + _loadCardAssetList = _uiCardList.GetLoadFileList(cardIdList as List); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadCardAssetList, null)); + onFinish(); + } + + private void CloseDeckView() + { + if (_loadCardAssetList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadCardAssetList); + _loadCardAssetList = null; + } + _uiCardList.SetActive(in_Active: false); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/EmptyDeckInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/EmptyDeckInfoTask.cs new file mode 100644 index 0000000..7f6c8d9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/EmptyDeckInfoTask.cs @@ -0,0 +1,32 @@ +namespace Wizard; + +public class EmptyDeckInfoTask : BaseTask +{ + public class EmptyDeckInfoTaskParam : BaseParam + { + public int deck_format; + } + + public EmptyDeckInfoTask() + { + base.type = ApiType.Type.EmptyDeckInfo; + } + + public void SetParameter(Format f) + { + EmptyDeckInfoTaskParam emptyDeckInfoTaskParam = new EmptyDeckInfoTaskParam(); + emptyDeckInfoTaskParam.deck_format = Data.FormatConvertApi(f); + base.Params = emptyDeckInfoTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.EmptyDeckInfo.EmptyDeckID = base.ResponseData["data"]["empty_deck_num"].ToInt(); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FreeAndRankMatchDeckSelectConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/FreeAndRankMatchDeckSelectConfirmDialog.cs new file mode 100644 index 0000000..ba62f6b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FreeAndRankMatchDeckSelectConfirmDialog.cs @@ -0,0 +1,81 @@ +using System.Collections; +using Wizard.Battle.Phase; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public static class FreeAndRankMatchDeckSelectConfirmDialog +{ + public static void Create(DialogBase dialogDeckList, DeckData deck, bool isBattleEnd) + { + if (!deck.IsUsable()) + { + InCompleteDeckDecideDialog.Create(dialogDeckList, deck, null, canUseNonPossessionCard: false, ChangeViewSceneAndSetBattleRetry); + return; + } + CompleteDeckDecideDialog.CreateForSingleDeck(dialogDeckList, deck, showSimpleStageOption: true, delegate + { + DecideDeck(deck, isBattleEnd); + }).DecisionUI.CardListCustomize = delegate(UICardList uiCardList) + { + if (!deck.IsRentalDeck) + { + uiCardList.SetEnableBlueButton(isEnable: true, Data.SystemText.Get("Card_0007"), delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DeckCardEditUI.SetDeckEditParameter(deck, null); + ChangeViewSceneAndSetBattleRetry(UIManager.ViewScene.DeckCardEdit); + }); + } + }; + } + + public static void DecideDeck(DeckData deck, bool isBattleEnd, bool notBlack = false, bool notCollider = false) + { + DeckListUtility.DataMgrSaveLastSelectDeckData(deck); + ToolboxGame.UIManager.createInSceneLoadingMatching(notBlack, notCollider); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + UIManager.GetInstance().StartCoroutine(ChangeMatchingScene(isBattleEnd)); + } + + private static IEnumerator ChangeMatchingScene(bool isBattleEnd) + { + yield return UIManager.GetInstance().StartCoroutine(MasterResetMonthTask.MasterReset()); + if (isBattleEnd) + { + if (BattleManagerBase.GetIns() != null && BattleManagerBase.GetIns().GetCurrentPhase() is MainPhase) + { + LocalLog.AccumulateTraceLog("Move Matching From deckSelectEnd"); + } + else + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(UIManager.ViewScene.RankMatch); + } + } + else + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.RankMatch); + } + } + + private static void ChangeViewSceneAndSetBattleRetry(UIManager.ViewScene viewScene) + { + if (UIManager.GetInstance().IsCurrentScene(UIManager.ViewScene.Battle)) + { + GameMgr.GetIns().GetBattleCtrl().BattleEnd(viewScene, SetBattleRetryForDeckCardEdit); + return; + } + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.OnChange = SetBattleRetryForDeckCardEdit; + UIManager.GetInstance().ChangeViewScene(viewScene, changeViewSceneParam); + } + + private static void SetBattleRetryForDeckCardEdit() + { + UIManager instance = UIManager.GetInstance(); + if (instance.IsCurrentScene(UIManager.ViewScene.DeckCardEdit)) + { + (instance.GetUiBaseOfCurrentScene() as DeckCardEditUI).IsBattleRetry = true; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FreeBattleDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard/FreeBattleDoMatchingTask.cs new file mode 100644 index 0000000..c59df45 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FreeBattleDoMatchingTask.cs @@ -0,0 +1,40 @@ +namespace Wizard; + +public class FreeBattleDoMatchingTask : DoMatchingBase +{ + public FreeBattleDoMatchingTask() + { + switch (Data.CurrentFormat) + { + case Format.Rotation: + base.type = ApiType.Type.FreeBattleDoMatchingRotation; + break; + case Format.Unlimited: + base.type = ApiType.Type.FreeBattleDoMatchingUnlimited; + break; + case Format.PreRotation: + base.type = ApiType.Type.FreeBattleDoMatchingPreRotation; + break; + case Format.Crossover: + base.type = ApiType.Type.FreeBattleDoMatchingCrossover; + break; + case Format.MyRotation: + base.type = ApiType.Type.FreeBattleDoMatchingMyRotation; + break; + case Format.Avatar: + base.type = ApiType.Type.FreeBattleDoMatchingAvatar; + break; + } + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + SettingDoMatchingData(); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/FreeBattleFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/FreeBattleFinishTask.cs new file mode 100644 index 0000000..bde62f5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/FreeBattleFinishTask.cs @@ -0,0 +1,46 @@ +namespace Wizard; + +public class FreeBattleFinishTask : FinishTaskBase +{ + public FreeBattleFinishTask() + { + switch (Data.CurrentFormat) + { + case Format.Rotation: + base.type = ApiType.Type.FreeMatchFinishRotation; + break; + case Format.Unlimited: + base.type = ApiType.Type.FreeMatchFinishUnlimited; + break; + case Format.PreRotation: + base.type = ApiType.Type.FreeMatchFinishPreRotation; + break; + case Format.Crossover: + base.type = ApiType.Type.FreeMatchFinishCrossover; + break; + case Format.MyRotation: + base.type = ApiType.Type.FreeMatchFinishMyRotation; + break; + case Format.Avatar: + base.type = ApiType.Type.FreeMatchFinishAvatar; + break; + } + Data.FreeMatchFinish.data = null; + } + + protected override int Parse() + { + int num = base.Parse(); + if (IsEffectiveErrorCode(num)) + { + return num; + } + Data.FreeMatchFinish.data = new FreeMatchFinishDetail(); + if (!IsResponseDataExist(base.ResponseData)) + { + return num; + } + new BattleFinishResponsProcessing().Processing(base.ResponseData, Data.FreeMatchFinish.data); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GachaUtil.cs b/SVSim.BattleEngine/Engine/Wizard/GachaUtil.cs new file mode 100644 index 0000000..b368e5d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GachaUtil.cs @@ -0,0 +1,56 @@ +namespace Wizard; + +public class GachaUtil +{ + public static string GetRewardListGoodsTypeName(UserGoods userGoods) + { + switch (userGoods.GoodsType) + { + case UserGoods.Type.Sleeve: + if (!Data.Master.SleeveMgr.Get(userGoods.Id).IsPremiumSleeve) + { + return Data.SystemText.Get("Shop_0227"); + } + return Data.SystemText.Get("Shop_0230"); + case UserGoods.Type.Emblem: + return Data.SystemText.Get("Shop_0228"); + case UserGoods.Type.Degree: + if (!Data.Master.DegreeMgr.Get((int)userGoods.Id).IsPremium) + { + return Data.SystemText.Get("Shop_0231"); + } + return Data.SystemText.Get("Shop_0250"); + case UserGoods.Type.Skin: + return Data.SystemText.Get("Shop_0229"); + case UserGoods.Type.MyPageBG: + return Data.SystemText.Get("MyPage_0102"); + default: + Debug.LogError($"unsupported UserGoods.Type : {userGoods.GoodsType}"); + return string.Empty; + } + } + + public static int GetRewardListSortIndex(UserGoods userGoods) + { + switch (userGoods.GoodsType) + { + case UserGoods.Type.Sleeve: + if (!Data.Master.SleeveMgr.Get(userGoods.Id).IsPremiumSleeve) + { + return 2; + } + return 3; + case UserGoods.Type.Emblem: + return 1; + case UserGoods.Type.Degree: + return 4; + case UserGoods.Type.Skin: + return 0; + case UserGoods.Type.MyPageBG: + return 5; + default: + Debug.LogError($"unsupported UserGoods.Type : {userGoods.GoodsType}"); + return int.MaxValue; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringAutoJoinTaskInfo.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringAutoJoinTaskInfo.cs new file mode 100644 index 0000000..f233134 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringAutoJoinTaskInfo.cs @@ -0,0 +1,50 @@ +using LitJson; + +namespace Wizard; + +public class GatheringAutoJoinTaskInfo +{ + public BaseRoomBattleEnterRoomTask BaseRoomBattleEnterRoomTask { get; set; } + + public string RoomId { get; private set; } + + public string DisplayRoomId { get; private set; } + + public bool IsOwner { get; private set; } + + public bool NeedsRetry { get; private set; } + + public GatheringInfo GatheringInfo { get; private set; } + + public bool IsEntryRoom { get; private set; } + + public GatheringAutoJoinTaskInfo(JsonData ResponseData, BaseRoomBattleEnterRoomTask baseRoomBattleEnterRoomTask, GatheringInfo gatheringInfo) + { + GatheringInfo = gatheringInfo; + BaseRoomBattleEnterRoomTask = baseRoomBattleEnterRoomTask; + if (!ResponseData.TryGetValue("data", out var value)) + { + return; + } + if (value.TryGetValue("result_reason", out var value2)) + { + NeedsRetry = value2.ToInt() == 12; + } + if (value.IsObject && value.TryGetValue("is_owner", out var value3)) + { + IsOwner = value3.ToInt() != 0; + if (value.TryGetValue("room_id", out var value4)) + { + RoomId = value4.ToString(); + } + if (value.TryGetValue("display_room_id", out var value5)) + { + DisplayRoomId = value5.ToString(); + } + if (value.TryGetValue("oppo_info", out var value6)) + { + IsEntryRoom = value6 != null; + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringChat.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringChat.cs new file mode 100644 index 0000000..3c43a19 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringChat.cs @@ -0,0 +1,298 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringChat : MonoBehaviour +{ + [SerializeField] + private GameObject _rootObj; + + [SerializeField] + private Chat _chatPrefab; + + private Chat _chat; + + [SerializeField] + private GatheringChatSettings _chatSettings; + + [SerializeField] + private GatheringChatDeckList _gatheringDeckListUI; + + [SerializeField] + private GatheringChatAutoJoinRoomMatch _autoJoinRoomMatchUI; + + [SerializeField] + private ChatSendDeckUI _sendDeckUI; + + [SerializeField] + private ChatSendReplayUI _sendReplayUI; + + [SerializeField] + private GatheringChatSendRoomMatchUI _sendRoomMatchUI; + + [SerializeField] + private ChatShareDeckUI _shareDeckUI; + + [SerializeField] + private GatheringChatInterruptOrLeave _interruptOrLeaveUI; + + [SerializeField] + private NotificatonAnimation _notificationAnimationPrefab; + + [SerializeField] + private GameObject _notificationParent; + + private DialogBase _confirmStateChangeDialog; + + public void OpenCategory() + { + ClearActionUI(); + List chatActionUIList = new List { _gatheringDeckListUI, _autoJoinRoomMatchUI, _sendDeckUI, _sendReplayUI, _sendRoomMatchUI, _shareDeckUI, _interruptOrLeaveUI }; + GatheringGetSelfInfoTask task = new GatheringGetSelfInfoTask(isDependGatheringInfo: true); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _chatSettings.SetGatheringInfo(task.Info, task.EntrySetting); + _chat = NGUITools.AddChild(_rootObj, _chatPrefab.gameObject).GetComponent(); + _chat.OnAddNewChatMessage = OnAddNewChatMessage; + _chat.OnMissionCleared = ShowMissionClearedNotifications; + _chat.gameObject.transform.localPosition = new Vector3(2000f, 0f, 0f); + _chat.Init(_chatSettings, chatActionUIList, task.ChatStampList, NetworkDefine.MAINTENANCE_TYPE.CHAT_GATHERING, delegate(ChatInfo chatInfo) + { + ChangeActionUI(_chatSettings.GatheringInfo, chatInfo); + _chat.gameObject.transform.localPosition = Vector3.zero; + bool b = _chatSettings.GatheringInfo.Rule.BattleParameterInstance.DeckFormat == Format.Avatar; + UIManager.SetObjectToGrey(_shareDeckUI.gameObject, b); + UIManager.SetObjectToGrey(_sendDeckUI.gameObject, b); + }); + })); + } + + public void ReadyCloseCategory() + { + _chat.ReadyClose(); + } + + public void CloseCategory() + { + _chat.ExecuteClose(); + } + + private void ChangeActionUI(GatheringInfo gatheringInfo, ChatInfo chatInfo) + { + ClearActionUI(); + bool canBattleJoin = gatheringInfo.CanBattleJoin; + switch (gatheringInfo.State) + { + case GatheringInfo.eState.BEFORE_BATTLE: + _gatheringDeckListUI.gameObject.SetActive(canBattleJoin); + break; + case GatheringInfo.eState.ACTIVE_BATTLE: + _gatheringDeckListUI.gameObject.SetActive(canBattleJoin); + if (!gatheringInfo.Rule.IsTournament) + { + _sendRoomMatchUI.gameObject.SetActive(canBattleJoin); + } + UpdateActiveAutoJoinRoomMatchUI(chatInfo); + break; + case GatheringInfo.eState.AFTER_BATTLE: + _sendDeckUI.gameObject.SetActive(value: true); + _sendReplayUI.gameObject.SetActive(value: true); + _shareDeckUI.gameObject.SetActive(value: true); + _interruptOrLeaveUI.gameObject.SetActive(value: true); + break; + } + } + + private void ClearActionUI() + { + _gatheringDeckListUI.gameObject.SetActive(value: false); + _autoJoinRoomMatchUI.gameObject.SetActive(value: false); + _sendRoomMatchUI.gameObject.SetActive(value: false); + _sendDeckUI.gameObject.SetActive(value: false); + _sendReplayUI.gameObject.SetActive(value: false); + _shareDeckUI.gameObject.SetActive(value: false); + _interruptOrLeaveUI.gameObject.SetActive(value: false); + } + + private void OnAddNewChatMessage(ChatInfo chatInfo) + { + UpdateActiveAutoJoinRoomMatchUI(chatInfo); + UpdateStateByChatMessage(chatInfo.MessageList); + } + + private void UpdateActiveAutoJoinRoomMatchUI(ChatInfo chatInfo) + { + if (_chatSettings.GatheringInfo.State != GatheringInfo.eState.ACTIVE_BATTLE) + { + _autoJoinRoomMatchUI.gameObject.SetActive(value: false); + return; + } + if (!_chatSettings.GatheringInfo.CanBattleJoin) + { + _autoJoinRoomMatchUI.gameObject.SetActive(value: false); + return; + } + _autoJoinRoomMatchUI.gameObject.SetActive(value: true); + if (_chatSettings.GatheringInfo.Rule.Type == GatheringRule.eType.TOURNAMENT) + { + _autoJoinRoomMatchUI.SetViewTournamentRoomMatch(chatInfo.GatheringMatchedRoom); + } + } + + private void UpdateStateByChatMessage(List chatMessageList) + { + GatheringInfo.eState state = _chatSettings.GatheringInfo.State; + GatheringInfo.eState eState = state; + if (state == GatheringInfo.eState.AFTER_BATTLE) + { + return; + } + using (List.Enumerator enumerator = chatMessageList.GetEnumerator()) + { + while (enumerator.MoveNext()) + { + switch (enumerator.Current.MessageType) + { + case ChatMessageInfo.eMessageType.GATHERING_BATTLE_END: + eState = GatheringInfo.eState.AFTER_BATTLE; + goto end_IL_003e; + case ChatMessageInfo.eMessageType.GATHERING_BATTLE_START: + eState = GatheringInfo.eState.ACTIVE_BATTLE; + break; + } + continue; + end_IL_003e: + break; + } + } + if (eState != state) + { + CreateConfirmStateChangeDialog(eState); + } + } + + private void ChangeViewSceneGoToGatheringActionMenu() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 3; + changeViewSceneParam.OnFinishChangeView = delegate + { + MyPageMenu.Instance.GoToGatheringActionMenu(); + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage, changeViewSceneParam); + } + + private void CreateConfirmStateChangeDialog(GatheringInfo.eState state) + { + if (state != GatheringInfo.eState.BEFORE_BATTLE) + { + if (_confirmStateChangeDialog != null) + { + _confirmStateChangeDialog.OnCloseStart = null; + _confirmStateChangeDialog.Close(); + } + _confirmStateChangeDialog = UIManager.GetInstance().CreateDialogClose(); + string text = string.Empty; + switch (state) + { + case GatheringInfo.eState.ACTIVE_BATTLE: + text = Data.SystemText.Get("Gathering_Chat_0009"); + break; + case GatheringInfo.eState.AFTER_BATTLE: + text = Data.SystemText.Get("Gathering_Chat_0010"); + break; + } + _confirmStateChangeDialog.SetText(text); + _confirmStateChangeDialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + _confirmStateChangeDialog.OnCloseStart = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_CANCEL_TRANS); + ChangeViewSceneGoToGatheringActionMenu(); + UIManager.GetInstance().dialogAllClear(); + }; + _confirmStateChangeDialog.SetPanelDepth(4000); + } + } + + public static bool IsMaintenance(List maintenanceCodeList, GatheringRule rule) + { + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_ALL_MAINTENANCE) || maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_BATTLE_MAINTENANCE)) + { + return true; + } + switch (rule.BattleParameterInstance.DeckFormat) + { + case Format.Rotation: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_ROTATION)) + { + return true; + } + break; + case Format.Unlimited: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_UNLIMITED)) + { + return true; + } + break; + case Format.PreRotation: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_PRE_ROTATION)) + { + return true; + } + break; + } + switch (rule.BattleParameterInstance.Rule) + { + case RoomConnectController.BattleRule.Bo1: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_RULE_BO1)) + { + return true; + } + break; + case RoomConnectController.BattleRule.Bo3: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_RULE_BO3)) + { + return true; + } + break; + case RoomConnectController.BattleRule.Bo5: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_RULE_BO5)) + { + return true; + } + break; + case RoomConnectController.BattleRule.Bo3Ban: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_RULE_BO3_BAN1)) + { + return true; + } + break; + case RoomConnectController.BattleRule.Bo5Ban: + if (maintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.ROOM_RULE_BO5_BAN1)) + { + return true; + } + break; + } + return false; + } + + public static void ResetLatestReadChatMessageId() + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.READ_LATEST_GATHERING_CHAT_MESSAGE_ID, -1); + } + + private void ShowMissionClearedNotifications(List messages) + { + List list = new List(); + for (int i = 0; i < messages.Count; i++) + { + list.Add(new NotificatonAnimation.Param(NotificatonAnimation.Param.Type.MissionCleared, messages[i])); + } + NotificatonAnimation component = NGUITools.AddChild(_notificationParent, _notificationAnimationPrefab.gameObject).GetComponent(); + StartCoroutine(component.Exec(list)); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringChatAutoJoinRoomMatch.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringChatAutoJoinRoomMatch.cs new file mode 100644 index 0000000..5908240 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringChatAutoJoinRoomMatch.cs @@ -0,0 +1,188 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; +using Wizard.ErrorDialog; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringChatAutoJoinRoomMatch : MonoBehaviour, IChatActionUI +{ + [SerializeField] + private UIButton _buttonAutoJoinRoomMatch; + + [SerializeField] + private UILabel _labelAutoJoinRoomMatchBtn; + + private ChatConnectController _chatConnectController; + + private GatheringChatSettings _gatheringChatSettings; + + private Action _startCreateRoomAction; + + private GatheringMatchedRoom _tournamentMatchedRoom; + + private const float RETRY_INTERVAL = 1f; + + private const int RETRY_COUNT_MAX = 5; + + private int _tournamentApiRetryCount; + + public void SetViewTournamentRoomMatch(GatheringMatchedRoom matchedRoom) + { + _tournamentMatchedRoom = matchedRoom; + UIManager.SetObjectToGrey(_buttonAutoJoinRoomMatch.gameObject, !matchedRoom.IsMatched); + } + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, ChatLogUI chatLogUI, Action actionAddNewChatLogAfterSendChat) + { + _chatConnectController = chatConnectController; + _gatheringChatSettings = chatSettings as GatheringChatSettings; + if (_gatheringChatSettings.SendRoomMatchUI != null) + { + _startCreateRoomAction = _gatheringChatSettings.SendRoomMatchUI.StartCreateRoom; + } + if (_gatheringChatSettings.GatheringInfo.Rule.IsTournament) + { + _labelAutoJoinRoomMatchBtn.text = Data.SystemText.Get("Gathering_Chat_0022"); + } + else + { + _labelAutoJoinRoomMatchBtn.text = Data.SystemText.Get("Gathering_Chat_0002"); + } + _buttonAutoJoinRoomMatch.onClick.Clear(); + _buttonAutoJoinRoomMatch.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + EnterAutoJoinRoomMatch(); + })); + } + + public void EnterAutoJoinRoomMatch() + { + if (GatheringChat.IsMaintenance(Data.MaintenanceCodeList, _gatheringChatSettings.GatheringInfo.Rule)) + { + Wizard.ErrorDialog.Dialog.Create(2030); + return; + } + GatheringInfo gatheringInfo = _gatheringChatSettings.GatheringInfo; + if (gatheringInfo.Rule.Type == GatheringRule.eType.FREE_BATTLE) + { + UIManager.GetInstance().StartCoroutine(EnterVacancyRoom(gatheringInfo)); + } + else if (gatheringInfo.Rule.Type == GatheringRule.eType.TOURNAMENT) + { + if (_tournamentMatchedRoom == null || !_tournamentMatchedRoom.IsMatched) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + Wizard.ErrorDialog.Dialog.Setup(dialogBase, 5315.ToString()); + dialogBase.SetPanelDepth(5400); + dialogBase.onPushButton1 = delegate + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage); + }; + } + else + { + EnterTournamentRoom(gatheringInfo); + } + } + else + { + Debug.LogError("ユーザー大会タイプが不正です。:" + gatheringInfo.Rule.Type); + } + } + + private IEnumerator EnterVacancyRoom(GatheringInfo gatheringInfo) + { + bool isRoomReady = false; + int retryCount = 0; + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + _chatConnectController.PausePolling(); + GatheringAutoJoinTaskInfo gatheringAutoJoinTaskInfo = null; + string battleId = ""; + while (!isRoomReady) + { + GatheringRoomEnterVacancyRoomTask enterVacancyRoomTask = new GatheringRoomEnterVacancyRoomTask(gatheringInfo); + yield return UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(enterVacancyRoomTask)); + gatheringAutoJoinTaskInfo = enterVacancyRoomTask.GatheringAutoJoinTaskInfo; + if (!enterVacancyRoomTask.IsResultSuccess) + { + _chatConnectController.ResetPolling(); + UIManager.GetInstance().closeInSceneCenterLoading(); + yield break; + } + battleId = enterVacancyRoomTask.BattleID; + if (gatheringAutoJoinTaskInfo.NeedsRetry) + { + int num = retryCount + 1; + retryCount = num; + if (num > 5) + { + _chatConnectController.ResetPolling(); + UIManager.GetInstance().closeInSceneCenterLoading(); + _startCreateRoomAction.Call(); + yield break; + } + yield return new WaitForSeconds(1f); + } + else + { + isRoomReady = true; + } + } + RoomConnectController.InitializeParameter initializeParameter = new RoomConnectController.InitializeParameter((!gatheringAutoJoinTaskInfo.IsOwner) ? RoomConnectController.PositionMode.VISITOR : RoomConnectController.PositionMode.OWNER, roomId: gatheringAutoJoinTaskInfo.IsOwner ? "" : gatheringAutoJoinTaskInfo.RoomId, battleParameter: gatheringInfo.Rule.BattleParameterInstance); + initializeParameter.IsGathering = true; + initializeParameter.GatheringAutoJoinTaskInfo = gatheringAutoJoinTaskInfo; + UIManager.GetInstance().StartCoroutine(GatheringUtility.JoinRoom(initializeParameter, battleId)); + } + + private void EnterTournamentRoom(GatheringInfo gatheringInfo) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + _chatConnectController.PausePolling(); + _tournamentApiRetryCount = 0; + GatheringRoomEnterTournamentRoom(gatheringInfo); + } + + private void GatheringRoomEnterTournamentRoom(GatheringInfo gatheringInfo) + { + GatheringRoomEnterTournamentRoomTask tournamentTask = new GatheringRoomEnterTournamentRoomTask(gatheringInfo); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(tournamentTask, delegate + { + UIManager.GetInstance().StartCoroutine(EnterTournamentSuccess(tournamentTask, gatheringInfo)); + }, null, delegate + { + _chatConnectController.ResetPolling(); + UIManager.GetInstance().closeInSceneCenterLoading(); + })); + } + + private IEnumerator EnterTournamentSuccess(GatheringRoomEnterTournamentRoomTask tournamentTask, GatheringInfo gatheringInfo) + { + GatheringAutoJoinTaskInfo gatheringAutoJoinTaskInfo = tournamentTask.GatheringAutoJoinTaskInfo; + if (gatheringAutoJoinTaskInfo.NeedsRetry) + { + _tournamentApiRetryCount++; + if (_tournamentApiRetryCount > 5) + { + _chatConnectController.ResetPolling(); + UIManager.GetInstance().closeInSceneCenterLoading(); + Wizard.ErrorDialog.Dialog.Create("TIMEOUT_NORETRY"); + } + else + { + yield return new WaitForSeconds(1f); + GatheringRoomEnterTournamentRoom(gatheringInfo); + } + } + else + { + RoomConnectController.InitializeParameter initializeParameter = new RoomConnectController.InitializeParameter((!gatheringAutoJoinTaskInfo.IsOwner) ? RoomConnectController.PositionMode.VISITOR : RoomConnectController.PositionMode.OWNER, roomId: gatheringAutoJoinTaskInfo.IsOwner ? "" : gatheringAutoJoinTaskInfo.RoomId, battleParameter: gatheringInfo.Rule.BattleParameterInstance); + initializeParameter.IsGathering = true; + initializeParameter.GatheringAutoJoinTaskInfo = gatheringAutoJoinTaskInfo; + UIManager.GetInstance().StartCoroutine(GatheringUtility.JoinRoom(initializeParameter, tournamentTask.BattleID)); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringChatDeckList.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringChatDeckList.cs new file mode 100644 index 0000000..f517a3e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringChatDeckList.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class GatheringChatDeckList : MonoBehaviour, IChatActionUI +{ + private const int DECK_DETAIL_DIALOG_DEPTH = 100; + + [SerializeField] + private UIButton _buttonGatheringDeckList; + + [SerializeField] + private UILabel _labelGatheringDeckListButton; + + [SerializeField] + private DeckDetailDialog _deckDetailDialogPrefab; + + private DeckDetailDialog _deckDetailDialog; + + private GatheringInfo _gatheringInfo; + + private DialogBase _dialogDeckList; + + private ChatConnectController _chatConnectController; + + private ChatLogUI _chatLogUI; + + private readonly List _loadedVoiceList = new List(); + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, ChatLogUI chatLogUI, Action actionAddNewChatLogAfterSendChat) + { + _chatConnectController = chatConnectController; + _chatLogUI = chatLogUI; + GatheringChatSettings gatheringChatSettings = chatSettings as GatheringChatSettings; + _gatheringInfo = gatheringChatSettings.GatheringInfo; + _labelGatheringDeckListButton.text = GetTextDeckListTitle(_gatheringInfo); + _buttonGatheringDeckList.onClick.Clear(); + _buttonGatheringDeckList.onClick.Add(new EventDelegate(delegate + { + OnClickGatheringDeckList(); + })); + } + + private string GetTextDeckListTitle(GatheringInfo gatheringInfo) + { + if (gatheringInfo.Rule.IsEntryDeckOnly) + { + return Data.SystemText.Get("Gathering_Chat_0001"); + } + return Data.SystemText.Get("Gathering_Chat_0021"); + } + + private void OnClickGatheringDeckList() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + GatheringConfirmDeckListTask task = new GatheringConfirmDeckListTask(); + _chatConnectController.StartConnectCommon(task, delegate + { + CreateDeckList(task.DeckGroupListData, task.DeckFormat); + }); + } + + private void CreateDeckList(DeckGroupListData deckGroupListData, Format deckFormat, bool isFadeBackView = true, bool isOpenSE = true) + { + DeckSelectUIDialog deckSelectUIDialog = DeckSelectUIDialog.Create(GetTextDeckListTitle(_gatheringInfo), deckGroupListData, deckFormat, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: false, delegate(DialogBase dialog, DeckData deck) + { + CreateDeckDetailDialog(deck); + }); + _dialogDeckList = deckSelectUIDialog.Dialog; + _dialogDeckList.IsEnableOpenSe = isOpenSE; + if (!isFadeBackView) + { + _dialogDeckList.ResetBackViewAlpha(); + } + _dialogDeckList.SetLayer("Loading"); + } + + private void CreateDeckDetailDialog(DeckData deck) + { + _deckDetailDialog = UnityEngine.Object.Instantiate(_deckDetailDialogPrefab); + _deckDetailDialog.gameObject.SetActive(value: true); + _deckDetailDialog.InitializeForGathering(deck, _gatheringInfo.Rule.IsEntryDeckOnly, delegate + { + GatheringConfirmDeckListTask task = new GatheringConfirmDeckListTask(); + _chatConnectController.StartConnectCommon(task, delegate + { + _dialogDeckList.Close(); + CreateDeckList(task.DeckGroupListData, task.DeckFormat, isFadeBackView: false, isOpenSE: false); + }); + }, _loadedVoiceList); + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(); + dialog.SetSize(DialogBase.Size.M); + dialog.SetPanelDepth(100); + dialog.SetTitleLabel(""); + dialog.SetObj(_deckDetailDialog.gameObject); + DialogBase dialogBase = dialog; + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + _deckDetailDialog.Final(); + }); + Action OnOpenDeckView = delegate + { + if (_dialogDeckList != null) + { + _dialogDeckList.SetActive(inActive: false); + } + dialog.Close(); + }; + Action OnCloseDeckView = delegate + { + if (_dialogDeckList != null) + { + _dialogDeckList.SetActive(inActive: true); + } + }; + Action onPushButton = delegate + { + _chatLogUI.ShowDeckViewByDeckData(deck, OnOpenDeckView, OnCloseDeckView, isActiveRedButton: false, isActiveDeckIntroductionObj: false); + }; + dialog.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialog.SetButtonText(Data.SystemText.Get("Card_0083")); + dialog.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE; + dialog.onPushButton1 = onPushButton; + dialog.isNotCloseWindowButton1 = true; + } + + private void OnDestroy() + { + if (_loadedVoiceList.Count > 0) + { + GameMgr.GetIns().GetSoundMgr().StopVoiceAll(0f); + Toolbox.ResourcesManager.RemoveAssetGroup(_loadedVoiceList); + _loadedVoiceList.Clear(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringChatInterruptOrLeave.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringChatInterruptOrLeave.cs new file mode 100644 index 0000000..a77672e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringChatInterruptOrLeave.cs @@ -0,0 +1,115 @@ +using System; +using UnityEngine; + +namespace Wizard; + +public class GatheringChatInterruptOrLeave : MonoBehaviour, IChatActionUI +{ + [SerializeField] + private UIButton _button; + + [SerializeField] + private UILabel _label; + + private bool _isOwner; + + private ChatConnectController _chatConnectController; + + private const string BUTTON_SPRITE_NAME_DEFAULT_OFF = "btn_common_01_s_off"; + + private const string BUTTON_SPRITE_NAME_DEFAULT_ON = "btn_common_01_s_on"; + + private const string BUTTON_SPRITE_NAME_RED_OFF = "btn_common_04_s_off"; + + private const string BUTTON_SPRITE_NAME_RED_ON = "btn_common_04_s_on"; + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectController, ChatLogUI chatLogUI, Action actionAddNewChatLogAfterSendChat) + { + _chatConnectController = chatConnectController; + GatheringChatSettings gatheringChatSettings = chatSettings as GatheringChatSettings; + _isOwner = gatheringChatSettings.GatheringInfo.Role == GatheringRule.eRole.OWNER; + _button.onClick.Clear(); + if (_isOwner) + { + _label.text = Data.SystemText.Get("Gathering_Chat_0011"); + _button.onClick.Add(new EventDelegate(OnClickInterrupt)); + _button.normalSprite = "btn_common_04_s_off"; + _button.pressedSprite = "btn_common_04_s_on"; + } + else + { + _label.text = Data.SystemText.Get("Gathering_Chat_0015"); + _button.onClick.Add(new EventDelegate(OnClickLeave)); + _button.normalSprite = "btn_common_01_s_off"; + _button.pressedSprite = "btn_common_01_s_on"; + } + } + + private void OnClickInterrupt() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + PauseChatPolling(); + SystemText text = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(text.Get("Gathering_Chat_0012")); + dialogBase.SetText(text.Get("Gathering_Chat_0013")); + dialogBase.SetButtonText(text.Get("Gathering_Chat_0014"), text.Get("Common_0005")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.onPushButton1 = delegate + { + GatheringInterruptTask task = new GatheringInterruptTask(); + _chatConnectController.StartConnectCommon(task, delegate + { + StopChatPolling(); + ChangeViewWithDialog(text.Get("Gathering_Chat_0019")); + }); + }; + dialogBase.onPushButton2 = ResumeChatPolling; + dialogBase.onCloseWithoutSelect = ResumeChatPolling; + } + + private void OnClickLeave() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + PauseChatPolling(); + SystemText text = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(text.Get("Gathering_Chat_0016")); + dialogBase.SetText(text.Get("Gathering_Chat_0017")); + dialogBase.SetButtonText(text.Get("Gathering_Chat_0018"), text.Get("Common_0005")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.onPushButton1 = delegate + { + GatheringLeaveTask task = new GatheringLeaveTask(); + _chatConnectController.StartConnectCommon(task, delegate + { + StopChatPolling(); + ChangeViewWithDialog(text.Get("Gathering_Chat_0020")); + }); + }; + dialogBase.onPushButton2 = ResumeChatPolling; + dialogBase.onCloseWithoutSelect = ResumeChatPolling; + } + + private void ChangeViewWithDialog(string text) + { + UIManager.GetInstance().CreateConfirmationDialog(text).OnCloseStart = Gathering.BackToMyPageForDrop; + } + + private void PauseChatPolling() + { + _chatConnectController.PausePolling(); + } + + private void ResumeChatPolling() + { + _chatConnectController.ResumePolling(); + } + + private void StopChatPolling() + { + _chatConnectController.StopPolling(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringChatSendRoomMatchUI.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringChatSendRoomMatchUI.cs new file mode 100644 index 0000000..d19b5ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringChatSendRoomMatchUI.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections; +using UnityEngine; +using Wizard.ErrorDialog; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringChatSendRoomMatchUI : MonoBehaviour, IChatActionUI +{ + [SerializeField] + private UIButton _buttonRoomMatch; + + private ChatConnectController _chatConnectCtr; + + public void Init(IChatSettings chatSettings, ChatConnectController chatConnectCtr, ChatLogUI chatLogUI, Action actionAddNewChatLogAfterSendChat) + { + _chatConnectCtr = chatConnectCtr; + _buttonRoomMatch.onClick.Clear(); + _buttonRoomMatch.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + GatheringInfo gatheringInfo = (chatSettings as GatheringChatSettings).GatheringInfo; + if (GatheringChat.IsMaintenance(Data.MaintenanceCodeList, gatheringInfo.Rule)) + { + Wizard.ErrorDialog.Dialog.Create(2030); + } + else + { + RoomConnectController.InitializeParameter param = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.OWNER, gatheringInfo.Rule.BattleParameterInstance, "") + { + IsGathering = true + }; + UIManager.GetInstance().StartCoroutine(CreateRoom(param)); + } + })); + } + + private IEnumerator CreateRoom(RoomConnectController.InitializeParameter param) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + RoomConnectController room = new RoomConnectController(param); + yield return UIManager.GetInstance().StartCoroutine(room.StartConnect()); + if (room.ConnectRoomResultType == RoomConnectController.ConnectRoomResult.SUCCESS) + { + _chatConnectCtr.StopPolling(); + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.RoomBattle; + UIManager.GetInstance()._Footer.InviteIconDisp(inDisp: false); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Room); + } + UIManager.GetInstance().closeInSceneCenterLoading(); + } + + public void StartCreateRoom() + { + UIButton.current = _buttonRoomMatch; + EventDelegate.Execute(_buttonRoomMatch.onClick); + UIButton.current = null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringChatSettings.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringChatSettings.cs new file mode 100644 index 0000000..803a742 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringChatSettings.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringChatSettings : MonoBehaviour, IChatSettings +{ + [SerializeField] + private ChatLogPlate _prefabChatLogPlate; + + [SerializeField] + private GatheringChatSendRoomMatchUI _sendRoomMatchUI; + + [SerializeField] + private GatheringChatAutoJoinRoomMatch _autoJoinRoomMatchUI; + + public GatheringChatSendRoomMatchUI SendRoomMatchUI => _sendRoomMatchUI; + + public GatheringChatAutoJoinRoomMatch AutoJoinRoomMatchUI => _autoJoinRoomMatchUI; + + public KeyValuePair PlayerPrefsKeyLatestReadChatMessageId => PlayerPrefsWrapper.READ_LATEST_GATHERING_CHAT_MESSAGE_ID; + + public IChatApiSettings ApiSettings { get; } = new GatheringChatApiSettings(); + + public ChatLogPlate PrefabChatLogPlate => _prefabChatLogPlate; + + public UIManager.ViewScene ReplayBackScene => UIManager.ViewScene.Gathering; + + public UIManager.ChangeViewSceneParam ReplayBackSceneParam => new UIManager.ChangeViewSceneParam + { + IsUpdateFooterMenuTexture = true + }; + + public GatheringInfo GatheringInfo { get; private set; } + + public GatheringEntrySetting EntrySetting { get; private set; } + + public Action OnSetChatLogRoomInfoViewJoinButton => delegate(GameObject joinVisitorBtn) + { + bool active = true; + if (GatheringInfo.Role == GatheringRule.eRole.OWNER && !GatheringInfo.Rule.IsOwnerEntryBattle) + { + active = false; + } + joinVisitorBtn.gameObject.SetActive(active); + }; + + public Action OnClickBtnJoinRoomVisitor => delegate(string roomId) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + RoomConnectController.InitializeParameter param = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.VISITOR, GatheringInfo.Rule.BattleParameterInstance, roomId) + { + IsGathering = true + }; + UIManager.GetInstance().StartCoroutine(GatheringUtility.JoinRoom(param, "")); + }; + + public Action OnClickBtnJoinRoomWatcher => delegate(string roomId) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + RoomConnectController.InitializeParameter param = new RoomConnectController.InitializeParameter(RoomConnectController.PositionMode.WATCHER, GatheringInfo.Rule.BattleParameterInstance, roomId) + { + IsGathering = true + }; + UIManager.GetInstance().StartCoroutine(GatheringUtility.JoinRoom(param, "")); + }; + + public void SetGatheringInfo(GatheringInfo info, GatheringEntrySetting entrySetting) + { + GatheringInfo = info; + EntrySetting = entrySetting; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringCreateDialog.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringCreateDialog.cs new file mode 100644 index 0000000..9ee7b51 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringCreateDialog.cs @@ -0,0 +1,498 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringCreateDialog : MonoBehaviour +{ + [SerializeField] + private UIButton _typeChangeButton; + + [SerializeField] + private UILabel _typeLabel; + + [SerializeField] + private UIButton _battleStyleChangeButton; + + [SerializeField] + private UILabel _battleStyleLabel; + + [SerializeField] + private UIButton _maxMemberChangeButton; + + [SerializeField] + private UILabel _maxMemberLabel; + + [SerializeField] + private UIButton _formatChangeButton; + + [SerializeField] + private UILabel _formatLabel; + + [SerializeField] + private UIButton _watchChangeButton; + + [SerializeField] + private UILabel _watchLabel; + + [SerializeField] + private UIButton _battleHourChangeButton; + + [SerializeField] + private UILabel _battleHourLabel; + + [SerializeField] + private UIButton _battleStartTimeChangeButton; + + [SerializeField] + private UILabel _battleStartTimeLabel; + + [SerializeField] + private UIToggle _isEntryDeckOnlyToggle; + + [SerializeField] + private GameObject _isEntryDeckOnlyObjectRoot; + + [SerializeField] + private GameObject _timeLimitObjectRoot; + + [SerializeField] + private UIGrid _ruleCategoryGrid; + + [SerializeField] + private GameObject _startTimeSelectPrefab; + + [SerializeField] + private UIToggle _ownerEntryBattleToggle; + + public Action OnDecideRule; + + private DialogBase _dialog; + + private GatheringRule _rule = new GatheringRule(); + + private bool _ownerEntryBattleToggleFirstCall = true; + + private bool _isEntryDeckOnlyToggleFirstCall = true; + + private List _formatList = new List(); + + private Format[] ALL_FORMAT = new Format[2] + { + Format.Rotation, + Format.Unlimited + }; + + private int[] BATTLE_HOUR_SETTING = new int[8] { 1, 2, 3, 4, 8, 12, 24, 48 }; + + private int[] BATTLE_START_MINUTE_SETTING = new int[8] { 5, 15, 30, 60, 120, 240, 480, 1440 }; + + private int[] MAX_MEMBER_SETTING = new int[7] { 2, 4, 8, 16, 32, 64, 128 }; + + private static List GetRuleListNormal(Format format) + { + List list = new List(); + list.Add(RoomConnectController.BattleRule.Bo1); + if (format != Format.Avatar) + { + list.Add(RoomConnectController.BattleRule.Bo3); + list.Add(RoomConnectController.BattleRule.Bo5); + list.Add(RoomConnectController.BattleRule.Bo3Ban); + list.Add(RoomConnectController.BattleRule.Bo5Ban); + } + return list; + } + + public static GatheringCreateDialog Create(GameObject prefab) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + GatheringCreateDialog component = UnityEngine.Object.Instantiate(prefab).GetComponent(); + component._dialog = dialogBase; + SystemText systemText = Data.SystemText; + dialogBase.SetObj(component.gameObject); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Gathering_0020")); + dialogBase.SetTitleLabel(systemText.Get("Gathering_0006")); + component._rule.LoadFromPlayerPrefs(); + component._rule.BattleStartLocalTime = DefaultStartTime(); + component.Refresh(); + return component; + } + + private static DateTime DefaultStartTime() + { + DateTime nowTime = PlayerStaticData.UserTime.GetNowTime(); + int num = 15; + int minute = nowTime.Minute; + int num2 = minute / num * num; + nowTime = nowTime.AddMinutes(num2 - minute); + TimeSpan timeSpan = nowTime - PlayerStaticData.UserTime.GetNowTime(); + while (timeSpan.TotalMinutes < 16.0) + { + nowTime = nowTime.AddMinutes(15.0); + timeSpan = nowTime - PlayerStaticData.UserTime.GetNowTime(); + } + return nowTime; + } + + private void Start() + { + _typeChangeButton.onClick.Add(new EventDelegate(delegate + { + OnClickGatheringTypeChangeButton(); + })); + _maxMemberChangeButton.onClick.Add(new EventDelegate(delegate + { + OnClickMaxMemberChangeButton(); + })); + _battleStyleChangeButton.onClick.Add(new EventDelegate(delegate + { + OnClickBattleStyleChangeButton(); + })); + _formatChangeButton.onClick.Add(new EventDelegate(delegate + { + OnClickFormatChangeButton(); + })); + _ownerEntryBattleToggle.onChange.Add(new EventDelegate(delegate + { + OnClickOwnerEntryBattle(); + })); + _watchChangeButton.onClick.Add(new EventDelegate(delegate + { + OnClickWatchChangeButton(); + })); + _battleHourChangeButton.onClick.Add(new EventDelegate(delegate + { + OnClickBattleHourChangeButton(); + })); + _battleStartTimeChangeButton.onClick.Add(new EventDelegate(delegate + { + OnClickBattleStartHourChangeButton(); + })); + _isEntryDeckOnlyToggle.onChange.Add(new EventDelegate(delegate + { + OnClickIsEntryDeckOnlyButton(); + })); + _dialog.onPushButton1 = delegate + { + CreateGathering(); + }; + } + + private void OnClickGatheringTypeChangeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + List allGatheringRule = GatheringUtility.GetAllGatheringRule(); + GatheringUtility.RuleTypeInfo item = allGatheringRule.FirstOrDefault((GatheringUtility.RuleTypeInfo x) => x.Type == _rule.Type && x.TournamentType == _rule.TournamentType && x.IsReset == _rule.IsReset); + List textList = new List(); + allGatheringRule.ForEach(delegate(GatheringUtility.RuleTypeInfo rule) + { + textList.Add(rule.Name); + }); + DialogBase drumDialog = DrumrollDialog.Create(textList, allGatheringRule.IndexOf(item), null, null, OnDecideGatheringType, Data.SystemText.Get("Gathering_0036")); + OnDrumUICommonSetting(drumDialog); + } + + private void OnDecideGatheringType(int index) + { + GatheringUtility.RuleTypeInfo ruleTypeInfo = GatheringUtility.GetAllGatheringRule()[index]; + _rule.Type = ruleTypeInfo.Type; + _rule.TournamentType = ruleTypeInfo.TournamentType; + _rule.IsReset = ruleTypeInfo.IsReset; + _rule.SaveToPlayerPrefs(); + if (ruleTypeInfo.MaxMember < _rule.MaxMember) + { + int num = MAX_MEMBER_SETTING.ToList().IndexOf(ruleTypeInfo.MaxMember); + if (num == -1) + { + Debug.LogError("選択肢に含まれていない最大人数です"); + OnSelectMember(0); + } + else + { + OnSelectMember(num); + } + } + } + + private void OnClickBattleStyleChangeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + int defaultIndex = 0; + List list = new List(); + List ruleListNormal = GetRuleListNormal(_rule.BattleParameterInstance.DeckFormat); + for (int i = 0; i < ruleListNormal.Count; i++) + { + if (_rule.BattleParameterInstance.Rule == ruleListNormal[i]) + { + defaultIndex = i; + } + list.Add(RoomRuleSetting.GetWinTypeString(ruleListNormal[i])); + } + DialogBase drumDialog = DrumrollDialog.Create(list, defaultIndex, null, null, OnDecideBattleStyle, Data.SystemText.Get("Gathering_0037")); + OnDrumUICommonSetting(drumDialog); + } + + private void OnDecideBattleStyle(int index) + { + _rule.BattleParameterInstance.Rule = GetRuleListNormal(_rule.BattleParameterInstance.DeckFormat)[index]; + _rule.SaveToPlayerPrefs(); + } + + private void OnClickFormatChangeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + int defaultIndex = 0; + List list = new List(); + List maintenanceFormatList = new List(); + DialogBase dialog = null; + _formatList.Clear(); + for (int i = 0; i < ALL_FORMAT.Length; i++) + { + if (_rule.BattleParameterInstance.DeckFormat == ALL_FORMAT[i]) + { + defaultIndex = i; + } + list.Add(FormatBehaviorManager.GetFormatName(ALL_FORMAT[i])); + _formatList.Add(ALL_FORMAT[i]); + } + if (Prerelease.Status == Prerelease.eStatus.PRE_ROTATION) + { + if (_rule.BattleParameterInstance.DeckFormat == Format.PreRotation) + { + defaultIndex = _formatList.Count; + } + _formatList.Add(Format.PreRotation); + list.Add(FormatBehaviorManager.GetFormatName(Format.PreRotation)); + } + if (Data.Crossover.IsWithinGatheringPeriod) + { + if (_rule.BattleParameterInstance.DeckFormat == Format.Crossover) + { + defaultIndex = _formatList.Count; + } + _formatList.Add(Format.Crossover); + string text = FormatBehaviorManager.GetFormatName(Format.Crossover); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_CROSSOVER)) + { + maintenanceFormatList.Add(Format.Crossover); + text += Data.SystemText.Get("RoomBattle_0099"); + } + list.Add(text); + } + if (Data.MyRotationAllInfo.IsWithinGatheringPeriod) + { + if (_rule.BattleParameterInstance.DeckFormat == Format.MyRotation) + { + defaultIndex = _formatList.Count; + } + _formatList.Add(Format.MyRotation); + string text2 = FormatBehaviorManager.GetFormatName(Format.MyRotation); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_MYROTATION)) + { + maintenanceFormatList.Add(Format.MyRotation); + text2 += Data.SystemText.Get("RoomBattle_0099"); + } + list.Add(text2); + } + if (Data.AvatarBattleAllInfo.IsWithinGatheringPeriod) + { + if (_rule.BattleParameterInstance.DeckFormat == Format.Avatar) + { + defaultIndex = _formatList.Count; + } + _formatList.Add(Format.Avatar); + string text3 = FormatBehaviorManager.GetFormatName(Format.Avatar); + if (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.GATHERING_AVATAR)) + { + maintenanceFormatList.Add(Format.Avatar); + text3 += Data.SystemText.Get("RoomBattle_0099"); + } + list.Add(text3); + } + Action selectCallback = delegate(int index) + { + UIManager.SetObjectToGrey(dialog.button1.gameObject, maintenanceFormatList.Contains(_formatList[index])); + if (_formatList[index] == Format.Avatar) + { + _rule.BattleParameterInstance.Rule = RoomConnectController.BattleRule.Bo1; + } + }; + dialog = DrumrollDialog.Create(list, defaultIndex, selectCallback, null, OnDecideFormat, Data.SystemText.Get("Gathering_0038")); + OnDrumUICommonSetting(dialog); + } + + private void OnDecideFormat(int index) + { + _rule.BattleParameterInstance.DeckFormat = _formatList[index]; + _rule.SaveToPlayerPrefs(); + } + + private void OnClickMaxMemberChangeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + int defaultIndex = 0; + List list = new List(); + for (int i = 0; i < MAX_MEMBER_SETTING.Length; i++) + { + if (_rule.MaxMember == MAX_MEMBER_SETTING[i]) + { + defaultIndex = i; + } + if (GatheringUtility.GetMaxMemberNumber(_rule.Type) < MAX_MEMBER_SETTING[i]) + { + break; + } + list.Add(Data.SystemText.Get("Gathering_0008", MAX_MEMBER_SETTING[i].ToString())); + } + DialogBase drumDialog = DrumrollDialog.Create(list, defaultIndex, null, null, OnSelectMember, Data.SystemText.Get("Gathering_0039")); + OnDrumUICommonSetting(drumDialog); + } + + private void OnSelectMember(int index) + { + _rule.MaxMember = MAX_MEMBER_SETTING[index]; + _rule.SaveToPlayerPrefs(); + } + + private void OnDrumUICommonSetting(DialogBase drumDialog) + { + _dialog.SetDisp(inDisp: false); + drumDialog.ResetBackViewAlpha(); + drumDialog.OnCloseStart = delegate + { + drumDialog.InactiveBackView(); + _dialog.ReOpen(isResetBackViewAlpha: true); + Refresh(); + }; + } + + private void OnClickOwnerEntryBattle() + { + _rule.IsOwnerEntryBattle = _ownerEntryBattleToggle.value; + if (!_ownerEntryBattleToggleFirstCall) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(_ownerEntryBattleToggle.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + _rule.SaveToPlayerPrefs(); + } + _ownerEntryBattleToggleFirstCall = false; + } + + private void OnClickIsEntryDeckOnlyButton() + { + _rule.IsEntryDeckOnly = _isEntryDeckOnlyToggle.value; + if (!_isEntryDeckOnlyToggleFirstCall) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(_isEntryDeckOnlyToggle.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + _rule.SaveToPlayerPrefs(); + } + _isEntryDeckOnlyToggleFirstCall = false; + } + + private void OnClickWatchChangeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + int defaultIndex = (int)(_rule.WatchSetting - 1); + List list = new List(); + SystemText systemText = Data.SystemText; + list.Add(systemText.Get("Gathering_0015")); + list.Add(systemText.Get("Gathering_0016")); + list.Add(systemText.Get("Gathering_0017")); + DialogBase drumDialog = DrumrollDialog.Create(list, defaultIndex, null, null, OnDecideWatchSetting, Data.SystemText.Get("Gathering_0042")); + OnDrumUICommonSetting(drumDialog); + } + + private void OnDecideWatchSetting(int index) + { + _rule.WatchSetting = (GatheringRule.eWatchSetting)(index + 1); + _rule.SaveToPlayerPrefs(); + } + + private void OnClickBattleHourChangeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + List list = new List(); + int defaultIndex = 0; + int num = 0; + int[] bATTLE_HOUR_SETTING = BATTLE_HOUR_SETTING; + for (int i = 0; i < bATTLE_HOUR_SETTING.Length; i++) + { + int num2 = bATTLE_HOUR_SETTING[i]; + list.Add(Data.SystemText.Get("Gathering_0013", num2.ToString())); + if (num2 == _rule.BattleTimeHour) + { + defaultIndex = num; + } + num++; + } + DialogBase drumDialog = DrumrollDialog.Create(list, defaultIndex, null, null, OnDecideBattleHour, Data.SystemText.Get("Gathering_0041")); + OnDrumUICommonSetting(drumDialog); + } + + private void OnDecideBattleHour(int index) + { + _rule.BattleTimeHour = BATTLE_HOUR_SETTING[index]; + _rule.SaveToPlayerPrefs(); + } + + private void OnClickBattleStartHourChangeButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase drumDialog = GatheringStartTimeSelectDialog.Create(_startTimeSelectPrefab, OnChangeBattleStartTime, _rule.BattleStartLocalTime); + OnDrumUICommonSetting(drumDialog); + } + + private void OnChangeBattleStartTime(DateTime time) + { + _rule.BattleStartLocalTime = time; + Refresh(); + } + + private void Refresh() + { + SystemText systemText = Data.SystemText; + _typeLabel.text = _rule.GetGatheringTypeString(); + _maxMemberLabel.text = systemText.Get("Gathering_0008", _rule.MaxMember.ToString()); + _battleStyleLabel.text = RoomRuleSetting.GetWinTypeString(_rule.BattleParameterInstance.Rule); + _formatLabel.text = FormatBehaviorManager.GetFormatName(_rule.BattleParameterInstance.DeckFormat); + _ownerEntryBattleToggle.value = _rule.IsOwnerEntryBattle; + _battleHourLabel.text = systemText.Get("Gathering_0013", _rule.BattleTimeHour.ToString()); + _isEntryDeckOnlyToggle.value = _rule.IsEntryDeckOnly; + _battleStartTimeLabel.text = ConvertTime.ToLocal(_rule.BattleStartUtcTime); + _isEntryDeckOnlyObjectRoot.SetActive(!_rule.IsTournament); + _timeLimitObjectRoot.SetActive(!_rule.IsTournament); + UIManager.SetObjectToGrey(_battleStyleChangeButton.gameObject, IsOnlyOneWinType()); + _ruleCategoryGrid.Reposition(); + switch (_rule.WatchSetting) + { + case GatheringRule.eWatchSetting.ALL_MEMBER: + _watchLabel.text = systemText.Get("Gathering_0016"); + break; + case GatheringRule.eWatchSetting.NONE: + _watchLabel.text = systemText.Get("Gathering_0017"); + break; + case GatheringRule.eWatchSetting.OWNER_ONLY: + _watchLabel.text = systemText.Get("Gathering_0015"); + break; + } + } + + private void CreateGathering() + { + if (_rule.IsTournament) + { + _rule.IsEntryDeckOnly = true; + } + OnDecideRule.Call(_rule); + } + + private bool IsOnlyOneWinType() + { + return GetRuleListNormal(_rule.BattleParameterInstance.DeckFormat).Count == 1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringCreateTask.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringCreateTask.cs new file mode 100644 index 0000000..832b609 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringCreateTask.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class GatheringCreateTask : BaseTask +{ + public class DeckEntry + { + public int deck_no; + + public string deck_name; + + public DeckEntry(DeckData deck) + { + deck_no = deck.GetDeckID(); + deck_name = deck.GetDeckName(); + } + } + + public class GatheringCreateTaskParam : BaseParam + { + public int join_member_limit; + + public int is_master_joined; + + public int deck_format; + + public int battle_type; + + public int watch_type; + + public long battle_begin_timestamp; + + public int battle_hours; + + public int gathering_type; + + public int is_deck_entry; + + public int tournament_format; + + public Dictionary deck_list = new Dictionary(); + } + + public GatheringCreateTask() + { + base.type = ApiType.Type.GatheringCreate; + } + + public void SetParameter(GatheringRule rule, List deckList) + { + GatheringCreateTaskParam gatheringCreateTaskParam = new GatheringCreateTaskParam(); + gatheringCreateTaskParam.deck_format = Data.FormatConvertApi(rule.BattleParameterInstance.DeckFormat); + gatheringCreateTaskParam.join_member_limit = rule.MaxMember; + gatheringCreateTaskParam.is_master_joined = (rule.IsOwnerEntryBattle ? 1 : 0); + gatheringCreateTaskParam.battle_type = (int)rule.BattleParameterInstance.Rule; + gatheringCreateTaskParam.watch_type = (int)rule.WatchSetting; + gatheringCreateTaskParam.battle_begin_timestamp = (long)ConvertTime.DateTimeToUnixTime(rule.BattleStartUtcTime); + gatheringCreateTaskParam.battle_hours = rule.BattleTimeHour; + gatheringCreateTaskParam.is_deck_entry = (rule.IsEntryDeckOnly ? 1 : 0); + gatheringCreateTaskParam.gathering_type = (int)rule.Type; + gatheringCreateTaskParam.tournament_format = (int)rule.TournamentType; + if (deckList != null) + { + for (int i = 0; i < deckList.Count; i++) + { + gatheringCreateTaskParam.deck_list[i.ToString()] = new DeckEntry(deckList[i]); + } + } + base.Params = gatheringCreateTaskParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringEntrySetting.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringEntrySetting.cs new file mode 100644 index 0000000..5a9966c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringEntrySetting.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringEntrySetting +{ + public GatheringRule Rule { get; private set; } + + public List DeckList { get; set; } + + public GatheringEntrySetting(GatheringRule rule) + { + Rule = rule; + int num = RoomConnectController.RuleSelectDeckCount(rule.BattleParameterInstance.Rule); + DeckList = new List(); + for (int i = 0; i < num; i++) + { + DeckData deckData = new DeckData(rule.BattleParameterInstance.DeckFormat); + deckData.SetDeckID(i + 1); + DeckList.Add(deckData); + } + } + + public DeckData GetDeck(int deckId) + { + return DeckList.Find((DeckData deck) => deck.GetDeckID() == deckId); + } + + public void RemoveDeck(int deckId) + { + List deckList = DeckList; + int count = deckList.Count; + Format format = deckList[0].Format; + DeckList = new List(); + for (int i = 0; i < count; i++) + { + if (deckList[i].GetDeckID() == deckId) + { + DeckData deckData = new DeckData(format); + deckData.SetDeckID(deckId); + DeckList.Add(deckData); + } + else + { + DeckList.Add(deckList[i]); + } + } + } + + public void DeckOrderChange(List order) + { + List deckList = DeckList; + int count = deckList.Count; + DeckList = new List(); + foreach (int deckId in order) + { + int index = deckList.FindIndex((DeckData d) => d.GetDeckID() == deckId); + DeckList.Add(deckList[index]); + deckList.RemoveAt(index); + } + foreach (DeckData item in deckList) + { + DeckList.Add(item); + } + for (int num = 0; num < count; num++) + { + DeckList[num].SetDeckID(num + 1); + } + } + + public bool IsEntryDeckOk() + { + foreach (DeckData deck in DeckList) + { + if (deck.IsNoCard()) + { + return false; + } + if (!deck.GetDeckIsComplete()) + { + return false; + } + } + return true; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringInfo.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringInfo.cs new file mode 100644 index 0000000..11d438d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringInfo.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class GatheringInfo +{ + public enum eState + { + BEFORE_BATTLE = 1, + ACTIVE_BATTLE, + AFTER_BATTLE + } + + public GatheringRule Rule { get; private set; } + + public eState State { get; private set; } + + public GatheringRule.eRole Role { get; private set; } + + public string Id { get; private set; } + + public int CurrentMemberCount { get; private set; } + + public List MemberList { get; private set; } + + public GatheringUserInfo OwnerInfo { get; private set; } + + public string BattleStartTime { get; private set; } + + public string BattleStartTimeShort { get; private set; } + + public string FinishTime { get; private set; } + + public bool IsGatheringFinish { get; private set; } + + public string Description { get; private set; } + + public bool CanBattleJoin + { + get + { + if (Role == GatheringRule.eRole.OWNER && !Rule.IsOwnerEntryBattle) + { + return false; + } + return true; + } + } + + public GatheringInfo() + { + } + + public GatheringInfo(JsonData data) + { + JsonData jsonData = data["gathering"]; + Rule = new GatheringRule(jsonData, data["gathering_config"]); + CurrentMemberCount = jsonData["join_member_count"].ToInt(); + Id = jsonData["id"].ToString(); + int num = jsonData["master_viewer_id"].ToInt(); + Role = ((num == PlayerStaticData.UserViewerID) ? GatheringRule.eRole.OWNER : GatheringRule.eRole.GUEST); + MemberList = new List(); + if (data.Keys.Contains("members")) + { + JsonData jsonData2 = data["members"]; + for (int i = 0; i < jsonData2.Count; i++) + { + GatheringUserInfo gatheringUserInfo = new GatheringUserInfo(jsonData2[i]); + gatheringUserInfo.IsOwner = gatheringUserInfo.ViewerId == num; + MemberList.Add(gatheringUserInfo); + } + } + OwnerInfo = new GatheringUserInfo(jsonData["master_user"]); + DateTime dateTime = DateTime.Parse(jsonData["battle_begin_time"].ToString()); + BattleStartTime = ConvertTime.ToLocal(dateTime).ToString(); + BattleStartTimeShort = ConvertTime.ToLocal(dateTime, ConvertTime.FORMAT.TIME_DATE_SHORT).ToString(); + if (jsonData.TryGetValue("battle_end_time", out var value)) + { + FinishTime = ConvertTime.ToLocal(DateTime.Parse(value.ToString())).ToString(); + } + if (jsonData.TryGetValue("is_battle_finished", out var value2)) + { + IsGatheringFinish = value2.ToInt() != 0; + } + Description = jsonData["description"].ToString(); + State = (eState)jsonData["status"].ToInt(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringMatchedRoom.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringMatchedRoom.cs new file mode 100644 index 0000000..a918cf1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringMatchedRoom.cs @@ -0,0 +1,15 @@ +namespace Wizard; + +public class GatheringMatchedRoom +{ + private const string NO_MATCHED_ROOM_ID = "0"; + + public string RoomId { get; private set; } + + public bool IsMatched => RoomId != "0"; + + public GatheringMatchedRoom(string roomId) + { + RoomId = roomId; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringRoomEnterTournamentRoomTask.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringRoomEnterTournamentRoomTask.cs new file mode 100644 index 0000000..71e0afb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringRoomEnterTournamentRoomTask.cs @@ -0,0 +1,43 @@ +using Cute; + +namespace Wizard; + +public class GatheringRoomEnterTournamentRoomTask : BaseRoomBattleEnterRoomTask +{ + private GatheringInfo _gatheringInfo; + + public GatheringAutoJoinTaskInfo GatheringAutoJoinTaskInfo { get; private set; } + + public GatheringRoomEnterTournamentRoomTask(GatheringInfo gatheringInfo) + { + _gatheringInfo = gatheringInfo; + base.type = ApiType.Type.GatheringRoomEnterRoomForTournament; + } + + protected override int Parse() + { + if (base.ResponseData.TryGetValue("data", out var value) && value.IsObject && value.TryGetValue("is_owner", out var value2)) + { + bool flag = false; + if (value.TryGetValue("oppo_info", out var value3)) + { + flag = value3 != null; + } + if (value2.ToInt() != 0 && value.Keys.Contains("result_reason") && !flag) + { + value["result_reason"] = "-1"; + } + } + int num = base.Parse(); + if (num != 1) + { + return num; + } + GatheringAutoJoinTaskInfo = new GatheringAutoJoinTaskInfo(base.ResponseData, this, _gatheringInfo); + if (GatheringAutoJoinTaskInfo.IsOwner) + { + CustomPreference.SetNodeServerURL(value["node_server_url"].ToString()); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringTornamentCreateTask.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringTornamentCreateTask.cs new file mode 100644 index 0000000..98fd1ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringTornamentCreateTask.cs @@ -0,0 +1,76 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class GatheringTornamentCreateTask : BaseTask +{ + public class DeckEntry + { + public int deck_no; + + public string deck_name; + + public DeckEntry(DeckData deck) + { + deck_no = deck.GetDeckID(); + deck_name = deck.GetDeckName(); + } + } + + public class TornamentGatheringCreateTaskParam : BaseParam + { + public int gathering_type; + + public int is_reset; + + public int join_member_limit; + + public int is_master_joined; + + public int deck_format; + + public int battle_type; + + public int watch_type; + + public long battle_begin_timestamp; + + public Dictionary deck_list = new Dictionary(); + + public int tournament_format; + } + + public GatheringTornamentCreateTask() + { + base.type = ApiType.Type.GatheringCreate; + } + + public void SetParameter(GatheringRule rule, List deckList) + { + TornamentGatheringCreateTaskParam tornamentGatheringCreateTaskParam = new TornamentGatheringCreateTaskParam(); + tornamentGatheringCreateTaskParam.gathering_type = (int)rule.Type; + tornamentGatheringCreateTaskParam.join_member_limit = rule.MaxMember; + tornamentGatheringCreateTaskParam.is_master_joined = (rule.IsOwnerEntryBattle ? 1 : 0); + tornamentGatheringCreateTaskParam.deck_format = Data.FormatConvertApi(rule.BattleParameterInstance.DeckFormat); + tornamentGatheringCreateTaskParam.battle_type = (int)rule.BattleParameterInstance.Rule; + tornamentGatheringCreateTaskParam.watch_type = (int)rule.WatchSetting; + tornamentGatheringCreateTaskParam.battle_begin_timestamp = (long)ConvertTime.DateTimeToUnixTime(rule.BattleStartUtcTime); + if (deckList != null) + { + for (int i = 0; i < deckList.Count; i++) + { + tornamentGatheringCreateTaskParam.deck_list[i.ToString()] = new DeckEntry(deckList[i]); + } + } + tornamentGatheringCreateTaskParam.tournament_format = (int)rule.TournamentType; + if (rule.TournamentType == GatheringRule.eTournamentType.DOUBLE_ELIMINATION) + { + tornamentGatheringCreateTaskParam.is_reset = (rule.IsReset ? 1 : 0); + } + else + { + tornamentGatheringCreateTaskParam.is_reset = 0; + } + base.Params = tornamentGatheringCreateTaskParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringUserInfo.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringUserInfo.cs new file mode 100644 index 0000000..464d800 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringUserInfo.cs @@ -0,0 +1,75 @@ +using System.Collections.Generic; +using Cute; +using LitJson; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringUserInfo : UserInfoBase +{ + public bool IsOwner { get; set; } + + public GatheringUserInfo(int viewerId, string name, long emblemId, string country, int rank, int degreeId, bool isFriend) + : base(viewerId, name, emblemId, country, rank, degreeId, isFriend) + { + } + + public GatheringUserInfo(Player player) + : base(player) + { + } + + public GatheringUserInfo(JsonData json) + : base(json) + { + } + + public GatheringUserInfo(UserFriend friend) + : base(friend) + { + } + + public override Texture GetUserEmblemTexture() + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(base.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_S, isfetch: true); + return Toolbox.ResourcesManager.LoadObject(assetTypePath); + } + + public override Texture GetUserRankTexture() + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(base.Rank.ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S, isfetch: true); + return Toolbox.ResourcesManager.LoadObject(assetTypePath); + } + + public override void InitializeDegreeTexture(UITexture texture) + { + DegreeHelper.InitializeDegree(texture, base.DegreeId, DegreeHelper.DegreeType.SMALL); + } + + public override Texture GetUserCountryTexture() + { + if (string.IsNullOrEmpty(base.CountryCode)) + { + return null; + } + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(base.CountryCode, ResourcesManager.AssetLoadPathType.Country_S, isfetch: true); + return Toolbox.ResourcesManager.LoadObject(assetTypePath); + } + + public override List GetUserAssetPathList() + { + List list = new List(); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(base.EmblemId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_S); + list.Add(assetTypePath); + assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(base.Rank.ToString("00"), ResourcesManager.AssetLoadPathType.RankIcon_S); + list.Add(assetTypePath); + list.AddRange(DegreeHelper.GetDegreeResourceList(base.DegreeId, DegreeHelper.DegreeType.SMALL, isFetch: false)); + if (!string.IsNullOrEmpty(base.CountryCode)) + { + assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(base.CountryCode, ResourcesManager.AssetLoadPathType.Country_S); + list.Add(assetTypePath); + } + return list; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GatheringUtility.cs b/SVSim.BattleEngine/Engine/Wizard/GatheringUtility.cs new file mode 100644 index 0000000..db1fac7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GatheringUtility.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class GatheringUtility : MonoBehaviour +{ + public class RuleTypeInfo + { + public string Name { get; private set; } + + public GatheringRule.eType Type { get; private set; } + + public GatheringRule.eTournamentType TournamentType { get; private set; } + + public int MaxMember { get; private set; } + + public bool IsReset { get; private set; } + + public RuleTypeInfo(GatheringRule.eType _eType, GatheringRule.eTournamentType _eTournamentType = GatheringRule.eTournamentType.NONE, bool _isReset = false) + { + Type = _eType; + TournamentType = _eTournamentType; + Name = GetGatheringTypeString(Type, TournamentType, _isReset); + MaxMember = GetMaxMemberNumber(Type); + IsReset = _isReset; + } + } + + public static List GetAllGatheringRule() + { + List list = new List(); + foreach (GatheringRule.eType value in Enum.GetValues(typeof(GatheringRule.eType))) + { + if (value == GatheringRule.eType.TOURNAMENT) + { + foreach (GatheringRule.eTournamentType value2 in Enum.GetValues(typeof(GatheringRule.eTournamentType))) + { + switch (value2) + { + case GatheringRule.eTournamentType.DOUBLE_ELIMINATION: + list.Add(new RuleTypeInfo(value, value2, _isReset: true)); + list.Add(new RuleTypeInfo(value, value2)); + break; + default: + list.Add(new RuleTypeInfo(value, value2)); + break; + case GatheringRule.eTournamentType.NONE: + break; + } + } + } + else + { + list.Add(new RuleTypeInfo(value)); + } + } + return list; + } + + public static string GetGatheringTypeString(GatheringInfo gatheringInfo) + { + return GetGatheringTypeString(gatheringInfo.Rule.Type, gatheringInfo.Rule.TournamentType, gatheringInfo.Rule.IsReset); + } + + public static string GetGatheringTypeString(GatheringRule.eType _eType, GatheringRule.eTournamentType _eTournamentType = GatheringRule.eTournamentType.NONE, bool isReset = false) + { + SystemText systemText = Data.SystemText; + switch (_eType) + { + case GatheringRule.eType.FREE_BATTLE: + return systemText.Get("Gathering_0033"); + case GatheringRule.eType.TOURNAMENT: + switch (_eTournamentType) + { + case GatheringRule.eTournamentType.SINGLE_ELIMINATION: + return systemText.Get("Gathering_0030"); + case GatheringRule.eTournamentType.DOUBLE_ELIMINATION: + if (!isReset) + { + return systemText.Get("Gathering_0035"); + } + return systemText.Get("Gathering_0031"); + default: + Debug.LogError("未知のトーナメントタイプが追加されています:" + _eTournamentType); + return ""; + } + default: + Debug.LogError("未知のタイプが追加されています:" + _eType); + return ""; + } + } + + public static int GetMaxMemberNumber(GatheringRule.eType _eType) + { + if (_eType == GatheringRule.eType.TOURNAMENT) + { + return 64; + } + return 128; + } + + public static IEnumerator JoinRoom(RoomConnectController.InitializeParameter param, string battleId) + { + UIManager.GetInstance().createInSceneCenterLoading(notBlack: true); + GameMgr.GetIns().GetDataMgr().m_BattleType = DataMgr.BattleType.RoomBattle; + RoomConnectController room = new RoomConnectController(param); + yield return UIManager.GetInstance().StartCoroutine(room.StartConnect(battleId)); + if (room.ConnectRoomResultType == RoomConnectController.ConnectRoomResult.SUCCESS) + { + UIManager.GetInstance()._Footer.InviteIconDisp(inDisp: false); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Room); + } + UIManager.GetInstance().closeInSceneCenterLoading(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/GenerateDeckImageTask.cs b/SVSim.BattleEngine/Engine/Wizard/GenerateDeckImageTask.cs new file mode 100644 index 0000000..aadf74c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/GenerateDeckImageTask.cs @@ -0,0 +1,102 @@ +using System; +using System.Text; +using Cute; +using UnityEngine; +using UnityEngine.Networking; + +namespace Wizard; + +public class GenerateDeckImageTask : BaseTask +{ + public class GenerateDeckCodeTaskParam : BaseParam + { + public int clan; + + public int deck_format; + + public int[] cardID; + + public int[] phantomCardID; + + public string rotation_id; + } + + public class GenerateDeckCodeTaskUseSubClassParam : BaseParam + { + public int clan; + + public int sub_clan; + + public int deck_format; + + public int[] cardID; + + public int[] phantomCardID; + } + + private const string HEADER_TWITTER_KEY = "X-TWITTER-MESSAGE"; + + public override string Url + { + get + { + string arg = Data.SystemText.Get("System_0045"); + string arg2 = string.Format(ApiType.ApiList[base.type], arg); + return $"{CustomPreference.GetDeckBuilderServerURL()}{arg2}"; + } + } + + public byte[] ImageBytes { get; private set; } + + public string TwitterMessage { get; private set; } + + public GenerateDeckImageTask() + { + base.type = ApiType.Type.GenerateDeckImage; + base.CallbackOnUnityWebRequestDone = HandleResponseData; + } + + public void SetParameter(int clan_id, GenerateDeckCodeTask.SubmitDeckType type, int[] card_id_array, string rotationId, int[] phantomCardIdList = null) + { + GenerateDeckCodeTaskParam generateDeckCodeTaskParam = new GenerateDeckCodeTaskParam(); + generateDeckCodeTaskParam.clan = clan_id; + generateDeckCodeTaskParam.deck_format = (int)type; + generateDeckCodeTaskParam.cardID = card_id_array; + generateDeckCodeTaskParam.phantomCardID = phantomCardIdList; + generateDeckCodeTaskParam.rotation_id = rotationId; + base.Params = generateDeckCodeTaskParam; + } + + public void SetParameter(int mainClassId, int subClassId, GenerateDeckCodeTask.SubmitDeckType type, int[] card_id_array, int[] phantomCardIdList = null) + { + GenerateDeckCodeTaskUseSubClassParam generateDeckCodeTaskUseSubClassParam = new GenerateDeckCodeTaskUseSubClassParam(); + generateDeckCodeTaskUseSubClassParam.clan = mainClassId; + generateDeckCodeTaskUseSubClassParam.sub_clan = subClassId; + generateDeckCodeTaskUseSubClassParam.deck_format = (int)type; + generateDeckCodeTaskUseSubClassParam.cardID = card_id_array; + generateDeckCodeTaskUseSubClassParam.phantomCardID = phantomCardIdList; + base.Params = generateDeckCodeTaskUseSubClassParam; + } + + private void HandleResponseData(UnityWebRequest www) + { + if (www.GetResponseHeaders().TryGetValue("X-TWITTER-MESSAGE", out var value)) + { + byte[] bytes = Convert.FromBase64String(value); + TwitterMessage = Encoding.UTF8.GetString(bytes); + } + SaveImageToBytes(www); + if (base.CallbackOnSuccess != null) + { + base.CallbackOnSuccess(ResultCode.Success); + } + } + + private void SaveImageToBytes(UnityWebRequest www) + { + Texture2D texture2D = new Texture2D(1, 1); + texture2D.LoadImage(www.downloadHandler.data); + ImageBytes = texture2D.EncodeToPNG(); + UnityEngine.Object.Destroy(texture2D); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/HofFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/HofFormatBehavior.cs new file mode 100644 index 0000000..5569225 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/HofFormatBehavior.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class HofFormatBehavior : IFormatBehavior +{ + public string Name => string.Empty; + + public string SmallIconSpriteName => string.Empty; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => false; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => false; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => Data.Master.CardSetNameMgr.GetListBasicAndPack(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => true; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsConventionMode => false; + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == cardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/IChatActionUI.cs b/SVSim.BattleEngine/Engine/Wizard/IChatActionUI.cs new file mode 100644 index 0000000..362f3e9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/IChatActionUI.cs @@ -0,0 +1,8 @@ +using System; + +namespace Wizard; + +public interface IChatActionUI +{ + void Init(IChatSettings chatSettings, ChatConnectController chatConnectCtr, ChatLogUI _chatLogUI, Action actionAddNewChatLogAfterSendChat); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/IChatApiSettings.cs b/SVSim.BattleEngine/Engine/Wizard/IChatApiSettings.cs new file mode 100644 index 0000000..a1d80b1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/IChatApiSettings.cs @@ -0,0 +1,18 @@ +namespace Wizard; + +public interface IChatApiSettings +{ + ApiType.Type ApiChatMessages { get; } + + ApiType.Type ApiChatPost { get; } + + ApiType.Type ApiChatAddReplay { get; } + + ApiType.Type ApiChatReplayDetail { get; } + + ApiType.Type ApiChatAddDeck { get; } + + ApiType.Type ApiChatDeleteDeck { get; } + + ApiType.Type ApiChatDeckLog { get; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/IChatSettings.cs b/SVSim.BattleEngine/Engine/Wizard/IChatSettings.cs new file mode 100644 index 0000000..243d8bc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/IChatSettings.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public interface IChatSettings +{ + KeyValuePair PlayerPrefsKeyLatestReadChatMessageId { get; } + + IChatApiSettings ApiSettings { get; } + + ChatLogPlate PrefabChatLogPlate { get; } + + UIManager.ViewScene ReplayBackScene { get; } + + UIManager.ChangeViewSceneParam ReplayBackSceneParam { get; } + + Action OnSetChatLogRoomInfoViewJoinButton { get; } + + Action OnClickBtnJoinRoomVisitor { get; } + + Action OnClickBtnJoinRoomWatcher { get; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/InviteConfigUpdateTask.cs b/SVSim.BattleEngine/Engine/Wizard/InviteConfigUpdateTask.cs new file mode 100644 index 0000000..a91dd62 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/InviteConfigUpdateTask.cs @@ -0,0 +1,37 @@ +namespace Wizard; + +public class InviteConfigUpdateTask : BaseTask +{ + public class InviteConfigUpdateTaskParam : BaseParam + { + public int receive_invitation; + + public int receive_invitation_in_battle; + + public int receive_invitation_in_offline; + + public int receive_friend_apply; + } + + public InviteConfigUpdateTask() + { + base.type = ApiType.Type.InviteConfigUpdate; + } + + public void SetParameter(bool receiveInvite, bool receiveInviteInBattle, bool receiveInviteInOffline, bool receiveFriendApply) + { + InviteConfigUpdateTaskParam inviteConfigUpdateTaskParam = new InviteConfigUpdateTaskParam(); + inviteConfigUpdateTaskParam.receive_invitation = (receiveInvite ? 1 : 0); + inviteConfigUpdateTaskParam.receive_invitation_in_battle = (receiveInviteInBattle ? 1 : 0); + inviteConfigUpdateTaskParam.receive_invitation_in_offline = (receiveInviteInOffline ? 1 : 0); + inviteConfigUpdateTaskParam.receive_friend_apply = (receiveFriendApply ? 1 : 0); + base.Params = inviteConfigUpdateTaskParam; + } + + protected override int Parse() + { + int result = base.Parse(); + _ = 1; + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/InviteGetListTask.cs b/SVSim.BattleEngine/Engine/Wizard/InviteGetListTask.cs new file mode 100644 index 0000000..400ab20 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/InviteGetListTask.cs @@ -0,0 +1,39 @@ +using LitJson; + +namespace Wizard; + +public class InviteGetListTask : BaseTask +{ + public class InviteGetListTaskParam : BaseParam + { + } + + public InviteGetListTask() + { + base.type = ApiType.Type.InviteGetList; + } + + public void SetParameter() + { + InviteGetListTaskParam inviteGetListTaskParam = new InviteGetListTaskParam(); + base.Params = inviteGetListTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.FriendInfo.Initialize(); + JsonData jsonData = base.ResponseData["data"]; + for (int i = 0; i < jsonData.Count; i++) + { + UserFriend item = new UserFriend(jsonData[i]); + Data.FriendInfo.data.friendList.Add(item); + } + Data.FriendInfo.servertime = base.ResponseData["data_headers"]["servertime"].ToInt(); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/LeaderSkinUpdateTask.cs b/SVSim.BattleEngine/Engine/Wizard/LeaderSkinUpdateTask.cs new file mode 100644 index 0000000..abed995 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/LeaderSkinUpdateTask.cs @@ -0,0 +1,63 @@ +using LitJson; + +namespace Wizard; + +public class LeaderSkinUpdateTask : BaseTask +{ + public class LeaderSkinUpdateTaskParam : BaseParam + { + public int class_id; + + public int leader_skin_id; + + public bool is_random_leader_skin; + + public int[] leader_skin_id_list; + } + + private LeaderSkinUpdateTaskParam _param; + + public LeaderSkinUpdateTask() + { + base.type = ApiType.Type.LeaderSkinUpdate; + _param = null; + } + + public void SetParameter(int class_id, int leader_skin_id) + { + _param = new LeaderSkinUpdateTaskParam(); + _param.class_id = class_id; + _param.leader_skin_id = leader_skin_id; + _param.is_random_leader_skin = false; + base.Params = _param; + } + + public void SetRandomParameter(int class_id, int[] leader_skin_id_list) + { + _param = new LeaderSkinUpdateTaskParam(); + _param.class_id = class_id; + _param.leader_skin_id_list = leader_skin_id_list; + _param.is_random_leader_skin = true; + base.Params = _param; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + ClassCharaPrm classPrm = dataMgr.GetClassPrm(_param.class_id); + JsonData jsonData = base.ResponseData["data"]; + bool flag = jsonData["is_random_leader_skin"].ToBoolean(); + int num2 = 0; + num2 = ((!flag) ? _param.leader_skin_id : jsonData["leader_skin_id"].ToInt()); + classPrm.SetLeaderRandomSkinIdList(jsonData["leader_skin_id_list"]); + classPrm.IsRandomLeaderSkin = flag; + ClassCharacterMasterData charaPrmBySkinId = dataMgr.GetCharaPrmBySkinId(num2); + dataMgr.GetClassPrm(_param.class_id).SetCurrentCharaId(charaPrmBySkinId.chara_id); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/LoadQueue.cs b/SVSim.BattleEngine/Engine/Wizard/LoadQueue.cs new file mode 100644 index 0000000..f8b3f01 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/LoadQueue.cs @@ -0,0 +1,170 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; + +namespace Wizard; + +public class LoadQueue +{ + public delegate void Callback(string id); + + private class Data + { + public string ID { get; private set; } + + public List PathList { get; set; } + + public Callback OnStart { get; set; } + + public Callback OnEnd { get; set; } + + public Data(string id, List pathList, Callback onStart, Callback onEnd) + { + ID = id; + PathList = pathList; + OnStart = onStart; + OnEnd = onEnd; + } + } + + private enum State + { + IDLE, + LOAD + } + + private readonly List _loadList = new List(); + + private State _state; + + public bool IsChangingPauseLoad { get; private set; } + + public bool IsClearing { get; private set; } + + public bool IsEmpty + { + get + { + if (_loadList.Count <= 0) + { + return _state == State.IDLE; + } + return false; + } + } + + public void AddToFirst(string id, List pathList, Callback onStart, Callback onEnd) + { + Add(isFirst: true, id, pathList, onStart, onEnd); + } + + public void AddToLast(string id, List pathList, Callback onStart, Callback onEnd) + { + Add(isFirst: false, id, pathList, onStart, onEnd); + } + + public void Add(bool isFirst, string id, List pathList, Callback onStart, Callback onEnd) + { + Remove(id); + Data item = new Data(id, pathList, onStart, onEnd); + if (isFirst) + { + _loadList.Insert(0, item); + } + else + { + _loadList.Add(item); + } + } + + public bool Remove(string id) + { + if (IsValidId(id)) + { + return _loadList.RemoveAll((Data x) => x.ID == id) > 0; + } + return false; + } + + public void StartLoad() + { + IsChangingPauseLoad = false; + if (_state != State.LOAD) + { + _state = State.LOAD; + LoadNext(); + } + } + + private void LoadNext() + { + if (_loadList.Count <= 0) + { + _state = State.IDLE; + return; + } + Data data = _loadList[0]; + _loadList.RemoveAt(0); + data.OnStart?.Invoke(data.ID); + if (data.PathList != null) + { + List list = (data.PathList = data.PathList.Where((string path) => !string.IsNullOrEmpty(path)).ToList()); + List list3 = list; + if (list3.Count > 0) + { + Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupAsync(list3, delegate + { + EndOneLoad(data); + }); + return; + } + } + EndOneLoad(data); + } + + private void EndOneLoad(Data data) + { + if (IsClearing) + { + _state = State.IDLE; + IsClearing = false; + if (data.PathList != null) + { + Toolbox.ResourcesManager.RemoveAssetGroup(data.PathList); + } + } + else if (IsChangingPauseLoad) + { + _state = State.IDLE; + IsChangingPauseLoad = false; + data.OnEnd?.Invoke(data.ID); + } + else + { + data.OnEnd?.Invoke(data.ID); + LoadNext(); + } + } + + public void PauseLoad() + { + if (_state == State.LOAD) + { + IsChangingPauseLoad = true; + } + } + + public void Clear() + { + _loadList.Clear(); + if (_state == State.LOAD) + { + IsClearing = true; + } + } + + private static bool IsValidId(string id) + { + return !string.IsNullOrEmpty(id); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MasterResetMonthTask.cs b/SVSim.BattleEngine/Engine/Wizard/MasterResetMonthTask.cs new file mode 100644 index 0000000..ced9d93 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MasterResetMonthTask.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections; +using Cute; +using LitJson; +using UnityEngine; + +namespace Wizard; + +public class MasterResetMonthTask : BaseTask +{ + private const int MASTER_RANK_NUMBER = 25; + + public MasterResetMonthTask() + { + base.type = ApiType.Type.MasterResetMonth; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + for (int i = 0; i < 2; i++) + { + JsonData jsonData = base.ResponseData["data"][Data.FormatConvertApi((Format)i).ToString()]; + UserRank userRank = Data.Load.data._userRank[i]; + userRank.rank = jsonData["rank"].ToInt(); + userRank.master_point = jsonData["master_point"].ToInt(); + userRank.grandMasterData.targetMasterPoint = jsonData["target_grand_master_point"].ToInt(); + userRank.grandMasterData.currentMasterPoint = jsonData["current_grand_master_point"].ToInt(); + UserRank.IsGrandMasterAvailability = true; + userRank.user_promotion_match.is_promotion = jsonData["is_promotion"].ToInt() != 0; + if (userRank.rank == 25) + { + userRank.is_grand_master_rank = false; + } + } + Data.User.ConnectTimeForMasterReset = ConvertTime.UnixTimeToDateTime(base.ResponseData["data_headers"]["servertime"].ToInt()); + Data.User.ConnectSinceStartUp = Time.realtimeSinceStartup; + return num; + } + + public static IEnumerator MasterReset() + { + if (PlayerStaticData.IsMasterRank(Format.Rotation) || PlayerStaticData.IsMasterRank(Format.Unlimited)) + { + DateTime dateTime = Data.User.ConnectTimeForMasterReset.AddSeconds(Time.realtimeSinceStartup - Data.User.ConnectSinceStartUp); + if (Data.User.ConnectTimeForMasterReset < Data.Load.data._masterResetNextTime && dateTime >= Data.Load.data._masterResetNextTime) + { + MasterResetMonthTask task = new MasterResetMonthTask(); + yield return UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task)); + } + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MissionRetireTask.cs b/SVSim.BattleEngine/Engine/Wizard/MissionRetireTask.cs new file mode 100644 index 0000000..e2ebcba --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MissionRetireTask.cs @@ -0,0 +1,32 @@ +namespace Wizard; + +public class MissionRetireTask : BaseTask +{ + public class MissionRetireTaskParam : BaseParam + { + public int id; + } + + public MissionRetireTask() + { + base.type = ApiType.Type.MissionRetire; + } + + public void SetParameter(int id) + { + MissionRetireTaskParam missionRetireTaskParam = new MissionRetireTaskParam(); + missionRetireTaskParam.id = id; + base.Params = missionRetireTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.MissionInfo.data = new MissionInfoDetail(base.ResponseData["data"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MultiDeckSelectDialog.cs b/SVSim.BattleEngine/Engine/Wizard/MultiDeckSelectDialog.cs new file mode 100644 index 0000000..9089270 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MultiDeckSelectDialog.cs @@ -0,0 +1,187 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class MultiDeckSelectDialog : MonoBehaviour +{ + private int _deckCount; + + private List _deckList; + + private DeckSelectUIDialog _deckSelectDialog; + + private int _deckIndex; + + private const int CARD_VIEW_DEPTH_OFFSET = 800; + + public Action OnClose; + + public Action> OnDecide { get; set; } + + public static MultiDeckSelectDialog Create(int deckCount, Format format, string deckListHeader) + { + MultiDeckSelectDialog multiDeckSelectDialog = new GameObject().AddComponent(); + multiDeckSelectDialog.Initialize(deckCount, format, deckListHeader); + return multiDeckSelectDialog; + } + + private void Initialize(int deckCount, Format format, string deckListHeader) + { + _deckCount = deckCount; + _deckList = new List(); + for (int i = 0; i < deckCount; i++) + { + _deckList.Add(null); + } + DeckInfoTask task = new DeckInfoTask(); + task.SetParameter(format); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _deckSelectDialog = DeckSelectUIDialog.Create(deckListHeader, task.DeckGroupListData, format, DeckSelectUIDialog.eFormatChangeUIType.SingleFormat, isVisibleCreateNew: false, OnSelectDeck, new DeckSelectUI.InitOptions + { + OnUpdateDeckUICustomize = OnUpDateDeckUICustomize + }); + })); + } + + private void OnSelectDeck(DialogBase dialogDeckList, DeckData deck) + { + int num = SearchDeckIndex(deck); + if (num >= 0) + { + _deckList[num] = null; + for (int i = num + 1; i < _deckList.Count; i++) + { + _deckList[i - 1] = _deckList[i]; + _deckList[i] = null; + } + _deckIndex--; + } + else + { + _deckList[_deckIndex] = deck; + _deckIndex++; + if (_deckIndex >= _deckCount) + { + string text = Data.SystemText.Get("RoomBattle_0091"); + text += "\n\n"; + CompleteDeckDecideDialog completeDeckDecideDialog = CompleteDeckDecideDialog.CreateForMultiDeck(dialogDeckList, text, showSimpleStageOption: false, OnDecideDeckList, OnCancelDeckList); + DeckDecisionUI decisionUI = completeDeckDecideDialog.DecisionUI; + decisionUI.OptionLabel.text = Data.SystemText.Get("Gathering_0027"); + if (_deckCount == 1) + { + DialogBase dialog = completeDeckDecideDialog.Dialog; + dialog.SetButtonText(null, Data.SystemText.Get("Card_0083")); + dialog.onPushButton2 = decisionUI.OnClickCreateCardList; + dialog.ClickSe_Btn2 = Se.TYPE.SYS_BTN_DECIDE; + dialog.isNotCloseWindowButton2 = true; + decisionUI.SetDeckData(deck, null); + decisionUI.DeckName = deck.GetDeckName(); + decisionUI.CardListCustomize = delegate(UICardList uiCardList) + { + uiCardList.SetPanelDepthOffset(800); + UIPanel[] componentsInChildren = uiCardList.CardDetail.gameObject.GetComponentsInChildren(includeInactive: true); + for (int j = 0; j < componentsInChildren.Length; j++) + { + componentsInChildren[j].depth += 800; + } + }; + } + } + } + _deckSelectDialog.UpdateAllDeckUICurrentPage(); + } + + private void OnDecideDeckList() + { + OnDecide.Call(_deckList); + UnityEngine.Object.Destroy(base.gameObject); + OnClose.Call(); + } + + private void OnCancelDeckList() + { + for (int i = 0; i < _deckList.Count; i++) + { + _deckList[i] = null; + } + _deckIndex = 0; + _deckSelectDialog.UpdateAllDeckUICurrentPage(); + } + + private static bool IsSameDeck(DeckData deck1, DeckData deck2) + { + if (deck1.IsDefaultDeck() != deck2.IsDefaultDeck()) + { + return false; + } + return deck1.GetDeckID() == deck2.GetDeckID(); + } + + private int SearchDeckIndex(DeckData deck) + { + return _deckList.FindIndex((DeckData tempDeck) => tempDeck != null && IsSameDeck(tempDeck, deck)); + } + + private void OnUpDateDeckUICustomize(DeckUI deckUI) + { + if (deckUI.ViewType == DeckUI.eViewType.CreateNew || deckUI.ViewType == DeckUI.eViewType.Empty) + { + return; + } + if (_deckIndex >= _deckCount) + { + deckUI.SetSelectable(isSelectable: false); + return; + } + DeckData deck = deckUI.Deck; + if (!deck.IsUsable()) + { + deckUI.SetSelectable(isSelectable: false); + } + else if (_deckCount > 1) + { + int num = SearchDeckIndex(deck); + if (num >= 0) + { + deckUI.SetTextCenterLabe(Data.SystemText.Get("RoomBattle_0084", (num + 1).ToString())); + deckUI.SetSelectable(isSelectable: true); + deckUI.SetColorToGrey(isGrey: true); + } + else if (IsSelectedClass(deck)) + { + deckUI.SetTextCenterLabe(Data.SystemText.Get("RoomBattle_0085")); + deckUI.SetSelectable(isSelectable: false); + } + } + } + + private bool IsSelectedClass(DeckData deck) + { + List list = new List(); + bool useSubClass = FormatBehaviorManager.GetDefaultBehaviour(deck.Format).UseSubClass; + foreach (DeckData deck2 in _deckList) + { + if (deck2 != null) + { + list.Add(deck2.GetDeckClassID()); + if (useSubClass) + { + list.Add(deck2.GetDeckSubClassID()); + } + } + } + if (list.Contains(deck.GetDeckClassID())) + { + return true; + } + if (useSubClass && list.Contains(deck.GetDeckSubClassID())) + { + return true; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageBGCustomDialog.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageBGCustomDialog.cs new file mode 100644 index 0000000..cdd33e2 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageBGCustomDialog.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.UI.Dialog.ImageSelection; + +namespace Wizard; + +public class MyPageBGCustomDialog : MonoBehaviour +{ + private const string DECK_BUTTON_KEY = "deck"; + + private const string RANDOM_BUTTON_KEY = "random"; + + private const int RANDOM_PANEL_DEPTH = 650; + + [SerializeField] + private ImageSelection _imageSelection; + + private List _randomIdList = new List(); + + private static readonly string[] FIRST_SELECT_SKIN = new string[8] { "1211410310", "1212410310", "1213410310", "1214410310", "1215410310", "1216410310", "1217410310", "1218410310" }; + + public static void Create(Action> onDecide) + { + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/MyPage/MyPageBGCustomDialog")) as GameObject; + MyPageBGCustomDialog customDialog = gameObject.GetComponent(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.XL); + dialogBase.SetTitleLabel(Data.SystemText.Get("MyPage_0102")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.DecisionBtn); + dialogBase.SetObj(gameObject); + dialogBase.onPushButton1 = delegate + { + string id = customDialog._imageSelection.GetSelectedItemKey(); + if (id == null) + { + goto IL_0060; + } + string text = id; + MyPageDetail.BGType type; + if (!(text == "deck")) + { + if (!(text == "random")) + { + goto IL_0060; + } + type = MyPageDetail.BGType.RandomBG; + } + else + { + type = MyPageDetail.BGType.Deck; + } + goto IL_0067; + IL_0067: + bool flag = false; + MyPageBGInfo bGInfo = Data.MyPage.data.BGInfo; + if (type != bGInfo.BGType) + { + flag = true; + } + if (type == MyPageDetail.BGType.CustomBG && id != bGInfo.Id) + { + flag = true; + } + if (IsNotEqualList(bGInfo.RandomIdList, customDialog._randomIdList)) + { + flag = true; + } + if (flag) + { + Data.MyPage.data.BGInfo.Id = ((type == MyPageDetail.BGType.CustomBG) ? id : string.Empty); + Data.MyPage.data.BGInfo.RandomIdList = customDialog._randomIdList; + Data.MyPage.data.BGInfo.BGType = type; + MyPageBGInfo bGInfo2 = Data.MyPage.data.BGInfo; + MyPageSettingUpdateTask myPageSettingUpdateTask = new MyPageSettingUpdateTask(); + myPageSettingUpdateTask.SetParameter(bGInfo2.BGType, bGInfo2.Id, bGInfo2.RandomIdList); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(myPageSettingUpdateTask, delegate + { + onDecide.Call(type, id, customDialog._randomIdList); + })); + } + return; + IL_0060: + type = MyPageDetail.BGType.CustomBG; + goto IL_0067; + }; + customDialog.Initialize(); + } + + private static bool IsNotEqualList(List current, List after) + { + if (current.Count != after.Count) + { + return true; + } + for (int i = 0; i < current.Count; i++) + { + if (current[i] != after[i]) + { + return true; + } + } + return false; + } + + private void Initialize() + { + _randomIdList = Data.MyPage.data.BGInfo.RandomIdList; + if (_randomIdList.Count == 0) + { + List list = new List(); + string[] fIRST_SELECT_SKIN = FIRST_SELECT_SKIN; + foreach (string item in fIRST_SELECT_SKIN) + { + if (Data.Load.data.AcquiredMyPageBGList.Contains(item)) + { + list.Add(item); + } + } + _randomIdList = list; + } + _imageSelection.Create(); + _imageSelection.AddItem("deck", null, isSelectable: true, null, null, null, isDisplaySprite: true, string.Empty, new string[2] + { + Data.SystemText.Get("MyPage_0104"), + Data.SystemText.Get("MyPage_0105") + }, null, delegate + { + OnClickDeckView(); + }); + _imageSelection.AddItem("random", null, isSelectable: true, null, null, null, isDisplaySprite: true, string.Empty, new string[2] + { + Data.SystemText.Get("MyPage_0106"), + Data.SystemText.Get("MyPage_0107") + }, null, delegate + { + OnClickRandomSelect(); + }); + string key = "deck"; + if (Data.MyPage.data.BGInfo.BGType == MyPageDetail.BGType.RandomBG) + { + key = "random"; + } + foreach (MyPageCustomBGMasterData myPageCustomBGMaster in Data.Master.MyPageCustomBGMasterList) + { + string id = myPageCustomBGMaster.Id; + if (Data.Load.data.AcquiredMyPageBGList.Contains(id)) + { + if (id == Data.MyPage.data.BGInfo.Id) + { + key = id; + } + ResourcesManager.AssetLoadPathType type = ResourcesManager.AssetLoadPathType.MyPageBackGroundIcon; + _imageSelection.AddItem(id, null, isSelectable: true, () => true, Toolbox.ResourcesManager.GetAssetTypePath(id, type), Toolbox.ResourcesManager.GetAssetTypePath(id, type, isfetch: true), isDisplaySprite: false, string.Empty, null, delegate + { + }); + } + } + _imageSelection.SelectItemWithKey(key); + _imageSelection.SetDisplayPage(_imageSelection.SelectItemWithKey(key)); + _imageSelection.LoadDisplayPage(); + _imageSelection.Open(); + } + + private void OnClickDeckView() + { + } + + private void OnClickRandomSelect() + { + MyPageBGRandomSelectDialog.Create(_randomIdList, 650, delegate(List newSelectList) + { + _randomIdList = newSelectList; + }); + } + + private void OnDestroy() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageCodeInputTask.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageCodeInputTask.cs new file mode 100644 index 0000000..0396140 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageCodeInputTask.cs @@ -0,0 +1,34 @@ +namespace Wizard; + +public class MyPageCodeInputTask : BaseTask +{ + public class MyPageCodeInputTaskParam : BaseParam + { + public string serial_code; + } + + public bool IsComplete { get; private set; } + + public MyPageCodeInputTask() + { + base.type = ApiType.Type.MyPageCodeInput; + } + + public void SetParameter(string inCode) + { + MyPageCodeInputTaskParam myPageCodeInputTaskParam = new MyPageCodeInputTaskParam(); + myPageCodeInputTaskParam.serial_code = inCode; + base.Params = myPageCodeInputTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + IsComplete = base.ResponseData["data"]["is_complete"].ToBoolean(); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageFinishBattleTask.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageFinishBattleTask.cs new file mode 100644 index 0000000..e0dd4fb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageFinishBattleTask.cs @@ -0,0 +1,126 @@ +using System; +using LitJson; + +namespace Wizard; + +public class MyPageFinishBattleTask : BaseTask +{ + public class MyPageFinishBattleParam : BaseParam + { + public int SDTRB; + } + + public Action UnfinishedBattleDialogCloseCallBack { get; set; } + + public MyPageFinishBattleTask() + { + base.type = ApiType.Type.MypageFinishBattle; + } + + public void SetParameter() + { + MyPageFinishBattleParam myPageFinishBattleParam = new MyPageFinishBattleParam(); + myPageFinishBattleParam.SDTRB = (int)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.SELF_DISCONNECT_OPEN_STATUS_TO_REPLACE_LOG); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.SELF_DISCONNECT_OPEN_STATUS_TO_REPLACE_LOG, 0f); + base.Params = myPageFinishBattleParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + int num2 = 0; + string text = "check_unfinished_battle"; + if (base.ResponseData["data"].Keys.Contains(text) && base.ResponseData["data"][text] != null) + { + num2 = base.ResponseData["data"][text].ToInt(); + } + if (base.ResponseData["data"].Keys.Contains("treasure_info")) + { + JsonData jsonData = base.ResponseData["data"]["treasure_info"]; + if (jsonData != null) + { + Data.MyPageNotifications.data.CampaignBattleWin.Parse(jsonData); + } + } + if (base.ResponseData["data"].TryGetValue("upgrade_treasure_box_info", out var value)) + { + Data.TreasureBoxCp.Parse(value, base.ResponseData["data_headers"]); + } + if (num2 != 0) + { + GameMgr.GetIns().GetDataMgr().SetClassPrm(base.ResponseData["data"]["user_class_list"], base.ResponseData["data"]["user_rank_match_list"]); + Data.Load.data.ParseUserRank(base.ResponseData["data"]); + if (Data.MyPage.data.IsExistUnfinishedBattle) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetPanelDepth(15); + if (UnfinishedBattleDialogCloseCallBack != null) + { + dialogBase.OnClose = UnfinishedBattleDialogCloseCallBack; + } + switch (num2) + { + case 1: + try + { + switch (base.ResponseData["data"]["is_win"].ToInt()) + { + case 0: + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0410")); + dialogBase.SetText(Data.SystemText.Get("Battle_0478")); + dialogBase.SetSize(DialogBase.Size.M); + break; + case 1: + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0410")); + dialogBase.SetText(Data.SystemText.Get("Battle_0479")); + dialogBase.SetSize(DialogBase.Size.M); + break; + case 2: + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0410")); + dialogBase.SetText(Data.SystemText.Get("Battle_0480")); + dialogBase.SetSize(DialogBase.Size.M); + break; + } + } + catch + { + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0410")); + dialogBase.SetText(Data.SystemText.Get("Battle_0402")); + dialogBase.SetSize(DialogBase.Size.M); + } + break; + case 2: + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0412")); + dialogBase.SetText(Data.SystemText.Get("Battle_0401")); + break; + case 3: + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0410")); + dialogBase.SetText(Data.SystemText.Get("Battle_0413")); + break; + case 4: + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0410")); + dialogBase.SetText(Data.SystemText.Get("Battle_0474")); + break; + default: + dialogBase.SetTitleLabel(Data.SystemText.Get("Battle_0412")); + dialogBase.SetText(Data.SystemText.Get("Battle_0401")); + break; + } + if (base.ResponseData["data"].Keys.Contains("reward_list")) + { + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + } + if (base.ResponseData["data"].Keys.Contains("freebie_status")) + { + Data.ArenaData.CompetitionData.FreebieStatus = (ArenaCompetition.FreebieStatusType)base.ResponseData["data"]["freebie_status"].ToInt(); + } + } + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageHomeDialog.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageHomeDialog.cs new file mode 100644 index 0000000..a593de5 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageHomeDialog.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class MyPageHomeDialog : MonoBehaviour +{ + private DialogBase _dialog; + + private MyPageHomeDialogData _homeDialogData; + + private List _loadPath = new List(); + + [SerializeField] + private UITexture _image; + + public static void Create(GameObject prefab, MyPageHomeDialogData data, Action onFinish) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + GameObject obj = UnityEngine.Object.Instantiate(prefab); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(data.DialogTitle); + dialogBase.gameObject.SetActive(value: false); + dialogBase.OnClose = delegate + { + data.Clear(); + onFinish.Call(); + }; + MyPageHomeDialog component = obj.GetComponent(); + component._dialog = dialogBase; + component._homeDialogData = data; + UIManager.GetInstance().createInSceneCenterLoading(); + } + + private void Start() + { + StartCoroutine(LoadResource(delegate + { + _dialog.SetObj(base.gameObject); + _dialog.gameObject.SetActive(value: true); + InitializeButtonAction(); + UIManager.GetInstance().closeInSceneCenterLoading(); + })); + } + + private void InitializeButtonAction() + { + List transitionList = _homeDialogData.TransitionList; + switch (transitionList.Count) + { + case 0: + _dialog.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + break; + case 1: + _dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueButton); + _dialog.SetButtonText(transitionList[0].ButtonText); + break; + case 2: + _dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueButton_BlueButton); + _dialog.SetButtonText(transitionList[0].ButtonText, transitionList[1].ButtonText); + break; + case 3: + _dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueButton_BlueButton_BlueButton); + _dialog.SetButtonText(transitionList[0].ButtonText, transitionList[1].ButtonText, transitionList[2].ButtonText); + break; + } + if (_homeDialogData.TransitionList.Count >= 1) + { + _dialog.onPushButton1 = delegate + { + OnClickButton(_homeDialogData.TransitionList[0]); + }; + } + if (_homeDialogData.TransitionList.Count >= 2) + { + _dialog.onPushButton2 = delegate + { + OnClickButton(_homeDialogData.TransitionList[1]); + }; + } + if (_homeDialogData.TransitionList.Count >= 3) + { + _dialog.onPushButton3 = delegate + { + OnClickButton(_homeDialogData.TransitionList[2]); + }; + } + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadPath); + _loadPath.Clear(); + } + + private string GetImageFilePath(bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(_homeDialogData.FilePath, ResourcesManager.AssetLoadPathType.UiDownLoad, isFetch); + } + + private IEnumerator LoadResource(Action onFinish) + { + _loadPath.Add(GetImageFilePath(isFetch: false)); + yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadPath, null)); + _image.mainTexture = Toolbox.ResourcesManager.LoadObject(GetImageFilePath(isFetch: true)); + onFinish.Call(); + } + + private void OnClickButton(MyPageHomeDialogData.TransitionData transitionData) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + MyPageBannerBase.SceneChangeBySetting(transitionData.TransitionTarget, transitionData.Status); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageOtherButtons.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageOtherButtons.cs new file mode 100644 index 0000000..99cb1c1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageOtherButtons.cs @@ -0,0 +1,590 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.Dialog.Setting; +using Wizard.Scripts.Network.Task.ItemAcquireHistory; +using Wizard.UI.Dialog; + +namespace Wizard; + +public class MyPageOtherButtons : UIBase +{ + [SerializeField] + private GameObject _dialogNotificationMenu; + + [SerializeField] + private GameObject _dialogContactMenu; + + [SerializeField] + private GameObject _dialogRewardScroll; + + [SerializeField] + private GameObject _dialogUserTicketCountPrefab; + + [SerializeField] + private UILabel _labelVideoHosting; + + [SerializeField] + private GameObject _buttonPool; + + [SerializeField] + private UIGrid _girdButtons; + + [SerializeField] + private UIButton _btnProfile; + + [SerializeField] + private UIButton _btnFriend; + + [SerializeField] + private UIButton _btnRanking; + + [SerializeField] + private GameObject _achievementIcon; + + [SerializeField] + private GameObject _achievementIconAndroid; + + [SerializeField] + private UIButton _btnSetting; + + [SerializeField] + private UIButton _btnReplay; + + [SerializeField] + private UIButton _btnHelp; + + [SerializeField] + private UIButton _btnGameGuide; + + [SerializeField] + private UIButton _btnItemsHistory; + + [SerializeField] + private UIButton _btnAchievement; + + [SerializeField] + private UIButton _btnData; + + [SerializeField] + private UIButton _btnAccountConnect; + + [SerializeField] + private UIButton _btnContact; + + [SerializeField] + private UIButton _btnNotification; + + [SerializeField] + private UIButton _btnSwitchLanguage; + + [SerializeField] + private UIButton _btnVideoHosting; + + [SerializeField] + private UIButton _btnCodeInput; + + [SerializeField] + private UIButton _btnReturnTitle; + + [SerializeField] + private UIButton _btnPortalSite; + + [SerializeField] + private UIButton _btnOffcialSite; + + [SerializeField] + private UIButton _btnSignInOut; + + [SerializeField] + private UIButton _btnTicketCount; + + [SerializeField] + private UIButton _informationButton; + + [SerializeField] + private GameObject _adjustSettingDialogPrefab; + + [SerializeField] + private UIButton _btnAdjustSetting; + + [SerializeField] + private UILabel _btnSignInOutLabel; + + private const int CODE_NUMBER_MAX = 16; + + private DialogBase _dialogCodeInput; + + private UIInput _codeInput; + + [SerializeField] + private UILabel _friendBadgeLabel; + + [SerializeField] + private UIButton _smallResourceButton; + + public List _enableOtherButtons { get; private set; } + + public UIButton btnAchievement => _btnAchievement; + + public UILabel FriendBadgeLabel => _friendBadgeLabel; + + public UIButton FriendButton => _btnFriend; + + private void Start() + { + _labelVideoHosting.text = VideoHostingUtil.GetVideoHostingSettingTitle(); + } + + public void Init() + { + List list = new List(); + list.Add(_btnSetting); + list.Add(_btnReplay); + list.Add(_btnHelp); + list.Add(_informationButton); + list.Add(_btnGameGuide); + list.Add(_btnTicketCount); + list.Add(_btnItemsHistory); + list.Add(_btnNotification); + list.Add(_btnData); + list.Add(_btnContact); + list.Add(_btnPortalSite); + list.Add(_btnOffcialSite); + list.Add(_btnSwitchLanguage); + list.Add(_btnCodeInput); + list.Add(_btnAdjustSetting); + list.Add(_btnReturnTitle); + for (int i = 0; i < list.Count; i++) + { + list[i].transform.parent = _girdButtons.transform; + } + if (_enableOtherButtons == null) + { + _enableOtherButtons = new List(); + } + _enableOtherButtons.Clear(); + _enableOtherButtons.Add(_btnProfile); + _enableOtherButtons.Add(_btnFriend); + _enableOtherButtons.Add(_btnRanking); + _enableOtherButtons.AddRange(list); + for (int j = 0; j < _enableOtherButtons.Count; j++) + { + _enableOtherButtons[j].gameObject.SetActive(value: true); + } + base.gameObject.SetActive(value: true); + _girdButtons.Reposition(); + _girdButtons.enabled = false; + _buttonPool.SetActive(value: false); + _btnAdjustSetting.onClick.Clear(); + _btnAdjustSetting.onClick.Add(new EventDelegate(delegate + { + OnClickAdjustSetting(); + })); + _informationButton.onClick.Clear(); + _informationButton.onClick.Add(new EventDelegate(delegate + { + OnClickInformation(); + })); + _smallResourceButton.onClick.Clear(); + _smallResourceButton.onClick.Add(new EventDelegate(delegate + { + OnClickSmallResourceButton(); + })); + } + + private void OnClickSmallResourceButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + int beforeSetting = PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS); + Action onFinish = delegate + { + int value = PlayerPrefsCache.Instance.GetValue(PlayerPrefsWrapper.SMALL_RESOURCE_STATUS); + if (beforeSetting != value) + { + SoftwareReset.exec(); + } + }; + Action onCancel = delegate + { + }; + SmallResourceSelectDialog.Create(onFinish, onCancel, isTitle: false); + } + + private void OnClickInformation() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + CheckTimeSlipRotationPeriodTask task = new CheckTimeSlipRotationPeriodTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.INFO); + })); + } + + private void UpdateSignInOutText() + { + if (!(_btnSignInOutLabel == null)) + { + SystemText systemText = Data.SystemText; + if (SocialServiceUtility.Instance.IsLoggedIn) + { + _btnSignInOutLabel.text = systemText.Get("OtherTop_0036"); + } + else + { + _btnSignInOutLabel.text = systemText.Get("OtherTop_0035"); + } + } + } + + protected override void OnDestroy() + { + base.OnDestroy(); + } + + public void OnBtnProfile() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Profile); + } + + public void OnBtnFriend() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Friend); + } + + public void OnBtnRanking() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Ranking); + } + + public void OnBtnSetting() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SettingBase.CreateDialog(); + } + + public void OnBtnReplay() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ReplayInfoTask replayInfoTask = new ReplayInfoTask(); + replayInfoTask.SetParameter(); + StartCoroutine(Toolbox.NetworkManager.Connect(replayInfoTask, delegate + { + ReplayDialog.Create(); + })); + } + + public void OnBtnHelp() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.HELP); + } + + public void OnBtnGameGuide() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.GetInstance().WebViewHelper.CreateOpenURLWindow(WebViewHelper.UrlType.GAME_GUIDE); + } + + public void OnBtnUserTicketCount() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("OtherTop_0062")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + UserTicketCountDialog component = UnityEngine.Object.Instantiate(_dialogUserTicketCountPrefab).GetComponent(); + component.Init(dialogBase); + dialogBase.SetObj(component.gameObject); + } + + public void OnBtnItemHistory() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ItemAcquireHistoryInfoTask itemAcquireHistoryInfoTask = new ItemAcquireHistoryInfoTask(); + itemAcquireHistoryInfoTask.SetParameter(); + StartCoroutine(Toolbox.NetworkManager.Connect(itemAcquireHistoryInfoTask, _DisplayItemHistory, BaseTask.OnRequestFailed, BaseTask.OnFailedErrorCode)); + } + + public void OnBtnAchievement() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + VideoHostingUtil.CheckVideoHostingAndShowAchievement(delegate + { + AchievementImpl.instance.ShowAchievements(delegate + { + UpdateSignInOutText(); + }); + }); + } + + public void OnBtnData() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (SingletonMonoBehaviour.instance.IsRecording() || SingletonMonoBehaviour.instance.IsPublising()) + { + VideoHostingUtil.CreateDialogPrivacyAccount(); + } + else + { + CreateDataLinkDialog(); + } + } + + public static void CreateDataLinkDialog() + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + EventDelegate method_btn = new EventDelegate(delegate + { + UIManager.GetInstance().AccountTransferHelper.CreateAccountTransferDialog(AccountBase.DisplayType.OTHER, AccountBase.TransitionOriginalScreen.OTHER); + }); + dialogBase.SetButtonDelegate(method_btn); + dialogBase.SetTitleLabel(systemText.Get("Account_0001")); + dialogBase.SetButtonText(systemText.Get("Account_0089")); + string text = systemText.Get("Account_0098"); + dialogBase.SetText(text); + dialogBase.SetSize(DialogBase.Size.M); + } + + public void OnBtnAccountConnect() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + if (SingletonMonoBehaviour.instance.IsRecording() || SingletonMonoBehaviour.instance.IsPublising()) + { + VideoHostingUtil.CreateDialogPrivacyAccount(); + } + else + { + CreateDialogAccountLink(); + } + } + + public static void CreateDialogAccountLink(Action close_callback = null) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + EventDelegate method_btn = new EventDelegate(delegate + { + UIManager.GetInstance().AccountTransferHelper.CreateAccountTransferDialog(AccountBase.DisplayType.ACCOUNT_LINK, AccountBase.TransitionOriginalScreen.OTHER, close_callback); + }); + dialogBase.SetTitleLabel(systemText.Get("Account_0087")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Account_0084")); + dialogBase.SetButtonDelegate(method_btn); + string text = systemText.Get("Account_0083"); + dialogBase.SetText(text); + dialogBase.SetSize(DialogBase.Size.M); + } + + public void OnBtnContactSupport() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Con_Management_001_Title")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + GameObject gameObject = UnityEngine.Object.Instantiate(_dialogContactMenu); + gameObject.GetComponent().SetDialog(dialogBase); + dialogBase.SetObj(gameObject); + } + + public void OnBtnNotification() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("OtherTop_0014")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + GameObject obj = UnityEngine.Object.Instantiate(_dialogNotificationMenu); + dialogBase.SetObj(obj); + } + + public void OnBtnSwitchLanguage() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SwitchLanguage.Create(isForceConfirmDialog: false, isTitle: false, delegate(bool isChangeLanguage) + { + if (isChangeLanguage) + { + Toolbox.SavedataManager.SetString(SavedataManager.LANGUAGE_CHANGE, "TRUE"); + } + SoftwareReset.exec(); + }); + } + + public void OnBtnReturnTitle() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(systemText.Get("OtherTop_0026")); + dialogBase.SetText(systemText.Get("OtherTop_0027")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("OtherTop_0028")); + dialogBase.onPushButton1 = delegate + { + SoftwareReset.exec(); + }; + } + + public void OnBtnVideoHosting() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ActivateVideoHosting(); + } + + private void ActivateVideoHosting() + { + if (SingletonMonoBehaviour.instance.IsVideoHostingSupported()) + { + VideoHostingUtil.CreateVideoHostingSetting(); + } + else + { + VideoHostingUtil.CreateDialogNotSupported(); + } + } + + public void OnBtnPortalSite() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + UIManager.ShowDialogUrl(Data.SystemText.Get("OtherTop_0030"), Data.SystemText.Get("URL_0002")); + } + + public void OnBtnOffcialSite() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SystemText systemText = Data.SystemText; + string text = "URL_0014"; + text += "_steam"; + UIManager.ShowDialogUrl(systemText.Get("OtherTop_0031"), systemText.Get(text)); + } + + public void OnBtnCodeInput() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + _dialogCodeInput = InputDialog.Create(16, 16); + _dialogCodeInput.InputAreaObjs.labels[2].text = Data.SystemText.Get("OtherCode_0009"); + _dialogCodeInput.InputAreaObjs.labels[3].text = ""; + _dialogCodeInput.SetTitleLabel(Data.SystemText.Get("OtherCode_0005")); + _dialogCodeInput.onPushButton1 = ReturnCodeInput; + _dialogCodeInput.SetButtonDisable(isEnableOK: true); + _codeInput = _dialogCodeInput.GetComponentInChildren(); + _codeInput.onChange.Add(new EventDelegate(OnChangeCodeInput)); + } + + private void OnChangeCodeInput() + { + _dialogCodeInput.SetButtonDisable(_codeInput.value.Length < 16); + } + + private void ReturnCodeInput() + { + string text = _dialogCodeInput.InputAreaObjs.labels[0].text; + MyPageCodeInputTask task = new MyPageCodeInputTask(); + task.SetParameter(text); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate(NetworkTask.ResultCode errorCode) + { + OnSuccessCodeInput(errorCode, task); + })); + } + + private void OnSuccessCodeInput(NetworkTask.ResultCode errorcode, MyPageCodeInputTask inputTask) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetTitleLabel(Data.SystemText.Get("OtherCode_0011")); + if (inputTask.IsComplete) + { + dialogBase.SetText(Data.SystemText.Get("OtherCode_0012")); + } + else + { + dialogBase.SetText(Data.SystemText.Get("OtherCode_0010")); + } + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.onPushButton1 = delegate + { + MailTopTask mailTopTask = GameMgr.GetIns().GetMailTopTask(); + mailTopTask.SetParameter(isTutorial: false); + StartCoroutine(Toolbox.NetworkManager.Connect(mailTopTask, delegate + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Mail); + })); + }; + } + + public void OnBtnShutdown() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + Application.Quit(); + } + + public void OnBtnSignInOut() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SystemText text = Data.SystemText; + try + { + if (SocialServiceUtility.Instance.IsLoggedIn) + { + SocialServiceUtility.Instance.SignOut(delegate + { + _btnSignInOutLabel.text = text.Get("OtherTop_0035"); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SOCIAL_ACHIEVEMENT_SIGNIN, flag: false); + }); + return; + } + StartCoroutine(SocialServiceUtility.Instance.SignIn(delegate(bool success) + { + if (success) + { + _btnSignInOutLabel.text = text.Get("OtherTop_0036"); + PlayerPrefsWrapper.SetBool(PlayerPrefsWrapper.SOCIAL_ACHIEVEMENT_SIGNIN, flag: true); + } + })); + } + catch (Exception ex) + { + LocalLog.AccumulateTraceLog("サインイン・アウト処理失敗:" + ex); + } + } + + private void _DisplayItemHistory(NetworkTask.ResultCode result) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Mail_0050")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + UIManager.GetInstance().closeInSceneCenterLoading(); + GameObject gameObject = UnityEngine.Object.Instantiate(_dialogRewardScroll); + dialogBase.SetObj(gameObject); + DialogRewardScroll component = gameObject.GetComponent(); + ResourceHandler resourceHandler = base.gameObject.AddMissingComponent(); + component.Handler = resourceHandler; + component.CurrentList = Data.ItemAcquireHistoryInfo.Histories; + component.resetScrollWrap(); + dialogBase.OnClose = delegate + { + resourceHandler.UnloadAll(); + UnityEngine.Object.Destroy(resourceHandler); + }; + } + + private void OnClickAdjustSetting() + { + AdjustSendSettingDialog.Create(_adjustSettingDialogPrefab).OnChange = delegate(bool enable) + { + AdjustSettingUpdateTask adjustSettingUpdateTask = new AdjustSettingUpdateTask(); + adjustSettingUpdateTask.SetParameter(enable); + StartCoroutine(Toolbox.NetworkManager.Connect(adjustSettingUpdateTask, delegate + { + Data.Load.data._userConfig.SetArrowAdjustSend(enable); + })); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageRefreshTask.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageRefreshTask.cs new file mode 100644 index 0000000..224ed89 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageRefreshTask.cs @@ -0,0 +1,32 @@ +namespace Wizard; + +public class MyPageRefreshTask : BaseTask +{ + public class MyPageRefreshTaskParam : BaseParam + { + } + + public MyPageRefreshTask() + { + base.type = ApiType.Type.MypageRefresh; + } + + public void SetParameter() + { + MyPageRefreshTaskParam myPageRefreshTaskParam = new MyPageRefreshTaskParam(); + base.Params = myPageRefreshTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.Load.data._receiveInviteCount = base.ResponseData["data"]["friend_battle_invite_count"].ToInt(); + Data.MyPageNotifications.data.ShopNotification.SetShopNotification(base.ResponseData); + Data.MyPageNotifications.data.GatheringMyPageInfo.IsMatchingNotification = !string.IsNullOrEmpty(base.ResponseData["data"]["gathering_notification"]["matching_established_message"].ToString()); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageRewardDialogBoxCount.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageRewardDialogBoxCount.cs new file mode 100644 index 0000000..2195ebb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageRewardDialogBoxCount.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +namespace Wizard; + +public class MyPageRewardDialogBoxCount : MonoBehaviour +{ + [SerializeField] + private UILabel _label; + + public static GameObject Create(GameObject prefab, CampaignBattleWin info) + { + GameObject obj = Object.Instantiate(prefab); + obj.GetComponentInChildren().Initialize(info); + return obj; + } + + private void Initialize(CampaignBattleWin info) + { + string text = ""; + switch (info.BoxStatus) + { + case CampaignBattleWin.eBoxStatus.NO_GET: + text = Data.SystemText.Get("MyPage_0078"); + break; + case CampaignBattleWin.eBoxStatus.ACTIVE: + text = Data.SystemText.Get("MyPage_0079"); + break; + case CampaignBattleWin.eBoxStatus.ALREADY_GET: + text = Data.SystemText.Get("MyPage_0080"); + break; + } + _label.text = Data.SystemText.Get("MyPage_0077") + " " + text; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyPageSpecialWinRewardDialog.cs b/SVSim.BattleEngine/Engine/Wizard/MyPageSpecialWinRewardDialog.cs new file mode 100644 index 0000000..94c12d3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyPageSpecialWinRewardDialog.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class MyPageSpecialWinRewardDialog : MonoBehaviour +{ + private const string GRADE_GAUGE_NAME = "gauge_bg_scale_15"; + + private float[] _memoryValue = new float[16] + { + 0f, 0.0585f, 0.126f, 0.194f, 0.263f, 0.331f, 0.399f, 0.467f, 0.535f, 0.602f, + 0.67f, 0.738f, 0.806f, 0.875f, 0.943f, 1f + }; + + private const int TREASURE_BOX_SPRITE_GRADE = 5; + + [SerializeField] + private UISprite _boxSprite; + + [SerializeField] + private UIGauge _gradeGauge; + + [SerializeField] + private UISprite _gaugeBackground; + + [SerializeField] + private UILabel _treasureBoxLabel; + + [SerializeField] + private UILabel _titleLabel; + + [SerializeField] + private UILabel _completeLabel; + + [SerializeField] + private GameObject _clickObject; + + [SerializeField] + private BoxCollider _clickObjectCollider; + + [SerializeField] + private UILabel _remineNumLabel; + + private List _loadFileList = new List(); + + private UIAtlas _arenaAtlas; + + private BoxCollider _notTouchMypageCollider; + + private GameObject _boxOpenEffectObj; + + private GameObject _treasureEffectObj; + + public static GameObject Create(GameObject prefab, BoxCollider notTouchMypageCollider) + { + GameObject obj = UnityEngine.Object.Instantiate(prefab); + obj.GetComponentInChildren().Initialize(notTouchMypageCollider); + return obj; + } + + private void Initialize(BoxCollider notTouchMypageCollider) + { + SystemText systemText = Data.SystemText; + _notTouchMypageCollider = notTouchMypageCollider; + SpecialTreasureInfo info = Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo; + _titleLabel.text = systemText.Get("MyPage_0109", info.SpecialTreasureBoxNecessaryNumbers.ToString()); + _remineNumLabel.text = systemText.Get("MyPage_0113", (info.SpecialTreasureBoxNecessaryNumbers - info.ReceivedBoxNumbers).ToString()); + _gradeGauge.Value = _memoryValue[info.ReceivedBoxNumbers]; + _treasureBoxLabel.text = (info.IsGotSpecialTreasureBox ? systemText.Get("TreasureBoxCp_0009") : ""); + UIManager.SetObjectToGrey(_boxSprite.gameObject, info.IsGotSpecialTreasureBox); + _completeLabel.gameObject.SetActive(info.ReceivedBoxNumbers == info.SpecialTreasureBoxNecessaryNumbers); + _clickObject.SetActive(info.IsTreasureBoxReadyToOpen); + _clickObjectCollider.enabled = info.IsTreasureBoxReadyToOpen; + string atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null); + _loadFileList.Add(atlasName); + StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(atlasName, delegate + { + atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null, isload: true); + _arenaAtlas = Toolbox.ResourcesManager.LoadObject(atlasName).GetComponent(); + _boxSprite.atlas = _arenaAtlas; + _gaugeBackground.atlas = UIManager.GetInstance().GetAtlasList().FirstOrDefault((UIAtlas s) => s.name == "MypageComon"); + _boxSprite.spriteName = (info.IsGotSpecialTreasureBox ? $"box_2pick_0{5}_open" : $"box_2pick_0{5}_close"); + _gaugeBackground.spriteName = "gauge_bg_scale_15"; + })); + UIEventListener.Get(_boxSprite.gameObject).onClick = OnClickBoxReceiveRewards; + } + + private void OnClickBoxReceiveRewards(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_LOTTERY_BOX_TOUCH); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + MypageReceiveSpecialTreasureTask receiveSpecialTreasureTask = new MypageReceiveSpecialTreasureTask(); + receiveSpecialTreasureTask.SetParameter(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(receiveSpecialTreasureTask, delegate + { + UIManager.GetInstance().StartCoroutine(RunOpenBoxEffect(receiveSpecialTreasureTask.Result, delegate + { + Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo.SetGotSpecialTreasureBox(isGot: true); + CreateRewardDialog(receiveSpecialTreasureTask, RedrawDialog); + RunHideBoxEffect(); + })); + })); + } + + private IEnumerator RunOpenBoxEffect(MypageReceiveSpecialTreasureTask.MypageTreasureBoxCpOpenTaskData result, Action endAction) + { + UIManager.GetInstance().OpenNotTouch(); + _notTouchMypageCollider.enabled = true; + yield return new WaitForSeconds(1f); + _boxOpenEffectObj = NGUITools.AddChild(base.gameObject, Resources.Load("UI/layoutParts/RankWinnerRewardResultPanel") as GameObject); + NguiObjs component = _boxOpenEffectObj.GetComponent(); + UISprite bg = component.sprites[0]; + UISprite window = component.sprites[1]; + UISprite box = component.sprites[2]; + box.atlas = _arenaAtlas; + UILabel label = component.labels[0]; + label.text = Data.SystemText.Get("MyPage_0111"); + UIPanel panel = _boxOpenEffectObj.GetComponent(); + panel.alpha = 0f; + box.spriteName = $"box_2pick_0{5}_close"; + string loadEffectName = $"cmn_arena_treasure_{6}"; + List list = new List(); + list.Add(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D)); + yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(list, null)); + _treasureEffectObj = UnityEngine.Object.Instantiate(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(loadEffectName, ResourcesManager.AssetLoadPathType.Effect2D, isfetch: true)) as GameObject); + _treasureEffectObj.transform.parent = _boxOpenEffectObj.transform; + GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(_treasureEffectObj, null); + _boxOpenEffectObj.SetLayer(LayerMask.NameToLayer("SystemUI"), isSetChildren: true); + bg.alpha = 0f; + box.alpha = 0f; + label.alpha = 0f; + panel.alpha = 1f; + TweenAlpha.Begin(bg.gameObject, 0.5f, 0.65f); + TweenAlpha.Begin(label.gameObject, 0.5f, 1f); + TweenAlpha.Begin(box.gameObject, 0.5f, 1f); + label.transform.localPosition = new Vector3(100f, 0f, 0f); + window.transform.localScale = new Vector3(1f, 0.01f, 1f); + box.transform.localPosition = new Vector3(180f, 0f, 0f); + iTween.MoveTo(label.gameObject, iTween.Hash("x", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + iTween.ScaleTo(window.gameObject, iTween.Hash("y", 1f, "time", 0.5f, "easetype", iTween.EaseType.easeInOutExpo)); + iTween.MoveTo(box.gameObject, iTween.Hash("y", 20f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + yield return new WaitForSeconds(0.8f); + TweenAlpha.Begin(label.gameObject, 0.5f, 0f); + iTween.MoveTo(box.gameObject, iTween.Hash("x", 0f, "time", 0.7f, "islocal", true, "easetype", iTween.EaseType.easeInOutExpo)); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_2PICK_BOX_OPEN); + yield return new WaitForSeconds(1f); + _treasureEffectObj.transform.localPosition = box.transform.localPosition; + _treasureEffectObj.transform.localScale = Vector3.one * 320f * 1.75f; + _treasureEffectObj.SetActive(value: true); + box.gameObject.SetActive(value: false); + yield return new WaitForSeconds(1.2f); + endAction.Call(); + } + + private void CreateRewardDialog(MypageReceiveSpecialTreasureTask info, Action onClose) + { + UIManager.GetInstance().createInSceneCenterLoading(); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(105, isSetBackViewDepthImmediately: true); + dialogBase.SetTitleLabel(Data.SystemText.Get("TreasureBoxCp_0026")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, Resources.Load("UI/layoutParts/StoryRewardPanel")).GetComponent(); + for (int i = 0; i < info.Result.RewardDataList.Count; i++) + { + component.AddReward(info.Result.RewardDataList[i]); + } + component.EndCreate(); + dialogBase.OnClose = delegate + { + onClose.Call(); + }; + } + + private void RunHideBoxEffect() + { + _treasureEffectObj.SetActive(value: false); + _boxOpenEffectObj.SetActive(value: false); + UnityEngine.Object.Destroy(_boxOpenEffectObj); + UnityEngine.Object.Destroy(_treasureEffectObj); + UIManager.GetInstance().offNotTouch(); + _notTouchMypageCollider.enabled = false; + } + + private void RedrawDialog() + { + SpecialTreasureInfo specialTreasureInfo = Data.MyPageNotifications.data.CampaignBattleWin.SpecialTreasureInfo; + _boxSprite.spriteName = (specialTreasureInfo.IsGotSpecialTreasureBox ? $"box_2pick_0{5}_open" : $"box_2pick_0{5}_close"); + UIManager.SetObjectToGrey(_boxSprite.gameObject, specialTreasureInfo.IsGotSpecialTreasureBox); + _completeLabel.gameObject.SetActive(specialTreasureInfo.ReceivedBoxNumbers == specialTreasureInfo.SpecialTreasureBoxNecessaryNumbers); + _treasureBoxLabel.text = (specialTreasureInfo.IsGotSpecialTreasureBox ? Data.SystemText.Get("TreasureBoxCp_0009") : ""); + _clickObject.SetActive(specialTreasureInfo.IsTreasureBoxReadyToOpen); + MyPageMenu.Instance.SetAfterSpecialWinRewardOpened(); + MyPageMenu.Instance.SpecialWinRewardOpened(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyRotationFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/MyRotationFormatBehavior.cs new file mode 100644 index 0000000..bcf8e8f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyRotationFormatBehavior.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class MyRotationFormatBehavior : IFormatBehavior +{ + public string Name => Data.SystemText.Get("Common_0178"); + + public string SmallIconSpriteName => "icon_myrotation_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.MY_ROTATION; + + public bool ExistsRestrictedCard => true; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public bool IsConventionMode => false; + + public List AvailableCardSetNameList => GetAvailableCardSetNameList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } + + private List GetAvailableCardSetNameList() + { + if (Prerelease.Status == Prerelease.eStatus.PRE_ROTATION) + { + string nextCardSetId = Prerelease.Instance.NextCardSetId.ToString(); + return (from setName in Data.Master.CardSetNameMgr.GetListBasicAndPack() + where setName.ID != nextCardSetId + select setName).ToList(); + } + return Data.Master.CardSetNameMgr.GetListBasicAndPack(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/MyRotationPeriodSelectDialog.cs b/SVSim.BattleEngine/Engine/Wizard/MyRotationPeriodSelectDialog.cs new file mode 100644 index 0000000..823e7c3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/MyRotationPeriodSelectDialog.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class MyRotationPeriodSelectDialog : MonoBehaviour +{ + private List _selectData; + + public MyRotationInfo SelectInfo { get; private set; } + + public static void Create(MyRotationInfo defaultSelectInfo, CardBasePrm.ClanType clanType, Action onDecide) + { + List list = new List(); + int num = 0; + int num2 = 0; + List list2 = new List(); + foreach (MyRotationInfo myRotationInfo in Data.MyRotationAllInfo.MyRotationInfoList) + { + if (clanType != CardBasePrm.ClanType.NEMESIS || myRotationInfo.IsEnableNemesis) + { + list2.Add(myRotationInfo); + list.Add(myRotationInfo.PackSelectText); + if (defaultSelectInfo != null && myRotationInfo.Id == defaultSelectInfo.Id) + { + num = num2; + } + num2++; + } + } + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/MyRotation/MyRotationPeriodSelectDialog")) as GameObject; + MyRotationPeriodSelectDialog selectDialog = gameObject.GetComponentInChildren(); + selectDialog._selectData = list2; + DialogBase dialog = DrumrollDialog.Create(gameObject.GetComponent(), list, num, selectDialog.OnSelect); + dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialog.SetButtonText(Data.SystemText.Get("Common_0003"), Data.SystemText.Get("MyRotation_ID_11")); + dialog.SetTitleLabel(Data.SystemText.Get("MyRotation_ID_23")); + dialog.onPushButton1 = delegate + { + onDecide(selectDialog.SelectInfo); + }; + dialog.onPushButton2 = delegate + { + OnClickAbilityDetailButton(dialog); + }; + dialog.isNotCloseWindowButton2 = true; + if (defaultSelectInfo == null) + { + dialog.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + } + selectDialog.OnSelect(num); + } + + private static void OnClickAbilityDetailButton(DialogBase periodSelectDialog) + { + DialogBase dialogBase = MyRotationAbilityDetailDialog.Create(Data.MyRotationAllInfo.AbilityGroup); + periodSelectDialog.SetActive(inActive: false); + dialogBase.OnClose = delegate + { + periodSelectDialog.SetActive(inActive: true); + }; + } + + private void OnSelect(int index) + { + SelectInfo = _selectData[index]; + } + + public MyRotationInfo GetMyRotationInfo(int index) + { + return _selectData[index]; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/NoneFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/NoneFormatBehavior.cs new file mode 100644 index 0000000..99ec8ad --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/NoneFormatBehavior.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class NoneFormatBehavior : IFormatBehavior +{ + public string Name => string.Empty; + + public string SmallIconSpriteName => string.Empty; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => false; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => Data.Master.CardSetNameMgr.GetListBasicAndPack(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => true; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsConventionMode => false; + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == cardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/NullReceiveTurnEndToJudgeResult.cs b/SVSim.BattleEngine/Engine/Wizard/NullReceiveTurnEndToJudgeResult.cs new file mode 100644 index 0000000..5391885 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/NullReceiveTurnEndToJudgeResult.cs @@ -0,0 +1,20 @@ +namespace Wizard; + +public class NullReceiveTurnEndToJudgeResult : ReceiveTurnEndToJudgeResult +{ + public override void StopChecker() + { + } + + protected override void IntervalCheck() + { + } + + public override void FinishChecker() + { + } + + public override void StartChecker(string log = "") + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/OutOfService.cs b/SVSim.BattleEngine/Engine/Wizard/OutOfService.cs new file mode 100644 index 0000000..57d7e69 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/OutOfService.cs @@ -0,0 +1,46 @@ +using System; +using Wizard.ErrorDialog; + +namespace Wizard; + +public static class OutOfService +{ + private static readonly DateTime RefundEndTime = new DateTime(2026, 10, 31, 14, 59, 59, DateTimeKind.Utc); + + public const int ERROR_CODE_OUT_OF_SERVICE = 9999; + + public static void ShowRefundDialog(string refundUrl) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(isSystem: true); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(systemText.Get("System_0070")); + dialogBase.SetText(systemText.Get("System_0071")); + dialogBase.SetRefund(refundUrl, systemText.Get("System_0072")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + dialogBase.SetFadeButtonEnabled(flag: false); + dialogBase.SetPanelDepth(6000); + dialogBase.SetPanelSortingOrder(2); + UIManager.GetInstance().WebViewHelper.CloseWebViewDialog(); + } + + public static bool IsServiceEnded() + { + return DateTime.UtcNow > RefundEndTime; + } + + public static bool ShowServiceEndedDialogIfNeeded() + { + if (IsServiceEnded()) + { + ShowServiceEndedDialog(); + return true; + } + return false; + } + + private static void ShowServiceEndedDialog() + { + Wizard.ErrorDialog.Dialog.Create(9999); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PackSetRotationStarterClassTask.cs b/SVSim.BattleEngine/Engine/Wizard/PackSetRotationStarterClassTask.cs new file mode 100644 index 0000000..66c52ff --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PackSetRotationStarterClassTask.cs @@ -0,0 +1,31 @@ +namespace Wizard; + +public class PackSetRotationStarterClassTask : BaseTask +{ + public class PackSetRotationStarterClassTaskParam : BaseParam + { + public int pack_id; + + public int class_id; + } + + public PackSetRotationStarterClassTask() + { + base.type = ApiType.Type.PackSetRotationStarterClass; + } + + public void SetParameter(int packId, int classId) + { + PackSetRotationStarterClassTaskParam packSetRotationStarterClassTaskParam = new PackSetRotationStarterClassTaskParam(); + packSetRotationStarterClassTaskParam.pack_id = packId; + packSetRotationStarterClassTaskParam.class_id = classId; + base.Params = packSetRotationStarterClassTaskParam; + } + + protected override int Parse() + { + int result = base.Parse(); + _ = 1; + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PaginationDots.cs b/SVSim.BattleEngine/Engine/Wizard/PaginationDots.cs new file mode 100644 index 0000000..8ff1549 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PaginationDots.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class PaginationDots : MonoBehaviour +{ + [SerializeField] + private UIGrid _dotsGrid; + + [SerializeField] + private UISprite _dotSpriteOriginal; + + private List _dotSprites = new List(); + + public void Init(int pageNum, int dotSpriteSize, int gridCellWidth, int depth) + { + UISprite dotSpriteOriginal = _dotSpriteOriginal; + int width = (_dotSpriteOriginal.height = dotSpriteSize); + dotSpriteOriginal.width = width; + _dotSpriteOriginal.depth = depth; + _dotsGrid.cellWidth = gridCellWidth; + ChangePageNum(pageNum); + } + + public void SetActivePageNumber(int pageNo) + { + SetActivePageIndex(pageNo - 1); + } + + public void SetActivePageIndex(int pageIndex) + { + for (int i = 0; i < _dotSprites.Count; i++) + { + _dotSprites[i].spriteName = ((i == pageIndex) ? "carousel_marker_on" : "carousel_marker_off"); + } + } + + public void ChangePageNum(int num) + { + if (num <= 1) + { + foreach (UISprite dotSprite in _dotSprites) + { + dotSprite.gameObject.SetActive(value: false); + } + return; + } + for (int i = _dotSprites.Count; i < num; i++) + { + UISprite component = NGUITools.AddChild(_dotsGrid.gameObject, _dotSpriteOriginal.gameObject).GetComponent(); + _dotSprites.Add(component); + } + for (int j = 0; j < num; j++) + { + _dotSprites[j].gameObject.SetActive(value: true); + } + for (int k = num; k < _dotSprites.Count; k++) + { + _dotSprites[k].gameObject.SetActive(value: false); + } + _dotsGrid.Reposition(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithEvoInformation.cs b/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithEvoInformation.cs new file mode 100644 index 0000000..d37ef40 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlaySkipWithEvoInformation.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using System.Linq; + +namespace Wizard; + +public class PlaySkipWithEvoInformation : PlaySkipInformation +{ + private List _evolutionPermittedCards; + + public bool HasEvolutionPermittedCards + { + get + { + if (_evolutionPermittedCards != null) + { + return _evolutionPermittedCards.Any(); + } + return false; + } + } + + public PlaySkipWithEvoInformation() + { + TagType = AIPlayTagType.PlaySkipWithEvo; + base.IsEvolutionPermittedTag = true; + _evolutionPermittedCards = null; + } + + public override bool IsEvoCardLegal(AIVirtualCard evoCard) + { + if (evoCard == null) + { + return true; + } + if (HasEvolutionPermittedCards) + { + return _evolutionPermittedCards.Any((AIVirtualCard c) => c.IsSameCard(evoCard)); + } + return false; + } + + public void AddEvolutionPermittedCards(List cards) + { + _evolutionPermittedCards = AIParamQuery.AddRangeToList(cards, _evolutionPermittedCards); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PlayerPrefsCache.cs b/SVSim.BattleEngine/Engine/Wizard/PlayerPrefsCache.cs new file mode 100644 index 0000000..d39b533 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PlayerPrefsCache.cs @@ -0,0 +1,63 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class PlayerPrefsCache +{ + private Dictionary _boolCache = new Dictionary(); + + private Dictionary _intCache = new Dictionary(); + + private static PlayerPrefsCache _instance; + + public static PlayerPrefsCache Instance + { + get + { + if (_instance == null) + { + _instance = new PlayerPrefsCache(); + } + return _instance; + } + } + + public static void OnSoftwareReset() + { + _instance = null; + } + + public int GetValue(KeyValuePair id) + { + if (_intCache.TryGetValue(id.Key, out var value)) + { + return value; + } + value = PlayerPrefsWrapper.GetValue(id); + _intCache.Add(id.Key, value); + return value; + } + + public void SetValue(KeyValuePair id, int value) + { + PlayerPrefsWrapper.SetValue(id, value); + _intCache[id.Key] = value; + } + + public bool GetBool(KeyValuePair id) + { + if (_boolCache.TryGetValue(id.Key, out var value)) + { + return value; + } + value = PlayerPrefsWrapper.GetBool(id); + _boolCache.Add(id.Key, value); + return value; + } + + public void SetBool(KeyValuePair id, bool value) + { + PlayerPrefsWrapper.SetBool(id, value); + _boolCache[id.Key] = value; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticeDeckInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/PracticeDeckInfoTask.cs new file mode 100644 index 0000000..9283895 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticeDeckInfoTask.cs @@ -0,0 +1,36 @@ +using LitJson; + +namespace Wizard; + +public class PracticeDeckInfoTask : BaseTask +{ + public class PracticeDeckInfoTaskParam : BaseParam + { + public int deck_format; + } + + public DeckGroupListData DeckGroupListData { get; private set; } + + public PracticeDeckInfoTask() + { + base.type = ApiType.Type.PracticeDeckInfo; + base.Params = new PracticeDeckInfoTaskParam + { + deck_format = Data.FormatConvertApi(Format.All) + }; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + GameMgr.GetIns().GetDataMgr().SetMaintenanceCardIds(base.ResponseData["data"]["maintenance_card_list"]); + DeckGroupListData = new DeckGroupListData(jsonData, Format.All); + GameMgr.GetIns().GetDataMgr().CurrentDeckListParamData = DeckGroupListData; + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticeDeckSelectConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/PracticeDeckSelectConfirmDialog.cs new file mode 100644 index 0000000..31fdb4a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticeDeckSelectConfirmDialog.cs @@ -0,0 +1,73 @@ +using Cute; + +namespace Wizard; + +public static class PracticeDeckSelectConfirmDialog +{ + private const int DECK_SELECT_DIALOG_PANEL_DEPTH = 15; + + private const string DECK_DECISION_PATH = "UI/DeckList/DeckDecision"; + + public static void Create(DialogBase dialogDeckList, DeckData deck, bool isBattleAgain) + { + if (!deck.IsUsable()) + { + InCompleteDeckDecideDialog.Create(dialogDeckList, deck); + return; + } + CompleteDeckDecideDialog.CreateForSingleDeck(dialogDeckList, deck, showSimpleStageOption: true, delegate + { + DecideDeck(deck, isBattleAgain); + }); + } + + public static void DecideDeck(DeckData deck, bool isBattleAgain) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.Load(); + DeckListUtility.DataMgrSaveLastSelectDeckData(deck); + dataMgr.SetEnemySubClassID(10); + dataMgr.SetEnemyMyRotationInfo(""); + dataMgr.SetEnemySleeveId(3000011L); + Data.CurrentFormat = deck.Format; + CardMaster.SetBattleCardMasterId(FormatBehaviorManager.GetDefaultBehaviour(deck.Format).CardMasterId); + DataMgr dataMgr2 = GameMgr.GetIns().GetDataMgr(); + if (isBattleAgain) + { + dataMgr2.Load(); + int enemyCharaOld = dataMgr2.GetEnemyCharaId(); + dataMgr2.SetSoroPlay3DFieldID(dataMgr2.Practice3DfieldId); + GameMgr.GetIns().GetSoundMgr().StopAllBGM(0.5f); + UIManager.GetInstance().CreatFadeClose(delegate + { + StartBattleAgain(enemyCharaOld); + }); + } + else + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.ClassSelectionPage, null, ClassSelectionPageParam.CreatePracticeSelect()); + } + } + + private static void StartBattleAgain(int enemyCharaOld) + { + UIManager.GetInstance().StartCoroutine(BattleManagerBase.GetIns().GetBattleControl().BattleEnd(delegate + { + UIManager.GetInstance().CreatFadeOpen(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.SetEnemyCharaId(enemyCharaOld); + dataMgr.SetCurrentEnemyDeckDataFromAIDeck(dataMgr.GetEnemyClassId(), dataMgr.m_EnemyAIDifficulty, dataMgr.m_EnemyAILogicLevel, dataMgr.m_EnemyAIMaxLife, dataMgr.m_EnemyAIDeckId, dataMgr.m_EnemyAIStyleId, dataMgr.m_EnemyAIEmoteId, dataMgr.m_EnemyAIUseInnerEmote); + dataMgr.LoadEnemyClassData(); + PracticeStartTask task = new PracticeStartTask(); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + IsShow_CardIntroduction = true + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Battle, param); + })); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleBattleFinish.cs b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleBattleFinish.cs new file mode 100644 index 0000000..e75d950 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleBattleFinish.cs @@ -0,0 +1,53 @@ +using LitJson; + +namespace Wizard; + +public class PracticePuzzleBattleFinish : BaseTask +{ + public class PracticePuzzleBattleFinishParam : BaseParam + { + public int puzzle_id; + + public int retry_count; + + public bool is_win; + } + + public PracticePuzzleBattleFinish() + { + base.type = ApiType.Type.PracticePuzzleBattleFinish; + } + + public void SetParameter(int puzzleId, int retryCount, bool isWin) + { + PracticePuzzleBattleFinishParam practicePuzzleBattleFinishParam = new PracticePuzzleBattleFinishParam(); + practicePuzzleBattleFinishParam.puzzle_id = puzzleId; + practicePuzzleBattleFinishParam.retry_count = retryCount; + practicePuzzleBattleFinishParam.is_win = isWin; + base.Params = practicePuzzleBattleFinishParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + DeleteRecoveryFileIfBattleAlreadyEnded(num); + return num; + } + Data.PracticePuzzleFinishData = new PracticePuzzleFinishData(); + Data.PracticePuzzleFinishData._responseData = base.ResponseData; + Data.PracticePuzzleFinishData.class_chara_experience = 0; + Data.PracticePuzzleFinishData.class_chara_level = 0; + Data.PracticePuzzleFinishData.get_class_chara_experience = base.ResponseData["data"]["get_class_experience"].ToInt(); + Data.PracticePuzzleFinishData.class_chara_experience = base.ResponseData["data"]["class_experience"].ToInt(); + Data.PracticePuzzleFinishData.class_chara_level = base.ResponseData["data"]["class_level"].ToInt(); + JsonData jsonData = base.ResponseData["data"]["achieved_info"]; + if (jsonData.GetJsonType() == JsonType.Object) + { + Data.PracticePuzzleFinishData.AchievedInfo.Read(jsonData); + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleBattleStartTask.cs b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleBattleStartTask.cs new file mode 100644 index 0000000..e133929 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleBattleStartTask.cs @@ -0,0 +1,21 @@ +namespace Wizard; + +public class PracticePuzzleBattleStartTask : BaseTask +{ + public class PracticePuzzleBattleStartTaskTaskParam : BaseParam + { + public int puzzle_id; + } + + public PracticePuzzleBattleStartTask() + { + base.type = ApiType.Type.PracticePuzzleBattleStart; + } + + public void SetParameter(int puzzleId) + { + PracticePuzzleBattleStartTaskTaskParam practicePuzzleBattleStartTaskTaskParam = new PracticePuzzleBattleStartTaskTaskParam(); + practicePuzzleBattleStartTaskTaskParam.puzzle_id = puzzleId; + base.Params = practicePuzzleBattleStartTaskTaskParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleData.cs b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleData.cs new file mode 100644 index 0000000..5551a58 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleData.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Linq; +using LitJson; + +namespace Wizard; + +public class PracticePuzzleData +{ + public int GroupdId { get; private set; } + + public string Title { get; private set; } + + public int CurrentClearCount { get; private set; } + + public int MaxClearCount { get; private set; } + + public bool IsMissionTarget { get; private set; } + + public bool IsClear => CurrentClearCount >= MaxClearCount; + + public PracticePuzzleData(JsonData json) + { + GroupdId = json["puzzle_master_id"].ToInt(); + IsMissionTarget = json["is_mission_target"].ToBoolean(); + Title = Data.SystemText.Get(json["basic_title_text_id"].ToString()); + List list = PuzzleQuestSelectDialog.CreateDisplayData(isDisplayNew: true, json["puzzle_data"]); + MaxClearCount = list.Count; + CurrentClearCount = list.Count((PuzzleQuestSelectDialog.DisplayData puzzle) => puzzle.IsCleared); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleListTask.cs b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleListTask.cs new file mode 100644 index 0000000..d20cecb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleListTask.cs @@ -0,0 +1,40 @@ +using LitJson; + +namespace Wizard; + +public class PracticePuzzleListTask : BaseTask +{ + public class PracticePuzzleListTaskParam : BaseParam + { + public int puzzle_master_id; + } + + public bool IsDisplayBadge { get; private set; } + + public PuzzleQuestInfo PuzzleQuestInfo { get; private set; } + + public PracticePuzzleListTask() + { + base.type = ApiType.Type.PracticePuzzleList; + } + + public void SetParameter(int puzzleGroupId) + { + PracticePuzzleListTaskParam practicePuzzleListTaskParam = new PracticePuzzleListTaskParam(); + practicePuzzleListTaskParam.puzzle_master_id = puzzleGroupId; + base.Params = practicePuzzleListTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + IsDisplayBadge = jsonData["is_display_badge"].ToBoolean(); + PuzzleQuestInfo = new PuzzleQuestInfo(jsonData); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleUI.cs b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleUI.cs new file mode 100644 index 0000000..bd7cc09 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PracticePuzzleUI.cs @@ -0,0 +1,222 @@ +using System; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class PracticePuzzleUI : UIBase +{ + private const int INVALID_GROUP_ID = 0; + + private const string BG_TEXTURE_PATH = "bg_puzzle"; + + private const int CHARACTER_ID = 3704; + + [SerializeField] + private UITexture _character; + + [SerializeField] + private SimpleScrollViewUI _puzzleListScrollView; + + [SerializeField] + private UIButton _decideButton; + + [SerializeField] + private UIButton _missionButton; + + [SerializeField] + private UITexture _backGround; + + [SerializeField] + private GameObject _puzzleMissionDialogPrefab; + + private List _loadFileList = new List(); + + private List _puzzleListData; + + private PracticePuzzleData _selectData; + + public static void ClearInMyPageScene() + { + GameMgr.GetIns().GetDataMgr().PracticePuzzleGroupId = 0; + } + + public override void onFirstStart() + { + base.onFirstStart(); + Data.MyPageNotifications.data.IsPracticePuzzleBadgeEnable = false; + UIManager.GetInstance().ShowFooterMenu(isShow: true); + UIManager.GetInstance()._Footer.UpdateCurrentIndex(1); + UIManager.GetInstance()._Footer.UpdateSoloPlayBadgeIcon(); + InitializeTopBar(); + UIEventListener.Get(_decideButton.gameObject).onClick = delegate + { + OnClickDecideButton(); + }; + UIEventListener.Get(_missionButton.gameObject).onClick = delegate + { + OnClickMissionButton(); + }; + PracticePuzzleInfoTask task = new PracticePuzzleInfoTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + _puzzleListData = task.PuzzleDataList; + LoadResource(delegate + { + InitializeCharacterTexture(); + InitializeBackGround(); + InitializeButtonEffect(); + _puzzleListScrollView.CreateScrollView(_puzzleListData.Count, InitializePlate); + int defaultScrollIndex = GetDefaultScrollIndex(_puzzleListData); + _puzzleListScrollView.MovePlateByIndex(defaultScrollIndex, SimpleScrollViewUI.VerticalMovement.Center); + _selectData = _puzzleListData[defaultScrollIndex]; + UpdateSelectCursor(_selectData); + UIManager.GetInstance().OnReadyViewScene(isFadein: true); + }); + })); + } + + private int GetDefaultScrollIndex(List list) + { + for (int i = 0; i < list.Count; i++) + { + if (list[i].GroupdId == GameMgr.GetIns().GetDataMgr().PracticePuzzleGroupId) + { + return i; + } + } + return 0; + } + + protected override void OnDestroy() + { + base.OnDestroy(); + Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList); + _loadFileList.Clear(); + } + + private void LoadResource(Action onFinish) + { + _loadFileList.Add(GetCharacterTexturePath(isFetch: false)); + _loadFileList.Add(GetBackGroundTexturePath(isFetch: false)); + _loadFileList.Add(Toolbox.ResourcesManager.GetAssetTypePath("cmn_ui_btn_1", ResourcesManager.AssetLoadPathType.Effect2D)); + foreach (PracticePuzzleData puzzleListDatum in _puzzleListData) + { + _loadFileList.Add(PracticePuzzlePlate.GetPlateTexturePath(puzzleListDatum, isFetch: false)); + } + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadFileList, delegate + { + onFinish.Call(); + })); + } + + private string GetBackGroundTexturePath(bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath("bg_puzzle", ResourcesManager.AssetLoadPathType.Background, isFetch); + } + + private void InitializeButtonEffect() + { + EffectUtility.CreateEffect2D(new Effect2dCreateParam + { + Parent = _decideButton.gameObject, + EffectName = "cmn_ui_btn_1", + ColorCode = eColorCodeId.DECISION_BTN_2_COLOR, + InitActive = false, + UnloadAssetList = _loadFileList + }).SetActive(value: true); + } + + private void InitializePlate(int index, GameObject plateObject) + { + plateObject.GetComponent().UpdateView(_puzzleListData[index], OnSelectPuzzle, _puzzleListData[index] == _selectData); + } + + private void InitializeBackGround() + { + _backGround.mainTexture = Toolbox.ResourcesManager.LoadObject(GetBackGroundTexturePath(isFetch: true)); + } + + private void OnSelectPuzzle(PracticePuzzleData data) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + _selectData = data; + UpdateSelectCursor(data); + } + + private void UpdateSelectCursor(PracticePuzzleData selectData) + { + foreach (GameObject activePlate in _puzzleListScrollView.ActivePlateList) + { + PracticePuzzlePlate component = activePlate.GetComponent(); + component.UpdateSelectSpriteVisible(component.PuzzleData == selectData); + } + } + + private string GetCharacterTexturePath(bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(3704.ToString("00"), ResourcesManager.AssetLoadPathType.ClassCharaBase, isFetch); + } + + private void InitializeCharacterTexture() + { + _character.mainTexture = Toolbox.ResourcesManager.LoadObject(GetCharacterTexturePath(isFetch: true)) as Texture; + } + + private void InitializeTopBar() + { + UIManager.ChangeViewSceneParam changeViewSceneParam = new UIManager.ChangeViewSceneParam(); + changeViewSceneParam.MyPageMenuIndex = 1; + changeViewSceneParam.IsCutCardMotion = true; + changeViewSceneParam.OnFinishChangeView = delegate + { + MyPageMenu.Instance.GoToPracticeTypeSelect(); + }; + string titleMsg = Data.SystemText.Get("Mission_0095"); + UIManager.GetInstance().CreateTopBar(base.gameObject, titleMsg, UIManager.ViewScene.MyPage, MoneyDraw: false, changeViewSceneParam).gameObject.layer = LayerMask.NameToLayer("FrontUI"); + } + + private void OnClickDecideButton() + { + if (_selectData == null) + { + return; + } + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + PracticePuzzleListTask task = new PracticePuzzleListTask(); + task.SetParameter(_selectData.GroupdId); + StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate + { + List loadList = PuzzleQuestSelectDialog.CollectResourcePath(task.PuzzleQuestInfo.DisplayDatas); + UIManager.GetInstance().createInSceneCenterLoading(); + StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + PuzzleQuestSelectDialog.CreateDialog(task.PuzzleQuestInfo, delegate(PuzzleQuestData puzzleData, int difficulty) + { + StartBattle(_selectData.GroupdId, puzzleData, difficulty); + }).OnClose = delegate + { + Toolbox.ResourcesManager.RemoveAssetGroup(loadList); + }; + })); + })); + } + + public static void StartBattle(int groupId, PuzzleQuestData data, int difficulty) + { + PuzzleUtil.SetPracticePuzzleData(groupId, data, difficulty, DataMgr.BattleType.Practice); + PuzzleUtil.ChangeSceneToPracticePuzzle(data); + } + + private void OnClickMissionButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + PracticePuzzleMissionListTask puzzleMissionTask = new PracticePuzzleMissionListTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(puzzleMissionTask, delegate + { + PracticePuzzleMissionDialog.Create(puzzleMissionTask.MissionData, _puzzleMissionDialogPrefab); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PreRotationFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/PreRotationFormatBehavior.cs new file mode 100644 index 0000000..d13b0bd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PreRotationFormatBehavior.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class PreRotationFormatBehavior : IFormatBehavior +{ + public string Name => UIUtil.GetFormatName(Format.PreRotation); + + public string SmallIconSpriteName => "icon_prerotation_s"; + + public CardMaster.CardMasterId CardMasterId => Prerelease.Instance.CardMasterId; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => false; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public bool IsConventionMode => false; + + public List AvailableCardSetNameList => (from id in Prerelease.Instance.RotationCardSetList.Distinct() + select Data.Master.CardSetNameMgr.Get(id.ToString())).ToList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PurchaseRewardItem.cs b/SVSim.BattleEngine/Engine/Wizard/PurchaseRewardItem.cs new file mode 100644 index 0000000..ab4e90d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PurchaseRewardItem.cs @@ -0,0 +1,327 @@ +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class PurchaseRewardItem : MonoBehaviour +{ + private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f); + + [SerializeField] + private Vector3 _sleeveAndEmblemColliderSize = new Vector3(200f, 200f, 0f); + + [SerializeField] + private Vector3 _sleeveAndEmblemColliderCenter = new Vector3(0f, 0f, 0f); + + [SerializeField] + private UILabel _labelPurchaseNth; + + [SerializeField] + private GameObject _objCardLayout; + + [SerializeField] + private GameObject _objCardRoot; + + [SerializeField] + private GameObject _objSleeveLayout; + + [SerializeField] + private UITexture _textureSleeve; + + [SerializeField] + private GameObject _degreeLayout; + + [SerializeField] + private UITexture _degreeTexture; + + [SerializeField] + private GameObject _objEmblemLayout; + + [SerializeField] + private UITexture _textureEmblem; + + [SerializeField] + private GameObject _objTwoEmblemsLayout; + + [SerializeField] + private UITexture[] _textureTwoEmblems; + + [SerializeField] + private GameObject _objComboSleeveEmblemLayout; + + [SerializeField] + private UITexture _textureComboSleeve; + + [SerializeField] + private UITexture _textureComboEmblem; + + [SerializeField] + private GameObject _objComboMultiEmblemsParent; + + [SerializeField] + private UITexture[] _textureComboMultiEmblems; + + [SerializeField] + private GameObject _objItemLayout; + + [SerializeField] + private UITexture _textureItem; + + [SerializeField] + private UILabel _labelAcquired; + + [SerializeField] + private UISprite _spriteAcquiredCardMask; + + [SerializeField] + private GameObject _objItemNum; + + [SerializeField] + private UILabel _labelItemNum; + + [SerializeField] + private GameObject[] _objLayouts; + + private const string PATH_REWARD_DETAIL_NORMAL = "UI/layoutParts/Dialog/DialogSleeveDetail"; + + private const string PATH_REWARD_DETAIL_LARGE = "UI/layoutParts/Dialog/DialogSleeveDetailLarge"; + + public string DetailDialogTitleOverride { get; set; } + + private static CardSleeveDetailWindow InstantiateDetailPrefab(bool useLargeDetailDialog) + { + return (Object.Instantiate(Resources.Load(useLargeDetailDialog ? "UI/layoutParts/Dialog/DialogSleeveDetailLarge" : "UI/layoutParts/Dialog/DialogSleeveDetail")) as GameObject).GetComponent(); + } + + public void SetUserGoods(PurchaseRewardInfo purchaseReward, bool useLargeDetailDialog, GameObject cardObj, bool isPaging, bool isEnableItemNumber) + { + SetPurchaseNthLabel(purchaseReward.PurchaseNthText); + GameObject[] objLayouts = _objLayouts; + for (int i = 0; i < objLayouts.Length; i++) + { + objLayouts[i].SetActive(value: false); + } + List rewardInfoList = purchaseReward.RewardInfoList; + if (rewardInfoList.Count == 1) + { + ShopCommonRewardInfo shopCommonRewardInfo = rewardInfoList[0]; + switch ((UserGoods.Type)shopCommonRewardInfo.Type) + { + case UserGoods.Type.Card: + SetCardLayout(shopCommonRewardInfo, cardObj); + ItemNumVisible(visible: true); + SetItemNum(shopCommonRewardInfo); + SetAcquired(_objCardLayout, purchaseReward.IsGet); + if (purchaseReward.IsGet) + { + _spriteAcquiredCardMask.gameObject.SetActive(value: true); + cardObj.GetComponent().enabled = true; + } + _objCardLayout.gameObject.SetActive(value: true); + break; + case UserGoods.Type.Sleeve: + SetTexture(shopCommonRewardInfo, _textureSleeve); + ItemNumVisible(visible: false); + SetAcquired(_objSleeveLayout, purchaseReward.IsGet); + _objSleeveLayout.gameObject.SetActive(value: true); + SetRewardDetailDialog(_objSleeveLayout, rewardInfoList, useLargeDetailDialog, isPaging); + break; + case UserGoods.Type.Emblem: + SetTexture(shopCommonRewardInfo, _textureEmblem); + ItemNumVisible(visible: false); + SetAcquired(_objEmblemLayout, purchaseReward.IsGet); + _objEmblemLayout.gameObject.SetActive(value: true); + SetRewardDetailDialog(_objEmblemLayout, rewardInfoList, useLargeDetailDialog, isPaging); + break; + case UserGoods.Type.Item: + SetTexture(shopCommonRewardInfo, _textureItem); + ItemNumVisible(isEnableItemNumber); + SetItemNum(shopCommonRewardInfo); + SetAcquired(_objItemLayout, purchaseReward.IsGet); + _objItemLayout.gameObject.SetActive(value: true); + break; + case UserGoods.Type.Degree: + SetTexture(shopCommonRewardInfo, _degreeTexture); + ItemNumVisible(visible: false); + SetAcquired(_degreeLayout, purchaseReward.IsGet); + _degreeLayout.gameObject.SetActive(value: true); + break; + } + } + else if (rewardInfoList.Count == 2) + { + List list = rewardInfoList.Where((ShopCommonRewardInfo reward) => reward.Type == 6).ToList(); + List list2 = rewardInfoList.Where((ShopCommonRewardInfo reward) => reward.Type == 7).ToList(); + int count = list.Count; + int count2 = list2.Count; + if (count2 == 1 && count == 1) + { + SetTexture(list[0], _textureComboSleeve); + SetTexture(list2[0], _textureComboEmblem); + ItemNumVisible(visible: false); + SetAcquired(_objComboSleeveEmblemLayout, purchaseReward.IsGet); + _objComboSleeveEmblemLayout.SetActive(value: true); + SetRewardDetailDialog(_objComboSleeveEmblemLayout, rewardInfoList, useLargeDetailDialog, isPaging); + } + else if (count2 == 2 && count == 0) + { + SetTexture(list2[0], _textureTwoEmblems[0]); + SetTexture(list2[1], _textureTwoEmblems[1]); + ItemNumVisible(visible: false); + SetAcquired(_objTwoEmblemsLayout, purchaseReward.IsGet); + _objTwoEmblemsLayout.SetActive(value: true); + SetRewardDetailDialog(_objTwoEmblemsLayout, rewardInfoList, useLargeDetailDialog, isPaging); + } + } + else + { + if (rewardInfoList.Count <= 2) + { + return; + } + List list3 = rewardInfoList.Where((ShopCommonRewardInfo reward) => reward.Type == 6).ToList(); + List list4 = rewardInfoList.Where((ShopCommonRewardInfo reward) => reward.Type == 7).ToList(); + int count3 = list3.Count; + int count4 = list4.Count; + int num = rewardInfoList.Count - count3 - count4; + if (count3 != 1 || count4 < 2 || count4 > 4 || num != 0) + { + return; + } + SetTexture(list3[0], _textureComboSleeve); + for (int num2 = 0; num2 < _textureComboMultiEmblems.Length; num2++) + { + if (num2 > count4 - 1) + { + _textureComboMultiEmblems[num2].gameObject.SetActive(value: false); + continue; + } + SetTexture(list4[num2], _textureComboMultiEmblems[num2]); + _textureComboMultiEmblems[num2].gameObject.SetActive(value: true); + } + ItemNumVisible(visible: false); + SetAcquired(_objComboSleeveEmblemLayout, purchaseReward.IsGet); + _objComboSleeveEmblemLayout.gameObject.SetActive(value: true); + _objComboMultiEmblemsParent.SetActive(value: true); + _textureComboEmblem.gameObject.SetActive(value: false); + SetRewardDetailDialog(_objComboSleeveEmblemLayout, rewardInfoList, useLargeDetailDialog, isPaging); + } + } + + private void SetPurchaseNthLabel(string purchaseNthText) + { + _labelPurchaseNth.SetWrapText(purchaseNthText); + } + + private void SetCardLayout(ShopCommonRewardInfo rewardCardInfo, GameObject cardObj) + { + cardObj.transform.parent = _objCardRoot.transform; + cardObj.transform.localPosition = Vector3.zero; + cardObj.transform.localScale = Vector3.one; + cardObj.transform.rotation = CARDOBJECT_ROTATION_QUATERNION; + cardObj.SetActive(value: true); + } + + private void SetTexture(ShopCommonRewardInfo rewardInfo, UITexture uiTexture) + { + string empty = string.Empty; + long id = 3000011L; + switch ((UserGoods.Type)rewardInfo.Type) + { + default: + return; + case UserGoods.Type.Sleeve: + id = Toolbox.ResourcesManager.GetExistingSleeveId(rewardInfo.UserGoodsId); + empty = Toolbox.ResourcesManager.GetAssetTypePath(id.ToString(), ResourcesManager.AssetLoadPathType.SleeveTexture, isfetch: true); + break; + case UserGoods.Type.Emblem: + empty = Toolbox.ResourcesManager.GetAssetTypePath(rewardInfo.UserGoodsId.ToString(), ResourcesManager.AssetLoadPathType.Emblem_M, isfetch: true); + break; + case UserGoods.Type.Item: + { + Item item = Data.Master.ItemList.Find((Item data) => data.UserGoodsId == rewardInfo.UserGoodsId); + if (item == null) + { + return; + } + empty = Toolbox.ResourcesManager.GetAssetTypePath(item.thumbnail, ResourcesManager.AssetLoadPathType.Item, isfetch: true); + break; + } + case UserGoods.Type.Degree: + empty = Toolbox.ResourcesManager.GetAssetTypePath(UserGoods.GetUserGoodsImageName(UserGoods.Type.Degree, 0L), ResourcesManager.AssetLoadPathType.Item, isfetch: true); + break; + case UserGoods.Type.Card: + return; + } + Texture mainTexture = Toolbox.ResourcesManager.LoadObject(empty); + uiTexture.mainTexture = mainTexture; + uiTexture.material = null; + if (rewardInfo.Type == 6) + { + Sleeve sleeve = Data.Master.SleeveMgr.Get(id); + if (sleeve.IsPremiumSleeve) + { + UIManager.GetInstance().getUIBase_CardManager().SetSleeveTexture(uiTexture, sleeve.sleeve_id); + } + } + } + + private void ItemNumVisible(bool visible) + { + _objItemNum.gameObject.SetActive(visible); + } + + private void SetItemNum(ShopCommonRewardInfo rewardInfo) + { + _labelItemNum.text = rewardInfo.Num.ToString(); + } + + private void SetAcquired(GameObject layout, bool isAcquired) + { + _labelAcquired.gameObject.SetActive(isAcquired); + UIManager.SetObjectToGrey(layout, isAcquired); + UIManager.SetObjectToGrey(_objItemNum, isAcquired); + } + + private void SetRewardDetailDialog(GameObject root, List rewardList, bool useLargeDetailDialog, bool isPaging) + { + BoxCollider boxCollider = root.AddComponent(); + boxCollider.size = _sleeveAndEmblemColliderSize; + boxCollider.center = _sleeveAndEmblemColliderCenter; + UIEventListener.Get(root).onClick = delegate + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(string.IsNullOrEmpty(DetailDialogTitleOverride) ? Data.SystemText.Get("Shop_0185") : DetailDialogTitleOverride); + if (isPaging) + { + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetLayer("Loading"); + RewardBase component = NGUITools.AddChild(dialogBase.gameObject, UIManager.GetInstance().GetRewardDialogPrefab().gameObject).GetComponent(); + for (int i = 0; i < rewardList.Count; i++) + { + component.AddReward(rewardList[i]); + } + component.SetActiveRewardLabel(isShow: false); + component.EndCreate(); + } + else + { + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + CardSleeveDetailWindow cardSleeveDetailWindow = InstantiateDetailPrefab(useLargeDetailDialog); + dialogBase.SetObj(cardSleeveDetailWindow.gameObject); + cardSleeveDetailWindow.SetData(rewardList, string.Empty, null); + } + }; + } + + public void SetScale(float scale) + { + base.transform.localScale = new Vector3(scale, scale, 1f); + Vector3 localScale = new Vector3(1f / scale, 1f / scale, 1f); + _labelPurchaseNth.transform.localScale = localScale; + _labelItemNum.transform.parent.localScale = localScale; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PuzzleHintDialog.cs b/SVSim.BattleEngine/Engine/Wizard/PuzzleHintDialog.cs new file mode 100644 index 0000000..dc430d8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PuzzleHintDialog.cs @@ -0,0 +1,18 @@ +using UnityEngine; + +namespace Wizard; + +public class PuzzleHintDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _winConditionLabel; + + [SerializeField] + private UILabel _hintLabel; + + public void Setup(string winConditionText, string hintText) + { + _winConditionLabel.text = winConditionText; + _hintLabel.text = hintText; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PuzzleQuestSelectItem.cs b/SVSim.BattleEngine/Engine/Wizard/PuzzleQuestSelectItem.cs new file mode 100644 index 0000000..236600a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PuzzleQuestSelectItem.cs @@ -0,0 +1,82 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class PuzzleQuestSelectItem : MonoBehaviour +{ + [SerializeField] + private UITexture _charaTexture; + + [SerializeField] + private UILabel _clearLabel; + + [SerializeField] + private UILabel _deckNameLabel; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private UILabel _newLabel; + + [SerializeField] + private UILabel _unlockConditionLabel; + + private PuzzleQuestSelectDialog.DisplayData _displayData; + + private const float PUSH_ANIMATION_DURATION = 0.03f; + + private static readonly Vector3 PushAnimationScale = new Vector3(0.95f, 0.95f, 1f); + + public void Setup(PuzzleQuestSelectDialog.DisplayData displayData, Action onClick) + { + _displayData = displayData; + _button.onClick.Add(new EventDelegate(delegate + { + onClick(_displayData); + })); + UIEventListener uIEventListener = UIEventListener.Get(_button.gameObject); + uIEventListener.onPress = (UIEventListener.BoolDelegate)Delegate.Combine(uIEventListener.onPress, (UIEventListener.BoolDelegate)delegate(GameObject obj, bool state) + { + PlayPushAnimation(state); + }); + _deckNameLabel.text = Data.SystemText.Get(displayData.Data.QuestNameTextId); + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(displayData.Data.PlayerSkin.ToString(), ResourcesManager.AssetLoadPathType.DeckListTexture, isfetch: true); + _charaTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath); + _clearLabel.gameObject.SetActive(displayData.IsCleared); + _newLabel.gameObject.SetActive(displayData.IsDisplayNew); + SetUiAccordingLockState(displayData); + } + + private void PlayPushAnimation(bool isPress) + { + Vector3 scale = (isPress ? PushAnimationScale : Vector3.one); + TweenScale.Begin(base.gameObject, 0.03f, scale); + } + + private void SetUiAccordingLockState(PuzzleQuestSelectDialog.DisplayData displayData) + { + if (displayData.IsUnlocked) + { + SetUnlockStateUI(); + } + else + { + SetLockStateUI(displayData.UnlockConditionText); + } + } + + private void SetUnlockStateUI() + { + _unlockConditionLabel.gameObject.SetActive(value: false); + } + + private void SetLockStateUI(string unlockConditionText) + { + UIManager.SetObjectToGrey(_button.gameObject, b: true); + _unlockConditionLabel.gameObject.SetActive(value: true); + _unlockConditionLabel.text = unlockConditionText; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/PuzzleWinConditionDisplay.cs b/SVSim.BattleEngine/Engine/Wizard/PuzzleWinConditionDisplay.cs new file mode 100644 index 0000000..d2f6f74 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/PuzzleWinConditionDisplay.cs @@ -0,0 +1,48 @@ +using System; +using UnityEngine; + +namespace Wizard; + +public class PuzzleWinConditionDisplay : MonoBehaviour +{ + [SerializeField] + private UILabel _winConditionLabel; + + [SerializeField] + private UIButton _button; + + [SerializeField] + private UIPanel _panel; + + private bool _isAppeared; + + private Action _onComplete; + + private const float APPEAR_DURATION = 0.5f; + + private const float DISAPPEAR_DURATION = 0.1f; + + public void Setup(string winConditionText, Action onComplete) + { + _winConditionLabel.text = winConditionText; + _panel.alpha = 0f; + _button.onClick.Add(new EventDelegate(OnClick)); + _onComplete = onComplete; + TweenAlpha.Begin(base.gameObject, 0.5f, 1f).onFinished.Add(new EventDelegate(delegate + { + _isAppeared = true; + })); + } + + private void OnClick() + { + if (_isAppeared) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_TOGGLE_ON); + TweenAlpha.Begin(base.gameObject, 0.1f, 0f).onFinished.Add(new EventDelegate(delegate + { + _onComplete(); + })); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QRCodeUtility.cs b/SVSim.BattleEngine/Engine/Wizard/QRCodeUtility.cs new file mode 100644 index 0000000..0bca6a9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QRCodeUtility.cs @@ -0,0 +1,311 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Text.RegularExpressions; +using Cute; +using UnityEngine; +using ZXing; +using ZXing.QrCode; +using ZXing.QrCode.Internal; + +namespace Wizard; + +public class QRCodeUtility +{ + public struct DeckDataFromQRCode + { + public CardBasePrm.ClanType ClanId; + + public CardBasePrm.ClanType SubClanId; + + public int[] CardIds; + + public bool IsSubClassSet; + + public Format Format; + + public MyRotationInfo MyRotationInfo { get; } + + public DeckDataFromQRCode(Format format, CardBasePrm.ClanType clanId, CardBasePrm.ClanType subClanId, int[] cardIds, MyRotationInfo myRotationInfo) + { + ClanId = clanId; + CardIds = cardIds; + SubClanId = subClanId; + IsSubClassSet = CardBasePrm.ClanTypeIsUseable(subClanId); + Format = format; + MyRotationInfo = myRotationInfo; + } + } + + public const int SIZE_SMALL = 207; + + public const int SIZE_BIG = 508; + + public const int BIGQRCODE_TEXTURE_WIDGIT_SIZE = 400; + + private const string NORMAL_URL_TAIL = "/deck/"; + + private const string CROSSOVER_URL_TAIL = "/deck_co/"; + + private const string MY_ROTATION_URL_TAIL = "/deck_my/"; + + public static DeckDataFromQRCode deckDataFromQRCode; + + public static Texture2D CreateQrCodeTexture(int width, int height, string content) + { + BarcodeWriter barcodeWriter = new BarcodeWriter + { + Format = BarcodeFormat.QR_CODE, + Options = new QrCodeEncodingOptions + { + ErrorCorrection = ErrorCorrectionLevel.L, + Width = width, + Height = height + } + }; + Texture2D texture2D = new Texture2D(width, height, TextureFormat.ARGB32, mipChain: false); + Color32[] pixels = barcodeWriter.Write(content); + texture2D.SetPixels32(pixels); + texture2D.Apply(); + return texture2D; + } + + private static string GetAppendUrlFromDeckType(IFormatBehavior formatBehavior, Format format) + { + if (formatBehavior.UseSubClass) + { + return "/deck_co/"; + } + if (format == Format.MyRotation) + { + return "/deck_my/"; + } + return "/deck/"; + } + + public static string GenerateQRCodeText(List deckList, CardBasePrm.ClanType? clanType, ClassSet classSet, IFormatBehavior formatBehavior, Format format, MyRotationInfo myRotationInfo) + { + bool useSubClass = formatBehavior.UseSubClass; + StringBuilder tempStringBuilder = UIUtil.GetTempStringBuilder(); + tempStringBuilder.Append("https://").Append("shadowverse-portal.com/api/v1/game_api/".Split('/')[0]); + tempStringBuilder.Append(GetAppendUrlFromDeckType(formatBehavior, format)); + tempStringBuilder.Append(((int)formatBehavior.DeckCodeType).ToString()).Append("."); + string value; + if (classSet == null) + { + value = ((int)clanType.Value).ToString(); + } + else + { + int mainClass = (int)classSet.MainClass; + value = mainClass.ToString(); + } + tempStringBuilder.Append(value).Append("."); + if (useSubClass) + { + int mainClass = (int)classSet.SubClass; + tempStringBuilder.Append(mainClass.ToString()).Append("."); + } + if (format == Format.MyRotation) + { + tempStringBuilder.Append(myRotationInfo.Id).Append("."); + } + CardMaster instance = CardMaster.GetInstance(formatBehavior.CardMasterId); + for (int i = 0; i < deckList.Count; i++) + { + int normalCardId = instance.GetCardParameterFromId(deckList[i]).NormalCardId; + tempStringBuilder.Append(instance.GetCardParameterFromId(normalCardId).CardHashId); + if (i != deckList.Count - 1) + { + tempStringBuilder.Append("."); + } + } + tempStringBuilder.Append("?lang=").Append(GetLanguageCode()); + return tempStringBuilder.ToString(); + } + + public static string GetLanguageCode() + { + string result = ""; + switch (CustomPreference.GetTextLanguage()) + { + case "Jpn": + result = "ja"; + break; + case "Ger": + result = "de"; + break; + case "Fre": + result = "fr"; + break; + case "Ita": + result = "it"; + break; + case "Cht": + result = "zh-tw"; + break; + case "Kor": + result = "ko"; + break; + case "Spa": + result = "es"; + break; + case "Chs": + case "Eng": + result = "en"; + break; + } + return result; + } + + public static string DecodeContentText(WebCamTexture webCamTexture) + { + if (webCamTexture == null) + { + return string.Empty; + } + return DecodeContentText(webCamTexture.GetPixels32(), webCamTexture.width, webCamTexture.height, isFromCamera: true); + } + + public static string DecodeContentText(Color32[] pixels, int width, int height, bool isFromCamera) + { + BarcodeReader barcodeReader = new BarcodeReader + { + AutoRotate = !isFromCamera + }; + Result result; + try + { + result = barcodeReader.Decode(pixels, width, height); + } + catch (Exception ex) + { + LocalLog.AccumulateTraceLog("#699501 :" + ex); + result = null; + } + if (result == null) + { + return string.Empty; + } + return result.Text; + } + + public static bool SetDeckFromQRCodeText(string qrCodeText, CardMaster.CardMasterId cardMasterId) + { + bool result = false; + string text = "https://" + "shadowverse-portal.com/api/v1/game_api/".Split('/')[0] + "/deck/"; + string text2 = "https://" + "shadowverse-portal.com/api/v1/game_api/".Split('/')[0] + "/deck_co/"; + string text3 = "https://" + "shadowverse-portal.com/api/v1/game_api/".Split('/')[0] + "/deck_my/"; + bool flag = qrCodeText.StartsWith(text); + bool flag2 = qrCodeText.StartsWith(text2); + bool flag3 = qrCodeText.StartsWith(text3); + if (!flag && !flag2 && !flag3) + { + return result; + } + if (!Regex.IsMatch(qrCodeText, "\\?lang=(\\w+$|zh-tw)")) + { + return result; + } + if (flag) + { + qrCodeText = Regex.Replace(qrCodeText, text, ""); + } + else if (flag2) + { + qrCodeText = Regex.Replace(qrCodeText, text2, ""); + } + else if (flag3) + { + qrCodeText = Regex.Replace(qrCodeText, text3, ""); + } + qrCodeText = Regex.Replace(qrCodeText, "\\?lang=(\\w+$|zh-tw)", ""); + string[] array = qrCodeText.Split('.'); + CardBasePrm.ClanType clanType = CardBasePrm.ClanType.NONE; + CardBasePrm.ClanType subClanId = CardBasePrm.ClanType.NONE; + MyRotationInfo myRotationInfo = null; + Format format = Format.Max; + try + { + format = GetFormatFromDeckCodeType((GenerateDeckCodeTask.SubmitDeckType)int.Parse(array[0])); + clanType = (CardBasePrm.ClanType)int.Parse(array[1]); + if (flag2) + { + subClanId = (CardBasePrm.ClanType)int.Parse(array[2]); + } + if (flag3) + { + myRotationInfo = Data.MyRotationAllInfo.Get(array[2]); + } + if (clanType < CardBasePrm.ClanType.MIN || clanType > CardBasePrm.ClanType.MAX) + { + return result; + } + } + catch (Exception ex) + { + if (array.Length >= 3) + { + Debug.LogError($"フォーマット: {array[0].ToString()}、クラス: {array[1].ToString()}、サブクラス: {array[2].ToString()}のいずれかの情報取得に失敗。{ex.ToString()}"); + } + else + { + Debug.LogError($"cardHashIdListの長さが{array.Length.ToString()}です。{ex.ToString()}"); + } + return result; + } + List list = new List(); + int num = 2; + if (flag2 || flag3) + { + num = 3; + } + for (int i = num; i < array.Length; i++) + { + try + { + int cardId = CardMaster.GetInstance(cardMasterId).GetCardParamFromCardHashId(array[i]).CardId; + if (!CardMaster.GetInstance(cardMasterId).CardExists(cardId)) + { + return result; + } + list.Add(cardId); + } + catch (Exception ex2) + { + Debug.LogError($"カードリストの{i.ToString()}番目要素の取得に失敗。{ex2.ToString()}"); + return result; + } + } + deckDataFromQRCode = new DeckDataFromQRCode(format, clanType, subClanId, list.ToArray(), myRotationInfo); + return true; + } + + public static Format GetFormatFromDeckCodeType(GenerateDeckCodeTask.SubmitDeckType type) + { + return type switch + { + GenerateDeckCodeTask.SubmitDeckType.NORMAL => Format.Unlimited, + GenerateDeckCodeTask.SubmitDeckType.Crossover => Format.Crossover, + _ => Format.Max, + }; + } + + public static bool IsShowQRCode(UICardList deckViewer, IFormatBehavior formatBehavior, Format format) + { + bool flag = deckViewer.getCardNum() == 40; + if (formatBehavior.UseSubClass) + { + flag &= deckViewer.CanShowQRCodeUseSubclass(); + } + if (format == Format.MyRotation && !deckViewer.IsDeckNull()) + { + flag &= deckViewer.IsAllCardCorrectMyRotation(); + } + if (format == Format.Avatar) + { + flag = false; + } + return flag; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestDeckSelectConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/QuestDeckSelectConfirmDialog.cs new file mode 100644 index 0000000..b25f42d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestDeckSelectConfirmDialog.cs @@ -0,0 +1,82 @@ +using Cute; + +namespace Wizard; + +public static class QuestDeckSelectConfirmDialog +{ + public static void Create(DialogBase dialogDeckList, DeckData deck, bool isBattleAgain) + { + if (!deck.IsUsable()) + { + InCompleteDeckDecideDialog.Create(dialogDeckList, deck); + return; + } + CompleteDeckDecideDialog completeDeckDecideDialog = CompleteDeckDecideDialog.CreateForSingleDeck(dialogDeckList, deck, showSimpleStageOption: false, delegate + { + DecideDeck(deck, isBattleAgain); + }); + if (GameMgr.GetIns().GetDataMgr().QuestBattleData.IsMockBattle) + { + completeDeckDecideDialog.DecisionUI.SetText(string.Empty, string.Empty); + completeDeckDecideDialog.Dialog.SetText(Data.SystemText.Get("Quest_0026", deck.GetDeckName())); + } + } + + public static void DecideDeck(DeckData deck, bool isBattleAgain) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.Load(); + DeckListUtility.DataMgrSaveLastSelectDeckData(deck); + dataMgr.SetEnemySleeveId(3000011L); + Data.CurrentFormat = deck.Format; + new QuestLastUsedDeckSaveDataManager().SaveDeck(dataMgr.QuestBattleData.QuestStageId, deck); + dataMgr.Load(); + CardMaster.SetBattleCardMasterId(FormatBehaviorManager.GetDefaultBehaviour(deck.Format).CardMasterId); + if (isBattleAgain) + { + GameMgr.GetIns().GetSoundMgr().StopAllBGM(0.5f); + UIManager.GetInstance().CreatFadeClose(delegate + { + UIManager.GetInstance().StartCoroutine(BattleManagerBase.GetIns().GetBattleControl().BattleEnd(delegate + { + UIManager.GetInstance().CreatFadeOpen(); + int enemyAiID = ((dataMgr.QuestBattleData != null) ? dataMgr.QuestBattleData.EnemyAiId : (-1)); + dataMgr.SetEnemyCharaId(dataMgr.GetEnemyCharaId()); + dataMgr.SetCurrentEnemyDeckDataFromAIDeck(dataMgr.GetEnemyClassId(), dataMgr.m_EnemyAIDifficulty, dataMgr.m_EnemyAILogicLevel, dataMgr.m_EnemyAIMaxLife, dataMgr.m_EnemyAIDeckId, dataMgr.m_EnemyAIStyleId, dataMgr.m_EnemyAIEmoteId, dataMgr.m_EnemyAIUseInnerEmote, enemyAiID); + dataMgr.LoadEnemyClassData(); + ChangeQuestBattleScene(); + })); + }); + return; + } + QuestBattleData battleData = dataMgr.QuestBattleData; + dataMgr.SetEnemyCharaId(battleData.CharaId); + dataMgr.SetStoryBgmID(battleData.BgmId); + dataMgr.SetSoroPlay3DFieldID(battleData.Battle3dFieldID); + StoryAISettingData settingData = Data.Master.QuestAISettingList.GetSettingData(battleData.EnemyAiId); + UIManager.GetInstance().createInSceneCenterLoading(); + Data.Master.LoadAICsv(new AICsvLoadingInfo(settingData.DeckId, settingData.StyleId, settingData.EmoteId), delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + dataMgr.SetQuestAILogicAndDeckData(battleData.EnemyClass, settingData.EnemyAiId); + dataMgr.LoadEnemyClassData(); + ChangeQuestBattleScene(); + }); + } + + private static void ChangeQuestBattleScene() + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + QuestStartTask questStartTask = new QuestStartTask(); + questStartTask.SetParameter(dataMgr.QuestBattleData.QuestStageId, dataMgr.QuestBattleData.ExtraDeckScheduleId); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(questStartTask, delegate + { + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + IsShow_CardIntroduction = true + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Battle, param); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestFinishTask.cs new file mode 100644 index 0000000..3b7e005 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestFinishTask.cs @@ -0,0 +1,139 @@ +using System.Collections.Generic; +using LitJson; +using Wizard.Battle.Recovery; + +namespace Wizard; + +public class QuestFinishTask : BaseTask +{ + public class QuestFinishTaskParam : BaseParam + { + public int quest_stage_id; + + public int deck_no; + + public bool is_win; + + public int deck_format; + + public bool is_prebuild_deck; + + public bool is_trial_deck; + + public int total_turn; + + public int turn_state; + + public Dictionary mission; + + public string recovery_data; + + public string[] prosessing_time_data; + } + + public class QuestFinishTaskParamForPuzzle : BaseParam + { + public int puzzle_id; + + public bool is_win; + + public int retry_count; + } + + public QuestFinishTask(bool isPuzzle = false) + { + base.type = (isPuzzle ? ApiType.Type.QuestPuzzleFinish : ApiType.Type.QuestFinish); + } + + public void SetParameter(int quest_stage_id, int deck_no, bool is_win, Format format, bool isPreBuildDeck, bool isTrialDeck, bool isFirst, int totalTurn) + { + QuestFinishTaskParam questFinishTaskParam = new QuestFinishTaskParam(); + questFinishTaskParam.quest_stage_id = quest_stage_id; + questFinishTaskParam.deck_no = deck_no; + questFinishTaskParam.is_win = is_win; + questFinishTaskParam.deck_format = Data.FormatConvertApi(format); + questFinishTaskParam.is_prebuild_deck = isPreBuildDeck; + questFinishTaskParam.is_trial_deck = isTrialDeck; + questFinishTaskParam.turn_state = ((!isFirst) ? 1 : 0); + questFinishTaskParam.total_turn = totalTurn; + BattleManagerBase ins = BattleManagerBase.GetIns(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + BattlePlayerPair battlePlayerPair = ins.GetBattlePlayerPair(isPlayer: true); + BattleCardBase selfClass = ins.GetBattlePlayer(isPlayer: true).Class; + if (dataMgr.RecoveryData == null) + { + dataMgr.SetRecoveryData(RecoveryOperationInfo.ReadRecoveryFile(OperationRecorderBase.RecordDirectoryPath + "recovery_single.json")); + } + questFinishTaskParam.recovery_data = dataMgr.RecoveryData.ToJson(); + questFinishTaskParam.mission = dataMgr.MissionNecessaryInformation.GetMissionNecessaryInfo(battlePlayerPair, selfClass); + base.Params = questFinishTaskParam; + } + + public void SetParameterForPuzzle(int puzzleId, bool isWin) + { + base.Params = new QuestFinishTaskParamForPuzzle + { + puzzle_id = puzzleId, + is_win = isWin, + retry_count = (BattleManagerBase.GetIns() as PuzzleBattleManager).RetryCount + }; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + DeleteRecoveryFileIfBattleAlreadyEnded(num); + return num; + } + Data.QuestFinish.data = new QuestFinishDetail(); + Data.QuestFinish.data._responseData = base.ResponseData; + JsonData jsonData = base.ResponseData["data"]; + if (base.type == ApiType.Type.QuestPuzzleFinish) + { + Data.QuestFinish.data.PuzzleQuestInfo = new PuzzleQuestInfo(jsonData); + } + Data.QuestFinish.data.get_class_chara_experience = jsonData["get_class_experience"].ToInt(); + Data.QuestFinish.data.class_chara_experience = jsonData["class_experience"].ToInt(); + Data.QuestFinish.data.class_chara_level = jsonData["class_level"].ToInt(); + Data.QuestFinish.data.CurrentPoint = jsonData["current_point"].ToInt(); + Data.QuestFinish.data.AddPoint = jsonData["add_point"].ToInt(); + Data.QuestFinish.data.ClassBonusPoint = jsonData["class_bonus_point"].ToInt(); + Data.QuestFinish.data.FormatBonusPoint = jsonData["format_bonus_point"].ToInt(); + JsonData jsonData2 = jsonData["clear_mission_list"]["common_mission"]; + Data.QuestFinish.data.CommonMissionClearInfoList = new List(); + for (int i = 0; i < jsonData2.Count; i++) + { + Data.QuestFinish.data.CommonMissionClearInfoList.Add(new QuestFinishDetail.MissionClearInfo(jsonData2[i]["name"].ToString(), jsonData2[i]["point"].ToInt())); + } + JsonData jsonData3 = jsonData["clear_mission_list"]["character_mission"]; + Data.QuestFinish.data.CharacterMissionClearInfoList = new List(); + for (int j = 0; j < jsonData3.Count; j++) + { + Data.QuestFinish.data.CharacterMissionClearInfoList.Add(new QuestFinishDetail.MissionClearInfo(jsonData3[j]["name"].ToString(), jsonData3[j]["point"].ToInt())); + } + Data.QuestFinish.data.WinBonusPoint = jsonData.GetValueOrDefault("win_bonus_point", 0); + Data.QuestFinish.data.WinCount = jsonData.GetValueOrDefault("win_count", 0); + Data.QuestFinish.data.WinCountForWinBonusPoint = jsonData.GetValueOrDefault("required_win_count_for_win_bonus_point", 0); + Data.QuestFinish.data.WinBonusPointStatus = (QuestFinishDetail.WinBonusStatus)jsonData.GetValueOrDefault("win_bonus_point_status", 0); + Data.QuestFinish.data.AddPoint = Data.QuestFinish.data.AddPoint - Data.QuestFinish.data.WinBonusPoint - Data.QuestFinish.data.GetTotalBonusPoint() - Data.QuestFinish.data.GetTotalCommonMissionClearPoint() - Data.QuestFinish.data.GetTotalCharacterMissionClearPoint(); + Data.QuestFinish.data.NecessaryPointList = new List(); + int num2 = 0; + for (int k = 0; k < jsonData["point_reward_list"].Count; k++) + { + int num3 = jsonData["point_reward_list"][k]["point"].ToInt(); + Data.QuestFinish.data.NecessaryPointList.Add(num3 - num2); + num2 = num3; + } + Data.QuestFinish.data.NecessaryPointList.Add(-1); + Data.QuestFinish.data.IsSpecialResult = jsonData.GetValueOrDefault("is_special_result", defaultValue: false); + Data.QuestFinish.data.IsSpecialEffect = jsonData.GetValueOrDefault("is_special_effect", defaultValue: false); + JsonData data = base.ResponseData["data"]["achieved_info"]; + Data.QuestFinish.data.AchievedInfo.Read(data); + Data.QuestFinish.data.HomeDialogData = new MyPageHomeDialogData(jsonData, "battle_dialog_list"); + Data.MyPageNotifications.ParseBadgeInfos(base.ResponseData); + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestRewardReceiveTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestRewardReceiveTask.cs new file mode 100644 index 0000000..c2612fa --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestRewardReceiveTask.cs @@ -0,0 +1,43 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class QuestRewardReceiveTask : BaseTask +{ + private class QuestRewardReceiveTaskParam : BaseParam + { + public int reward_id; + } + + public List ReceiveRewardList { get; private set; } + + public QuestRewardReceiveTask() + { + base.type = ApiType.Type.QuestRewardReceive; + } + + public void SetParameter(int reward_id) + { + QuestRewardReceiveTaskParam questRewardReceiveTaskParam = new QuestRewardReceiveTaskParam(); + questRewardReceiveTaskParam.reward_id = reward_id; + base.Params = questRewardReceiveTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + ReceiveRewardList = new List(); + JsonData jsonData = base.ResponseData["data"]["total_receive_count_list"]; + for (int i = 0; i < jsonData.Count; i++) + { + ReceiveRewardList.Add(new ReceivedReward(jsonData[i])); + } + PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestStartTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestStartTask.cs new file mode 100644 index 0000000..5f3c9af --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestStartTask.cs @@ -0,0 +1,59 @@ +using LitJson; + +namespace Wizard; + +public class QuestStartTask : BaseTask +{ + public class QuestStartTaskParam : BaseParam + { + public int quest_stage_id; + + public int extra_deck_schedule_id; + } + + public class QuestStartTaskParamForPuzzle : BaseParam + { + public int puzzle_id; + } + + public QuestStartTask(bool isPuzzle = false) + { + base.type = (isPuzzle ? ApiType.Type.QuestPuzzleStart : ApiType.Type.QuestStart); + } + + public void SetParameter(int questStageId, int extraDeckScheduleId) + { + QuestStartTaskParam questStartTaskParam = new QuestStartTaskParam(); + questStartTaskParam.quest_stage_id = questStageId; + questStartTaskParam.extra_deck_schedule_id = extraDeckScheduleId; + base.Params = questStartTaskParam; + } + + public void SetParameterForPuzzle(int puzzleId) + { + base.Params = new QuestStartTaskParamForPuzzle + { + puzzle_id = puzzleId + }; + } + + protected override int Parse() + { + int num = base.Parse(); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.ClearSpecialBattleSettingInfo(); + if (num != 1) + { + return num; + } + if (base.type == ApiType.Type.QuestPuzzleStart) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]["special_battle_setting"]; + int num2 = jsonData["player_first_turn"].ToInt(); + dataMgr.SetSpecialBattleSetting((num2 == 0) ? ((bool?)null) : new bool?(num2 == 1), playerPp: jsonData["player_start_pp"].ToInt(), enemyPp: jsonData["enemy_start_pp"].ToInt(), playerLife: jsonData["player_start_life"].ToInt(), playerMaxLife: jsonData["player_start_life"].ToInt(), enemyMaxLife: jsonData["enemy_start_life"].ToInt(), playerSkill: jsonData["player_attach_skill"].ToString(), enemySkill: jsonData["enemy_attach_skill"].ToString(), idOverrideBattleLogText: jsonData["id_override_in_battle_log"].ToString()); + dataMgr.SetMissionNecessaryInformation(base.ResponseData["data"]["mission_parameter"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/QuestTweetTask.cs b/SVSim.BattleEngine/Engine/Wizard/QuestTweetTask.cs new file mode 100644 index 0000000..cb27bb1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/QuestTweetTask.cs @@ -0,0 +1,30 @@ +using LitJson; + +namespace Wizard; + +public class QuestTweetTask : BaseTask +{ + public string Message { get; private set; } + + public string ImagePath { get; private set; } + + public QuestTweetTask() + { + base.type = ApiType.Type.QuestTweet; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + JsonData jsonData = base.ResponseData["data"]; + string format = jsonData["tweet_message"].ToString().Replace("\\n", "\n"); + ImagePath = jsonData["tweet_image"].ToString(); + string arg = jsonData["tweet_url"].ToString(); + Message = string.Format(format, arg); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RankBattleDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard/RankBattleDoMatchingTask.cs new file mode 100644 index 0000000..c785dcc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RankBattleDoMatchingTask.cs @@ -0,0 +1,59 @@ +using LitJson; + +namespace Wizard; + +public class RankBattleDoMatchingTask : DoMatchingBase +{ + private const string DATA = "data"; + + private const string DISCOVERED_REWAED = "discovered_reward"; + + private const string GRADE_ID = "grade_id"; + + private const string REWARD_MESSAGE = "reward_message"; + + public RankBattleDoMatchingTask() + { + switch (Data.CurrentFormat) + { + case Format.Rotation: + base.type = ApiType.Type.RankBattleDoMatchingRotation; + break; + case Format.Unlimited: + base.type = ApiType.Type.RankBattleDoMatchingUnlimited; + break; + case Format.Crossover: + base.type = ApiType.Type.RankBattleDoMatchingCrossover; + break; + default: + Debug.LogError("UnknownFormat:" + Data.CurrentFormat); + break; + } + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + SettingDoMatchingData(); + if (base.ResponseData["data"].Keys.Contains("discovered_reward")) + { + if (base.ResponseData["data"]["discovered_reward"].Keys.Contains("grade_id")) + { + JsonData jsonData = base.ResponseData["data"]["discovered_reward"]["grade_id"]; + JsonData jsonData2 = base.ResponseData["data"]["discovered_reward"]["reward_message"]; + Data.DoMatchingDetail.data.SetWinnerRewardInfo(jsonData.ToInt(), jsonData2.ToString()); + } + } + else + { + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_GRADE, 0); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.BATTLE_WINNER_REWARD_STRING, ""); + Data.DoMatchingDetail.data.ClearWinnerRewardInfo(); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RankBattleFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/RankBattleFinishTask.cs new file mode 100644 index 0000000..ad7b0d0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RankBattleFinishTask.cs @@ -0,0 +1,92 @@ +using System; +using LitJson; + +namespace Wizard; + +public class RankBattleFinishTask : FinishTaskBase +{ + public class RankBattleFinishParam : BattleFinishParam + { + } + + public RankBattleFinishTask() + { + if (GameMgr.GetIns().IsAINetwork) + { + base.type = ((Data.CurrentFormat == Format.Rotation) ? ApiType.Type.AIRotationRankBattleFinish : ApiType.Type.AIUnlimitedRankBattleFinish); + } + else + { + switch (Data.CurrentFormat) + { + case Format.Rotation: + base.type = ApiType.Type.RankMatchFinishRotation; + break; + case Format.Unlimited: + base.type = ApiType.Type.RankMatchFinishUnlimited; + break; + case Format.Crossover: + base.type = ApiType.Type.RankMatchFinishCrossover; + break; + default: + Debug.LogError("UnknownFormat:" + Data.CurrentFormat); + break; + } + } + Data.RankMatchFinish.data = new RankMatchFinishDetail(); + } + + protected override int Parse() + { + int num = base.Parse(); + if (IsEffectiveErrorCode(num)) + { + return num; + } + Data.RankMatchFinish.data = new RankMatchFinishDetail(); + if (!IsResponseDataExist(base.ResponseData)) + { + return num; + } + RankMatchFinishDetail data = Data.RankMatchFinish.data; + data.class_chara_experience = 0; + data.class_chara_level = 0; + Data.Load.data._userRank[(int)Data.CurrentFormat].user_promotion_match = new UserPromotionMatch(); + new BattleFinishResponsProcessing().Processing(base.ResponseData, Data.RankMatchFinish.data); + JsonData jsonData = base.ResponseData["data"]; + data.UserRank = jsonData.GetValueOrDefault("rank", 0); + data.AfterBattlePoint = jsonData.GetValueOrDefault("after_battle_point", 0); + data.AfterMasterPoint = jsonData.GetValueOrDefault("after_master_point", 0); + data.BasicBattlePoint_and_SuperiorBonus = jsonData.GetValueOrDefault("battle_point", 0); + data.BasicMasterPoint_and_SuperiorBonus = jsonData.GetValueOrDefault("master_point", 0); + data.SuccessiveWinNumber = jsonData.GetValueOrDefault("successive_win_number", 0); + data.SuccessiveWinBonus = jsonData.GetValueOrDefault("successive_win_bonus", 0); + if (jsonData.Keys.Contains("upgrade_treasure_box_info")) + { + data.TreasureBoxCpResultInfo.Parse(jsonData["upgrade_treasure_box_info"]); + } + if (jsonData.TryGetValue("speed_challenge_schedule", out var value) && value.TryGetValue("announce_time", out var value2)) + { + data.SpeedChallengeAnnounceTime = DateTime.Parse(value2.ToString()); + } + int num2 = PlayerStaticData.UserRankCurrentFormat(); + if (num2 != data.UserRank) + { + PlayerStaticData.ReLoadUserRankTexture(num2.ToString("00"), data.UserRank.ToString("00"), Data.CurrentFormat); + } + ClassCharaPrm classPrm = GameMgr.GetIns().GetDataMgr().GetClassPrm(classId); + classPrm.AddClassCharaBattleCount(); + if (data.battleResult == BattleManagerBase.BATTLE_RESULT_TYPE.WIN) + { + classPrm.AddClassCharaWin(); + } + return num; + } + + protected override BattleFinishParam CreateBattleFinishParam(int class_id, int total_turn, int evolve_count, int enemy_evolve_count, int battle_result, int is_retire) + { + BattleFinishParam battleFinishParam = base.CreateBattleFinishParam(class_id, total_turn, evolve_count, enemy_evolve_count, battle_result, is_retire); + battleFinishParam.SDTRB = (int)PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.SELF_DISCONNECT_OPEN_STATUS_TO_REPLACE_LOG); + return battleFinishParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RankMatchEnemyAI.cs b/SVSim.BattleEngine/Engine/Wizard/RankMatchEnemyAI.cs new file mode 100644 index 0000000..fbdf420 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RankMatchEnemyAI.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections; +using System.Diagnostics; +using UnityEngine; +using Wizard.Battle.View.Vfx; + +namespace Wizard; + +public class RankMatchEnemyAI : EnemyAI +{ + private Stopwatch _turnTimeStopWatch = new Stopwatch(); + + public override bool IsStackAction => _isStackAction; + + public override bool IsConnectNetwork => _isConnectNetwork; + + public RankMatchEnemyAI() + { + base.IsRankMatchAI = true; + } + + public override VfxBase GetEmote(AIEmoteCmdType cmdType, AISituationInfo situation = null, ClassCharaPrm.EmotionType receivedEmoteType = ClassCharaPrm.EmotionType.NULL, int emoteInput = -1) + { + return NullVfx.GetInstance(); + } + + protected override IEnumerator WeakLogicTimerCoroutine() + { + float currentMilliSec = 0f; + float currentTimeOverLogicSec = 0f; + _elapsedThinkingTime = 0f; + _currentThinkingIntervalTime = 0f; + _isRunTurnEndLimitTimer = false; + _turnStartVfxFinishTime = 0f; + _elapsedTurnTimeAfterTurnStartVfx = 0f; + _turnTimeStopWatch.Reset(); + _turnTimeStopWatch.Start(); + while (true) + { + yield return null; + if (base.IsBattleEnd) + { + break; + } + float num = (float)(_turnTimeStopWatch.Elapsed.TotalMilliseconds - (double)currentMilliSec) / 1000f; + currentMilliSec = (float)_turnTimeStopWatch.Elapsed.TotalMilliseconds; + float num2 = currentMilliSec / 1000f; + if (_isRunTurnEndLimitTimer) + { + _elapsedTurnTimeAfterTurnStartVfx = num2 - _turnStartVfxFinishTime; + } + if (battleMgr.VfxMgr.IsEnd) + { + if (_enabledThinkingCounter) + { + _elapsedThinkingTime += num; + } + if (base.IsThinkingInterval) + { + _currentThinkingIntervalTime -= num; + } + if (!_isRunTurnEndLimitTimer) + { + _turnStartVfxFinishTime = num2; + _isRunTurnEndLimitTimer = true; + } + } + if (!base.IsRunWeakLogic) + { + currentTimeOverLogicSec += num; + _timeOverLogicSec = (int)currentTimeOverLogicSec; + if (_timeOverLogicSec > 7 && battleMgr.VfxMgr.IsEnd && AIOperationQueue.Count <= 0) + { + ChangeWeakLogic(); + currentTimeOverLogicSec = 0f; + } + } + } + } + + public override void Retire() + { + EnemyAICoroutine.GetInstance().StopAllCoroutines(); + BattleCoroutine instance = BattleCoroutine.GetInstance(); + if (weakLogicCoroutine != null) + { + instance.StopCoroutine(weakLogicCoroutine); + weakLogicCoroutine = null; + } + battleMgr.VfxMgr.RegisterImmediateVfx(new CanNotTouchCardVfx()); + if (!battleMgr.GetBattlePlayer(isPlayer: true).Class.IsDead) + { + battleMgr.VfxMgr.RegisterSequentialVfx(battleMgr.DeadClass(PlayerDead: false, BattleManagerBase.FINISH_TYPE.RETIRE)); + battleMgr.VfxMgr.RegisterSequentialVfx(InstantVfx.Create(delegate + { + battleMgr.InitiateGameEndSequence(hasWon: true); + })); + } + } + + public override void Disconnect() + { + _isConnectNetwork = false; + } + + public override void Reconnect() + { + _isConnectNetwork = true; + } + + public override void CleanupStackedAction() + { + base.IsStopThinkingLogic = true; + ExecuteActionOperationQueue(); + } + + public override void RegistActionOperationQueue(Action action) + { + base.RegistActionOperationQueue(action); + CheckIsStackAction(); + } + + public override void ExecuteActionOperationQueue() + { + base.ExecuteActionOperationQueue(); + CheckIsStackAction(); + } + + protected override void OnBeforeTurnEnd() + { + if (weakLogicCoroutine != null) + { + BattleCoroutine.GetInstance().StopCoroutine(weakLogicCoroutine); + weakLogicCoroutine = null; + } + } + + protected override void OnFinishOprAttack() + { + CheckIsStackAction(); + } + + protected override void OnFinishOprTargetSelect() + { + SetupThinkingInterval(); + CheckIsStackAction(); + } + + protected override void CheckIsStackAction() + { + _isStackAction = AIOperationQueue.Count > 0; + } + + protected override void SetupThinkingInterval() + { + _enabledThinkingCounter = false; + float num = UnityEngine.Random.Range(0f, 3f); + num = ((num <= _elapsedThinkingTime) ? 0f : num); + _currentThinkingIntervalTime = num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignMissionLabel.cs b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignMissionLabel.cs new file mode 100644 index 0000000..25be194 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignMissionLabel.cs @@ -0,0 +1,18 @@ +using UnityEngine; + +namespace Wizard; + +public class RedEtherCampaignMissionLabel : MonoBehaviour +{ + [SerializeField] + public UILabel _missionName; + + [SerializeField] + public UILabel _redEtherCount; + + public void Initialize(RedEtherCampaignResultData.ClearMissionInfo info) + { + _missionName.text = info.MissionText; + _redEtherCount.text = "+" + info.RedEther; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignPanel.cs b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignPanel.cs new file mode 100644 index 0000000..1811736 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RedEtherCampaignPanel.cs @@ -0,0 +1,262 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class RedEtherCampaignPanel : MonoBehaviour +{ + private const float GAUGEUP_DELAY = 0.1f; + + private const float GAUGEUP_DURATION = 0.3f; + + private const int GAUGEUP_SE_CNT = 6; + + private const float FADE_TIME = 0.2f; + + [SerializeField] + public ParticleSystem _gaugeEffect; + + [SerializeField] + private ParticleSystem _lineEffect; + + [SerializeField] + private UIGauge _uIGauge; + + [SerializeField] + private UITexture _redEtherIcon; + + [SerializeField] + private UIButton _tocuhCollider; + + [SerializeField] + private UILabel _battleRewardLabel; + + [SerializeField] + private GameObject _missionEtherRoot; + + [SerializeField] + private GameObject _battleEtherRoot; + + [SerializeField] + private UILabel _battleWinPoint; + + [SerializeField] + private UILabel _battleWinTitle; + + [SerializeField] + private RedEtherCampaignMissionLabel _missionLabelOriginal; + + [SerializeField] + private GameObject[] _redEtherAtlasList; + + [SerializeField] + private UIPanel _panel; + + [SerializeField] + private UIGrid _missionTextGrid; + + private List _loadFileList = new List(); + + private RedEtherCampaignResultData _data; + + private List _clearMissionList = new List(); + + private bool _isTouchColliderClicked; + + private const float GAUGEUP_LABEL_DURATION = 0.5f; + + private const float GAUGEUP_LABEL_MOVE_DISTANCE = 50f; + + private const float WAIT_GAUGE_ANIMATION_AFTER = 1f; + + private Action OnFinish { get; set; } + + public bool IsAnimationComplete { get; private set; } + + public static void Create(GameObject parent, RedEtherCampaignResultData data, BattleResultUIController controller, Action onFinish) + { + controller.GreySpriteBGVisible = true; + NGUITools.AddChild(parent, Resources.Load("UI/layoutParts/Other/RedEtherCampaignPanel") as GameObject).GetComponent().Initialize(data, onFinish); + } + + public void Initialize(RedEtherCampaignResultData data, Action onFinish) + { + _panel.alpha = 0f; + _data = data; + _uIGauge.Value = data.BeforeGaugeValue; + OnFinish = onFinish; + UpdateGaugeAnimation(0f); + _missionEtherRoot.SetActive(value: false); + _battleEtherRoot.SetActive(value: false); + _battleWinPoint.text = "+" + data.BattleRewardEther; + _battleRewardLabel.text = data.BeforeDailyEther + "/" + data.MaxDailyEther; + foreach (RedEtherCampaignResultData.ClearMissionInfo clearMission in data.ClearMissionList) + { + RedEtherCampaignMissionLabel component = NGUITools.AddChild(_missionLabelOriginal.transform.parent.gameObject, _missionLabelOriginal.gameObject).GetComponent(); + component.Initialize(clearMission); + _clearMissionList.Add(component); + } + _battleWinTitle.text = Data.SystemText.Get("RedEther_0010", _data.CanGainBattleWin.ToString()); + _missionTextGrid.Reposition(); + StartCoroutine(LoadResources(delegate + { + TweenAlpha.Begin(_panel.gameObject, 0.2f, 1f); + UIManager.GetInstance().AddResidentAtlas(UIAtlasManager.AssetBundleNames.RedEtherCampaign); + List obj_list = new List(_redEtherAtlasList); + UIManager.GetInstance().AttachAtlas(obj_list); + _redEtherIcon.mainTexture = Toolbox.ResourcesManager.LoadObject(GetIconTextureName(isFetch: true)) as Texture; + _tocuhCollider.onClick.Add(new EventDelegate(delegate + { + OnClickTouchCollider(); + })); + StartCoroutine(AnimationCoroutine()); + StartCoroutine(MissionLabelAnimation()); + _lineEffect.gameObject.SetActive(value: true); + _lineEffect.Play(); + })); + } + + private void StartAnimation() + { + SetGaugeAniamtion(); + } + + private IEnumerator LoadResources(Action callBack) + { + List loadList = new List + { + GetIconTextureName(isFetch: false), + GetAtlasName(isFetch: false) + }; + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadList, null)); + _loadFileList.AddRange(loadList); + List list = new List(); + list.Add(_gaugeEffect.gameObject); + list.Add(_lineEffect.gameObject); + _loadFileList.AddRange(GameMgr.GetIns().GetEffectMgr().SetUIParticleShader(list, delegate + { + callBack.Call(); + })); + } + + private void OnDestroy() + { + UIManager.GetInstance().RemoveResidentAtlas(UIAtlasManager.AssetBundleNames.RedEtherCampaign); + Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList); + _loadFileList.Clear(); + } + + private string GetIconTextureName(bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath("icon_liquid_m", ResourcesManager.AssetLoadPathType.Item, isFetch); + } + + private string GetAtlasName(bool isFetch) + { + return UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.RedEtherCampaign, "", isFetch); + } + + private IEnumerator MissionLabelAnimation() + { + _battleEtherRoot.SetActive(_data.BattleRewardEther > 0); + foreach (RedEtherCampaignMissionLabel clearMission in _clearMissionList) + { + clearMission.gameObject.SetActive(value: true); + } + _missionTextGrid.Reposition(); + _battleEtherRoot.SetActive(value: false); + foreach (RedEtherCampaignMissionLabel clearMission2 in _clearMissionList) + { + clearMission2.gameObject.SetActive(value: false); + } + yield return new WaitForSeconds(0.5f); + if (_data.BattleRewardEther > 0) + { + _battleEtherRoot.SetActive(value: true); + TextAnimation(_battleWinTitle.gameObject); + TextAnimation(_battleWinPoint.gameObject); + } + foreach (RedEtherCampaignMissionLabel clearMission3 in _clearMissionList) + { + clearMission3.gameObject.SetActive(value: true); + TextAnimation(clearMission3._missionName.gameObject); + TextAnimation(clearMission3._redEtherCount.gameObject); + } + } + + private void TextAnimation(GameObject label) + { + label.SetActive(value: true); + TweenAlpha.Begin(label.gameObject, 0.5f, 1f); + iTween.MoveFrom(label, iTween.Hash("x", label.transform.localPosition.x - 50f, "time", 0.5f, "islocal", true, "easetype", iTween.EaseType.easeOutExpo)); + } + + private IEnumerator AnimationCoroutine() + { + yield return new WaitForSeconds(0.5f); + StartAnimation(); + yield return new WaitForSeconds(1.4f); + _isTouchColliderClicked = false; + while (!_isTouchColliderClicked) + { + yield return null; + } + FadeOutAnimation(0.2f); + yield return new WaitForSeconds(0.2f); + _lineEffect.gameObject.SetActive(value: false); + OnFinish.Call(); + } + + private void OnClickTouchCollider() + { + _isTouchColliderClicked = true; + } + + private void SetGaugeAniamtion() + { + _uIGauge.Value = _data.BeforeGaugeValue; + iTween.ValueTo(base.gameObject, iTween.Hash("from", 0f, "to", 1f, "time", 0.3f, "delay", 0.1f, "onstart", "StartGaugeAnimation", "onupdate", "UpdateGaugeAnimation", "oncomplete", "OnFinishGaugeAnimation", "easetype", iTween.EaseType.easeOutQuad)); + } + + private void StartGaugeAnimation() + { + PlayGaugeUpSE(); + _gaugeEffect.gameObject.SetActive(value: true); + _gaugeEffect.Play(); + } + + private void UpdateGaugeAnimation(float t) + { + _uIGauge.Value = Mathf.Lerp(_data.BeforeGaugeValue, _data.AfterGaugeValue, t); + int num = (int)Mathf.Lerp(_data.BeforeDailyEther, _data.AfterDailyEther, t); + _battleRewardLabel.text = num + "/" + _data.MaxDailyEther; + } + + private void OnFinishGaugeAnimation() + { + _gaugeEffect.Stop(); + } + + private void PlayGaugeUpSE() + { + StartCoroutine(GaugeUpSECoroutine()); + } + + private IEnumerator GaugeUpSECoroutine() + { + for (int i = 0; i < 6; i++) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_RESULT_GAUGEUP); + yield return new WaitForSeconds(0.05f); + } + } + + private void FadeOutAnimation(float fadeTime) + { + TweenAlpha.Begin(base.gameObject, 0f, 1f); + TweenAlpha.Begin(base.gameObject, fadeTime, 0f); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ReplayContentView.cs b/SVSim.BattleEngine/Engine/Wizard/ReplayContentView.cs new file mode 100644 index 0000000..10ae2f3 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ReplayContentView.cs @@ -0,0 +1,235 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ReplayContentView : MonoBehaviour +{ + [SerializeField] + private UITexture _emblemTexture; + + [SerializeField] + private UITexture _countoryTexture; + + [SerializeField] + private UILabel _nameLabel; + + [SerializeField] + private UILabel _descriptionLabel; + + [SerializeField] + private UILabel _classNameLabel; + + [SerializeField] + private UISprite _classIconSprite; + + [SerializeField] + private UISprite _subClassIconSprite; + + [SerializeField] + private UILabel _winLabel; + + [SerializeField] + private UILabel _loseLabel; + + [SerializeField] + private UISprite _formatIconSprite; + + [SerializeField] + private UILabel _formatLabel; + + [SerializeField] + private UILabel _oldReplayLabel; + + [SerializeField] + private UIGrid _abilityRoot; + + [SerializeField] + private UISprite _abilityIcon; + + private List _abilityIcons = new List(); + + private const float ABILITY_ORIGINAL_POS_X = -405.6f; + + private const int ABILITY_ICON_WIDTH = 25; + + private const int CLASS_LABEL_ORIGINAL_WIDTH = 237; + + private const int CLASS_LABEL_AND_ICON_GAP = 4; + + public void SetData(ReplayInfoItem item) + { + ClearTexture(); + SetOpponentPlayerInfo(item); + SetBattleInfo(item); + SetTexture(item); + } + + public void ClearTexture() + { + _emblemTexture.mainTexture = null; + _countoryTexture.mainTexture = null; + } + + public void SetOpponentPlayerInfo(ReplayInfoItem item) + { + _classIconSprite.spriteName = ClassCharaPrm.GetIconSpriteName((CardBasePrm.ClanType)item.OpponentClassId); + _nameLabel.text = item.OpponentName; + if (FormatBehaviorManager.GetDefaultBehaviour(item.BattleFormat).UseSubClass) + { + _classNameLabel.gameObject.SetActive(value: false); + _subClassIconSprite.gameObject.SetActive(value: true); + _subClassIconSprite.spriteName = ClassCharaPrm.GetIconSpriteName((CardBasePrm.ClanType)item.OpponentSubClassId); + _abilityRoot.gameObject.SetActive(value: false); + return; + } + _classNameLabel.gameObject.SetActive(value: true); + _subClassIconSprite.gameObject.SetActive(value: false); + _abilityIcon.gameObject.SetActive(value: false); + MyRotationInfo myRotationInfo = null; + if (!string.IsNullOrEmpty(item.OpponentRotationId)) + { + myRotationInfo = Data.MyRotationAllInfo.Get(item.OpponentRotationId); + } + _abilityRoot.gameObject.SetActive(myRotationInfo != null); + if (myRotationInfo != null) + { + _classNameLabel.text = DeckData.CreateMyRotationClassName(item.OpponentClassId, myRotationInfo); + _classNameLabel.width = 233 - myRotationInfo.Abilities.Count * 25; + _classNameLabel.InitializeFont(); + Vector3 localPosition = _abilityRoot.transform.localPosition; + localPosition.x = -401.6f + _classNameLabel.printedSize.x; + _abilityRoot.transform.localPosition = localPosition; + for (int i = 0; i < _abilityIcons.Count; i++) + { + _abilityIcons[i].gameObject.SetActive(value: false); + Object.Destroy(_abilityIcons[i].gameObject); + } + _abilityIcons.Clear(); + for (int j = 0; j < myRotationInfo.Abilities.Count; j++) + { + UISprite component = NGUITools.AddChild(_abilityRoot.gameObject, _abilityIcon.gameObject).GetComponent(); + component.spriteName = myRotationInfo.Abilities[j].IconName; + component.gameObject.SetActive(value: true); + _abilityIcons.Add(component); + } + _abilityRoot.Reposition(); + } + else if (item.BattleFormat == Format.Avatar) + { + ClassCharacterMasterData charaPrmByCharaId = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(item.OpponentCharaId); + _classNameLabel.text = charaPrmByCharaId.chara_name; + } + else + { + _classNameLabel.text = GameMgr.GetIns().GetDataMgr().GetClanNameByKey(item.OpponentClassId); + } + ClassCharaPrm.SetClassLabelSetting(_classNameLabel, (CardBasePrm.ClanType)item.OpponentClassId); + } + + public void SetBattleInfo(ReplayInfoItem item) + { + string battleTypeName = UIUtil.GetBattleTypeName(item.BattleParameter.BattleType); + string clanNameByKey = GameMgr.GetIns().GetDataMgr().GetClanNameByKey(item.ClassId); + string text = ConvertTime.ToLocal(item.BattleStartTime, ConvertTime.FORMAT.TIME_DATE_SHORT); + if (item.BattleFormat == Format.Avatar) + { + string chara_name = GameMgr.GetIns().GetDataMgr().GetCharaPrmByCharaId(item.CharaId) + .chara_name; + _descriptionLabel.text = Data.SystemText.Get("Dia_Replay_002", battleTypeName, chara_name, text); + } + else + { + _descriptionLabel.text = Data.SystemText.Get("Dia_Replay_002", battleTypeName, clanNameByKey, text); + } + _winLabel.gameObject.SetActive(item.IsWin); + _loseLabel.gameObject.SetActive(!item.IsWin); + if (item.BattleParameter.IsTwoPick || item.BattleParameter.IsSealed) + { + if (UIUtil.IsTwoPickForReplay(item.BattleParameter)) + { + _formatIconSprite.gameObject.SetActive(value: true); + _formatLabel.gameObject.SetActive(value: true); + _formatIconSprite.spriteName = "icon_2pick"; + _formatLabel.text = Data.SystemText.Get("Battle_0004"); + } + else if (item.BattleParameter.IsSealed) + { + _formatIconSprite.gameObject.SetActive(value: true); + _formatLabel.gameObject.SetActive(value: true); + _formatIconSprite.spriteName = "icon_sealed_s"; + _formatLabel.text = Data.SystemText.Get("BattleName_Sealed"); + } + else if (item.BattleParameter.TwoPickFormat == TwoPickFormat.Cube || item.BattleParameter.TwoPickFormat == TwoPickFormat.BackdraftCube) + { + if (Data.MyPageNotifications.data.RoomRule.ChallengePickFormat == TwoPickFormat.Cube) + { + _formatIconSprite.gameObject.SetActive(value: true); + _formatIconSprite.spriteName = "icon_2pick"; + } + else + { + _formatIconSprite.gameObject.SetActive(value: false); + } + _formatLabel.gameObject.SetActive(value: true); + _formatLabel.text = Data.SystemText.Get("RoomBattle_0113"); + } + else if (item.BattleParameter.TwoPickFormat == TwoPickFormat.Chaos || item.BattleParameter.TwoPickFormat == TwoPickFormat.BackdraftChaos) + { + if (Data.MyPageNotifications.data.RoomRule.ChallengePickFormat == TwoPickFormat.Chaos) + { + _formatIconSprite.gameObject.SetActive(value: true); + _formatIconSprite.spriteName = "icon_2pick"; + } + else + { + _formatIconSprite.gameObject.SetActive(value: false); + } + _formatLabel.gameObject.SetActive(value: true); + _formatLabel.text = Data.SystemText.Get("Chaos_FormatName"); + } + else + { + _formatIconSprite.gameObject.SetActive(value: false); + _formatLabel.gameObject.SetActive(value: false); + } + } + else if (item.BattleFormat == Format.Hof) + { + _formatIconSprite.gameObject.SetActive(value: false); + _formatLabel.gameObject.SetActive(value: true); + _formatLabel.text = Data.SystemText.Get("Colosseum_0108"); + } + else if (item.BattleFormat == Format.Windfall) + { + _formatIconSprite.gameObject.SetActive(value: false); + _formatLabel.gameObject.SetActive(value: true); + _formatLabel.text = Data.SystemText.Get("Colosseum_0115"); + } + else + { + _formatIconSprite.gameObject.SetActive(value: true); + _formatLabel.gameObject.SetActive(value: true); + _formatIconSprite.spriteName = FormatBehaviorManager.GetDefaultBehaviour(item.BattleFormat).SmallIconSpriteName; + _formatLabel.text = FormatBehaviorManager.GetFormatName(item.BattleFormat); + } + } + + public void SetTexture(ReplayInfoItem item) + { + string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentEmblemId, ResourcesManager.AssetLoadPathType.Emblem_S, isfetch: true); + _emblemTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath); + if (!string.IsNullOrEmpty(item.OpponentCountryCode)) + { + string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentCountryCode, ResourcesManager.AssetLoadPathType.Country_S, isfetch: true); + _countoryTexture.mainTexture = Toolbox.ResourcesManager.LoadObject(assetTypePath2); + } + } + + public void SetOldReplayLabel(bool isActive) + { + _oldReplayLabel.text = Data.SystemText.Get("Dia_Replay_003"); + _oldReplayLabel.gameObject.SetActive(isActive); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattle2PickDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattle2PickDoMatchingTask.cs new file mode 100644 index 0000000..3f23190 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattle2PickDoMatchingTask.cs @@ -0,0 +1,20 @@ +using Wizard.RoomMatch; + +namespace Wizard; + +public class RoomBattle2PickDoMatchingTask : RoomBattleDoMatchingTask +{ + public class RoomBattle2PickDoMatchingTaskParam : BaseParam + { + public int deck_no; + } + + public RoomBattle2PickDoMatchingTask(TwoPickFormat deckFormatType, RoomConnectController.BattleRule rule) + : base(isConvention: false, isGathering: false) + { + base.type = RoomTwoPickApiVariation.GetApiType(deckFormatType, rule, RoomTwoPickApiVariation.VariationType.DoMatching); + SkipCuteTimeOutPopup(); + SkipCuteHttpStatusErrorPopup(); + SkipAllCuteResultCodeCheckErrorPopup(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattle2PickFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattle2PickFinishTask.cs new file mode 100644 index 0000000..8f15ab8 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattle2PickFinishTask.cs @@ -0,0 +1,12 @@ +using Wizard.RoomMatch; + +namespace Wizard; + +public class RoomBattle2PickFinishTask : RoomBattleFinishTask +{ + public RoomBattle2PickFinishTask(TwoPickFormat deckFormatType, RoomConnectController.BattleRule rule) + : base(isConvention: false, isGathering: false) + { + base.type = RoomTwoPickApiVariation.GetApiType(deckFormatType, rule, RoomTwoPickApiVariation.VariationType.Finish); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTask.cs new file mode 100644 index 0000000..c4918f1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTask.cs @@ -0,0 +1,49 @@ +using LitJson; + +namespace Wizard; + +public class RoomBattleDoMatchingTask : DoMatchingBase +{ + public RoomBattleDoMatchingTask(bool isConvention, bool isGathering) + { + if (isConvention) + { + base.type = ApiType.Type.EventRoomBattleBattleDoMatching; + } + else if (isGathering) + { + base.type = ApiType.Type.GatheringRoomBattleDoMatching; + } + else + { + base.type = ApiType.Type.OpenRoomBattleBattleDoMatching; + } + SkipCuteTimeOutPopup(); + SkipCuteHttpStatusErrorPopup(); + SkipAllCuteResultCodeCheckErrorPopup(); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.RoomBattleMatching.data = new RoomBattleMatchingDetail(); + Data.RoomBattleMatching.data.battle_state = 0; + Data.RoomBattleMatching.data.matching_state = 0; + JsonData jsonData = base.ResponseData["data"]; + Data.RoomBattleMatching.data.matching_state = jsonData["matching_state"].ToInt(); + if (jsonData.Keys.Contains("battle_state")) + { + Data.RoomBattleMatching.data.battle_state = jsonData["battle_state"].ToInt(); + } + if (jsonData.TryGetValue("battle_id", out var value)) + { + Data.LastRoomBattleId = value.ToString(); + } + Data.RoomBattleMatching.data.battleId = Data.LastRoomBattleId; + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskAvatar.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskAvatar.cs new file mode 100644 index 0000000..270e319 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskAvatar.cs @@ -0,0 +1,17 @@ +namespace Wizard; + +public class RoomBattleDoMatchingTaskAvatar : RoomBattleDoMatchingTask +{ + public RoomBattleDoMatchingTaskAvatar(bool isGathering) + : base(isConvention: false, isGathering: false) + { + if (isGathering) + { + base.type = ApiType.Type.GatheringRoomBattleDoMatching; + } + else + { + base.type = ApiType.Type.OpenRoomBattleDoMatchingAvatar; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskHOF.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskHOF.cs new file mode 100644 index 0000000..3cdb389 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskHOF.cs @@ -0,0 +1,10 @@ +namespace Wizard; + +public class RoomBattleDoMatchingTaskHOF : RoomBattleDoMatchingTask +{ + public RoomBattleDoMatchingTaskHOF() + : base(isConvention: false, isGathering: false) + { + base.type = ApiType.Type.OpenRoomBattleBattleDoMatchingHOF; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskWindFall.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskWindFall.cs new file mode 100644 index 0000000..737fe89 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleDoMatchingTaskWindFall.cs @@ -0,0 +1,10 @@ +namespace Wizard; + +public class RoomBattleDoMatchingTaskWindFall : RoomBattleDoMatchingTask +{ + public RoomBattleDoMatchingTaskWindFall() + : base(isConvention: false, isGathering: false) + { + base.type = ApiType.Type.OpenRoomBattleBattleDoMatchingWindFall; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTask.cs new file mode 100644 index 0000000..bbc2591 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTask.cs @@ -0,0 +1,38 @@ +namespace Wizard; + +public class RoomBattleFinishTask : FinishTaskBase +{ + public RoomBattleFinishTask(bool isConvention, bool isGathering) + { + if (isConvention) + { + base.type = ApiType.Type.EventRoomMatchFinish; + } + else if (isGathering) + { + base.type = ApiType.Type.GatheringRoomBattleFinish; + } + else + { + base.type = ApiType.Type.OpenRoomMatchFinish; + } + } + + protected override int Parse() + { + int num = base.Parse(); + if (IsEffectiveErrorCode(num)) + { + return num; + } + if (!IsResponseDataExist(base.ResponseData)) + { + return num; + } + Data.RoomMatchFinish.data = new RoomMatchFinishDetail(); + Data.RoomMatchFinish.data.class_chara_experience = 0; + Data.RoomMatchFinish.data.class_chara_level = 0; + new BattleFinishResponsProcessing().Processing(base.ResponseData, Data.RoomMatchFinish.data); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskAvatar.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskAvatar.cs new file mode 100644 index 0000000..bb79280 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskAvatar.cs @@ -0,0 +1,17 @@ +namespace Wizard; + +public class RoomBattleFinishTaskAvatar : RoomBattleFinishTask +{ + public RoomBattleFinishTaskAvatar(bool isGathering) + : base(isConvention: false, isGathering: false) + { + if (isGathering) + { + base.type = ApiType.Type.GatheringRoomBattleFinish; + } + else + { + base.type = ApiType.Type.OpenRoomMatchFinishAvatar; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskHOF.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskHOF.cs new file mode 100644 index 0000000..b44d24b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskHOF.cs @@ -0,0 +1,10 @@ +namespace Wizard; + +public class RoomBattleFinishTaskHOF : RoomBattleFinishTask +{ + public RoomBattleFinishTaskHOF() + : base(isConvention: false, isGathering: false) + { + base.type = ApiType.Type.OpenRoomMatchFinishHof; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskWindFall.cs b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskWindFall.cs new file mode 100644 index 0000000..0e7ac28 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RoomBattleFinishTaskWindFall.cs @@ -0,0 +1,10 @@ +namespace Wizard; + +public class RoomBattleFinishTaskWindFall : RoomBattleFinishTask +{ + public RoomBattleFinishTaskWindFall() + : base(isConvention: false, isGathering: false) + { + base.type = ApiType.Type.OpenRoomMatchFinishWindFall; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/RotationFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/RotationFormatBehavior.cs new file mode 100644 index 0000000..def90bd --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/RotationFormatBehavior.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class RotationFormatBehavior : IFormatBehavior +{ + public string Name => Data.SystemText.Get("Common_0154"); + + public string SmallIconSpriteName => "icon_timesliprotation_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => false; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => (from id in Data.Load.data.RotationCardSetList.Distinct() + select Data.Master.CardSetNameMgr.Get(id.ToString())).ToList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsConventionMode => false; + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ScenarioPart.cs b/SVSim.BattleEngine/Engine/Wizard/ScenarioPart.cs new file mode 100644 index 0000000..7e3d11b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ScenarioPart.cs @@ -0,0 +1,8 @@ +namespace Wizard; + +public enum ScenarioPart +{ + None, + FirstHalf, + SecondHalf +} diff --git a/SVSim.BattleEngine/Engine/Wizard/ScenarioSummary.cs b/SVSim.BattleEngine/Engine/Wizard/ScenarioSummary.cs new file mode 100644 index 0000000..d4643eb --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/ScenarioSummary.cs @@ -0,0 +1,97 @@ +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class ScenarioSummary +{ + public class Data + { + public string Title { get; } + + public string PastSummary { get; } + + public string BeforeSummary { get; } + + public string AfterSummary { get; } + + public Data() + { + } + + public Data(string title, string pastSummary, string beforeSummary, string afterSummary) + { + Title = title; + PastSummary = pastSummary; + BeforeSummary = beforeSummary; + AfterSummary = afterSummary; + } + } + + private const string FILE_NAME_PREFIX = "scenario_text_summary_"; + + private static readonly int CLASS_NONE; + + private Dictionary _dataTable = new Dictionary(); + + private string _loadedAsset; + + public bool IsValid { get; private set; } + + public ScenarioSummary(int sectionId, int? sectionClassId) + { + ScenarioSummary scenarioSummary = this; + IsValid = false; + int processedClassId = (sectionClassId.HasValue ? sectionClassId.Value : CLASS_NONE); + ResourcesManager resMgr = Toolbox.ResourcesManager; + string fileName = "scenario_text_summary_" + sectionId; + _loadedAsset = resMgr.GetAssetTypePath(fileName, ResourcesManager.AssetLoadPathType.StoryText); + resMgr.StartCoroutine_LoadAssetGroupAsync(_loadedAsset, delegate + { + foreach (ArrayList item in Utility.ConvertCSV((resMgr.LoadObject(resMgr.GetAssetTypePath(fileName, ResourcesManager.AssetLoadPathType.StoryText, isfetch: true)) as TextAsset).ToString())) + { + string[] array = (string[])item.ToArray(typeof(string)); + int num = -1; + if (int.Parse(array[++num]) == processedClassId) + { + string chapterId = array[++num]; + string text = array[++num]; + int? subChapterId = (string.IsNullOrEmpty(text) ? ((int?)null) : new int?(int.Parse(text))); + string key = CreateKey(chapterId, subChapterId); + Data value = new Data(array[++num], array[++num], array[++num], array[++num]); + scenarioSummary._dataTable.Add(key, value); + } + } + scenarioSummary.IsValid = true; + }); + } + + public void Dispose() + { + Toolbox.ResourcesManager.RemoveAsset(_loadedAsset); + _loadedAsset = null; + _dataTable.Clear(); + } + + public Data GetData(string chapterId, int? subChapterId = null) + { + string key = CreateKey(chapterId, subChapterId); + if (_dataTable.TryGetValue(key, out var value)) + { + return value; + } + Debug.LogError("チャプター 「" + chapterId + "」 の ScenarioSummary のデータが見つかりませんでした。"); + return new Data(); + } + + private static string CreateKey(string chapterId, int? subChapterId) + { + if (!subChapterId.HasValue || subChapterId == StoryChapterData.SUB_CHAPTER_ALL) + { + return chapterId; + } + return $"{chapterId}_{subChapterId}"; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedBattleDoMatchingTask.cs b/SVSim.BattleEngine/Engine/Wizard/SealedBattleDoMatchingTask.cs new file mode 100644 index 0000000..e1ccc75 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedBattleDoMatchingTask.cs @@ -0,0 +1,21 @@ +namespace Wizard; + +public class SealedBattleDoMatchingTask : DoMatchingBase +{ + public SealedBattleDoMatchingTask(int deckNo, int needInit, int log) + { + base.type = ApiType.Type.ArenaSealedBattleDoMatching; + base.SetParameter(deckNo, needInit, log); + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + SettingDoMatchingData(); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedBattleFinishTask.cs b/SVSim.BattleEngine/Engine/Wizard/SealedBattleFinishTask.cs new file mode 100644 index 0000000..eb50ba9 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedBattleFinishTask.cs @@ -0,0 +1,28 @@ +using Wizard.Scripts.Network.Data.TaskData.Arena; + +namespace Wizard; + +public class SealedBattleFinishTask : FinishTaskBase +{ + public SealedBattleFinishTask() + { + base.type = ApiType.Type.ArenaSealedBattleFinish; + Data.ArenaBattleFinish = null; + } + + protected override int Parse() + { + int num = base.Parse(); + if (IsEffectiveErrorCode(num)) + { + return num; + } + Finish finish = (Data.ArenaBattleFinish = new Finish()); + if (!IsResponseDataExist(base.ResponseData)) + { + return num; + } + new BattleFinishResponsProcessing().Processing(base.ResponseData, finish.data); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedClassSelect.cs b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelect.cs new file mode 100644 index 0000000..08f9c4e --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelect.cs @@ -0,0 +1,212 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class SealedClassSelect : MonoBehaviour +{ + [SerializeField] + private UIGrid _classObjectsGrid; + + [SerializeField] + private SealedClassSelectObject _classObjectOriginal; + + [SerializeField] + private GameObject _effectsRoot; + + [SerializeField] + private GameObject _cardDetailRoot; + + [SerializeField] + private SealedClassSelectConfirmDialog _classSelectConfirmDialogPrefab; + + private readonly List _unloadAssetList = new List(); + + private readonly Dictionary> _cardObjectsDic = new Dictionary>(); + + private const float CARD_SCALE = 0.64f; + + private const float CARD_COLLIDER_SCALE = 0.85f; + + private const int CARD_DEPTH_ADD_VALUE = 5; + + private CardDetailUI _cardDetailDialog; + + private List _cardDetailCardObjectList; + + private int _cardDetailCardIndex; + + public bool IsReady { get; private set; } + + private SealedData SealedData => Data.ArenaData.SealedData; + + public void Init() + { + StartCoroutine(InitCoroutine()); + } + + private IEnumerator InitCoroutine() + { + yield return StartCoroutine(CreateCardObjectsCoroutine()); + List loadRequestList = CreateClassSelectObjects(); + List loadAssetList = loadRequestList.SelectMany((SealedClassSelectLoadRequest x) => x.LoadAssetList).ToList(); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadAssetList, delegate + { + _unloadAssetList.AddRange(loadAssetList); + loadRequestList.ForEach(delegate(SealedClassSelectLoadRequest x) + { + x.LoadEndCallback(); + }); + })); + IsReady = true; + } + + public void Final() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_unloadAssetList); + _unloadAssetList.Clear(); + } + + private List CreateClassSelectObjects() + { + List list = new List(); + foreach (SealedClassInfo classInfo in SealedData.ClassInfoList) + { + SealedClassSelectObject component = NGUITools.AddChild(_classObjectsGrid.gameObject, _classObjectOriginal.gameObject).GetComponent(); + int classId = classInfo.ClassId; + SealedClassSelectObjectInitParam initParam = new SealedClassSelectObjectInitParam + { + CharaParam = GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(classId), + CardObjectList = _cardObjectsDic[classId], + SelectButtonClickCallback = delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OnSelectClass(classId); + }, + EffectRoot = _effectsRoot, + UnloadAssetList = _unloadAssetList + }; + list.Add(component.Init(initParam)); + } + _classObjectsGrid.Reposition(); + return list; + } + + private IEnumerator CreateCardObjectsCoroutine() + { + List cardNums = (from x in SealedData.ClassInfoList.SelectMany((SealedClassInfo x) => x.PublishedCardInfoList) + select x.SealedCardId).ToList(); + UIManager uiMgr = UIManager.GetInstance(); + bool isLoaded = false; + uiMgr.CardLoadSelect(null, cardNums, base.gameObject.layer, is2D: true, delegate + { + isLoaded = true; + }); + while (!isLoaded) + { + yield return null; + } + List cardList2DObjs = uiMgr.getCardList2DObjs(); + List list = new List(cardList2DObjs); + cardList2DObjs.Clear(); + List cardListAssetPathList = Toolbox.ResourcesManager.CardListAssetPathList; + _unloadAssetList.AddRange(new List(cardListAssetPathList)); + cardListAssetPathList.Clear(); + _cardDetailDialog = DialogCreator.CreateCardDetailDialog(_cardDetailRoot, "Detail"); + _cardDetailDialog.ChangeCardMaster(FormatBehaviorManager.GetDefaultBehaviour(Format.Sealed).CardMasterId); + _cardDetailDialog.gameObject.SetActive(value: false); + _cardDetailDialog.OnDragCard = CardDetailDragCallback; + _cardDetailDialog.OnDetailCardUpdate = UpdateCardDetailArrowButtonVisible; + int num = 0; + foreach (SealedClassInfo classInfo in SealedData.ClassInfoList) + { + List list2 = new List(); + _cardObjectsDic.Add(classInfo.ClassId, list2); + for (int num2 = 0; num2 < classInfo.PublishedCardInfoList.Count; num2++) + { + GameObject cardObject = list[num++].CardObj; + CardListTemplate component = cardObject.GetComponent(); + list2.Add(component); + component.SetId(classInfo.PublishedCardInfoList[num2].SealedCardId); + component.SetScale(0.64f); + component.AddDepth(5); + component.HideNum(); + int tempIndex = num2; + component.AddColliderToFrame(0.85f).onClick = delegate + { + _cardDetailCardObjectList = list2; + _cardDetailCardIndex = tempIndex; + _cardDetailDialog.OnPushCardDetailOn(cardObject); + }; + } + } + } + + private void OnSelectClass(int classId) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OpenClassSelectConfirmDialog(classId); + } + + private void OpenClassSelectConfirmDialog(int classId) + { + Action decideClassFunc = delegate(Action gotoNextScene) + { + SealedData.UnregisterAllSealedCard(); + StartCoroutine(Toolbox.NetworkManager.Connect(new SealedSelectClassTask(classId), delegate + { + gotoNextScene(); + })); + }; + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(systemText.Get("Sealed_ClassSelect_0002")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn_CancelBtn_BlueBtn); + dialogBase.SetButtonText(systemText.Get("Sealed_ClassSelect_0006"), null, systemText.Get("Common_0003")); + dialogBase.onPushButton1 = delegate + { + decideClassFunc(SealedController.GoToSealedDeckEdit); + }; + dialogBase.onPushButton3 = delegate + { + decideClassFunc(SealedController.GoToSealedCardPackOpen); + }; + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + dialogBase.ClickSe_Btn3 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + SealedClassSelectConfirmDialog component = UnityEngine.Object.Instantiate(_classSelectConfirmDialogPrefab.gameObject).GetComponent(); + component.Init(classId, SealedData.ClassInfoList.Find((SealedClassInfo x) => x.ClassId == classId).PublishedCardInfoList.Select((SealedCardInfo x) => x.SealedCardId).ToList()); + dialogBase.SetObj(component.gameObject); + } + + private void CardDetailDragCallback(Vector2 vec) + { + if (!_cardDetailDialog.IsEnableShowDetail) + { + return; + } + float x = vec.x; + if (!(Mathf.Abs(x) < 70f)) + { + int num = _cardDetailCardIndex + ((!(x > 0f)) ? 1 : (-1)); + if (num >= 0 && _cardDetailCardObjectList.Count > num) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_SLIDE_BTN); + _cardDetailDialog.CloseDefault(playSe: false); + _cardDetailDialog.ShowCardDetail(_cardDetailCardObjectList[num].gameObject); + _cardDetailCardIndex = num; + UpdateCardDetailArrowButtonVisible(); + } + } + } + + private void UpdateCardDetailArrowButtonVisible() + { + _cardDetailDialog.LeftButtonVisible = _cardDetailCardIndex != 0; + _cardDetailDialog.RightButtonVisible = _cardDetailCardIndex != _cardDetailCardObjectList.Count - 1; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectConfirmDialog.cs new file mode 100644 index 0000000..6a6a481 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectConfirmDialog.cs @@ -0,0 +1,46 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class SealedClassSelectConfirmDialog : MonoBehaviour +{ + [SerializeField] + private ClassInfoParts _classInfoParts; + + [SerializeField] + private UILabel _cardListLabel; + + [SerializeField] + private UIToggle _cardAutoOpenToggleButton; + + private bool isFirstToggleChange = true; + + public void Init(int classId, List cardList) + { + _classInfoParts.InitByCharaPrm(GameMgr.GetIns().GetDataMgr().GetCharaPrmByClassId(classId)); + _cardListLabel.text = string.Empty; + for (int i = 0; i < cardList.Count; i++) + { + if (i != 0) + { + _cardListLabel.text += "\n"; + } + _cardListLabel.text += CardMaster.GetInstance(FormatBehaviorManager.GetDefaultBehaviour(Format.Sealed).CardMasterId).GetCardParameterFromId(cardList[i]).CardName; + } + _cardAutoOpenToggleButton.value = PlayerPrefsWrapper.GetValue(PlayerPrefsWrapper.CARDPACK_CARD_AUTO_OPEN); + EventDelegate.Add(_cardAutoOpenToggleButton.onChange, OnChangeCardAutoOpenToggleButton); + } + + private void OnChangeCardAutoOpenToggleButton() + { + if (isFirstToggleChange) + { + isFirstToggleChange = false; + return; + } + bool value = _cardAutoOpenToggleButton.value; + GameMgr.GetIns().GetSoundMgr().PlaySe(value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + PlayerPrefsWrapper.SetValue(PlayerPrefsWrapper.CARDPACK_CARD_AUTO_OPEN, value); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectLoadRequest.cs b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectLoadRequest.cs new file mode 100644 index 0000000..e4b72dc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectLoadRequest.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +namespace Wizard; + +public class SealedClassSelectLoadRequest +{ + public List LoadAssetList { get; private set; } = new List(); + + public Action LoadEndCallback { get; set; } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectObject.cs b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectObject.cs new file mode 100644 index 0000000..fd43189 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectObject.cs @@ -0,0 +1,112 @@ +using System.Collections; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class SealedClassSelectObject : MonoBehaviour +{ + [SerializeField] + private ClassInfoParts _classInfoParts; + + [SerializeField] + private UITexture _charaTexture; + + [SerializeField] + private UIGrid _cardObjectsGrid; + + [SerializeField] + private UIButton _selectButton; + + [SerializeField] + private UITexture _effectMask; + + private const ResourcesManager.AssetLoadPathType CHARA_TEX_LOAD_TYPE = ResourcesManager.AssetLoadPathType.ClassCharaBase; + + private const int EFFECT_SORTING_ORDER = 2; + + private readonly eColorCodeId[] EFFECT_COLORCODEID_TABLE = new eColorCodeId[9] + { + eColorCodeId.MAX, + eColorCodeId.SEALED_CLASS_ELF_EFFECT_COLOR, + eColorCodeId.SEALED_CLASS_ROYAL_EFFECT_COLOR, + eColorCodeId.SEALED_CLASS_WITCH_EFFECT_COLOR, + eColorCodeId.SEALED_CLASS_DRAGON_EFFECT_COLOR, + eColorCodeId.SEALED_CLASS_NECRO_EFFECT_COLOR, + eColorCodeId.SEALED_CLASS_VAMPIRE_EFFECT_COLOR, + eColorCodeId.SEALED_CLASS_BISHOP_EFFECT_COLOR, + eColorCodeId.SEALED_CLASS_NEMESIS_EFFECT_COLOR + }; + + private GameObject _effect; + + public SealedClassSelectLoadRequest Init(SealedClassSelectObjectInitParam initParam) + { + _classInfoParts.InitByCharaPrm(initParam.CharaParam); + foreach (CardListTemplate cardObject in initParam.CardObjectList) + { + cardObject.SetParentAndResetPos(_cardObjectsGrid.transform); + } + _cardObjectsGrid.Reposition(); + UIEventListener.Get(_selectButton.gameObject).onClick = delegate + { + initParam.SelectButtonClickCallback(); + }; + int class_id = initParam.CharaParam.class_id; + CreateEffect(initParam, class_id); + InitEffectMask(class_id); + return CreateLoadRequest(initParam); + } + + private SealedClassSelectLoadRequest CreateLoadRequest(SealedClassSelectObjectInitParam initParam) + { + SealedClassSelectLoadRequest sealedClassSelectLoadRequest = new SealedClassSelectLoadRequest(); + ResourcesManager resMgr = Toolbox.ResourcesManager; + string strSkinId = initParam.CharaParam.skin_id.ToString(); + sealedClassSelectLoadRequest.LoadAssetList.Add(resMgr.GetAssetTypePath(strSkinId, ResourcesManager.AssetLoadPathType.ClassCharaBase)); + sealedClassSelectLoadRequest.LoadEndCallback = delegate + { + _charaTexture.mainTexture = resMgr.LoadObject(resMgr.GetAssetTypePath(strSkinId, ResourcesManager.AssetLoadPathType.ClassCharaBase, isfetch: true)); + _effect.transform.position = base.transform.position; + }; + return sealedClassSelectLoadRequest; + } + + private void CreateEffect(SealedClassSelectObjectInitParam initParam, int stencil) + { + StartCoroutine(CreateEffectCoroutine(initParam, stencil)); + } + + private IEnumerator CreateEffectCoroutine(SealedClassSelectObjectInitParam initParam, int stencil) + { + bool isEndMaterialSet = false; + _effect = EffectUtility.CreateEffect2D(new Effect2dCreateParam + { + Parent = initParam.EffectRoot, + EffectName = "cmn_sealed_class_1", + ColorCode = EFFECT_COLORCODEID_TABLE[initParam.CharaParam.class_id], + InitActive = true, + MaterialSetEndCallback = delegate + { + isEndMaterialSet = true; + }, + UnloadAssetList = initParam.UnloadAssetList + }); + while (!isEndMaterialSet) + { + yield return null; + } + ParticleSystemRenderer[] componentsInChildren = _effect.GetComponentsInChildren(); + foreach (ParticleSystemRenderer obj in componentsInChildren) + { + obj.sortingOrder = 2; + obj.material = new Material(obj.material); + } + GameMgr.GetIns().GetEffectMgr().ChangeMaskShader(_effect.gameObject, stencil); + } + + private void InitEffectMask(int stencil) + { + _effectMask.material = MaterialDefine.CreateNguiStencilMaskMaterial(stencil); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectObjectInitParam.cs b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectObjectInitParam.cs new file mode 100644 index 0000000..1ac5112 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedClassSelectObjectInitParam.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace Wizard; + +public class SealedClassSelectObjectInitParam +{ + public ClassCharacterMasterData CharaParam { get; set; } + + public List CardObjectList { get; set; } + + public Action SelectButtonClickCallback { get; set; } + + public GameObject EffectRoot { get; set; } + + public List UnloadAssetList { get; set; } + + public bool IsValid + { + get + { + if (CharaParam != null && CardObjectList != null && SelectButtonClickCallback != null && EffectRoot != null) + { + return UnloadAssetList != null; + } + return false; + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedController.cs b/SVSim.BattleEngine/Engine/Wizard/SealedController.cs new file mode 100644 index 0000000..c6ffd0f --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedController.cs @@ -0,0 +1,227 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class SealedController : UIBase +{ + private enum eStep + { + None, + ClassSelect, + Lobby, + Max + } + + [SerializeField] + private UISprite _bgMask; + + [SerializeField] + private SealedClassSelect _classSelectPrefab; + + [SerializeField] + private SealedLobby _lobbyPrefab; + + private static bool _isKeepDataAndAsset; + + private static List _unloadResidentAssetList; + + private SealedStepFuncs[] _stepFuncsTable; + + private eStep _nowStep; + + private SealedClassSelect _classSelect; + + private SealedLobby _lobby; + + private SealedData SealedData => Data.ArenaData.SealedData; + + private SealedStepFuncs NowStepFuncs => _stepFuncsTable[(int)_nowStep]; + + public static void OnSoftwareReset() + { + _isKeepDataAndAsset = false; + _unloadResidentAssetList = null; + } + + public override void onFirstStart() + { + _stepFuncsTable = new SealedStepFuncs[3] + { + new SealedStepFuncs(InitNone, FinalNone), + new SealedStepFuncs(InitClassSelect, FinalClassSelect), + new SealedStepFuncs(InitLobby, FinalLobby) + }; + UIManager.GetInstance().CreateTopBar(base.gameObject, Data.SystemText.Get("Sealed_0001"), UIManager.ViewScene.MyPage, MoneyDraw: false, new UIManager.ChangeViewSceneParam + { + MyPageMenuIndex = 3, + IsCutCardMotion = true, + OnFinishChangeView = delegate + { + MyPageMenu.Instance.GoToChallengeMenu(); + } + }); + _bgMask.gameObject.SetActive(value: false); + base.onFirstStart(); + } + + protected override void onOpen() + { + StartCoroutine(OpenCoroutine()); + } + + private IEnumerator OpenCoroutine() + { + base.onOpen(); + UIManager.GetInstance().UpdateFooterMenuTexture(UIManager.ViewScene.Sealed); + if (!_isKeepDataAndAsset) + { + if (!SealedData.EntryId.HasValue) + { + SealedTopTask task = new SealedTopTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task)); + while (!task.IsResultSuccess) + { + yield return null; + } + } + yield return StartCoroutine(LoadResidentAssetCoroutine()); + } + else + { + _isKeepDataAndAsset = false; + } + ChangeStep((!SealedData.IsSelectedClass) ? eStep.ClassSelect : eStep.Lobby, delegate + { + UIManager.GetInstance().OnReadyViewScene(isFadein: true); + }); + } + + protected override void onClose() + { + NowStepFuncs.FinalFunc(); + if (!_isKeepDataAndAsset) + { + RemoveDataAndAsset(); + } + base.onClose(); + } + + public static void RemoveDataAndAsset() + { + _isKeepDataAndAsset = false; + Data.ArenaData.SealedData.UnregisterAllSealedCard(); + Data.ArenaData.ClearSealedData(); + UnloadResidentAssetCoroutine(); + } + + private static IEnumerator LoadResidentAssetCoroutine() + { + UIManager uiMgr = UIManager.GetInstance(); + ResourcesManager resourcesManager = Toolbox.ResourcesManager; + List residentAssetList = new List(); + residentAssetList.Add(uiMgr.GetSceneAssetPath(UIAtlasManager.AssetBundleNames.CardFramePhantom)); + residentAssetList.AddRange(_3dCardFrameManager.GetLoadAssetList(_3dCardFrameManager.eFrameKind.Phantom)); + residentAssetList.Add(resourcesManager.GetAssetTypePath("cmn_sealed_class_1", ResourcesManager.AssetLoadPathType.Effect2D)); + yield return uiMgr.StartCoroutine(resourcesManager.LoadAssetGroupAsync(residentAssetList, delegate + { + _unloadResidentAssetList = residentAssetList; + uiMgr.AddResidentAtlas(UIAtlasManager.AssetBundleNames.CardFramePhantom); + uiMgr.getUIBase_CardManager()._3dCardFrameManager.InitFrameMaterials(_3dCardFrameManager.eFrameKind.Phantom); + })); + } + + private static void UnloadResidentAssetCoroutine() + { + if (_unloadResidentAssetList != null) + { + UIManager instance = UIManager.GetInstance(); + instance.RemoveResidentAtlas(UIAtlasManager.AssetBundleNames.CardFramePhantom); + instance.getUIBase_CardManager()._3dCardFrameManager.ClearFrameMaterials(_3dCardFrameManager.eFrameKind.Phantom); + Toolbox.ResourcesManager.RemoveAssetGroup(_unloadResidentAssetList); + _unloadResidentAssetList = null; + } + } + + private void ChangeStep(eStep step, Action initFinishCallback = null) + { + StartCoroutine(ChangeStepCoroutine(step, initFinishCallback)); + } + + private IEnumerator ChangeStepCoroutine(eStep step, Action initFinishCallback) + { + NowStepFuncs.FinalFunc(); + _nowStep = step; + yield return StartCoroutine(NowStepFuncs.InitFunc()); + initFinishCallback.Call(); + } + + private IEnumerator InitNone() + { + yield return null; + } + + private void FinalNone() + { + } + + private IEnumerator InitClassSelect() + { + UIManager.GetInstance().ShowFooterMenu(isShow: false); + _bgMask.gameObject.SetActive(value: true); + _classSelect = NGUITools.AddChild(base.gameObject, _classSelectPrefab.gameObject).GetComponent(); + _classSelect.Init(); + while (!_classSelect.IsReady) + { + yield return null; + } + } + + private void FinalClassSelect() + { + _bgMask.gameObject.SetActive(value: false); + _classSelect.Final(); + UnityEngine.Object.Destroy(_classSelect.gameObject); + } + + private IEnumerator InitLobby() + { + UIManager.GetInstance().ShowFooterMenu(isShow: true); + SealedData.ClearGachaCardInfo(); + SealedData.ClearGachaSupplyInfo(); + SealedGetMaintCardListTask task = new SealedGetMaintCardListTask(); + StartCoroutine(Toolbox.NetworkManager.Connect(task)); + while (!task.IsResultSuccess) + { + yield return null; + } + _lobby = NGUITools.AddChild(base.gameObject, _lobbyPrefab.gameObject).GetComponent(); + _lobby.Init(); + while (!_lobby.IsReady) + { + yield return null; + } + yield return null; + } + + private void FinalLobby() + { + _lobby.Final(); + UnityEngine.Object.Destroy(_lobby.gameObject); + } + + public static void GoToSealedCardPackOpen() + { + _isKeepDataAndAsset = true; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.SealedCardPackOpen); + } + + public static void GoToSealedDeckEdit() + { + _isKeepDataAndAsset = true; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.SealedDeckEdit); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedEntryData.cs b/SVSim.BattleEngine/Engine/Wizard/SealedEntryData.cs new file mode 100644 index 0000000..c4a9369 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedEntryData.cs @@ -0,0 +1,15 @@ +using LitJson; + +namespace Wizard; + +public class SealedEntryData : ArenaEntryDataBase +{ + public SealedEntryData(JsonData rootData) + { + isJoin = rootData["is_join"].ToInt() == 1; + crystalCost = rootData["crystal_cost"].ToInt(); + rupyCost = rootData["rupy_cost"].ToInt(); + ticketCost = rootData["ticket_cost"].ToInt(); + base.LootBoxType = PlayerStaticData.LootBoxType.SEALED; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/SealedFormatBehavior.cs new file mode 100644 index 0000000..c66b737 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedFormatBehavior.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cute; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class SealedFormatBehavior : IFormatBehavior +{ + public string Name => string.Empty; + + public string SmallIconSpriteName => "icon_sealed_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.SEALED; + + public bool ExistsRestrictedCard => false; + + public List SortedDeckUsableCardList => SealedData.SortedOwnSealedCardList.Distinct().ToList(); + + public int DeckCardNumMin => Data.ArenaData.SealedMyPageResponseData.DeckCardNumMin; + + public int DeckCardNumMax => SealedData.DeckCardNumMax.Value; + + public int DeckSameKindCardNumMax => DeckCardNumMax; + + public int DeckSavableCardNumMax => DeckCardNumMax; + + public bool IsShowDeckName => false; + + public bool IsEmphasizeDeckCardShortage => true; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => false; + + public bool CanShowQRCode => false; + + public bool IsShowFirstTipsAtDeckEdit => false; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => false; + + public bool IsCraftableCardAtDeckEdit => false; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.Sealed; + + public Action DeckSaveFunc => SaveDeck; + + public bool UseSubClass => false; + + public List AvailableCardSetNameList => (from x in Data.ArenaData.SealedMyPageResponseData.CardPackIdList.Distinct().Select(Data.Master.CardSetNameMgr.Get) + orderby x.ID + select x).ToList(); + + public bool IsShowPrizeCardSetFilter => false; + + public bool IsShowPhantomCardSetFilter => true; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => false; + + public bool IsShowSpotCardFilter => false; + + public bool IsConventionMode => false; + + private SealedData SealedData => Data.ArenaData.SealedData; + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + if (DeckCardNumMin <= cardNum) + { + return cardNum <= DeckCardNumMax; + } + return false; + } + + private void SaveDeck(CardBundleController deckCardBundle) + { + List cardList = deckCardBundle.SelectionAreaList.IdList; + int count = cardList.Count; + UIManager uiMgr = UIManager.GetInstance(); + SystemText text = Data.SystemText; + Action action = delegate + { + uiMgr.StartCoroutine(Toolbox.NetworkManager.Connect(new SealedUpdateDeckTask(cardList), delegate + { + UIManager.GetInstance().CreateConfirmationDialog(text.Get("Card_0019")).OnCloseStart = delegate + { + uiMgr.ChangeViewScene(UIManager.ViewScene.Sealed); + }; + })); + }; + if (count < DeckCardNumMin) + { + DialogBase dialogBase = uiMgr.CreateDialogClose(); + dialogBase.SetTitleLabel(text.Get("Dia_DeckEdit_005_Title")); + dialogBase.SetText(text.Get("Card_0050", DeckCardNumMin.ToString())); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(text.Get("Dia_DeckEdit_005_Button"), text.Get("Dia_DeckEdit_005_Button_2")); + dialogBase.onPushButton1 = action; + } + else + { + action(); + } + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return null; + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return null; + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedLobby.cs b/SVSim.BattleEngine/Engine/Wizard/SealedLobby.cs new file mode 100644 index 0000000..06cd19b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedLobby.cs @@ -0,0 +1,251 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class SealedLobby : MonoBehaviour +{ + [SerializeField] + private ArenaCommonLobby _commonLobbyPrefab; + + [SerializeField] + private GameObject _buttonsRoot; + + [SerializeField] + private UIButton _deckEditButton; + + [SerializeField] + private UIButton _deckViewButton; + + [SerializeField] + private UIButton _deckCodeGenerateButton; + + [SerializeField] + private UIButton _stageSelectButton; + + [SerializeField] + private UIButton _retireButton; + + [SerializeField] + private UISprite _incompleteDeckIcon; + + [SerializeField] + private CardSelectDialog _cardSelectDialogPrefab; + + private const int BATTLE_MAX_NUM = 5; + + private List _unloadAssetList = new List(); + + private ArenaCommonLobby _commonLobby; + + private UICardList _deckViewerDialog; + + private SealedData SealedData => Data.ArenaData.SealedData; + + public bool IsReady => _commonLobby.IsReady; + + public void Init() + { + _commonLobby = NGUITools.AddChild(base.gameObject, _commonLobbyPrefab.gameObject).GetComponent(); + _commonLobby.Init(new ArenaCommonLobbyInitParam + { + ClassId = SealedData.SelectedClassId.Value, + BattleMaxNum = 5, + BattleWinNum = SealedData.BattleWinNum, + BattleResultList = SealedData.BattleResultList, + BattleButtonClickCallback = OnClickBattleButton, + RewardReceiveButtonClickCallback = OnClickRewardReceiveButton, + BattleMaintenanceType = NetworkDefine.MAINTENANCE_TYPE.ARENA_SEALED_BATTLE_MAINTENANCE + }); + _buttonsRoot.transform.SetParent(_commonLobby.ButtonsRoot.transform); + _buttonsRoot.transform.localPosition = Vector3.zero; + UIEventListener.Get(_deckEditButton.gameObject).onClick = OnClickDeckEditButton; + UIEventListener.Get(_deckViewButton.gameObject).onClick = OnClickDeckViewButton; + UIEventListener.Get(_deckCodeGenerateButton.gameObject).onClick = OnClickDeckCodeGenerateButton; + UIEventListener.Get(_stageSelectButton.gameObject).onClick = OnClickStageSelectButton; + UIEventListener.Get(_retireButton.gameObject).onClick = OnClickRetireButton; + bool flag = SealedData.BattleResultList.Length >= 5; + UIManager.SetObjectToGrey(_deckEditButton.gameObject, flag); + UIManager.SetObjectToGrey(_stageSelectButton.gameObject, flag); + UIManager.SetObjectToGrey(_retireButton.gameObject, flag); + bool flag2 = !SealedData.IsCompletedDeck.Value && !flag; + _commonLobby.SetDecisionButtonToDark(flag2); + UIManager.SetObjectToGrey(_deckCodeGenerateButton.gameObject, flag2); + _incompleteDeckIcon.gameObject.SetActive(flag2 || SealedData.DeckData.GetCardIdList().Any((int id) => GameMgr.GetIns().GetDataMgr().IsMaintenanceCard(id))); + } + + public void Final() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_unloadAssetList); + _unloadAssetList.Clear(); + _deckViewerDialog?.RemoveData(); + _commonLobby.Final(); + UnityEngine.Object.Destroy(_commonLobby.gameObject); + } + + private void OnClickDeckEditButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + SealedController.GoToSealedDeckEdit(); + } + + private void OnClickDeckViewButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + StartCoroutine(OpenDeckViewerDialogCoroutine()); + } + + private IEnumerator OpenDeckViewerDialogCoroutine() + { + if (_deckViewerDialog == null) + { + _deckViewerDialog = DialogCreator.CreateDeckViewerDialog(base.gameObject); + DeckData deckData = SealedData.DeckData; + List loadAssetList = _deckViewerDialog.GetLoadFileList(deckData.GetCardIdList()); + UIManager uiMgr = UIManager.GetInstance(); + uiMgr.createInSceneCenterLoading(); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(loadAssetList, delegate + { + _unloadAssetList.AddRange(loadAssetList); + })); + uiMgr.closeInSceneCenterLoading(); + _deckViewerDialog.SetDeck(deckData, null); + _deckViewerDialog.SetShareButtonUse(isUse: true); + _deckViewerDialog.SubmitDeckType = GenerateDeckCodeTask.SubmitDeckType.SEALED; + CardDetailUI cardDetail = _deckViewerDialog.CardDetail; + cardDetail.IsShowFlavorTextButton = true; + cardDetail.IsShowVoiceButton = true; + cardDetail.IsShowEvolutionButton = true; + } + _deckViewerDialog.SetActive(in_Active: true); + _deckViewerDialog.ResetScroll(); + } + + private void OnClickDeckCodeGenerateButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ArenaCommonLobby.GenerateDeckCode(GenerateDeckCodeTask.SubmitDeckType.SEALED, SealedData.SelectedClassId.Value, SealedData.DeckOriginalExcludedPhantomCardList, SealedData.DeckOriginalPhantomCardList); + } + + private void OnClickStageSelectButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + DialogCreator.CreateStageSelectDialog(); + } + + private void OnClickRetireButton(GameObject g) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + ArenaCommonLobby.OpenRetireConfirmDialog().onPushButton1 = delegate + { + StartCoroutine(Toolbox.NetworkManager.Connect(new SealedRetireTask(), delegate + { + ReceiveReward(); + })); + }; + } + + private void OnClickBattleButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS); + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + Data.CurrentFormat = Format.Sealed; + dataMgr.m_BattleType = DataMgr.BattleType.Sealed; + dataMgr.SetSelectDeckId(SealedData.EntryId.Value); + dataMgr.LastSelectDeckAttributeType = DeckAttributeType.Invalid; + dataMgr.SetPlayerCharaIdByClassId(SealedData.SelectedClassId.Value); + dataMgr.SetCurrentDeckData(SealedData.SortedDeckOriginalCardList); + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.RankMatch); + } + + private void OnClickRewardReceiveButton() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + StartCoroutine(Toolbox.NetworkManager.Connect(new SealedFinishTask(), delegate + { + ReceiveReward(); + })); + } + + private void ReceiveReward() + { + _commonLobby.ClickProtectionCollider.gameObject.SetActive(value: true); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = false; + _commonLobby.TreasureBoxInfo.OpenBox(delegate + { + _commonLobby.ClickProtectionCollider.gameObject.SetActive(value: false); + GameMgr.GetIns().GetInputMgr().isBackKeyEnable = true; + if (SealedData.RewardCardCandidates.Count <= 0) + { + OpenRewardReceiveDialog(); + } + else + { + OpenCardSelectDialog(); + } + }); + } + + private void OpenRewardReceiveDialog() + { + DialogBase dialogBase = DialogCreator.CreateRewardReceiveDialog(SealedData.RewardList); + dialogBase.SetLayer("Loading"); + dialogBase.ClickSe_Btn1 = Se.TYPE.SYS_BTN_CANCEL_TRANS; + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.MyPage); + }); + } + + private void OpenCardSelectDialog() + { + StartCoroutine(OpenCardSelectDialogCoroutine()); + } + + private IEnumerator OpenCardSelectDialogCoroutine() + { + UIManager uiMgr = UIManager.GetInstance(); + uiMgr.createInSceneCenterLoading(); + SystemText systemText = Data.SystemText; + DialogBase dialog = uiMgr.CreateDialogClose(); + dialog.SetLayer("Loading"); + dialog.SetSize(DialogBase.Size.M); + dialog.SetTitleLabel(systemText.Get("Sealed_RewardCardSelect_0001")); + dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn); + dialog.onPushButton1 = (dialog.onCloseWithoutSelect = _commonLobby.TreasureBoxInfo.Reset); + CardSelectDialog dialogObject = NGUITools.AddChild(dialog.gameObject, _cardSelectDialogPrefab.gameObject).GetComponent(); + dialogObject.Init(SealedData.RewardCardCandidates, delegate(int cardId) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + OpenCardSelectConfirmDialog(dialog, cardId); + }, systemText.Get("Sealed_RewardCardSelect_0002")); + while (!dialogObject.IsReady) + { + yield return null; + } + uiMgr.closeInSceneCenterLoading(); + } + + private void OpenCardSelectConfirmDialog(DialogBase cardSelectDialog, int cardId) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetTitleLabel(systemText.Get("Sealed_RewardCardSelect_0003")); + dialogBase.SetText(systemText.Get("Sealed_RewardCardSelect_0004", CardMaster.GetInstance(FormatBehaviorManager.GetDefaultBehaviour(Format.Sealed).CardMasterId).GetCardParameterFromId(cardId).CardName)); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("Common_0004")); + dialogBase.onPushButton1 = delegate + { + cardSelectDialog.Close(); + StartCoroutine(Toolbox.NetworkManager.Connect(new SealedSelectPhantomCardTask(cardId), delegate + { + OpenRewardReceiveDialog(); + })); + }; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SealedStepFuncs.cs b/SVSim.BattleEngine/Engine/Wizard/SealedStepFuncs.cs new file mode 100644 index 0000000..b7c0216 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SealedStepFuncs.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections; + +namespace Wizard; + +public class SealedStepFuncs +{ + public Func InitFunc { get; private set; } + + public Action FinalFunc { get; private set; } + + public SealedStepFuncs(Func initFunc, Action finalFunc) + { + InitFunc = initFunc; + FinalFunc = finalFunc; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SecretBossDeckConfirmDialog.cs b/SVSim.BattleEngine/Engine/Wizard/SecretBossDeckConfirmDialog.cs new file mode 100644 index 0000000..4033b21 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SecretBossDeckConfirmDialog.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class SecretBossDeckConfirmDialog : MonoBehaviour +{ + private const int DIALOG_PANEL_DEPTH = 50; + + private const float GRID_CARD_SCALE = 0.97f; + + private const int GRID_CARD_DEPTH = 5; + + public const string LAYER_NAME = "MyPage"; + + [SerializeField] + private UIGrid _cardGrid; + + [SerializeField] + private CardImageHelpder _cardLoader; + + [SerializeField] + private DeckViewHelper _deckViewHelper; + + [SerializeField] + private UILabel _deckNameLabel; + + [SerializeField] + private UIButton _buttonOriginal; + + private List _loadPathList = new List(); + + private DeckData _deck; + + private List _abilityList; + + private bool _isBattleAgain; + + public static void Create(DeckData deck, List abilityList, bool isBattleAgain) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0021")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn); + dialogBase.SetButtonText(Data.SystemText.Get("Common_0004"), Data.SystemText.Get("Card_0210")); + dialogBase.ClickSe_Btn2 = Se.TYPE.SYS_BTN_DECIDE; + dialogBase.isNotCloseWindowButton2 = true; + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/BossRush/SecretBossDeckConfirmDialog")) as GameObject; + dialogBase.SetObj(gameObject); + dialogBase.SetLayer("MyPage"); + dialogBase.SetPanelDepth(50); + gameObject.GetComponent().Initialize(dialogBase, deck, abilityList, isBattleAgain); + } + + private void Initialize(DialogBase dialog, DeckData deck, List abilityList, bool isBattleAgain) + { + _deck = deck; + _abilityList = abilityList; + _isBattleAgain = isBattleAgain; + CardMaster instance = CardMaster.GetInstance(CardMaster.CardMasterId.Default); + List cardIdLIst = new List(); + foreach (BossRushLobbyAbilityData ability in abilityList) + { + CardParameter cardParameterFromId = instance.GetCardParameterFromId(ability.DisplayCardId); + if (ability.IsFoil) + { + cardIdLIst.Add(cardParameterFromId.FoilCardId); + } + else + { + cardIdLIst.Add(ability.DisplayCardId); + } + } + _deckNameLabel.text = deck.GetDeckName(); + UIManager.GetInstance().createInSceneCenterLoading(); + StartCoroutine(LoadResources(cardIdLIst, delegate + { + UIManager.GetInstance().closeInSceneCenterLoading(); + InitializeCardList(cardIdLIst); + InitializeDeckView(); + dialog.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + dialog.onPushButton1 = delegate + { + OnClickOkButton(); + }; + dialog.onPushButton2 = delegate + { + OnClickDeckViewButton(); + }; + })); + } + + private void InitializeDeckView() + { + _deckViewHelper.Initialize(); + _deckViewHelper.UICardList.SetEnableBlueButton(isEnable: true, Data.SystemText.Get("BossRush_0038"), delegate + { + OnClickAbilityView(); + }); + _deckViewHelper.SetEnableDeckShareButton(enable: false); + } + + private void OnClickAbilityView() + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + BossRushLobbyAbilityDetailDialog.Create(_abilityList, _abilityList.Count); + } + + private void OnClickDeckViewButton() + { + _deckViewHelper.ShowDeckView(_deck); + } + + private IEnumerator LoadResources(List cardNoList, Action onFinish) + { + if (_isBattleAgain) + { + _loadPathList.Add(UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.BossRush)); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(_loadPathList, null)); + UIManager.GetInstance().AddResidentAtlas(UIAtlasManager.AssetBundleNames.BossRush); + } + float cardScale = 0.97f; + int depth = 5; + bool finish = false; + _cardLoader.Load(cardNoList, cardScale, depth, CardTemplateCustomize, delegate + { + finish = true; + }); + while (!finish) + { + yield return null; + } + onFinish.Call(); + } + + private void OnDestroy() + { + if (_isBattleAgain) + { + UIManager.GetInstance().RemoveResidentAtlas(UIAtlasManager.AssetBundleNames.BossRush); + } + Toolbox.ResourcesManager.RemoveAssetGroup(_loadPathList); + _loadPathList.Clear(); + } + + private void CardTemplateCustomize(CardListTemplate cardTemplate) + { + cardTemplate.SetBossRushSkillFrame(); + cardTemplate.HideNum(); + cardTemplate.HideLabelsForBossRushSkill(); + cardTemplate.SetBossRushCardTexture(); + } + + private void InitializeCardList(List cardNoList) + { + for (int i = 0; i < cardNoList.Count; i++) + { + BossRushLobbyAbilityData ability = _abilityList[i]; + UIButton component = NGUITools.AddChild(_cardGrid.gameObject, _buttonOriginal.gameObject).GetComponent(); + UIEventListener.Get(component.gameObject).onClick = delegate + { + OnClickCard(ability); + }; + GameObject cardObj = _cardLoader.GetCardObjData(i).CardObj; + Vector3 localScale = cardObj.transform.localScale; + cardObj.transform.parent = component.transform; + cardObj.transform.localPosition = Vector3.zero; + cardObj.transform.localScale = localScale; + } + _cardGrid.Reposition(); + } + + private void OnClickCard(BossRushLobbyAbilityData selectAbility) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE); + BossRushLobbyAbilityDetailDialog.Create(_abilityList, _abilityList.Count, selectAbility); + } + + private void OnClickOkButton() + { + BossRushHiddenBattleStartTask battleStartTask = new BossRushHiddenBattleStartTask(_deck, _abilityList); + UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(battleStartTask, delegate + { + MoveBattle(battleStartTask); + })); + } + + private void MoveBattle(BossRushHiddenBattleStartTask battleStartTask) + { + StoryAISettingData settingData = Data.Master.QuestAISettingList.GetSettingData(battleStartTask.QuestBossData.AI); + GameMgr.GetIns().GetSoundMgr().StopAllBGM(0.5f); + UIManager.GetInstance().CreatFadeClose(delegate + { + BattleCleanIfNeed(delegate + { + Data.Master.LoadAICsv(new AICsvLoadingInfo(settingData.DeckId, settingData.StyleId, settingData.EmoteId), delegate + { + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + dataMgr.SetCurrentEnemyDeckDataFromAIDeck(dataMgr.GetEnemyClassId(), -1, settingData.LogicLevel, battleStartTask.QuestBossData.Life, settingData.DeckId, settingData.StyleId, settingData.EmoteId, settingData.UseInnerEmote, settingData.EnemyAiId, battleStartTask.PlayerSkillList.Select((BossRushSpecialSkill s) => s.OriginalCardId).ToList()); + dataMgr.LoadEnemy(); + UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam + { + IsFadeout = false, + IsShow_CardIntroduction = true + }; + UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.Battle, param); + }); + }); + }); + } + + private void BattleCleanIfNeed(Action onFinish) + { + if (!_isBattleAgain) + { + onFinish.Call(); + return; + } + UIManager.GetInstance().StartCoroutine(BattleManagerBase.GetIns().GetBattleControl().BattleEnd(delegate + { + onFinish(); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SendTraceLogTask.cs b/SVSim.BattleEngine/Engine/Wizard/SendTraceLogTask.cs new file mode 100644 index 0000000..94d26a7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SendTraceLogTask.cs @@ -0,0 +1,68 @@ +namespace Wizard; + +public class SendTraceLogTask : BaseTask +{ + public class SendTraceLastLogParam : BaseParam + { + public string log; + } + + public class SendTraceLogParam : SendTraceLastLogParam + { + public string setting_log; + } + + public class SendAllTraceLogParam : SendTraceLastLogParam + { + public string last_log; + + public string setting_log; + } + + public SendTraceLogTask(LocalLog.TRACELOG_TYPE logType) + { + switch (logType) + { + case LocalLog.TRACELOG_TYPE.TRACE_ALL_LOG: + base.type = ApiType.Type.SendAllTraceLog; + break; + case LocalLog.TRACELOG_TYPE.TRACE_LOG: + base.type = ApiType.Type.SendTraceLog; + break; + case LocalLog.TRACELOG_TYPE.TRACE_LAST_LOG: + base.type = ApiType.Type.SendLastTraceLog; + break; + } + } + + public void SetParameter(string last_log) + { + SendTraceLastLogParam sendTraceLastLogParam = new SendTraceLastLogParam(); + sendTraceLastLogParam.log = last_log; + base.Params = sendTraceLastLogParam; + } + + public void SetParameter(string log, string setting_log) + { + SendTraceLogParam sendTraceLogParam = new SendTraceLogParam(); + sendTraceLogParam.log = log; + sendTraceLogParam.setting_log = setting_log; + base.Params = sendTraceLogParam; + } + + public void SetParameter(string log, string last_log, string setting_log) + { + SendAllTraceLogParam sendAllTraceLogParam = new SendAllTraceLogParam(); + sendAllTraceLogParam.log = log; + sendAllTraceLogParam.last_log = last_log; + sendAllTraceLogParam.setting_log = setting_log; + base.Params = sendAllTraceLogParam; + } + + protected override int Parse() + { + int result = base.Parse(); + _ = 1; + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SkinPurchaseInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/SkinPurchaseInfoTask.cs new file mode 100644 index 0000000..61291d6 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SkinPurchaseInfoTask.cs @@ -0,0 +1,174 @@ +using LitJson; +using Wizard.Scripts.Network.Data.TaskData.SkinPurchase; + +namespace Wizard; + +public class SkinPurchaseInfoTask : BaseTask +{ + public class SkinPurchaseInfoTaskParam : BaseParam + { + } + + public SkinPurchaseInfoTask() + { + base.type = ApiType.Type.SkinInfo; + } + + public void SetParameter() + { + SkinPurchaseInfoTaskParam skinPurchaseInfoTaskParam = new SkinPurchaseInfoTaskParam(); + base.Params = skinPurchaseInfoTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.SkinPurchaseInfo.seriesList.Clear(); + JsonData jsonData = base.ResponseData["data"]; + for (int i = 0; i < jsonData.Count; i++) + { + JsonData jsonData2 = jsonData[i]; + int num2 = jsonData2["series_id"].ToInt(); + if (!Data.Master.LeaderSkinSeriesIdDic.ContainsKey(num2)) + { + continue; + } + SkinSeriesPurchaseInfo skinSeriesPurchaseInfo = new SkinSeriesPurchaseInfo(); + skinSeriesPurchaseInfo.series_id = num2; + skinSeriesPurchaseInfo.is_completed = jsonData2["is_completed"].ToBoolean(); + if (jsonData2.Keys.Contains("ticket_info")) + { + JsonData jsonData3 = jsonData2["ticket_info"]; + skinSeriesPurchaseInfo.HaveTicket = jsonData3["has_ticket"].ToBoolean(); + } + else + { + skinSeriesPurchaseInfo.HaveTicket = false; + } + skinSeriesPurchaseInfo.IsNew = jsonData2.Keys.Contains("is_new") && jsonData2["is_new"].ToBoolean(); + skinSeriesPurchaseInfo.description = Data.Master.LeaderSkinSeriesIdDic[skinSeriesPurchaseInfo.series_id].Introduction; + skinSeriesPurchaseInfo.SetSalesStatus = (SkinSeriesPurchaseInfo.eSetSalesStatus)jsonData2["set_sales_status"].ToInt(); + if (skinSeriesPurchaseInfo.SetSalesStatus != SkinSeriesPurchaseInfo.eSetSalesStatus.None) + { + skinSeriesPurchaseInfo._rewardStatus = (SkinSeriesPurchaseInfo.RewardStatus)jsonData2["rewards"]["status"].ToInt(); + skinSeriesPurchaseInfo.saleInfo = CreateSetSaleInfo(skinSeriesPurchaseInfo, jsonData2); + JsonData jsonData4 = jsonData2["rewards"]["items"]; + for (int j = 0; j < jsonData4.Count; j++) + { + ShopCommonRewardInfo shopCommonRewardInfo = new ShopCommonRewardInfo(); + if (jsonData4[j].Keys.Contains("reward_type")) + { + shopCommonRewardInfo.Type = jsonData4[j]["reward_type"].ToInt(); + } + if (jsonData4[j].Keys.Contains("reward_detail_id")) + { + shopCommonRewardInfo.UserGoodsId = jsonData4[j]["reward_detail_id"].ToLong(); + } + if (jsonData4[j].Keys.Contains("reward_number")) + { + shopCommonRewardInfo.Num = jsonData4[j]["reward_number"].ToInt(); + } + skinSeriesPurchaseInfo.rewardInfoList.Add(shopCommonRewardInfo); + } + } + else + { + skinSeriesPurchaseInfo._rewardStatus = SkinSeriesPurchaseInfo.RewardStatus.none; + skinSeriesPurchaseInfo.saleInfo = null; + } + JsonData jsonData5 = jsonData2["products"]; + for (int k = 0; k < jsonData5.Count; k++) + { + SkinProductInfo skinProductInfo = new SkinProductInfo(); + skinProductInfo.product_id = jsonData5[k]["product_id"].ToInt(); + string key = jsonData5[k]["introduction"].ToString(); + skinProductInfo.description = Data.Master.GetLeaderSkinProductText(key); + string key2 = jsonData5[k]["cv_name"].ToString(); + skinProductInfo.cv_name = Data.Master.GetLeaderSkinProductText(key2); + skinProductInfo.leader_skin_id = jsonData5[k]["leader_skin_id"].ToInt(); + skinProductInfo.is_purchased = jsonData5[k]["is_purchased"].ToBoolean(); + ShopCommonSaleInfo shopCommonSaleInfo = new ShopCommonSaleInfo(); + string key3 = jsonData5[k]["product_name"].ToString(); + shopCommonSaleInfo.name = Data.Master.GetLeaderSkinProductText(key3); + shopCommonSaleInfo.path = skinProductInfo.leader_skin_id.ToString(); + if (jsonData5[k]["sale"].Keys.Contains("single_price_crystal")) + { + shopCommonSaleInfo.costCrystal = jsonData5[k]["sale"]["single_price_crystal"].ToInt(); + } + if (jsonData5[k]["sale"].Keys.Contains("single_price_rupy")) + { + shopCommonSaleInfo.costRupy = jsonData5[k]["sale"]["single_price_rupy"].ToInt(); + } + if (jsonData5[k]["sale"].Keys.Contains("single_price_ticket")) + { + shopCommonSaleInfo.costTicket = jsonData5[k]["sale"]["single_price_ticket"].ToInt(); + } + if (jsonData5[k]["sale"].Keys.Contains("ticket_number")) + { + shopCommonSaleInfo.haveTicketNum = jsonData5[k]["sale"]["ticket_number"].ToInt(); + } + if (jsonData5[k]["sale"].Keys.Contains("item_id")) + { + shopCommonSaleInfo.costTicketItemId = jsonData5[k]["sale"]["item_id"].ToLong(); + } + shopCommonSaleInfo.expirtyTimeInfo = new ShopExpirtyInfo(jsonData5[k]["sales_period_info"]); + shopCommonSaleInfo.isFree = false; + if (shopCommonSaleInfo.costCrystal.HasValue && shopCommonSaleInfo.costRupy.HasValue && shopCommonSaleInfo.costCrystal <= 0 && shopCommonSaleInfo.costRupy <= 0) + { + shopCommonSaleInfo.isFree = true; + } + skinProductInfo.saleInfo = shopCommonSaleInfo; + JsonData jsonData6 = jsonData5[k]["rewards"]; + for (int l = 0; l < jsonData6.Count; l++) + { + ShopCommonRewardInfo shopCommonRewardInfo2 = new ShopCommonRewardInfo(); + shopCommonRewardInfo2.Type = jsonData6[l]["reward_type"].ToInt(); + shopCommonRewardInfo2.UserGoodsId = jsonData6[l]["reward_detail_id"].ToLong(); + shopCommonRewardInfo2.Num = jsonData6[l]["reward_number"].ToInt(); + shopCommonRewardInfo2.IsAlreadyGet = jsonData6[l].GetValueOrDefault("is_owned", defaultValue: false); + skinProductInfo.rewardInfoList.Add(shopCommonRewardInfo2); + } + skinSeriesPurchaseInfo.productList.Add(skinProductInfo); + } + Data.SkinPurchaseInfo.seriesList.Add(skinSeriesPurchaseInfo); + } + return num; + } + + private ShopCommonSaleInfo CreateSetSaleInfo(SkinSeriesPurchaseInfo seriesInfo, JsonData seriesData) + { + ShopCommonSaleInfo shopCommonSaleInfo = new ShopCommonSaleInfo(); + shopCommonSaleInfo.name = Data.Master.LeaderSkinSeriesIdDic[seriesInfo.series_id].SetName; + shopCommonSaleInfo.path = $"class_skin_set_{seriesInfo.series_id}"; + JsonData jsonData = seriesData["set_prices"]; + if (jsonData.Keys.Contains("set_price_crystal")) + { + shopCommonSaleInfo.costCrystal = jsonData["set_price_crystal"].ToInt(); + } + if (jsonData.Keys.Contains("set_price_rupy")) + { + shopCommonSaleInfo.costRupy = jsonData["set_price_rupy"].ToInt(); + } + if (jsonData.Keys.Contains("set_price_ticket")) + { + shopCommonSaleInfo.costTicket = jsonData["set_price_ticket"].ToInt(); + shopCommonSaleInfo.haveTicketNum = seriesData["ticket_info"]["ticket_number"].ToInt(); + shopCommonSaleInfo.costTicketItemId = jsonData["ticket_id"].ToInt(); + } + shopCommonSaleInfo.expirtyTimeInfo = new ShopExpirtyInfo(seriesData["sales_period_info"]); + shopCommonSaleInfo.isFree = false; + if (shopCommonSaleInfo.costCrystal.HasValue && shopCommonSaleInfo.costRupy.HasValue && shopCommonSaleInfo.costCrystal <= 0 && shopCommonSaleInfo.costRupy <= 0) + { + shopCommonSaleInfo.isFree = true; + } + if (seriesInfo.is_completed && seriesInfo._rewardStatus == SkinSeriesPurchaseInfo.RewardStatus.not_got) + { + shopCommonSaleInfo.isFree = true; + } + return shopCommonSaleInfo; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SoloBattleEnemyAI.cs b/SVSim.BattleEngine/Engine/Wizard/SoloBattleEnemyAI.cs new file mode 100644 index 0000000..f9fb654 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SoloBattleEnemyAI.cs @@ -0,0 +1,61 @@ +using Wizard.Battle.View.Vfx; + +namespace Wizard; + +public class SoloBattleEnemyAI : EnemyAI +{ + public override bool IsStackAction => false; + + public override bool IsConnectNetwork => false; + + public SoloBattleEnemyAI() + { + base.IsRankMatchAI = false; + } + + public override void Retire() + { + } + + protected override void OnBeforeTurnEnd() + { + emoteQuery.OnOperation(); + VfxBase vfxBase = null; + vfxBase = ((base.TurnCount != 1) ? GetEmote(AIEmoteCmdType.ON_ALLY_TURN_END) : GetEmote(AIEmoteCmdType.ON_FIRST_TURN)); + if (vfxBase != null) + { + battleMgr.VfxMgr.RegisterSequentialVfx(vfxBase); + } + base.IsThisTurnEmotePlayed = false; + } + + protected override void OnFinishOprAttack() + { + emoteMng.OnOperationRequest(); + } + + protected override void OnFinishOprTargetSelect() + { + emoteMng.OnOperationRequest(); + } + + public override void Disconnect() + { + } + + public override void Reconnect() + { + } + + public override void CleanupStackedAction() + { + } + + protected override void CheckIsStackAction() + { + } + + protected override void SetupThinkingInterval() + { + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpecialTitleAssetBundle.cs b/SVSim.BattleEngine/Engine/Wizard/SpecialTitleAssetBundle.cs new file mode 100644 index 0000000..0be4cf7 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpecialTitleAssetBundle.cs @@ -0,0 +1,88 @@ +using System.IO; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class SpecialTitleAssetBundle : MonoBehaviour +{ + private AssetHandle _handle; + + private string _id; + + public GameObject _specialTitle; + + public bool IsSetupFinish { get; private set; } + + private static string GetSpecialTitlePath(string id, bool isFetch) + { + return Toolbox.ResourcesManager.GetAssetTypePath(id, ResourcesManager.AssetLoadPathType.SpecialTitle, isFetch); + } + + private static string GetBGMCueName(string id) + { + return "bgm_title_" + id; + } + + private static bool IsBGMAvailable(string id) + { + return File.Exists(Path.Combine(Application.persistentDataPath, "b", GetBGMCueName(id) + ".awb")); + } + + public static bool IsAvailableTitleAssetBundle(string id) + { + if (!IsBGMAvailable(id)) + { + return false; + } + return File.Exists(new AssetHandle(GetSpecialTitlePath(id, isFetch: false), null, null, null, null, null).BuildLocalCachePath()); + } + + public void Initialize(string id) + { + if (!IsAvailableTitleAssetBundle(id)) + { + return; + } + _id = id; + _handle = new AssetHandle(GetSpecialTitlePath(id, isFetch: false), null, null, null, null, null); + _handle.Load(delegate + { + _specialTitle = NGUITools.AddChild(base.gameObject, Toolbox.ResourcesManager.LoadObject(GetSpecialTitlePath(id, isFetch: true)) as GameObject); + ChangeableTitleUIParts component = _specialTitle.gameObject.GetComponent(); + if (component != null) + { + component.Init(); + } + IsSetupFinish = true; + }); + } + + public void PlayBGM() + { + GameMgr.GetIns().GetSoundMgr().PlayBGM(GetBGMCueName(_id), 0f, 0L); + } + + public void UnloadBGM() + { + Toolbox.AudioManager.RemoveCueSheet(GetBGMCueName(_id)); + GameMgr.GetIns().GetSoundMgr().UnloadBGM(GetBGMCueName(_id)); + } + + public void RemoveSpecialTitle() + { + if (_specialTitle != null) + { + Object.Destroy(_specialTitle); + _specialTitle = null; + } + } + + private void OnDestroy() + { + if (_handle != null) + { + _handle.Unload(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangePlate.cs b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangePlate.cs new file mode 100644 index 0000000..ef337ea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/SpotCardExchangePlate.cs @@ -0,0 +1,105 @@ +using System; +using UnityEngine; +using Wizard.Scripts.Network.Data.TaskData.SpotCardExchange; + +namespace Wizard; + +public class SpotCardExchangePlate : MonoBehaviour +{ + private readonly Quaternion CARDOBJECT_ROTATION_QUATERNION = new Quaternion(0f, 0f, 0f, 0f); + + private const string SPOT_CARD_NUM_FORMAT = "[fcd24a]+{0}[-]"; + + [SerializeField] + private GameObject _objCardRoot; + + [SerializeField] + private UILabel _labelSpotCardName; + + [SerializeField] + private UILabel _labelCardPossessionNum; + + [SerializeField] + private UILabel _labelCardPossessionNumNormal; + + [SerializeField] + private UILabel _labelCardPossessionNumPremium; + + [SerializeField] + private UILabel _labelCostSpotCardPoint; + + [SerializeField] + private UIButton _btnExchangeSpotCard; + + [SerializeField] + private UILabel _labelExchanged; + + private GameObject _cardObject; + + public void SetData(SpotCardExchangeInfo spotCardInfo, int haveSpotCardPoint, SpotCardExchangeInfoTask.PrereleaseExchangeInfo prereleaseInfo, Action onClickExchangButton) + { + SystemText systemText = Data.SystemText; + string text = spotCardInfo.GetExchangeCardTextSmall(); + if (spotCardInfo.IsPrereleaseCard) + { + text = systemText.Get("Shop_0183", text); + } + _labelSpotCardName.text = text; + DataMgr dataMgr = GameMgr.GetIns().GetDataMgr(); + int possessionCardNum = dataMgr.GetPossessionCardNum(spotCardInfo.CardId, isIncludingSpotCard: false); + int spotCardNum = dataMgr.SpotCardData.GetSpotCardNum(spotCardInfo.CardId); + _labelCardPossessionNumNormal.text = possessionCardNum + ((spotCardNum > 0) ? $"[fcd24a]+{spotCardNum}[-]" : string.Empty); + int cardId = spotCardInfo.CardId + 1; + int possessionCardNum2 = dataMgr.GetPossessionCardNum(cardId, isIncludingSpotCard: false); + _labelCardPossessionNumPremium.text = possessionCardNum2.ToString(); + int num = possessionCardNum + possessionCardNum2 + spotCardNum; + _labelCardPossessionNum.text = num.ToString(); + string typeName = ""; + string detailName = ""; + ShopCommonUtility.GetRewardNames(12, 0L, spotCardInfo.ExchangePoint, out typeName, out detailName); + _labelCostSpotCardPoint.text = systemText.Get("Shop_0129", typeName, detailName); + switch (spotCardInfo.SpotCardExchangeStatus) + { + case SpotCardExchangeInfo.ExchangeStatus.AlreadyExchange: + _btnExchangeSpotCard.gameObject.SetActive(value: false); + _labelExchanged.gameObject.SetActive(value: true); + break; + case SpotCardExchangeInfo.ExchangeStatus.EnableExchange: + { + _btnExchangeSpotCard.onClick.Clear(); + _btnExchangeSpotCard.onClick.Add(new EventDelegate(delegate + { + onClickExchangButton(spotCardInfo); + })); + _btnExchangeSpotCard.gameObject.SetActive(value: true); + _labelExchanged.gameObject.SetActive(value: false); + bool flag = haveSpotCardPoint < spotCardInfo.ExchangePoint; + if (prereleaseInfo.IsPrerelease && spotCardInfo.IsPrereleaseCard) + { + flag |= prereleaseInfo.RemainingExchangeableCount <= 0; + } + UIManager.SetObjectToGrey(_btnExchangeSpotCard.gameObject, flag); + break; + } + case SpotCardExchangeInfo.ExchangeStatus.LimitOver: + _btnExchangeSpotCard.gameObject.SetActive(value: true); + _labelExchanged.gameObject.SetActive(value: false); + UIManager.SetObjectToGrey(_btnExchangeSpotCard.gameObject, b: true); + break; + } + } + + public void SetCardObject(GameObject cardObject, GameObject evacuationParent) + { + if (_cardObject != null) + { + _cardObject.SetActive(value: false); + _cardObject.transform.parent = evacuationParent.transform; + } + cardObject.transform.parent = _objCardRoot.transform; + cardObject.transform.localPosition = Vector3.zero; + cardObject.transform.rotation = CARDOBJECT_ROTATION_QUATERNION; + cardObject.SetActive(value: true); + _cardObject = cardObject; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StarterPurchaseConfirmationDialog.cs b/SVSim.BattleEngine/Engine/Wizard/StarterPurchaseConfirmationDialog.cs new file mode 100644 index 0000000..5880e96 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StarterPurchaseConfirmationDialog.cs @@ -0,0 +1,125 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class StarterPurchaseConfirmationDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _packPriceLabel; + + [SerializeField] + private UILabel _packConfirmLabel; + + [SerializeField] + private UILabel _currentClassLabel; + + [SerializeField] + private UILabel _labelAfterItemUnit; + + [SerializeField] + private UILabel _cautionLabel; + + [SerializeField] + private UILabel _haveCrystalBefore; + + [SerializeField] + private UILabel _haveCrystalAfter; + + [SerializeField] + private UILabel _freePackBeforeCountLabel; + + [SerializeField] + private UILabel _freePackAfterCountLabel; + + [SerializeField] + private UIButton _jpnLawButton; + + [SerializeField] + private UILabel _saleTimeLabel; + + [SerializeField] + private UISprite _jpaLawLine; + + [SerializeField] + private GameObject _crystalLayoutRoot; + + [SerializeField] + private UILabel _freePackTitleLabel; + + [SerializeField] + private GameObject _freeBuyLayoutRoot; + + [SerializeField] + private CenteringUIWidget _freeCountCenter; + + [SerializeField] + private UITable _freeCountTable; + + [SerializeField] + private UIScrollBar _scrollBar; + + [SerializeField] + private UIScrollView _scrollView; + + public void Init(DialogBase inDialog, int selectedClassId, PackConfig packConfig, PackChildGachaInfo info, Action onPurchase) + { + inDialog.SetSize(DialogBase.Size.M); + inDialog.SetTitleLabel(packConfig.Title); + inDialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + SetTextAndLabels(inDialog, selectedClassId, packConfig, info); + inDialog.onPushButton1 = delegate + { + onPurchase.Call(packConfig, info, 10, null, (CardBasePrm.ClanType)selectedClassId, null); + }; + inDialog.ClickSe_Btn1 = Se.TYPE.SYS_BTN_DECIDE_TRANS; + _jpnLawButton.onClick.Add(new EventDelegate(delegate + { + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.LEGALTEXT); + })); + _jpaLawLine.gameObject.SetActive(value: true); + if (packConfig.ExpirtyInfo.IsEnableText) + { + _saleTimeLabel.text = packConfig.ExpirtyInfo.GetText(); + } + else + { + _saleTimeLabel.gameObject.SetActive(value: false); + } + _crystalLayoutRoot.SetActive(!info.IsFreePack); + _freeBuyLayoutRoot.SetActive(info.IsFreePack); + if (info.IsFreePack) + { + int num = info.AvailableCount / info.PackCountBuyPer; + _freePackBeforeCountLabel.text = num.ToString(); + _freePackAfterCountLabel.text = (num - 1).ToString(); + _freePackTitleLabel.text = Data.SystemText.Get("Shop_0224"); + _freePackTitleLabel.ProcessText(); + _freeCountTable.Reposition(); + _freeCountCenter.Reposition(); + } + _jpnLawButton.gameObject.SetActive(value: false); + _saleTimeLabel.gameObject.SetActive(value: false); + _jpaLawLine.gameObject.SetActive(value: false); + _scrollBar.gameObject.SetActive(value: false); + _scrollView.enabled = false; + } + + private void SetTextAndLabels(DialogBase inDialog, int selectedClassId, PackConfig packConfig, PackChildGachaInfo info) + { + int num = 10 * info.Cost; + inDialog.SetButtonText(Data.SystemText.Get("Shop_0082")); + string clanNameByKey = GameMgr.GetIns().GetDataMgr().GetClanNameByKey(selectedClassId); + _packPriceLabel.text = Data.SystemText.Get("Shop_0241", num.ToString()); + _packConfirmLabel.text = Data.SystemText.Get("Shop_0242", packConfig.Title); + _currentClassLabel.text = Data.SystemText.Get("Shop_0243", clanNameByKey); + _cautionLabel.text = Data.SystemText.Get("Shop_0244", clanNameByKey); + _labelAfterItemUnit.text = Data.SystemText.Get("Card_0100"); + int userCrystalCount = PlayerStaticData.UserCrystalCount; + int num2 = userCrystalCount - 10 * info.Cost; + _haveCrystalBefore.text = userCrystalCount.ToString(); + _haveCrystalAfter.text = num2.ToString(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StorySectionSummaryDialog.cs b/SVSim.BattleEngine/Engine/Wizard/StorySectionSummaryDialog.cs new file mode 100644 index 0000000..f483d18 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StorySectionSummaryDialog.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class StorySectionSummaryDialog : MonoBehaviour +{ + private const int FRAME_DEFAULT_HEIGHT = 87; + + private const int FRAME_OFFSET_HEIGHT_PER_LINE_COUNT = 28; + + private const int GRID_DEFAULT_CELL_HIEGHT = 28; + + private const string SUMMARY_TITLE_KEY_FORMAT = "story_section_summary_title_{0:D2}"; + + private const string SUMMARY_TEXT_KEY_FORMAT = "story_section_summary_text_{0:D2}"; + + private const string SUMMARTY_BG_TEXTURE_FORMAT = "bg_story_section_summary_{0:D2}"; + + [SerializeField] + private UITexture _textureBackGround; + + [SerializeField] + private UISprite _spriteSummaryFrame; + + [SerializeField] + private UISprite _spriteSummaryFramePanel; + + [SerializeField] + private UILabel _labelSectionSummary; + + [SerializeField] + private UIGrid _gridSummaryDetailLines; + + [SerializeField] + private UISprite _spriteSummaryDetailLine; + + private string _bgTexturePath; + + private int SummaryDefaultFontSize => _labelSectionSummary.fontSize; + + public static void Create(int sectionId) + { + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/StorySectionSummaryDialog")) as GameObject; + dialogBase.SetObj(gameObject); + gameObject.GetComponent().Initialize(dialogBase, sectionId); + } + + private void Initialize(DialogBase dialog, int sectionId) + { + string storySectionTitleText = Data.Master.GetStorySectionTitleText($"story_section_summary_title_{sectionId:D2}"); + dialog.SetTitleLabel(storySectionTitleText); + dialog.SetSize(DialogBase.Size.XL); + string storySectionTitleText2 = Data.Master.GetStorySectionTitleText($"story_section_summary_text_{sectionId:D2}"); + SetSummaryText(storySectionTitleText2); + SetFramePanelAtlas(); + UIManager.GetInstance().createInSceneCenterLoading(); + string bgTextureName = $"bg_story_section_summary_{sectionId:D2}"; + StartCoroutine(LoadBgTexture(bgTextureName, delegate + { + SetBackGroundTexture(bgTextureName); + DialogBase dialogBase = dialog; + dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate + { + UnloadTexture(); + }); + UIManager.GetInstance().closeInSceneCenterLoading(); + })); + } + + private IEnumerator LoadBgTexture(string bgTextureName, Action onFinish) + { + _bgTexturePath = Toolbox.ResourcesManager.GetAssetTypePath(bgTextureName, ResourcesManager.AssetLoadPathType.UiStorySectionSummary); + yield return StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(_bgTexturePath, null)); + onFinish.Call(); + } + + private void UnloadTexture() + { + Toolbox.ResourcesManager.RemoveAsset(_bgTexturePath); + _bgTexturePath = null; + } + + private void SetBackGroundTexture(string bgTextureName) + { + Texture mainTexture = Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(bgTextureName, ResourcesManager.AssetLoadPathType.UiStorySectionSummary, isfetch: true)) as Texture; + _textureBackGround.mainTexture = mainTexture; + } + + private void SetFramePanelAtlas() + { + UIManager.GetInstance().AttachAtlas(_spriteSummaryFramePanel.gameObject, isTargetChildren: false); + } + + private void SetSummaryText(string summaryText) + { + _labelSectionSummary.SetWrapText(summaryText); + int textLineCount = Global.GetTextLineCount(_labelSectionSummary.text); + int fontSizeDelta = SummaryDefaultFontSize - _labelSectionSummary.finalFontSize; + SetSummaryLayout(textLineCount, fontSizeDelta); + } + + private void SetSummaryLayout(int lineCount, int fontSizeDelta) + { + ResizeSummaryFrame(lineCount, fontSizeDelta); + GenerateDetailLineGrid(lineCount, fontSizeDelta); + } + + private void ResizeSummaryFrame(int lineCount, int fontSizeDelta) + { + int num = (28 - fontSizeDelta) * lineCount; + _spriteSummaryFrame.height = 87 + num; + } + + private void GenerateDetailLineGrid(int lineCount, int fontSizeDelta) + { + for (int i = 1; i < lineCount; i++) + { + NGUITools.AddChild(_gridSummaryDetailLines.gameObject, _spriteSummaryDetailLine.gameObject); + } + _gridSummaryDetailLines.cellHeight = 28 - fontSizeDelta; + UIUtil.AddPositionY(_gridSummaryDetailLines.transform, fontSizeDelta); + _gridSummaryDetailLines.Reposition(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/StorySectionTask.cs b/SVSim.BattleEngine/Engine/Wizard/StorySectionTask.cs new file mode 100644 index 0000000..1e1262b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/StorySectionTask.cs @@ -0,0 +1,47 @@ +using System; +using Wizard.Story; + +namespace Wizard; + +public class StorySectionTask : BaseTask +{ + public class StorySectionTaskParam : BaseParam + { + public bool is_disp_first_tips; + } + + public StorySectionTask(SelectedStoryInfo storyInfo) + { + base.type = GetApiType(storyInfo.StoryEntranceType); + } + + private static ApiType.Type GetApiType(StoryEntranceType storyType) + { + return storyType switch + { + StoryEntranceType.AllStory => ApiType.Type.AllStorySection, + StoryEntranceType.MainStory => ApiType.Type.MainStorySection, + StoryEntranceType.LimitedStory => ApiType.Type.LimitedStorySection, + StoryEntranceType.EventStory => ApiType.Type.EventStorySection, + _ => throw new NotImplementedException(), + }; + } + + public void SetParameter(bool isDispFirstTips) + { + StorySectionTaskParam storySectionTaskParam = new StorySectionTaskParam(); + storySectionTaskParam.is_disp_first_tips = isDispFirstTips; + base.Params = storySectionTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.StoryWorldDataManager.SetData(base.ResponseData["data"]); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithMultipleTypes.cs b/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithMultipleTypes.cs new file mode 100644 index 0000000..2e035ed --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TagCollectionWithMultipleTypes.cs @@ -0,0 +1,75 @@ +using System.Collections.Generic; + +namespace Wizard; + +public class TagCollectionWithMultipleTypes : TagCollectionWithTypeBase +{ + private List _types; + + public TagCollectionWithMultipleTypes(List types, TagCollection tagCollection) + { + _types = types; + base.Collection = tagCollection; + } + + public override TagCollectionWithTypeBase Clone() + { + TagCollection tagCollection = base.Collection.Clone(); + return new TagCollectionWithMultipleTypes(new List(_types), tagCollection); + } + + public override bool IsUnderManagement(AIPlayTagType type) + { + return base.Collection.IsUnderManagement(type); + } + + public override void AddTag(AIPlayTag tag) + { + if (!_types.Contains(tag.Type)) + { + _types.Add(tag.Type); + } + base.Collection.AddTag(tag); + } + + public override bool RemoveTagAndCheckIsNolongerHoldThisType(AIPlayTag tag) + { + if (base.Collection.RemoveTagAndCheckIsNoLongerHoldThisType(tag)) + { + _types.Remove(tag.Type); + return _types.Count <= 0; + } + return false; + } + + public override void RegisterTypes(List targetList) + { + for (int i = 0; i < _types.Count; i++) + { + if (!targetList.Contains(_types[i])) + { + targetList.Add(_types[i]); + } + } + } + + public override void RemoveTypes(List targetList) + { + for (int i = 0; i < _types.Count; i++) + { + if (targetList.Contains(_types[i])) + { + targetList.Remove(_types[i]); + } + } + } + + public override bool HasTag(AIPlayTagType type) + { + if (_types.Contains(type)) + { + return base.Collection.HasTag; + } + return false; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TransitionDeleteTask.cs b/SVSim.BattleEngine/Engine/Wizard/TransitionDeleteTask.cs new file mode 100644 index 0000000..1f667ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TransitionDeleteTask.cs @@ -0,0 +1,16 @@ +namespace Wizard; + +public class TransitionDeleteTask : BaseTask +{ + public TransitionDeleteTask() + { + base.type = ApiType.Type.TransitionDelete; + } + + protected override int Parse() + { + int result = base.Parse(); + _ = 1; + return result; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TransitionDialog.cs b/SVSim.BattleEngine/Engine/Wizard/TransitionDialog.cs new file mode 100644 index 0000000..302c66c --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TransitionDialog.cs @@ -0,0 +1,74 @@ +using System; +using Cute; +using UnityEngine; + +namespace Wizard; + +public class TransitionDialog : MonoBehaviour +{ + [SerializeField] + private UIToggle _toggle; + + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private UILabel _coutionLabel; + + [SerializeField] + private UILabel _coutionTitleLabel; + + private Action _completePublishTransitionCode; + + private bool _firstToggleCall = true; + + public Action OnChange; + + public static void Create(Action onExec) + { + GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/TransitionToTwo/TransitionDialog")) as GameObject; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + SystemText systemText = Data.SystemText; + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn); + dialogBase.SetButtonText(systemText.Get("BeyondHandover_0003"), systemText.Get("Common_0005")); + dialogBase.SetTitleLabel(systemText.Get("BeyondHandover_0001")); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetObj(gameObject); + TransitionDialog transitionDialog = gameObject.GetComponent(); + transitionDialog.Initialize(onExec); + dialogBase.SetButtonDelegate(new EventDelegate(delegate + { + transitionDialog.PublishCode(); + })); + dialogBase.SetButtonDisable(isEnableOK: true); + } + + private void Initialize(Action onExec) + { + _toggle.onChange.Add(new EventDelegate(delegate + { + OnChangeToggle(); + })); + _completePublishTransitionCode = onExec; + _coutionLabel.text = Data.SystemText.Get("BeyondHandover_0012"); + _coutionTitleLabel.text = Data.SystemText.Get("BeyondHandover_0016"); + _scrollView.GetComponent().Reposition(); + _scrollView.ResetPosition(); + } + + private void OnChangeToggle() + { + if (!_firstToggleCall) + { + GameMgr.GetIns().GetSoundMgr().PlaySe(_toggle.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF); + OnChange.Call(_toggle.value); + base.transform.parent.GetComponent().SetButtonDisable(!_toggle.value); + } + _firstToggleCall = false; + } + + private void PublishCode() + { + _completePublishTransitionCode.Call(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TransitionInfoTask.cs b/SVSim.BattleEngine/Engine/Wizard/TransitionInfoTask.cs new file mode 100644 index 0000000..4eb4e2b --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TransitionInfoTask.cs @@ -0,0 +1,22 @@ +namespace Wizard; + +public class TransitionInfoTask : BaseTask +{ + public int Status { get; private set; } + + public TransitionInfoTask() + { + base.type = ApiType.Type.TransitionInfo; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Status = base.ResponseData["data"]["status"].ToInt(); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TransitionPublishDialog.cs b/SVSim.BattleEngine/Engine/Wizard/TransitionPublishDialog.cs new file mode 100644 index 0000000..39e580d --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TransitionPublishDialog.cs @@ -0,0 +1,60 @@ +using Cute; +using UnityEngine; + +namespace Wizard; + +public class TransitionPublishDialog : MonoBehaviour +{ + [SerializeField] + private UILabel _idLabel; + + [SerializeField] + private UILabel _passwardLabel; + + [SerializeField] + private UIButton _idCopyButton; + + [SerializeField] + private UIButton _passwardButton; + + public static void Create(string pass) + { + GameObject gameObject = Object.Instantiate(Resources.Load("UI/layoutParts/TransitionToTwo/TransitionPublishDialog")) as GameObject; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetTitleLabel(Data.SystemText.Get("BeyondHandover_0001")); + dialogBase.SetSize(DialogBase.Size.M); + dialogBase.SetObj(gameObject); + TransitionPublishDialog component = gameObject.GetComponent(); + component.SetIdText(pass); + component.SetCopyButtonEvent(pass); + } + + private void SetIdText(string pass) + { + _idLabel.text = $"{PlayerStaticData.UserViewerID:#,0}".Replace(",", " "); + _passwardLabel.text = pass; + } + + private void SetCopyButtonEvent(string pass) + { + _idCopyButton.onClick.Add(new EventDelegate(delegate + { + NativePluginWrapper.SetStringToClipboard(PlayerStaticData.UserViewerID.ToString()); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetPanelDepth(100); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetText(Data.SystemText.Get("BeyondHandover_0014")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + })); + _passwardButton.onClick.Add(new EventDelegate(delegate + { + NativePluginWrapper.SetStringToClipboard(pass); + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetPanelDepth(100); + dialogBase.SetSize(DialogBase.Size.S); + dialogBase.SetText(Data.SystemText.Get("BeyondHandover_0015")); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + })); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TransitionPublishTask.cs b/SVSim.BattleEngine/Engine/Wizard/TransitionPublishTask.cs new file mode 100644 index 0000000..59ab12a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TransitionPublishTask.cs @@ -0,0 +1,22 @@ +namespace Wizard; + +public class TransitionPublishTask : BaseTask +{ + public string Password { get; private set; } + + public TransitionPublishTask() + { + base.type = ApiType.Type.TransitionPublish; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Password = base.ResponseData["data"]["password"].ToString(); + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TreasureBoxCpDialog.cs b/SVSim.BattleEngine/Engine/Wizard/TreasureBoxCpDialog.cs new file mode 100644 index 0000000..fe60dbf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TreasureBoxCpDialog.cs @@ -0,0 +1,179 @@ +using System.Collections.Generic; +using Cute; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public class TreasureBoxCpDialog : MonoBehaviour +{ + private UIAtlas _arenaAtlas; + + private const string GRADE_STAR_ON_SPRITE_NAME = "icon_diamond_mark_on"; + + private const string GRADE_STAR_OFF_SPRITE_NAME = "icon_diamond_mark_off"; + + private const string GRADE_GAUGE_NAME = "gauge_bg_scale_{0}"; + + private List _loadFileList = new List(); + + [SerializeField] + private UISprite _currentBoxSprite; + + [SerializeField] + private UISprite _nextBoxSprite; + + [SerializeField] + private UISprite _openedBoxSprite; + + [SerializeField] + private UISprite[] _gradeStepSprites; + + [SerializeField] + private UIGauge _gradeGauge; + + [SerializeField] + private UILabel _nextGradeLabel; + + [SerializeField] + private UILabel _nextGradeNumLabel; + + [SerializeField] + private GameObject _openedBoxParts; + + [SerializeField] + private GameObject _notOpenedBoxParts; + + [SerializeField] + private UISprite _gaugeBackground; + + [SerializeField] + private UIButton _treasureBoxGradeUpMethodButton; + + [SerializeField] + private UISprite _arrowSprite; + + private readonly float[][] _memory_value = new float[5][] + { + new float[0], + new float[2] { 0f, 1f }, + new float[7] { 0f, 0.156f, 0.33f, 0.503f, 0.676f, 0.848f, 1f }, + new float[9] { 0f, 0.114f, 0.244f, 0.373f, 0.502f, 0.631f, 0.761f, 0.892f, 1f }, + new float[11] + { + 0f, 0.087f, 0.192f, 0.294f, 0.397f, 0.5f, 0.605f, 0.709f, 0.812f, 0.917f, + 1f + } + }; + + public static DialogBase CreateDialog() + { + SystemText systemText = Data.SystemText; + DialogBase dialog = UIManager.GetInstance().CreateDialogClose(); + dialog.SetButtonLayout(DialogBase.ButtonLayout.GrayBtn); + dialog.SetSize(DialogBase.Size.M); + dialog.SetButtonText(systemText.Get("TreasureBoxCp_0023")); + dialog.SetTitleLabel(systemText.Get("TreasureBoxCp_0001")); + GameObject gameObject = Object.Instantiate(LoadPrefab("UI/layoutParts/TreasureBoxCpDialog")); + TreasureBoxCpDialog treasureBoxCpDialog = gameObject.GetComponent(); + treasureBoxCpDialog._treasureBoxGradeUpMethodButton.onClick.Add(new EventDelegate(delegate + { + dialog.SetDisp(inDisp: false); + GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON); + treasureBoxCpDialog.CreateDetailDialog(dialog); + })); + treasureBoxCpDialog.SetData(); + dialog.SetObj(gameObject); + return dialog; + } + + private void CreateDetailDialog(DialogBase parentDialog) + { + SystemText systemText = Data.SystemText; + DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose(); + dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn); + dialogBase.SetSize(DialogBase.Size.M); + GameObject obj = Object.Instantiate(LoadPrefab("UI/layoutParts/TreasureBoxCpDetail")); + dialogBase.SetTitleLabel(systemText.Get("TreasureBoxCp_0007")); + dialogBase.SetObj(obj); + dialogBase.OnClose = delegate + { + if (parentDialog != null) + { + parentDialog.SetDisp(inDisp: true); + } + }; + if (RoomBase.GetInstance() != null) + { + RoomBase.GetInstance().TreasureCpGradeUpConditionDialog = dialogBase; + } + } + + private static GameObject LoadPrefab(string path) + { + PrefabMgr prefabMgr = GameMgr.GetIns().GetPrefabMgr(); + prefabMgr.Load(path); + return prefabMgr.Get(path); + } + + public void SetData() + { + _openedBoxParts.SetActive(value: false); + _notOpenedBoxParts.SetActive(value: false); + TreasureBoxCp data = Data.TreasureBoxCp; + _gradeGauge.Value = ((data.NextGrade == 0) ? 1f : _memory_value[data.NextGrade][data.CurrentMemory]); + _nextGradeLabel.text = Data.SystemText.Get("TreasureBoxCp_0005"); + int num = data.MaxMemory - data.CurrentMemory; + _nextGradeNumLabel.text = Data.SystemText.Get("TreasureBoxCp_0027", num.ToString()); + SetGaugeBackground(data.NextGrade, data.MaxGrade); + string atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null); + _loadFileList.Add(atlasName); + StartCoroutine(Toolbox.ResourcesManager.LoadAssetAsync(atlasName, delegate + { + atlasName = UIManager.GetInstance().GetSceneAssetPath(UIAtlasManager.AssetBundleNames.Arena, null, isload: true); + _arenaAtlas = Toolbox.ResourcesManager.LoadObject(atlasName).GetComponent(); + _currentBoxSprite.atlas = _arenaAtlas; + _nextBoxSprite.atlas = _arenaAtlas; + _openedBoxSprite.atlas = _arenaAtlas; + _gaugeBackground.atlas = _arenaAtlas; + _arrowSprite.atlas = _arenaAtlas; + if (data.IsTreasureBoxOpened) + { + _openedBoxSprite.spriteName = $"box_2pick_0{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[data.CurrentGrade]}_open"; + UIManager.SetObjectToGrey(_openedBoxSprite.gameObject, b: true); + _openedBoxParts.SetActive(value: true); + } + else + { + _currentBoxSprite.spriteName = $"box_2pick_0{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[data.CurrentGrade]}_close"; + _nextBoxSprite.spriteName = $"box_2pick_0{TreasureBoxCp.GRADE_TO_TREASURE_BOX_ID[data.NextGrade]}_close"; + _arrowSprite.spriteName = "arrow"; + _notOpenedBoxParts.SetActive(value: true); + } + for (int i = 0; i < _gradeStepSprites.Length; i++) + { + _gradeStepSprites[i].atlas = _arenaAtlas; + if (i < data.CurrentGrade) + { + _gradeStepSprites[i].spriteName = "icon_diamond_mark_on"; + } + else + { + _gradeStepSprites[i].spriteName = "icon_diamond_mark_off"; + } + } + })); + } + + private void SetGaugeBackground(int nextGrade, int maxGrade) + { + int num = ((nextGrade == 0) ? maxGrade : nextGrade); + _gaugeBackground.spriteName = $"gauge_bg_scale_{num}"; + } + + private void OnDestroy() + { + Toolbox.ResourcesManager.RemoveAssetGroup(_loadFileList); + _loadFileList.Clear(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TweenAnimation.cs b/SVSim.BattleEngine/Engine/Wizard/TweenAnimation.cs new file mode 100644 index 0000000..9123aea --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TweenAnimation.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System.Linq; +using UnityEngine; + +namespace Wizard; + +[ExecuteAlways] +public class TweenAnimation : MonoBehaviour +{ + [SerializeField] + private float _duration; + + private List _tweenList = new List(); + + private bool _isPlaying; + + public void Play() + { + _isPlaying = true; + CollectTween(); + SetupTweenParam(); + foreach (UITweener tween in _tweenList) + { + tween.ResetToBeginning(); + tween.PlayForward(); + tween.SetOnFinished(delegate + { + _isPlaying = false; + }); + } + } + + private void CollectTween() + { + _tweenList = base.gameObject.GetComponents().ToList(); + } + + private void SetupTweenParam() + { + foreach (UITweener tween in _tweenList) + { + tween.duration = _duration - tween.delay; + } + } + + public bool IsPlayEnd() + { + return !_isPlaying; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/TweenAnimationGroup.cs b/SVSim.BattleEngine/Engine/Wizard/TweenAnimationGroup.cs new file mode 100644 index 0000000..3171ba0 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/TweenAnimationGroup.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Cute; +using UnityEngine; + +namespace Wizard; + +[ExecuteAlways] +public class TweenAnimationGroup : MonoBehaviour +{ + private List _tweenAnimationList = new List(); + + [SerializeField] + private ParticleSystem _effect; + + [SerializeField] + private float _effectDelayTime; + + [SerializeField] + private GameObject[] _gameObjects; + + public void Play(Action onComplete) + { + CollectTweenAnimation(); + foreach (TweenAnimation tweenAnimation in _tweenAnimationList) + { + tweenAnimation.Play(); + } + if (UIManager.GetInstance() != null) + { + UIManager.GetInstance().StartCoroutine(OnPlayComplete(onComplete)); + UIManager.GetInstance().StartCoroutine(PlayEffect(_effectDelayTime)); + } + else + { + StartCoroutine(OnPlayComplete(onComplete)); + StartCoroutine(PlayEffect(_effectDelayTime)); + } + } + + private IEnumerator OnPlayComplete(Action onComplete) + { + if (onComplete != null) + { + while (!AnimationAllEnd()) + { + yield return null; + } + onComplete.Call(); + } + } + + private IEnumerator PlayEffect(float delay) + { + if (!(_effect == null)) + { + _effect.gameObject.SetActive(value: false); + _effect.gameObject.transform.position = base.gameObject.transform.position; + yield return new WaitForSeconds(delay); + _effect.gameObject.SetActive(value: true); + } + } + + private bool AnimationAllEnd() + { + bool flag = true; + foreach (TweenAnimation tweenAnimation in _tweenAnimationList) + { + flag &= tweenAnimation.IsPlayEnd(); + } + return flag; + } + + private void CollectTweenAnimation() + { + _tweenAnimationList = base.gameObject.GetComponentsInChildren().ToList(); + } + + public GameObject GetChildObject(int index) + { + if (index < _gameObjects.Length) + { + return _gameObjects[index]; + } + return null; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UIDestroyUtility.cs b/SVSim.BattleEngine/Engine/Wizard/UIDestroyUtility.cs new file mode 100644 index 0000000..dccac8a --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UIDestroyUtility.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace Wizard; + +public class UIDestroyUtility +{ + public static void RemoveChildren(Transform trans) + { + for (int num = trans.childCount - 1; num >= 0; num--) + { + Object.DestroyImmediate(trans.GetChild(num).gameObject); + } + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UIMarquee.cs b/SVSim.BattleEngine/Engine/Wizard/UIMarquee.cs new file mode 100644 index 0000000..56e85cc --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UIMarquee.cs @@ -0,0 +1,139 @@ +using UnityEngine; + +namespace Wizard; + +public class UIMarquee : MonoBehaviour +{ + private enum State + { + Stop, + WaitForMove, + Move, + Reappear + } + + [SerializeField] + [Range(0f, float.MaxValue)] + private float _secToStartMoving = 1.5f; + + [SerializeField] + [Range(0f, float.MaxValue)] + private float _movePerSec = 100f; + + [SerializeField] + [Range(0f, float.MaxValue)] + private float _secToReappear = 1.5f; + + [SerializeField] + private AnimationCurve _reappearCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f); + + [SerializeField] + [Range(0f, float.MaxValue)] + private float _widthOfNeedsToScroll = 256f; + + [SerializeField] + private UIPanel _panel; + + [SerializeField] + private UIWidget _content; + + private State _state; + + private float _timeCount; + + private float _startX; + + public void StartMarquee() + { + if ((float)_content.width < _widthOfNeedsToScroll) + { + SetState(State.Stop); + } + else + { + SetState(State.WaitForMove); + } + } + + public void Reset() + { + SetState(State.Stop); + SetAlpha(1f); + } + + public void SetWidthOfNeedsToScroll(float width) + { + _widthOfNeedsToScroll = width; + } + + public void SetDefaultWidthOfNeedsToScroll() + { + _widthOfNeedsToScroll = _panel.width; + } + + private void Update() + { + _timeCount += Time.deltaTime; + switch (_state) + { + case State.WaitForMove: + if (_timeCount >= _secToStartMoving) + { + SetState(State.Move); + } + break; + case State.Move: + if (IsScrollComplete()) + { + SetState(State.Reappear); + SetAlpha(0f); + } + else + { + SetContentPosX(_startX - _movePerSec * _timeCount); + } + break; + case State.Reappear: + SetAlpha(_reappearCurve.Evaluate(_timeCount / _secToReappear)); + if (_timeCount >= _secToReappear) + { + SetState(State.WaitForMove); + SetAlpha(1f); + } + break; + } + } + + private void SetState(State state) + { + _state = state; + _timeCount = 0f; + _panel.UpdateAnchors(); + _content.UpdateAnchors(); + _startX = CalcStartX(); + SetContentPosX(_startX); + } + + private float CalcStartX() + { + return _panel.baseClipRegion.x - _panel.baseClipRegion.z * 0.5f; + } + + private void SetContentPosX(float posX) + { + Transform obj = _content.transform; + Vector3 localPosition = obj.localPosition; + localPosition.x = posX; + obj.localPosition = localPosition; + } + + private bool IsScrollComplete() + { + return _content.transform.localPosition.x - _startX <= (float)(-_content.width); + } + + private void SetAlpha(float alpha) + { + _panel.alpha = alpha; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UnlimitedFormatBehavior.cs b/SVSim.BattleEngine/Engine/Wizard/UnlimitedFormatBehavior.cs new file mode 100644 index 0000000..6237ed1 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UnlimitedFormatBehavior.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Wizard.DeckCardEdit; + +namespace Wizard; + +public class UnlimitedFormatBehavior : IFormatBehavior +{ + public string Name => Data.SystemText.Get("Common_0155"); + + public string SmallIconSpriteName => "icon_unlimited_s"; + + public CardMaster.CardMasterId CardMasterId => CardMaster.CardMasterId.Default; + + public GenerateDeckCodeTask.SubmitDeckType DeckCodeType => GenerateDeckCodeTask.SubmitDeckType.NORMAL; + + public bool ExistsRestrictedCard => true; + + public List SortedDeckUsableCardList => CardMaster.GetInstance(CardMasterId).GetAllCardIds(); + + public int DeckCardNumMin => DeckCardNumMax; + + public int DeckCardNumMax => 40; + + public int DeckSameKindCardNumMax => 3; + + public int DeckSavableCardNumMax => 50; + + public bool IsShowDeckName => true; + + public bool IsEmphasizeDeckCardShortage => false; + + public bool IsEmphasizeDeckCardOverage => true; + + public bool IsSavableLastSelectDeck => true; + + public bool CanShowQRCode => true; + + public bool IsShowFirstTipsAtDeckEdit => true; + + public bool IsShowAutoDeckCreateButtonAtDeckEdit => true; + + public bool IsCraftableCardAtDeckEdit => true; + + public UIManager.ViewScene DeckEditBackScene => UIManager.ViewScene.DeckList; + + public Action DeckSaveFunc => null; + + public bool UseSubClass => false; + + public bool IsConventionMode => false; + + public List AvailableCardSetNameList => GetAvailableCardSetNameList(); + + public bool IsShowPrizeCardSetFilter => true; + + public bool IsShowPhantomCardSetFilter => false; + + public bool IsShowFormatFilter => false; + + public bool IsShowFavoriteFilter => true; + + public bool IsShowSpotCardFilter => GameMgr.GetIns().GetDataMgr().SpotCardData.ExistsSpotCard(); + + public bool IsEnableDeckShareButton(int cardNum, int cardNumMax) + { + return cardNum == DeckCardNumMax; + } + + public IDictionary GetCardPool(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetUserOwnCardData(isIncludingSpotCard); + } + + public Dictionary ClonePossessionCardDictionary(bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().ClonePossessionCardDictionary(isIncludingSpotCard); + } + + public int GetPossessionCardNum(int cardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionCardNum(cardId, isIncludingSpotCard); + } + + public int GetPossessionBaseCardNum(int baseCardId, bool isIncludingSpotCard) + { + return GameMgr.GetIns().GetDataMgr().GetPossessionBaseCardNum(baseCardId, isIncludingSpotCard, CardMasterId); + } + + private List GetAvailableCardSetNameList() + { + if (Prerelease.Status == Prerelease.eStatus.PRE_ROTATION) + { + string nextCardSetId = Prerelease.Instance.NextCardSetId.ToString(); + return (from setName in Data.Master.CardSetNameMgr.GetListBasicAndPack() + where setName.ID != nextCardSetId + select setName).ToList(); + } + return Data.Master.CardSetNameMgr.GetListBasicAndPack(); + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UserInfoBase.cs b/SVSim.BattleEngine/Engine/Wizard/UserInfoBase.cs new file mode 100644 index 0000000..5963ecf --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UserInfoBase.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using LitJson; +using UnityEngine; +using Wizard.RoomMatch; + +namespace Wizard; + +public abstract class UserInfoBase +{ + public int ViewerId { get; private set; } + + public string Name { get; private set; } + + public long EmblemId { get; private set; } + + public string CountryCode { get; private set; } + + public int Rank { get; private set; } + + public int DegreeId { get; private set; } + + public bool? IsFriend { get; private set; } + + public bool? IsFriendRequestSending { get; private set; } + + public bool IsSelf => ViewerId == PlayerStaticData.UserViewerID; + + public UserInfoBase(int viewerId, string name, long emblemId, string country, int rank, int degreeId, bool isFriend) + { + ViewerId = viewerId; + Name = name; + EmblemId = emblemId; + CountryCode = country; + Rank = rank; + DegreeId = degreeId; + IsFriend = isFriend; + } + + public UserInfoBase(JsonData json) + { + ViewerId = json["viewer_id"].ToInt(); + Name = json["name"].ToString(); + EmblemId = json["emblem_id"].ToLong(); + CountryCode = json["country_code"].ToString(); + Rank = json["rank"].ToInt(); + DegreeId = json["degree_id"].ToInt(); + if (json.Keys.Contains("is_friend")) + { + IsFriend = json["is_friend"].ToBoolean(); + } + if (json.Keys.Contains("is_friend_apply")) + { + IsFriendRequestSending = json["is_friend_apply"].ToBoolean(); + } + } + + public UserInfoBase(Player player) + { + ViewerId = player.ViewerId; + Name = player.Name; + EmblemId = player.Emblem; + CountryCode = player.Country; + Rank = player.Rank; + DegreeId = player.Degree; + IsFriend = player.IsFriend; + } + + public UserInfoBase(UserFriend friend) + { + ViewerId = friend.viewerId; + Name = friend.name; + EmblemId = friend.emblemId; + CountryCode = friend.countryCode; + Rank = friend.rank; + DegreeId = friend.degreeId; + IsFriend = friend.IsFriend; + } + + public abstract Texture GetUserEmblemTexture(); + + public abstract Texture GetUserRankTexture(); + + public abstract void InitializeDegreeTexture(UITexture texture); + + public abstract Texture GetUserCountryTexture(); + + public abstract List GetUserAssetPathList(); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/UtilityDrumrollItemCustomize.cs b/SVSim.BattleEngine/Engine/Wizard/UtilityDrumrollItemCustomize.cs new file mode 100644 index 0000000..6985a44 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/UtilityDrumrollItemCustomize.cs @@ -0,0 +1,10 @@ +using UnityEngine; + +namespace Wizard; + +public abstract class UtilityDrumrollItemCustomize : MonoBehaviour +{ + public abstract void OnUpdate(float angle, Color32 color); + + public abstract void OnInitialize(int index); +} diff --git a/SVSim.BattleEngine/Engine/Wizard/VoteDataTask.cs b/SVSim.BattleEngine/Engine/Wizard/VoteDataTask.cs new file mode 100644 index 0000000..d01d377 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/VoteDataTask.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; +using LitJson; + +namespace Wizard; + +public class VoteDataTask : BaseTask +{ + public class VoteDataTaskParam : BaseParam + { + public int vote_id; + } + + public VoteDataTask() + { + base.type = ApiType.Type.VoteData; + } + + public void SetParameter(int vote_id) + { + VoteDataTaskParam voteDataTaskParam = new VoteDataTaskParam(); + voteDataTaskParam.vote_id = vote_id; + base.Params = voteDataTaskParam; + } + + protected override int Parse() + { + int num = base.Parse(); + if (num != 1) + { + return num; + } + Data.VoteInfo = new VoteData(); + Data.VoteInfo.is_vote = base.ResponseData["data"]["is_vote"].ToBoolean(); + if (base.ResponseData["data"].Keys.Contains("vote_name")) + { + Data.VoteInfo.vote_name = base.ResponseData["data"]["vote_name"].ToString(); + } + JsonData jsonData = base.ResponseData["data"]["vote_info"]; + Data.VoteInfo.title_text = jsonData["title_text"].ToString(); + Data.VoteInfo.before_content_text = jsonData["before_content_text"].ToString().Replace("/n", "\n"); + Data.VoteInfo.after_content_text = jsonData["after_content_text"].ToString().Replace("/n", "\n"); + Data.VoteInfo.tweet_text = jsonData["tweet_text"].ToString(); + Data.VoteInfo.tweet_tag = jsonData["tweet_tag"].ToString(); + Data.VoteInfo.tweet_url = jsonData["tweet_url"].ToString(); + Data.VoteInfo.tweet_image = jsonData["tweet_image"].ToString(); + JsonData jsonData2 = base.ResponseData["data"]["vote_list"]; + Data.VoteInfo.vote_target_list = new Dictionary(); + for (int i = 0; i < jsonData2.Count; i++) + { + Data.VoteInfo.vote_target_list.Add(jsonData2[i]["target_id"].ToInt(), jsonData2[i]["vote_name"].ToString()); + } + return num; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/VoteTask.cs b/SVSim.BattleEngine/Engine/Wizard/VoteTask.cs new file mode 100644 index 0000000..ff48541 --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/VoteTask.cs @@ -0,0 +1,24 @@ +namespace Wizard; + +public class VoteTask : BaseTask +{ + public class VoteTaskParam : BaseParam + { + public int vote_id; + + public int target_id; + } + + public VoteTask() + { + base.type = ApiType.Type.Vote; + } + + public void SetParameter(int voteId, int targetId) + { + VoteTaskParam voteTaskParam = new VoteTaskParam(); + voteTaskParam.vote_id = voteId; + voteTaskParam.target_id = targetId; + base.Params = voteTaskParam; + } +} diff --git a/SVSim.BattleEngine/Engine/Wizard/WizardFirebase.cs b/SVSim.BattleEngine/Engine/Wizard/WizardFirebase.cs new file mode 100644 index 0000000..3a1b8ee --- /dev/null +++ b/SVSim.BattleEngine/Engine/Wizard/WizardFirebase.cs @@ -0,0 +1,20 @@ +namespace Wizard; + +public class WizardFirebase +{ + public static bool IsEnable => false; + + public static void OnBootSystem() + { + UpdateFirebaseEnable(); + } + + private static void UpdateFirebaseEnable() + { + } + + public static void OnChangeDataUseEnable() + { + UpdateFirebaseEnable(); + } +} diff --git a/SVSim.BattleEngine/Engine/WrapContentsScrollBarSizeByDirection.cs b/SVSim.BattleEngine/Engine/WrapContentsScrollBarSizeByDirection.cs new file mode 100644 index 0000000..aa5ba1a --- /dev/null +++ b/SVSim.BattleEngine/Engine/WrapContentsScrollBarSizeByDirection.cs @@ -0,0 +1,48 @@ +using UnityEngine; + +public class WrapContentsScrollBarSizeByDirection : MonoBehaviour +{ + [SerializeField] + private UIScrollView _scrollView; + + [SerializeField] + private UIWrapContent _wrapContent; + + private UIWidget _uiWidget; + + private void Start() + { + ContentUpdate(); + } + + public void ContentUpdate() + { + if (_uiWidget == null) + { + SetUpUIWidget(); + } + _uiWidget.pivot = UIWidget.Pivot.TopLeft; + int num = _wrapContent.itemSize * (Mathf.Abs(_wrapContent.minIndex - _wrapContent.maxIndex) + 1); + float num2 = (float)_wrapContent.itemSize / 2f; + switch (_scrollView.movement) + { + case UIScrollView.Movement.Vertical: + _uiWidget.height = num; + base.transform.localPosition = new Vector3(0f, num2, 0f); + break; + case UIScrollView.Movement.Horizontal: + _uiWidget.width = num; + base.transform.localPosition = new Vector3(0f - num2, 0f, 0f); + break; + } + } + + private void SetUpUIWidget() + { + _uiWidget = base.gameObject.GetComponent(); + if (_uiWidget == null) + { + _uiWidget = base.gameObject.AddComponent(); + } + } +} diff --git a/SVSim.BattleEngine/Engine/WrapVariableContentsScrollBarSize.cs b/SVSim.BattleEngine/Engine/WrapVariableContentsScrollBarSize.cs new file mode 100644 index 0000000..2bf5031 --- /dev/null +++ b/SVSim.BattleEngine/Engine/WrapVariableContentsScrollBarSize.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +public class WrapVariableContentsScrollBarSize : MonoBehaviour +{ + public UIWrapVariableContentVertical wrapContent; + + private void Start() + { + ContentUpdate(); + } + + public void ContentUpdate() + { + UIWidget uIWidget = base.gameObject.GetComponent(); + if (uIWidget == null) + { + uIWidget = base.gameObject.AddComponent(); + } + int num = 0; + for (int i = 0; i < wrapContent.ItemParamList.Count; i++) + { + num += wrapContent.ItemParamList[i].Size; + } + uIWidget.height = num; + uIWidget.pivot = UIWidget.Pivot.Top; + Vector3 localPosition = Vector3.zero; + if (wrapContent.ItemParamList.Count > 0) + { + float position = wrapContent.ItemParamList[0].Position; + localPosition = new Vector3(localPosition.x, position, localPosition.z); + } + base.transform.localPosition = localPosition; + } +}