diff --git a/nekoyume/Assets/Resources/AddressableAssetsContainer.asset b/nekoyume/Assets/Resources/AddressableAssetsContainer.asset index 85932035a66..b2e69b0b8ee 100644 --- a/nekoyume/Assets/Resources/AddressableAssetsContainer.asset +++ b/nekoyume/Assets/Resources/AddressableAssetsContainer.asset @@ -126,3 +126,4 @@ MonoBehaviour: - {fileID: 4900000, guid: 7d9d5820f221437094f1f72a78d12790, type: 3} - {fileID: 4900000, guid: 92bd59b6eadf47443ae612f44eb2a8d9, type: 3} - {fileID: 4900000, guid: 9ce4b6514480fcc47b5c05de6cbe7657, type: 3} + - {fileID: 4900000, guid: 92ae4e6336725f74a8475d848cd18510, type: 3} diff --git a/nekoyume/Assets/Resources/ScriptableObject/UI_PatrolRewardData.asset b/nekoyume/Assets/Resources/ScriptableObject/UI_PatrolRewardData.asset deleted file mode 100644 index 8642fc23250..00000000000 --- a/nekoyume/Assets/Resources/ScriptableObject/UI_PatrolRewardData.asset +++ /dev/null @@ -1,24 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 606157be58c14d7681c049185f7de0ae, type: 3} - m_Name: UI_PatrolRewardData - m_EditorClassIdentifier: - fallbackIconSprite: {fileID: 21300000, guid: d444b12d0440a264f97070116f8ba54e, type: 3} - iconList: - - Level: 0 - IconSprite: {fileID: 21300000, guid: d444b12d0440a264f97070116f8ba54e, type: 3} - - Level: 1 - IconSprite: {fileID: 21300000, guid: 3a4de4fd4b3809e4dbfb9a445f47a39d, type: 3} - - Level: 2 - IconSprite: {fileID: 21300000, guid: 6c1d261c785e47d45aa1930f4d5ff658, type: 3} - - Level: 3 - IconSprite: {fileID: 21300000, guid: 4906883aea275b14aaeef0c1fec4c339, type: 3} diff --git a/nekoyume/Assets/Resources/ScriptableObject/UI_PatrolRewardData.asset.meta b/nekoyume/Assets/Resources/ScriptableObject/UI_PatrolRewardData.asset.meta deleted file mode 100644 index 6174de900dd..00000000000 --- a/nekoyume/Assets/Resources/ScriptableObject/UI_PatrolRewardData.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e718cafc25a7b2f4392845c64d218de1 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/nekoyume/Assets/Resources/SpriteAtlases/Background/MainMenu.spriteatlas b/nekoyume/Assets/Resources/SpriteAtlases/Background/MainMenu.spriteatlas index 6f83a60f8f8..8a76e85eaa3 100644 --- a/nekoyume/Assets/Resources/SpriteAtlases/Background/MainMenu.spriteatlas +++ b/nekoyume/Assets/Resources/SpriteAtlases/Background/MainMenu.spriteatlas @@ -187,7 +187,6 @@ SpriteAtlas: - {fileID: 21300000, guid: 001e252a3c854354b941a4745381f383, type: 3} - {fileID: 21300000, guid: 9b87562abef3acb4caa1fd440c5b56e9, type: 3} - {fileID: 21300000, guid: b0f0d13a905e14ae2b9d05c821ebb219, type: 3} - - {fileID: 21300000, guid: 4906883aea275b14aaeef0c1fec4c339, type: 3} - {fileID: 21300000, guid: bc221f3aa2559334aa5f9ed7ca265c35, type: 3} - {fileID: 21300000, guid: 013bb45a1b22d9746b3e6d571cd65735, type: 3} - {fileID: 21300000, guid: 1402b85ae950dd64f911cea59c53d8f9, type: 3} @@ -212,7 +211,6 @@ SpriteAtlas: - {fileID: 21300000, guid: 366d0aeb2efb36d42a500592a8aebb20, type: 3} - {fileID: 21300000, guid: 6ca32ceba2e2078489c75609c4604799, type: 3} - {fileID: 21300000, guid: 6b91210c23919614c818c79210422a62, type: 3} - - {fileID: 21300000, guid: 6c1d261c785e47d45aa1930f4d5ff658, type: 3} - {fileID: 21300000, guid: 26b4c42c1577349f59de21b50e614bd3, type: 3} - {fileID: 21300000, guid: 0e66033c6157a22488196fa0c48dc551, type: 3} - {fileID: 21300000, guid: c9d24d3c97fef4406ba2153335608c65, type: 3} @@ -223,7 +221,6 @@ SpriteAtlas: - {fileID: 21300000, guid: 558359dc5133443d28fbec9eec6d4fe6, type: 3} - {fileID: 21300000, guid: 065d16ec339c24783a27694953b6c2da, type: 3} - {fileID: 21300000, guid: 208db90d9bffe8946a3b558fc0216939, type: 3} - - {fileID: 21300000, guid: d444b12d0440a264f97070116f8ba54e, type: 3} - {fileID: 21300000, guid: 70d1443db16d2ec49a61f893dd46888b, type: 3} - {fileID: 21300000, guid: 62f1404db9387224ab831ae46092ab38, type: 3} - {fileID: 21300000, guid: 6543e94d8c1874b72a2d3a5265dd548a, type: 3} @@ -235,7 +232,6 @@ SpriteAtlas: - {fileID: 21300000, guid: db11b5cda8ec3b245bac2b7d3a6035b3, type: 3} - {fileID: 21300000, guid: 1af2d6cdc26dc4009877e1775ce923f0, type: 3} - {fileID: 21300000, guid: 189118edb1599534787fd2ed6563ff52, type: 3} - - {fileID: 21300000, guid: 3a4de4fd4b3809e4dbfb9a445f47a39d, type: 3} - {fileID: 21300000, guid: 0db7990e056098c49aa96802f8de723e, type: 3} - {fileID: 21300000, guid: a665b81e6c2bba148ab21c8cf7b4af63, type: 3} - {fileID: 21300000, guid: b227014e230f5514e940db305d2fab34, type: 3} @@ -399,7 +395,6 @@ SpriteAtlas: - Main_Patrol_01 - worldboss_02 - Main_rock_03 - - PatrolReward_00 - bg_character_main_07 - shop_02_01 - bg_xmas_tree_02_light_03 @@ -424,7 +419,6 @@ SpriteAtlas: - UI_icon_Speech_08 - shop_01 - Staking_00 - - PatrolReward_03 - bg_valentine_bg_03_Eff - Main_leaf_05 - Main_Cloud_04 @@ -435,7 +429,6 @@ SpriteAtlas: - Main_rock_02 - Main_Leaf_09 - Icon_Seasonpass_s_1 - - PatrolReward_01 - bg_character_main_08 - worldboss_03_Chain_Front_4 - Menu_Season_bg_02 @@ -447,7 +440,6 @@ SpriteAtlas: - bg_xmas_Island_01 - Main_Leaf_08 - Main_tower_08 - - PatrolReward_02 - Main_Staking - worldboss_01 - worldboss_03_Chain_Back_5 diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_00.png b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_00.png deleted file mode 100644 index 4057c7bbd0f..00000000000 Binary files a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_00.png and /dev/null differ diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_00.png.meta b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_00.png.meta deleted file mode 100644 index d49606ead36..00000000000 --- a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_00.png.meta +++ /dev/null @@ -1,147 +0,0 @@ -fileFormatVersion: 2 -guid: 4906883aea275b14aaeef0c1fec4c339 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 12 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMasterTextureLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 1 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 8 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - cookieLightType: 1 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: iPhone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 50 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Android - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 47 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Server - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: 5e97eb03825dee720800000000000000 - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_01.png b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_01.png deleted file mode 100644 index c68a8d6c764..00000000000 Binary files a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_01.png and /dev/null differ diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_01.png.meta b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_01.png.meta deleted file mode 100644 index cf9caa90179..00000000000 --- a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_01.png.meta +++ /dev/null @@ -1,147 +0,0 @@ -fileFormatVersion: 2 -guid: d444b12d0440a264f97070116f8ba54e -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 12 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMasterTextureLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 1 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 8 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - cookieLightType: 1 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: iPhone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 50 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Android - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 47 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Server - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: 5e97eb03825dee720800000000000000 - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_02.png b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_02.png deleted file mode 100644 index 63a441ca0d0..00000000000 Binary files a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_02.png and /dev/null differ diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_02.png.meta b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_02.png.meta deleted file mode 100644 index 3cc1c9f6a1e..00000000000 --- a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_02.png.meta +++ /dev/null @@ -1,147 +0,0 @@ -fileFormatVersion: 2 -guid: 3a4de4fd4b3809e4dbfb9a445f47a39d -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 12 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMasterTextureLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 1 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 8 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - cookieLightType: 1 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: iPhone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 50 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Android - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 47 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Server - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: 5e97eb03825dee720800000000000000 - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_03.png b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_03.png deleted file mode 100644 index 0562a534579..00000000000 Binary files a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_03.png and /dev/null differ diff --git a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_03.png.meta b/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_03.png.meta deleted file mode 100644 index 7c6fc98b26d..00000000000 --- a/nekoyume/Assets/Sprites/Background/MainMenu/Object/PatrolReward_03.png.meta +++ /dev/null @@ -1,147 +0,0 @@ -fileFormatVersion: 2 -guid: 6c1d261c785e47d45aa1930f4d5ff658 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 12 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMasterTextureLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 1 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 8 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - cookieLightType: 1 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: iPhone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 50 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Android - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 47 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Server - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: 5e97eb03825dee720800000000000000 - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - nameFileIdTable: {} - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/nekoyume/Assets/_Scripts/ApiClient/ApiClients.cs b/nekoyume/Assets/_Scripts/ApiClient/ApiClients.cs index 5213140a48b..cc2926d27e2 100644 --- a/nekoyume/Assets/_Scripts/ApiClient/ApiClients.cs +++ b/nekoyume/Assets/_Scripts/ApiClient/ApiClients.cs @@ -27,8 +27,6 @@ private static class Singleton public MarketServiceClient MarketServiceClient { get; private set; } - public NineChroniclesAPIClient PatrolRewardServiceClient { get; private set; } - public SeasonPassServiceManager SeasonPassServiceManager { get; private set; } // Game.IAPStoreManager와 기능 정리 가능할지도? @@ -61,7 +59,6 @@ public void Initialize(CommandLineOptions clo) ArenaServiceClient = new NineChroniclesAPIClient(clo.ArenaServiceHost); WorldBossQuery.SetUrl(clo.OnBoardingHost); MarketServiceClient = new MarketServiceClient(clo.MarketServiceHost); - PatrolRewardServiceClient = new NineChroniclesAPIClient(clo.PatrolRewardServiceHost); SeasonPassServiceManager = new SeasonPassServiceManager(clo.SeasonPassServiceHost); ApplySeasonPassMarketUrl(clo); diff --git a/nekoyume/Assets/_Scripts/ApiClient/PatrolRewardQuery.cs b/nekoyume/Assets/_Scripts/ApiClient/PatrolRewardQuery.cs deleted file mode 100644 index 4fab0e0ee2e..00000000000 --- a/nekoyume/Assets/_Scripts/ApiClient/PatrolRewardQuery.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System.Threading.Tasks; -using Nekoyume.UI.Model; - -namespace Nekoyume.ApiClient -{ - public static class PatrolRewardQuery - { - public static async Task<(AvatarModel, PolicyModel)> InitializeInformation(string avatarAddress, string agentAddress, int level) - { - var serviceClient = ApiClients.Instance.PatrolRewardServiceClient; - if (!serviceClient.IsInitialized) - { - return (null, null); - } - - var query = - $@"query {{ - avatar(avatarAddress: ""{avatarAddress}"", agentAddress: ""{agentAddress}"") {{ - avatarAddress - agentAddress - createdAt - lastClaimedAt - level - }} - policy(level: {level}, free: true) {{ - activate - minimumLevel - maxLevel - minimumRequiredInterval - rewards {{ - ... on FungibleAssetValueRewardModel {{ - currency - perInterval - rewardInterval - }} - ... on FungibleItemRewardModel {{ - itemId - perInterval - rewardInterval - }} - }} - }} -}}"; - - var response = await serviceClient.GetObjectAsync(query); - if (response is null) - { - NcDebug.LogError($"Failed getting response : {nameof(InitializeResponse)}"); - return (null, null); - } - - if (response.Policy is null) - { - NcDebug.LogError($"Failed getting response : {nameof(PolicyResponse.Policy)}"); - } - - return (response.Avatar ?? await PutAvatar(avatarAddress, agentAddress), response.Policy); - } - - public static async Task LoadAvatarInfo(string avatarAddress, string agentAddress) - { - var serviceClient = ApiClients.Instance.PatrolRewardServiceClient; - if (!serviceClient.IsInitialized) - { - return null; - } - - var query = $@"query {{ - avatar(avatarAddress: ""{avatarAddress}"", agentAddress: ""{agentAddress}"") {{ - avatarAddress - agentAddress - createdAt - lastClaimedAt - level - }} - }}"; - - var response = await serviceClient.GetObjectAsync(query); - if (response is null) - { - NcDebug.LogError($"Failed getting response : {nameof(AvatarResponse)}"); - return null; - } - - return response.Avatar ?? await PutAvatar(avatarAddress, agentAddress); - } - - public static async Task LoadPolicyInfo(int level, bool free = true) - { - var serviceClient = ApiClients.Instance.PatrolRewardServiceClient; - if (!serviceClient.IsInitialized) - { - return null; - } - - var query = - $@"query {{ - policy(level: {level}, free: true) {{ - activate - minimumLevel - maxLevel - minimumRequiredInterval - rewards {{ - ... on FungibleAssetValueRewardModel {{ - currency - perInterval - rewardInterval - }} - ... on FungibleItemRewardModel {{ - itemId - perInterval - rewardInterval - }} - }} - }} -}}"; - - var response = await serviceClient.GetObjectAsync(query); - if (response is null) - { - NcDebug.LogError($"Failed getting response : {nameof(PolicyResponse)}"); - return null; - } - - if (response.Policy is null) - { - NcDebug.LogError($"Failed getting response : {nameof(PolicyResponse.Policy)}"); - } - - return response.Policy; - } - - public static async Task ClaimReward(string avatarAddress, string agentAddress) - { - var serviceClient = ApiClients.Instance.PatrolRewardServiceClient; - if (!serviceClient.IsInitialized) - { - return null; - } - - var query = - $@"mutation {{ - claim(avatarAddress: ""{avatarAddress}"", agentAddress: ""{agentAddress}"") -}}"; - - var response = await serviceClient.GetObjectAsync(query); - if (response is null) - { - NcDebug.LogError($"Failed getting response : {nameof(ClaimResponse)}"); - return null; - } - - if (response.Claim is null) - { - NcDebug.LogError($"Failed getting response : {nameof(ClaimResponse.Claim)}"); - } - - return response.Claim; - } - - private static async Task PutAvatar(string avatarAddress, string agentAddress) - { - var serviceClient = ApiClients.Instance.PatrolRewardServiceClient; - if (!serviceClient.IsInitialized) - { - return null; - } - - var query = - $@"mutation {{ - putAvatar(avatarAddress: ""{avatarAddress}"", agentAddress: ""{agentAddress}"") {{ - avatarAddress - agentAddress - createdAt - lastClaimedAt - level - }} -}}"; - - var response = await serviceClient.GetObjectAsync(query); - if (response is null) - { - NcDebug.LogError($"Failed getting response : {nameof(PutAvatarResponse)}"); - return null; - } - - if (response.PutAvatar is null) - { - NcDebug.LogError($"Failed getting response : {nameof(PutAvatarResponse.PutAvatar)}"); - } - - return response.PutAvatar; - } - } -} diff --git a/nekoyume/Assets/_Scripts/ApiClient/PatrolRewardQuery.cs.meta b/nekoyume/Assets/_Scripts/ApiClient/PatrolRewardQuery.cs.meta deleted file mode 100644 index c92b30503d8..00000000000 --- a/nekoyume/Assets/_Scripts/ApiClient/PatrolRewardQuery.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: b9282ecd12ae45d29d943c2c5533e548 -timeCreated: 1729589725 \ No newline at end of file diff --git a/nekoyume/Assets/_Scripts/Blockchain/ActionManager.cs b/nekoyume/Assets/_Scripts/Blockchain/ActionManager.cs index 362d2607cd9..943452cb0b4 100644 --- a/nekoyume/Assets/_Scripts/Blockchain/ActionManager.cs +++ b/nekoyume/Assets/_Scripts/Blockchain/ActionManager.cs @@ -1934,6 +1934,18 @@ public IObservable> CustomEquipmentCraft( .DoOnError(e => HandleException(null, e)); } + public IObservable> ClaimPatrolReward() + { + var action = new ClaimPatrolReward(States.Instance.CurrentAvatarState.address); + ProcessAction(action); + return _agent.ActionRenderer.EveryRender() + .Timeout(ActionTimeout) + .Where(eval => eval.Action.PlainValue.Equals(action.PlainValue)) + .First() + .ObserveOnMainThread() + .DoOnError(e => HandleException(null, e)); + } + #if UNITY_EDITOR || LIB9C_DEV_EXTENSIONS public IObservable> CreateTestbed() { diff --git a/nekoyume/Assets/_Scripts/Blockchain/ActionRenderHandler.cs b/nekoyume/Assets/_Scripts/Blockchain/ActionRenderHandler.cs index a1fe977aaca..cb4868ac97c 100644 --- a/nekoyume/Assets/_Scripts/Blockchain/ActionRenderHandler.cs +++ b/nekoyume/Assets/_Scripts/Blockchain/ActionRenderHandler.cs @@ -212,6 +212,7 @@ public override void Start(ActionRenderer renderer) // Claim Items ClaimItems(); + ClaimPatrolReward(); // Mint Assets MintAssets(); @@ -4614,6 +4615,88 @@ private void ResponseCustomEquipmentCraft((ActionEvaluation() + .ObserveOn(Scheduler.ThreadPool) + .Where(eval => + eval.Action.AvatarAddress.Equals(States.Instance?.CurrentAvatarState?.address)) + .Where(ValidateEvaluationIsSuccess) + .Select(PrepareClaimPatrolReward) + .ObserveOnMainThread() + .Subscribe(ResponseClaimPatrolReward) + .AddTo(_disposables); + + _actionRenderer.EveryRender() + .ObserveOn(Scheduler.ThreadPool) + .Where(ValidateEvaluationForCurrentAgent) + .Where(ValidateEvaluationIsTerminated) + .ObserveOnMainThread() + .Subscribe(ExceptionClaimPatrolReward) + .AddTo(_disposables); + } + + private (ActionEvaluation, PatrolRewardMail, AvatarState) PrepareClaimPatrolReward(ActionEvaluation eval) + { + var gameStates = Game.Game.instance.States; + var agentAddr = gameStates.AgentState.address; + var avatarAddr = gameStates.CurrentAvatarState.address; + var states = eval.OutputState; + var avatarState = StateGetter.GetAvatarState(states, avatarAddr); + var mailBox = avatarState.mailBox; + UpdateCurrentAvatarStateAsync(avatarState).Forget(); + var mail = mailBox.OfType() + .First(r => r.blockIndex == eval.BlockIndex); + foreach (var fav in mail.FungibleAssetValues) + { + var currency = fav.Currency; + var recipientAddress = Currencies.PickAddress(currency, agentAddr, + avatarAddr); + var isCrystal = currency.Equals(Currencies.Crystal); + var balance = StateGetter.GetBalance( + states, + recipientAddress, + currency); + if (isCrystal) + { + gameStates.SetCrystalBalance(balance); + } + else + { + gameStates.SetCurrentAvatarBalance(balance); + } + } + ReactiveAvatarState.UpdatePatrolRewardClaimedBlockIndex(eval.BlockIndex); + + return (eval, mail, avatarState); + } + + private void ResponseClaimPatrolReward((ActionEvaluation eval, PatrolRewardMail mail, AvatarState avatarState) prepared) + { + var eval = prepared.eval; + if (eval.Exception is not null) + { + NcDebug.Log(eval.Exception.Message); + OneLineSystem.Push( + MailType.System, + L10nManager.Localize("NOTIFICATION_PATROL_REWARD_CLAIMED_FAILE"), + NotificationCell.NotificationType.Alert); + return; + } + LocalLayerModifier.AddNewMail(prepared.avatarState, prepared.mail.id); + OneLineSystem.Push( + MailType.System, + L10nManager.Localize("NOTIFICATION_PATROL_REWARD_CLAIMED"), + NotificationCell.NotificationType.Notification); + PatrolReward.Claiming.Value = false; + } + + private void ExceptionClaimPatrolReward(ActionEvaluation eval) + { + PatrolReward.Claiming.Value = false; + } + /// /// 정확한 전투 재현을 위해 관련 상태를 모두 PreviousState로 가져와서 갱신합니다. /// 여기엔 AvatarState, AllRuneState, CollectionState가 해당됩니다. diff --git a/nekoyume/Assets/_Scripts/Blockchain/StateGetter.cs b/nekoyume/Assets/_Scripts/Blockchain/StateGetter.cs index db5a1a5f83a..abf5506cff0 100644 --- a/nekoyume/Assets/_Scripts/Blockchain/StateGetter.cs +++ b/nekoyume/Assets/_Scripts/Blockchain/StateGetter.cs @@ -3,6 +3,7 @@ using System.Globalization; using System.Linq; using System.Security.Cryptography; +using System.Threading.Tasks; using Bencodex.Types; using Libplanet.Action.State; using Libplanet.Common; @@ -282,5 +283,14 @@ public static MailBox GetMailBox( return new MailBox(mailBoxList); } + + public static async Task GetPatrolRewardReceivedBlockIndex(HashDigest + hash, Address avatarAddress) + { + var state = await Game.Game.instance.Agent.GetStateAsync(hash, Addresses.PatrolReward, avatarAddress); + return state is Integer index + ? index + : 0L; + } } } diff --git a/nekoyume/Assets/_Scripts/Extensions/LocalizationExtensions.cs b/nekoyume/Assets/_Scripts/Extensions/LocalizationExtensions.cs index 8a8d3b1a20c..b2db518a2d9 100644 --- a/nekoyume/Assets/_Scripts/Extensions/LocalizationExtensions.cs +++ b/nekoyume/Assets/_Scripts/Extensions/LocalizationExtensions.cs @@ -261,6 +261,8 @@ public static async Task ToInfo(this MailModel mail) GetLocalizedNonColoredName( customCraftMail.Equipment, customCraftMail.Equipment.ItemType.HasElementType())); + case PatrolRewardMail _: + return L10nManager.Localize("NOTIFICATION_PATROL_REWARD_CLAIMED"); default: throw new NotSupportedException( $"Given mail[{mail}] doesn't support {nameof(ToInfo)}() method."); diff --git a/nekoyume/Assets/_Scripts/Game/ScriptableObject/PatrolRewardDataScriptableObject.cs b/nekoyume/Assets/_Scripts/Game/ScriptableObject/PatrolRewardDataScriptableObject.cs deleted file mode 100644 index e19c57f2aca..00000000000 --- a/nekoyume/Assets/_Scripts/Game/ScriptableObject/PatrolRewardDataScriptableObject.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace Nekoyume -{ - [CreateAssetMenu(fileName = "UI_PatrolRewardData", menuName = "Scriptable Object/Patrol Reward Data", - order = int.MaxValue)] - public class PatrolRewardDataScriptableObject : ScriptableObject - { - [SerializeField] - private Sprite fallbackIconSprite; - - [SerializeField] - private List iconList; - - [Serializable] - private struct IconData - { - public int Level; - public Sprite IconSprite; - } - - public Sprite GetIcon(int level) - { - var data = iconList.Find(x => x.Level == level); - - return data.IconSprite ? data.IconSprite : fallbackIconSprite; - } - } -} diff --git a/nekoyume/Assets/_Scripts/Game/ScriptableObject/PatrolRewardDataScriptableObject.cs.meta b/nekoyume/Assets/_Scripts/Game/ScriptableObject/PatrolRewardDataScriptableObject.cs.meta deleted file mode 100644 index 4b727f12d64..00000000000 --- a/nekoyume/Assets/_Scripts/Game/ScriptableObject/PatrolRewardDataScriptableObject.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 606157be58c14d7681c049185f7de0ae -timeCreated: 1694744151 \ No newline at end of file diff --git a/nekoyume/Assets/_Scripts/Game/TableSheets.cs b/nekoyume/Assets/_Scripts/Game/TableSheets.cs index 457bd9434cb..fdc3d017c99 100644 --- a/nekoyume/Assets/_Scripts/Game/TableSheets.cs +++ b/nekoyume/Assets/_Scripts/Game/TableSheets.cs @@ -296,6 +296,9 @@ private void Initialize(IDictionary sheets) public CustomEquipmentCraftRecipeSkillSheet CustomEquipmentCraftRecipeSkillSheet { get; private set; } public ClaimableGiftsSheet ClaimableGiftsSheet { get; private set; } + [UsedImplicitly] + public PatrolRewardSheet PatrolRewardSheet { get; private set; } + [UsedImplicitly] public SynthesizeSheet SynthesizeSheet { get; private set; } diff --git a/nekoyume/Assets/_Scripts/Game/Util/IngameDebugConsoleCommands.cs b/nekoyume/Assets/_Scripts/Game/Util/IngameDebugConsoleCommands.cs index dc33a0ae347..e1045a812a6 100644 --- a/nekoyume/Assets/_Scripts/Game/Util/IngameDebugConsoleCommands.cs +++ b/nekoyume/Assets/_Scripts/Game/Util/IngameDebugConsoleCommands.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Reactive.Linq; using Nekoyume.ApiClient; +using Nekoyume.State; namespace Nekoyume.Game.Util { @@ -88,8 +89,7 @@ public static void Initailize() DebugLogConsole.AddCommand("patrol-avatar", "Sync patrol reward avatar info", () => { var avatarAddress = Game.instance.States.CurrentAvatarState.address; - var agentAddress = Game.instance.States.AgentState.address; - PatrolReward.LoadAvatarInfo(avatarAddress.ToHex(), agentAddress.ToHex()); + PatrolReward.LoadAvatarInfo(avatarAddress, ReactiveAvatarState.PatrolRewardClaimedBlockIndex); }); DebugLogConsole.AddCommand("adventureboss-info", "Clear Screen", () => diff --git a/nekoyume/Assets/_Scripts/Helper/CommandLineOptions.cs b/nekoyume/Assets/_Scripts/Helper/CommandLineOptions.cs index 25fb15e9a4c..c1088a38d88 100644 --- a/nekoyume/Assets/_Scripts/Helper/CommandLineOptions.cs +++ b/nekoyume/Assets/_Scripts/Helper/CommandLineOptions.cs @@ -98,8 +98,6 @@ public class CommandLineOptions private string _arenaServiceHost; - private string _patrolRewardServiceHost; - private string _seasonPassServiceHost; private string _googleMarketUrl; @@ -117,7 +115,7 @@ public class CommandLineOptions private bool _mixpanelDebugError; private bool _mixpanelDebugAssert; - + private bool _mixpanelDebugException; private bool _mixpanelDebugWarning; @@ -536,17 +534,6 @@ public string ArenaServiceHost } } - [Option("patrol-reward-service-host", Required = false, HelpText = "patrol reward service host")] - public string PatrolRewardServiceHost - { - get => _patrolRewardServiceHost; - set - { - _patrolRewardServiceHost = value; - Empty = false; - } - } - [Option("season-pass-service-host", Required = false, HelpText = "season pass service host")] public string SeasonPassServiceHost { diff --git a/nekoyume/Assets/_Scripts/Lib9c/lib9c b/nekoyume/Assets/_Scripts/Lib9c/lib9c index bfcfe43e1d7..5dc3e6d1229 160000 --- a/nekoyume/Assets/_Scripts/Lib9c/lib9c +++ b/nekoyume/Assets/_Scripts/Lib9c/lib9c @@ -1 +1 @@ -Subproject commit bfcfe43e1d7d6ee6f2c54bd93f20f27a65ea352c +Subproject commit 5dc3e6d12295ada5bb512b871ff6d7616ee8937c diff --git a/nekoyume/Assets/_Scripts/Multiplanetary/PlanetSelector.cs b/nekoyume/Assets/_Scripts/Multiplanetary/PlanetSelector.cs index f02b24f3882..6625f67baa4 100644 --- a/nekoyume/Assets/_Scripts/Multiplanetary/PlanetSelector.cs +++ b/nekoyume/Assets/_Scripts/Multiplanetary/PlanetSelector.cs @@ -364,9 +364,6 @@ private static PlanetContext UpdateCommandLineOptions(PlanetContext context) clo.OnBoardingHost = rpcEndpoints.WorldBossRest.Count > 0 ? rpcEndpoints.WorldBossRest[Random.Range(0, rpcEndpoints.WorldBossRest.Count)] : null; - clo.PatrolRewardServiceHost = rpcEndpoints.PatrolRewardGql.Count > 0 - ? rpcEndpoints.PatrolRewardGql[Random.Range(0, rpcEndpoints.PatrolRewardGql.Count)] - : null; clo.ArenaServiceHost = rpcEndpoints.ArenaGql.Count > 0 ? rpcEndpoints.ArenaGql[Random.Range(0, rpcEndpoints.ArenaGql.Count)] : null; diff --git a/nekoyume/Assets/_Scripts/State/ReactiveAvatarState.cs b/nekoyume/Assets/_Scripts/State/ReactiveAvatarState.cs index c2c40979476..71c615af665 100644 --- a/nekoyume/Assets/_Scripts/State/ReactiveAvatarState.cs +++ b/nekoyume/Assets/_Scripts/State/ReactiveAvatarState.cs @@ -22,6 +22,7 @@ public static class ReactiveAvatarState private static readonly ReactiveProperty DailyRewardReceivedIndexInternal; private static readonly ReactiveProperty QuestListInternal; private static readonly ReactiveProperty RelationshipInternal; + private static readonly ReactiveProperty PatrolRewardClaimedBlockIndexInternal; public static readonly IObservable
Address; public static readonly IObservable Inventory; @@ -31,11 +32,13 @@ public static class ReactiveAvatarState public static readonly IObservable ObservableDailyRewardReceivedIndex; public static readonly IObservable ObservableQuestList; public static readonly IObservable ObservableRelationship; + public static readonly IObservable ObservablePatrolRewardClaimedBlockIndex; public static long ActionPoint => ActionPointInternal.Value; public static long DailyRewardReceivedIndex => DailyRewardReceivedIndexInternal.Value; public static QuestList QuestList => QuestListInternal.Value; public static long Relationship => RelationshipInternal.Value; + public static long PatrolRewardClaimedBlockIndex => PatrolRewardClaimedBlockIndexInternal.Value; static ReactiveAvatarState() { @@ -47,6 +50,7 @@ static ReactiveAvatarState() DailyRewardReceivedIndexInternal = new ReactiveProperty(); QuestListInternal = new ReactiveProperty(); RelationshipInternal = new ReactiveProperty(); + PatrolRewardClaimedBlockIndexInternal = new ReactiveProperty(); Address = AddressInternal.ObserveOnMainThread(); Inventory = InventoryInternal.ObserveOnMainThread(); @@ -56,6 +60,8 @@ static ReactiveAvatarState() ObservableDailyRewardReceivedIndex = DailyRewardReceivedIndexInternal.ObserveOnMainThread(); ObservableQuestList = QuestListInternal.ObserveOnMainThread(); ObservableRelationship = RelationshipInternal.ObserveOnMainThread(); + ObservablePatrolRewardClaimedBlockIndex = + PatrolRewardClaimedBlockIndexInternal.ObserveOnMainThread(); } public static void Initialize(AvatarState state) @@ -118,5 +124,10 @@ public static void UpdateRelationship(long relationship) { RelationshipInternal.SetValueAndForceNotify(relationship); } + + public static void UpdatePatrolRewardClaimedBlockIndex(long index) + { + PatrolRewardClaimedBlockIndexInternal.SetValueAndForceNotify(index); + } } } diff --git a/nekoyume/Assets/_Scripts/State/States.cs b/nekoyume/Assets/_Scripts/State/States.cs index 975d4132e24..d7249ccfc99 100644 --- a/nekoyume/Assets/_Scripts/State/States.cs +++ b/nekoyume/Assets/_Scripts/State/States.cs @@ -601,9 +601,6 @@ await UniTask.RunOnThreadPool(async () => { await InitializeAvatarAndRelatedStates(agent, stateRootHash, avatarState, avatarState.address); }); - - PatrolReward.InitializeInformation(avatarState.address.ToHex(), - AgentState.address.ToHex(), avatarState.level).AsUniTask().Forget(); ApiClients.Instance.SeasonPassServiceManager.AvatarStateRefreshAsync().AsUniTask().Forget(); Widget.Find().ClearSlots(); @@ -629,13 +626,15 @@ private async UniTask InitializeAvatarAndRelatedStates(IAgent agent, HashDigest< // [3]: DailyRewardReceivedBlockIndex // [4]: Relationship // [5]: ClaimedGiftIds + // [6]: PatrolRewardClaimedBlockIndex var listStates = await Task.WhenAll( agent.GetStateAsync(stateRootHash, ReservedAddresses.LegacyAccount, skillStateAddress), agent.GetStateAsync(stateRootHash, Addresses.Collection, avatarAddr), agent.GetStateAsync(stateRootHash, Addresses.ActionPoint, avatarAddr), agent.GetStateAsync(stateRootHash, Addresses.DailyReward, avatarAddr), agent.GetStateAsync(stateRootHash, Addresses.Relationship, avatarAddr), - agent.GetStateAsync(stateRootHash, Addresses.ClaimedGiftIds, avatarAddr)); + agent.GetStateAsync(stateRootHash, Addresses.ClaimedGiftIds, avatarAddr), + agent.GetStateAsync(stateRootHash, Addresses.PatrolReward, avatarAddr)); SetCrystalRandomSkillState(listStates[0] is List serialized ? new CrystalRandomSkillState(skillStateAddress, serialized) : null); @@ -659,6 +658,8 @@ private async UniTask InitializeAvatarAndRelatedStates(IAgent agent, HashDigest< SetAllCombinationSlotState(avatarAddr, allCombinationSlotState); SetAllRuneState(GetStateExtensions.GetAllRuneState(stateRootHash, curAvatarState.address)); + var latestPatrolRewardBlock = await StateGetter.GetPatrolRewardReceivedBlockIndex(stateRootHash, curAvatarState.address); + ReactiveAvatarState.UpdatePatrolRewardClaimedBlockIndex(latestPatrolRewardBlock); await InitRuneSlotStates(); } diff --git a/nekoyume/Assets/_Scripts/UI/Model/PatrolReward.cs b/nekoyume/Assets/_Scripts/UI/Model/PatrolReward.cs index a3fe6dbb03f..a3aed1222c4 100644 --- a/nekoyume/Assets/_Scripts/UI/Model/PatrolReward.cs +++ b/nekoyume/Assets/_Scripts/UI/Model/PatrolReward.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; -using System.Threading.Tasks; using Libplanet.Crypto; -using Nekoyume.GraphQL; +using Nekoyume.Blockchain; using Nekoyume.L10n; -using Nekoyume.Model.Mail; -using Nekoyume.UI; +using Nekoyume.State; using Nekoyume.UI.Model; -using Nekoyume.UI.Scroller; using UnityEngine; namespace Nekoyume.ApiClient @@ -16,149 +13,111 @@ namespace Nekoyume.ApiClient public static class PatrolReward { - public static readonly ReactiveProperty LastRewardTime = new(); + public static readonly ReactiveProperty LastRewardClaimedBlockIndex = new(); public static int NextLevel { get; private set; } - public static TimeSpan Interval { get; private set; } + public static long Interval { get; private set; } public static readonly ReactiveProperty> RewardModels = new(); - public static readonly IReadOnlyReactiveProperty PatrolTime; + public static readonly ReactiveProperty PatrolTime = new(); public static readonly ReactiveProperty Claiming = new(false); private const string PatrolRewardPushIdentifierKey = "PATROL_REWARD_PUSH_IDENTIFIER"; - private static Address? _currentAvatarAddress = null; + private static Address? _currentAvatarAddress; public static bool NeedToInitialize(Address avatarAddress) => !_currentAvatarAddress.HasValue || _currentAvatarAddress != avatarAddress; public static bool CanClaim => - _currentAvatarAddress.HasValue && !Claiming.Value && PatrolTime.Value >= Interval; + _currentAvatarAddress.HasValue && !Claiming.Value && (PatrolTime.Value >= Interval || PatrolTime.Value == 0); static PatrolReward() { - PatrolTime = Observable.Timer(TimeSpan.Zero, TimeSpan.FromMinutes(1)) - .CombineLatest(LastRewardTime, (_, lastReward) => - { - var timeSpan = DateTime.Now - lastReward; - return timeSpan > Interval ? Interval : timeSpan; - }) - .ToReactiveProperty(); - LastRewardTime.ObserveOnMainThread() - .Select(lastRewardTime => lastRewardTime + Interval - DateTime.Now) + var agent = Game.Game.instance.Agent; + agent.BlockIndexSubject + .Subscribe(OnUpdateBlockIndex) + .AddTo(Game.Game.instance); + + LastRewardClaimedBlockIndex.ObserveOnMainThread() + .Select(lastRewardTime => lastRewardTime + Interval - Game.Game.instance.Agent.BlockIndex) .Subscribe(SetPushNotification); + + ReactiveAvatarState.ObservablePatrolRewardClaimedBlockIndex + .Subscribe(blockIndex => LastRewardClaimedBlockIndex.Value = blockIndex) + .AddTo(Game.Game.instance); + } + + private static void OnUpdateBlockIndex(long blockIndex) + { + var lastRewardTime = LastRewardClaimedBlockIndex.Value; + var patrolTime = blockIndex - lastRewardTime; + PatrolTime.Value = Math.Min(Interval, patrolTime); } // Called at CurrentAvatarState isNewlySelected - public static async Task InitializeInformation(string avatarAddress, string agentAddress, int level) + public static void InitializeInformation(Address avatarAddress, int level, + long lastClaimedBlockIndex, long currentBlockIndex) { - var (avatar, policy) = - await PatrolRewardQuery.InitializeInformation(avatarAddress, agentAddress, level); - if (policy is not null) - { - SetPolicyModel(policy); - } + LoadPolicyInfo(level, currentBlockIndex); - if (avatar is not null) - { - SetAvatarModel(avatar); - } + SetAvatarModel(avatarAddress, lastClaimedBlockIndex); // for changed avatar Claiming.Value = false; } - public static async Task LoadAvatarInfo(string avatarAddress, string agentAddress) + public static void LoadAvatarInfo(Address avatarAddress, long lastClaimedBlockIndex) { - var avatar = await PatrolRewardQuery.LoadAvatarInfo(avatarAddress, agentAddress); - if (avatar is not null) - { - SetAvatarModel(avatar); - } + SetAvatarModel(avatarAddress, lastClaimedBlockIndex); } - public static async Task LoadPolicyInfo(int level, bool free = true) + public static void LoadPolicyInfo(int level, long blockIndex) { - var policy = await PatrolRewardQuery.LoadPolicyInfo(level, free); - if (policy is not null) + var patrolRewardSheet = Game.Game.instance.TableSheets.PatrolRewardSheet; + var row = patrolRewardSheet.FindByLevel(level, blockIndex); + var rewards = new List(); + foreach (var rewardModel in row.Rewards) { - SetPolicyModel(policy); + rewards.Add(new PatrolRewardModel + { + Currency = rewardModel.Ticker, + ItemId = rewardModel.ItemId, + PerInterval = rewardModel.Count, + }); } + var policy = new PolicyModel + { + MinimumLevel = row.MinimumLevel, + MaxLevel = row.MaxLevel, + RequiredBlockInterval = row.Interval, + Rewards = rewards, + }; + SetPolicyModel(policy); } - public static async void ClaimReward(System.Action onSuccess) + public static void ClaimReward(System.Action onSuccess) { Claiming.Value = true; - - var avatarAddress = Game.Game.instance.States.CurrentAvatarState.address; - var agentAddress = Game.Game.instance.States.AgentState.address; - var txId = await PatrolRewardQuery.ClaimReward(avatarAddress.ToHex(), agentAddress.ToHex()); - while (true) - { - var txResultResponse = await TxResultQuery.QueryTxResultAsync(txId); - if (txResultResponse is null) - { - NcDebug.LogError( - $"Failed getting response : {nameof(TxResultQuery.TxResultResponse)}"); - OneLineSystem.Push( - MailType.System, - L10nManager.Localize("NOTIFICATION_PATROL_REWARD_CLAIMED_FAILE"), - NotificationCell.NotificationType.Alert); - break; - } - - var currentAvatarAddress = Game.Game.instance.States.CurrentAvatarState.address; - var txStatus = txResultResponse.transaction.transactionResult.txStatus; - if (txStatus == TxResultQuery.TxStatus.SUCCESS) + ActionManager.Instance.ClaimPatrolReward() + .Subscribe(_ => { - if (avatarAddress != currentAvatarAddress) - { - return; - } - - OneLineSystem.Push( - MailType.System, - L10nManager.Localize("NOTIFICATION_PATROL_REWARD_CLAIMED"), - NotificationCell.NotificationType.Notification); - onSuccess?.Invoke(); - break; - } - - if (txStatus == TxResultQuery.TxStatus.FAILURE) - { - if (avatarAddress != currentAvatarAddress) - { - return; - } - - OneLineSystem.Push( - MailType.System, - L10nManager.Localize("NOTIFICATION_PATROL_REWARD_CLAIMED_FAILE"), - NotificationCell.NotificationType.Alert); - break; - } - - await Task.Delay(3000); - } - - Claiming.Value = false; - await LoadAvatarInfo(avatarAddress.ToHex(), agentAddress.ToHex()); + }); } - private static void SetAvatarModel(AvatarModel avatar) + private static void SetAvatarModel(Address avatarAddress, long lastClaimedBlockIndex) { - var lastClaimedAt = avatar.LastClaimedAt ?? avatar.CreatedAt; - LastRewardTime.Value = DateTime.Parse(lastClaimedAt); - _currentAvatarAddress = new Address(avatar.AvatarAddress); + LastRewardClaimedBlockIndex.Value = lastClaimedBlockIndex; + _currentAvatarAddress = avatarAddress; } private static void SetPolicyModel(PolicyModel policy) { NextLevel = policy.MaxLevel ?? int.MaxValue; - Interval = policy.MinimumRequiredInterval; + Interval = policy.RequiredBlockInterval; RewardModels.Value = policy.Rewards; } - private static void SetPushNotification(TimeSpan completeTime) + private static void SetPushNotification(long completeTime) { var prevPushIdentifier = PlayerPrefs.GetString(PatrolRewardPushIdentifierKey, string.Empty); if (!string.IsNullOrEmpty(prevPushIdentifier)) @@ -169,7 +128,7 @@ private static void SetPushNotification(TimeSpan completeTime) var pushIdentifier = PushNotifier.Push( L10nManager.Localize("PUSH_PATROL_REWARD_COMPLETE_CONTENT"), - completeTime, + completeTime.BlockToTimeSpan(), PushNotifier.PushType.Reward); PlayerPrefs.SetString(PatrolRewardPushIdentifierKey, pushIdentifier); } diff --git a/nekoyume/Assets/_Scripts/UI/Model/PatrolRewardModel.cs b/nekoyume/Assets/_Scripts/UI/Model/PatrolRewardModel.cs index ebe54bea6c0..3fbf61c501b 100644 --- a/nekoyume/Assets/_Scripts/UI/Model/PatrolRewardModel.cs +++ b/nekoyume/Assets/_Scripts/UI/Model/PatrolRewardModel.cs @@ -5,41 +5,14 @@ namespace Nekoyume.UI.Model { - public class InitializeResponse - { - public AvatarModel Avatar { get; set; } - public PolicyModel Policy { get; set; } - } - - public class AvatarResponse - { - public AvatarModel Avatar { get; set; } - } - - public class AvatarModel - { - public string AgentAddress { get; set; } - public string AvatarAddress { get; set; } - public string CreatedAt { get; set; } - public string LastClaimedAt { get; set; } - public int Level { get; set; } - } - - public class PolicyResponse - { - public PolicyModel Policy { get; set; } - } - public class PolicyModel { - public bool Activate { get; set; } public int MinimumLevel { get; set; } public int? MaxLevel { get; set; } - [JsonConverter(typeof(TimespanConverter))] - public TimeSpan MinimumRequiredInterval { get; set; } - public List Rewards { get; set; } + + public long RequiredBlockInterval { get; set; } } public class PatrolRewardModel @@ -52,51 +25,5 @@ public class PatrolRewardModel public int? ItemId { get; set; } public int PerInterval { get; set; } - - [JsonConverter(typeof(TimespanConverter))] - public TimeSpan RewardInterval { get; set; } - } - - public class ClaimResponse - { - public string Claim { get; set; } - } - - public class PutAvatarResponse - { - public AvatarModel PutAvatar { get; set; } - } - - public class TimespanConverter : JsonConverter - { - public override bool CanConvert(Type objectType) - { - return objectType == typeof(TimeSpan); - } - - public override bool CanRead => true; - public override bool CanWrite => true; - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (objectType != typeof(TimeSpan)) - { - throw new ArgumentException(); - } - - var spanString = reader.Value as string; - if (spanString == null) - { - return null; - } - - return XmlConvert.ToTimeSpan(spanString); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var duration = (TimeSpan)value; - writer.WriteValue(XmlConvert.ToString(duration)); - } } } diff --git a/nekoyume/Assets/_Scripts/UI/Module/Lobby/PatrolRewardMenu.cs b/nekoyume/Assets/_Scripts/UI/Module/Lobby/PatrolRewardMenu.cs index 7217b801568..676548665e7 100644 --- a/nekoyume/Assets/_Scripts/UI/Module/Lobby/PatrolRewardMenu.cs +++ b/nekoyume/Assets/_Scripts/UI/Module/Lobby/PatrolRewardMenu.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Nekoyume.ApiClient; using Nekoyume.L10n; +using Nekoyume.State; using TMPro; using UnityEngine; using UnityEngine.UI; @@ -18,12 +19,6 @@ public class PatrolRewardMenu : MainMenu [SerializeField] private Image rewardIcon; - [SerializeField] - private PatrolRewardDataScriptableObject patrolRewardData; - - [SerializeField] - private GameObject effect00; - [SerializeField] private GameObject effect03; @@ -44,28 +39,49 @@ public class PatrolRewardMenu : MainMenu private readonly List _disposables = new(); - private void OnEnable() + protected override void Awake() + { + base.Awake(); + Game.Lobby.OnLobbyEnterEvent += OnLobbyEnter; + } + + private void OnDestroy() + { + Game.Lobby.OnLobbyEnterEvent -= OnLobbyEnter; + } + + private void OnDisable() + { + _disposables.DisposeAllAndClear(); + } + + private void OnLobbyEnter() { var avatarState = Game.Game.instance.States.CurrentAvatarState; if (avatarState is null) { + NcDebug.LogWarning($"[{nameof(PatrolRewardMenu)}] AvatarState is null."); return; } if (PatrolReward.NeedToInitialize(avatarState.address)) { - NcDebug.LogWarning("PatrolReward is not initialized."); - return; + var avatarAddress = Game.Game.instance.States.CurrentAvatarState.address; + var level = Game.Game.instance.States.CurrentAvatarState.level; + var lastClaimedBlockIndex = ReactiveAvatarState.PatrolRewardClaimedBlockIndex; + var currentBlockIndex = Game.Game.instance.Agent.BlockIndex; + PatrolReward.InitializeInformation(avatarAddress, level, lastClaimedBlockIndex, currentBlockIndex); } - PatrolReward.PatrolTime - .Select(time => time < PatrolReward.Interval) + Game.Game.instance.Agent.BlockIndexSubject .Where(_ => !PatrolReward.Claiming.Value) + .Select(_ => !PatrolReward.CanClaim) .Subscribe(patrolling => SetCanClaim(patrolling, false)) .AddTo(_disposables); - PatrolReward.Claiming.Where(claiming => claiming) - .Subscribe(value => SetCanClaim(false, true)).AddTo(_disposables); + PatrolReward.Claiming + .Where(claiming => claiming) + .Subscribe(_ => SetCanClaim(false, true)).AddTo(_disposables); } private void SetCanClaim(bool patrolling, bool claiming) @@ -98,10 +114,5 @@ public void ClaimRewardAnimation() 0, ItemMoveAnimation.EndPoint.Inventory); } - - private void OnDisable() - { - _disposables.DisposeAllAndClear(); - } } } diff --git a/nekoyume/Assets/_Scripts/UI/Module/PatrolRewardModule.cs b/nekoyume/Assets/_Scripts/UI/Module/PatrolRewardModule.cs index 3de8ea7887b..1fc742d4d25 100644 --- a/nekoyume/Assets/_Scripts/UI/Module/PatrolRewardModule.cs +++ b/nekoyume/Assets/_Scripts/UI/Module/PatrolRewardModule.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Nekoyume.ApiClient; using Nekoyume.Helper; using Nekoyume.L10n; +using Nekoyume.State; using Nekoyume.UI.Model; using TMPro; using UnityEngine; @@ -30,8 +29,10 @@ private class RewardView [SerializeField] private TextMeshProUGUI gaugeUnitText1; [SerializeField] private TextMeshProUGUI gaugeUnitText2; - public void Awake() + public void Initialize() { + SetData(); + PatrolReward.RewardModels .Where(model => model != null) .Subscribe(SetRewardModels) @@ -43,23 +44,22 @@ public void Awake() .AddTo(gameObject); } - public async Task SetData() + public void SetData() { var avatarAddress = Game.Game.instance.States.CurrentAvatarState.address; - var agentAddress = Game.Game.instance.States.AgentState.address; var level = Game.Game.instance.States.CurrentAvatarState.level; + var lastClaimedBlockIndex = ReactiveAvatarState.PatrolRewardClaimedBlockIndex; + var currentBlockIndex = Game.Game.instance.Agent.BlockIndex; if (PatrolReward.NeedToInitialize(avatarAddress)) { - await PatrolReward.InitializeInformation(avatarAddress.ToHex(), - agentAddress.ToHex(), level); + PatrolReward.InitializeInformation(avatarAddress, level, lastClaimedBlockIndex, currentBlockIndex); } else if (PatrolReward.NextLevel <= level) { - await PatrolReward.LoadPolicyInfo(level); + PatrolReward.LoadPolicyInfo(level, currentBlockIndex); } SetIntervalText(PatrolReward.Interval); - // SetPatrolTime(PatrolReward.PatrolTime.Value, PatrolReward.Interval); // 구독하고 있으니 필요 없지 않나? } #region UI @@ -85,43 +85,29 @@ private void SetRewardModels(List rewardModels) } // Time - private void SetPatrolTime(TimeSpan patrolTime, TimeSpan interval) + private void SetPatrolTime(long patrolTime, long interval) { patrolTimeText.text = - L10nManager.Localize("UI_PATROL_TIME_FORMAT", TimeSpanToString(patrolTime)); - patrolTimeGauge.fillAmount = (float)(patrolTime / interval); - } - - private void SetIntervalText(TimeSpan interval) - { - gaugeUnitText1.text = TimeSpanToString(interval / 2); - gaugeUnitText2.text = TimeSpanToString(interval); + L10nManager.Localize("UI_PATROL_TIME_FORMAT", patrolTime.BlockToTimeSpan()); + patrolTimeGauge.fillAmount = (float)patrolTime / interval; } - public static string TimeSpanToString(TimeSpan time) + private void SetIntervalText(long interval) { - var hourExist = time.TotalHours >= 1; - var minuteExist = time.Minutes >= 1; - var hourText = hourExist ? $"{(int)time.TotalHours}h " : string.Empty; - var minuteText = minuteExist || !hourExist ? $"{time.Minutes}m" : string.Empty; - return $"{hourText}{minuteText}"; + gaugeUnitText1.text = (interval / 2).BlockRangeToTimeSpanString(); + gaugeUnitText2.text = interval.BlockRangeToTimeSpanString(); } private static Sprite GetSprite(PatrolRewardModel reward) { - if (reward.ItemId != null) + if (reward.ItemId != null && reward.ItemId != 0) { return SpriteHelper.GetItemIcon(reward.ItemId.Value); } - if (!string.IsNullOrEmpty(reward.Currency)) - { - return SpriteHelper.GetFavIcon(reward.Currency); - } - - return null; + return !string.IsNullOrEmpty(reward.Currency) ? SpriteHelper.GetFavIcon(reward.Currency) : null; } - #endregion + #endregion UI } } diff --git a/nekoyume/Assets/_Scripts/UI/Widget/Popup/EventRewardPopup.cs b/nekoyume/Assets/_Scripts/UI/Widget/Popup/EventRewardPopup.cs index 493adf3e4b3..8858527cf0e 100644 --- a/nekoyume/Assets/_Scripts/UI/Widget/Popup/EventRewardPopup.cs +++ b/nekoyume/Assets/_Scripts/UI/Widget/Popup/EventRewardPopup.cs @@ -56,6 +56,7 @@ public void SetText(string text) [SerializeField] private ConditionalButton receiveButton; [SerializeField] private GameObject receiveButtonIndicator; + private bool _isPatrolRewardInitialized; private bool _isInitialized; private readonly List _disposables = new (); @@ -161,6 +162,12 @@ public override void Show(bool ignoreShowAnimation = false) return; } + if (!_isPatrolRewardInitialized) + { + patrolRewardModule.Initialize(); + _isPatrolRewardInitialized = true; + } + int index; if (TryGetClaimableGift(out _)) { @@ -287,20 +294,15 @@ private void SetClaimGift(EventRewardPopupData.Content content) }).AddTo(_disposables); } - private async void SetPatrolReward() + private void SetPatrolReward() { - await patrolRewardModule.SetData(); + patrolRewardModule.SetData(); patrolRewardModule.gameObject.SetActive(true); receiveButton.gameObject.SetActive(true); PatrolReward.PatrolTime .Where(_ => !PatrolReward.Claiming.Value) - .Select(patrolTime => - { - var patrolTimeWithOutSeconds = new TimeSpan(patrolTime.Ticks / - TimeSpan.TicksPerMinute * TimeSpan.TicksPerMinute); - return PatrolReward.Interval - patrolTimeWithOutSeconds; - }) + .Select(patrolTime => PatrolReward.Interval - patrolTime) .Subscribe(SetReceiveButton) .AddTo(_disposables); @@ -405,14 +407,14 @@ private void ClaimPatrolReward() } // subscribe from PatrolReward.PatrolTime - private void SetReceiveButton(TimeSpan remainTime) + public void SetReceiveButton(long remainTime) { - var canReceive = remainTime <= TimeSpan.Zero; + var canReceive = remainTime <= 0L; receiveButton.Interactable = canReceive; receiveButton.Text = canReceive ? L10nManager.Localize("UI_GET_REWARD") : L10nManager.Localize("UI_REMAINING_TIME", - PatrolRewardModule.TimeSpanToString(remainTime)); + remainTime.BlockRangeToTimeSpanString()); receiveButtonIndicator.SetActive(false); } diff --git a/nekoyume/Assets/_Scripts/UI/Widget/Popup/PatrolRewardPopup.cs b/nekoyume/Assets/_Scripts/UI/Widget/Popup/PatrolRewardPopup.cs index 931308c4167..a6fd5b2b331 100644 --- a/nekoyume/Assets/_Scripts/UI/Widget/Popup/PatrolRewardPopup.cs +++ b/nekoyume/Assets/_Scripts/UI/Widget/Popup/PatrolRewardPopup.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using JetBrains.Annotations; using mixpanel; using Nekoyume.ApiClient; using Nekoyume.Game.Controller; @@ -18,6 +19,8 @@ public class PatrolRewardPopup : PopupWidget [SerializeField] private PatrolRewardModule patrolRewardModule; [SerializeField] private ConditionalButton receiveButton; + private bool _isInitialized; + protected override void Awake() { base.Awake(); @@ -31,12 +34,7 @@ protected override void Awake() PatrolReward.PatrolTime .Where(_ => !PatrolReward.Claiming.Value) - .Select(patrolTime => - { - var patrolTimeWithOutSeconds = new TimeSpan(patrolTime.Ticks / - TimeSpan.TicksPerMinute * TimeSpan.TicksPerMinute); - return PatrolReward.Interval - patrolTimeWithOutSeconds; - }) + .Select(patrolTime => PatrolReward.Interval - patrolTime) .Subscribe(SetReceiveButton) .AddTo(gameObject); @@ -49,27 +47,20 @@ protected override void Awake() .AddTo(gameObject); } - public void Show(bool ignoreShowAnimation = false) + public override void Show(bool ignoreShowAnimation = false) { if (PatrolReward.Claiming.Value) { return; } - var clientInitialized = ApiClients.Instance.PatrolRewardServiceClient.IsInitialized; - if (!clientInitialized) + if (!_isInitialized) { - NcDebug.Log( - $"[{nameof(PatrolRewardPopup)}]PatrolRewardServiceClient is not initialized."); - return; + patrolRewardModule.Initialize(); + _isInitialized = true; } - ShowAsync(ignoreShowAnimation); - } - - private async void ShowAsync(bool ignoreShowAnimation = false) - { - await patrolRewardModule.SetData(); + patrolRewardModule.SetData(); var patrolTime = PatrolReward.PatrolTime.Value; Analyzer.Instance.Track("Unity/PatrolReward/Show Popup", new Dictionary @@ -95,17 +86,17 @@ private void ClaimReward() Close(); } - // subscribe from PatrolReward.PatrolTime - private void SetReceiveButton(TimeSpan remainTime) + private void SetReceiveButton(long remainTime) { - var canReceive = remainTime <= TimeSpan.Zero; + var canReceive = remainTime <= 0L; receiveButton.Interactable = canReceive; receiveButton.Text = canReceive ? L10nManager.Localize("UI_GET_REWARD") - : L10nManager.Localize("UI_REMAINING_TIME", PatrolRewardModule.TimeSpanToString(remainTime)); + : L10nManager.Localize("UI_REMAINING_TIME", remainTime.BlockRangeToTimeSpanString()); } // Invoke from TutorialController.PlayAction() by TutorialTargetType + [UsedImplicitly] public void TutorialActionClickClaimPatrolRewardButton() { receiveButton.OnSubmitSubject.OnNext(default);