From 2cc5f0f2726fa794c25895fcf07fa2e0b4e11222 Mon Sep 17 00:00:00 2001 From: 99jamin <99jamin56@gmail.com> Date: Wed, 19 Mar 2025 11:09:44 +0900 Subject: [PATCH] =?UTF-8?q?Do-37=20[Feat]=20=EA=B4=91=EA=B3=A0=20=EB=B3=B4?= =?UTF-8?q?=EC=83=81=20=EC=BD=94=EC=9D=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KJM/Admob/AdManager.cs | 13 +- .../ScrollItem/ShopScrollItem.prefab | 5 +- Assets/KJM/ShopTest.meta | 8 + .../KJM/ShopTest/MainPanelButtonController.cs | 37 ++ .../MainPanelButtonController.cs.meta | 11 + Assets/KJM/ShopTest/ShopTestKJM.unity | 607 ++++++++++++++++++ Assets/KJM/ShopTest/ShopTestKJM.unity.meta | 7 + Assets/Prefabs/Main Panel.prefab | 31 +- Assets/Script/Common/CoinsPanelController.cs | 2 +- Assets/Script/Common/ScrollItem/ShopItem.cs | 1 - Assets/Script/Game/GameManager.cs | 19 +- Assets/Script/Main/NetworkManager.cs | 64 +- Assets/Script/Main/UserManager.cs | 8 + .../ShopItemController.cs | 10 +- .../UI/PanelController/TestPanelController.cs | 2 - 15 files changed, 800 insertions(+), 25 deletions(-) create mode 100644 Assets/KJM/ShopTest.meta create mode 100644 Assets/KJM/ShopTest/MainPanelButtonController.cs create mode 100644 Assets/KJM/ShopTest/MainPanelButtonController.cs.meta create mode 100644 Assets/KJM/ShopTest/ShopTestKJM.unity create mode 100644 Assets/KJM/ShopTest/ShopTestKJM.unity.meta diff --git a/Assets/KJM/Admob/AdManager.cs b/Assets/KJM/Admob/AdManager.cs index cd50811..ec955f1 100644 --- a/Assets/KJM/Admob/AdManager.cs +++ b/Assets/KJM/Admob/AdManager.cs @@ -10,7 +10,7 @@ public class AdManager : MonoBehaviour void Start() { // Google Mobile Ads 초기화 - MobileAds.Initialize(initStatus => { Debug.Log("AdMob Initialized"); }); + MobileAds.Initialize(initStatus => { }); // 광고 로드 LoadRewardedInterstitialAd(); @@ -45,7 +45,6 @@ public class AdManager : MonoBehaviour { rewardedInterstitialAd.Show((Reward reward) => { - Debug.Log("코인 지급됨: " + reward.Amount); // 코인 지급 로직 GrantReward(); }); @@ -66,7 +65,13 @@ public class AdManager : MonoBehaviour // 코인 지급 함수 private void GrantReward() { - Debug.Log("코인 지금 완료"); - // 코인 보상 로직 추가 + NetworkManager.Instance.WatchAdForCoins((coinsAdded) => + { + // UI 업데이트 + GameManager.Instance.UpdateCoinsPanelUI(coinsAdded); + }, () => + { + Debug.Log("광고 시청 후 코인 추가 실패!"); + }); } } \ No newline at end of file diff --git a/Assets/KJM/KJMprefabs/ScrollItem/ShopScrollItem.prefab b/Assets/KJM/KJMprefabs/ScrollItem/ShopScrollItem.prefab index 4768b74..bf0ab54 100644 --- a/Assets/KJM/KJMprefabs/ScrollItem/ShopScrollItem.prefab +++ b/Assets/KJM/KJMprefabs/ScrollItem/ShopScrollItem.prefab @@ -34,7 +34,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -28.8, y: 0} + m_AnchoredPosition: {x: -25, y: 0} m_SizeDelta: {x: 200, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8644449565768019552 @@ -333,7 +333,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: 0} + m_Sprite: {fileID: 21300000, guid: 307bff9630735f342852f28b1cd5d300, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -491,6 +491,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4d28917ad20c19e428cbf98ba5609e69, type: 3} m_Name: m_EditorClassIdentifier: - adManager: {fileID: 8786799901643631561, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} profileSprites: - {fileID: 21300000, guid: 307bff9630735f342852f28b1cd5d300, type: 3} diff --git a/Assets/KJM/ShopTest.meta b/Assets/KJM/ShopTest.meta new file mode 100644 index 0000000..fbaf905 --- /dev/null +++ b/Assets/KJM/ShopTest.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9c9055371cfdd4a4ab37e2274906ec49 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KJM/ShopTest/MainPanelButtonController.cs b/Assets/KJM/ShopTest/MainPanelButtonController.cs new file mode 100644 index 0000000..be9f547 --- /dev/null +++ b/Assets/KJM/ShopTest/MainPanelButtonController.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +/// +/// 메인 패널 메뉴 버튼 +/// +public class MainPanelButtonController : MonoBehaviour +{ + //상점 패널 생성 + public void OnShopPanelClick() + { + List shopItems = new List(); //상점 데이터 리스트 생성 + for (int i = 0; i < 5; i++) + { + if (i == 0) //광고 항목 + { + ShopItem shopItem = new ShopItem + { + Name = "코인500개 ", + Price = "광고" + }; + shopItems.Add(shopItem); + } + else + { + ShopItem shopItem = new ShopItem + { + Name = "코인"+i*1000+"개 ", + Price = (i * 1000)+ "원" + }; + shopItems.Add(shopItem); + } + } + + GameManager.Instance.OpenShopPanel(shopItems); + } +} diff --git a/Assets/KJM/ShopTest/MainPanelButtonController.cs.meta b/Assets/KJM/ShopTest/MainPanelButtonController.cs.meta new file mode 100644 index 0000000..2ef9d04 --- /dev/null +++ b/Assets/KJM/ShopTest/MainPanelButtonController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c9598d78723880e4f8026beb096f28c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KJM/ShopTest/ShopTestKJM.unity b/Assets/KJM/ShopTest/ShopTestKJM.unity new file mode 100644 index 0000000..084adda --- /dev/null +++ b/Assets/KJM/ShopTest/ShopTestKJM.unity @@ -0,0 +1,607 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &183715510 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 183715513} + - component: {fileID: 183715512} + - component: {fileID: 183715511} + m_Layer: 0 + m_Name: GameManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!82 &183715511 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 183715510} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 1 + m_Volume: 1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 +--- !u!114 &183715512 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 183715510} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 35a4c6d5d3a97b444b968e68ec8bb9f7, type: 3} + m_Name: + m_EditorClassIdentifier: + mainPanel: {fileID: 8564394481744056992, guid: e1835a90a4d722a4b99be61179de8789, type: 3} + signinPanel: {fileID: 925522282249935710, guid: e14c9b2925f0ddb4192af743e5cc166a, type: 3} + signupPanel: {fileID: 3181524094944658765, guid: 8827fe7caa3145e40b1369cc42f8697d, type: 3} + settingsPanel: {fileID: 2861881646994438329, guid: ea820246b5075c54d9f614291ca41c5d, type: 3} + confirmPanel: {fileID: 8145365568262946399, guid: 76f1fe6b5243faf4f9b8caee7312d336, type: 3} + rankingPanel: {fileID: 154459105952450598, guid: bf4bb18aa323fe748b3eb1d537503596, type: 3} + shopPanel: {fileID: 8190964574954487140, guid: eb257b0a685b2254f860f294ce8cba54, type: 3} + giboPanel: {fileID: 3090474328172188941, guid: c63914e01332f8d479ada92325335e41, type: 3} + loadingPanel: {fileID: 1942997847427067673, guid: 634a60576b4855940a97d1e7447b9fcc, type: 3} + mainBgm: {fileID: 8300000, guid: 1d9c7fb20aa822c48933d00b6bd6a757, type: 3} + profileSprites: [] +--- !u!224 &183715513 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 183715510} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!1 &521295930 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 521295933} + - component: {fileID: 521295932} + - component: {fileID: 521295931} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &521295931 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 521295930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &521295932 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 521295930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &521295933 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 521295930} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &634833532 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7455536569977767830, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8786799901643631561, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} + propertyPath: m_Name + value: Admob + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c401513426cb83c4e8759c73d8be4c3a, type: 3} +--- !u!1 &1340395578 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1340395582} + - component: {fileID: 1340395581} + - component: {fileID: 1340395580} + - component: {fileID: 1340395579} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1340395579 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340395578} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1340395580 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340395578} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1080, y: 1920} + m_ScreenMatchMode: 1 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &1340395581 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340395578} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 0 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1340395582 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1340395578} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1377839198 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1377839201} + - component: {fileID: 1377839200} + - component: {fileID: 1377839199} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1377839199 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1377839198} + m_Enabled: 1 +--- !u!20 &1377839200 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1377839198} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1377839201 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1377839198} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 1377839201} + - {fileID: 183715513} + - {fileID: 1340395582} + - {fileID: 521295933} + - {fileID: 634833532} diff --git a/Assets/KJM/ShopTest/ShopTestKJM.unity.meta b/Assets/KJM/ShopTest/ShopTestKJM.unity.meta new file mode 100644 index 0000000..99d953b --- /dev/null +++ b/Assets/KJM/ShopTest/ShopTestKJM.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a2cc37101a3e9a9409463bfdb2d4241f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Main Panel.prefab b/Assets/Prefabs/Main Panel.prefab index d0732c1..3d18d83 100644 --- a/Assets/Prefabs/Main Panel.prefab +++ b/Assets/Prefabs/Main Panel.prefab @@ -386,6 +386,7 @@ GameObject: m_Component: - component: {fileID: 2720476515686469179} - component: {fileID: 7796730417217941349} + - component: {fileID: 8890768496808647529} m_Layer: 5 m_Name: Buttons m_TagString: Untagged @@ -443,6 +444,18 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &8890768496808647529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1637449823560643887} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c9598d78723880e4f8026beb096f28c4, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &2440131775796007731 GameObject: m_ObjectHideFlags: 0 @@ -831,7 +844,19 @@ MonoBehaviour: m_TargetGraphic: {fileID: 1942682002419496767} m_OnClick: m_PersistentCalls: - m_Calls: [] + m_Calls: + - m_Target: {fileID: 8890768496808647529} + m_TargetAssemblyTypeName: MainPanelButtonController, Assembly-CSharp + m_MethodName: OnShopPanelClick + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 --- !u!1 &3505803793046748957 GameObject: m_ObjectHideFlags: 0 @@ -1068,7 +1093,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "16\uAE09" + m_text: "18\uAE09" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2} m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2} @@ -1653,7 +1678,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "\uD14C\uC2A4\uD2B801" + m_text: kjm m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 85a19688db53c77469fc4406b01045da, type: 2} m_sharedMaterial: {fileID: -2477908578676791210, guid: 85a19688db53c77469fc4406b01045da, type: 2} diff --git a/Assets/Script/Common/CoinsPanelController.cs b/Assets/Script/Common/CoinsPanelController.cs index 19a2c65..45d06af 100644 --- a/Assets/Script/Common/CoinsPanelController.cs +++ b/Assets/Script/Common/CoinsPanelController.cs @@ -99,7 +99,7 @@ public class CoinsPanelController : MonoBehaviour Sequence sequence = DOTween.Sequence(); // i += a 반복 횟수 조절, 100개 단위로 상승 차감 시 100으로 설정 - for (int i = 0; i < coinsCount; i+=1) + for (int i = 0; i < coinsCount; i+=100) { sequence.AppendCallback(() => { diff --git a/Assets/Script/Common/ScrollItem/ShopItem.cs b/Assets/Script/Common/ScrollItem/ShopItem.cs index 7502de4..da665a5 100644 --- a/Assets/Script/Common/ScrollItem/ShopItem.cs +++ b/Assets/Script/Common/ScrollItem/ShopItem.cs @@ -4,7 +4,6 @@ using UnityEngine; public class ShopItem { - public int ItemSpriteIndex; public string Name; public string Price; } diff --git a/Assets/Script/Game/GameManager.cs b/Assets/Script/Game/GameManager.cs index c3202ff..ef5a664 100644 --- a/Assets/Script/Game/GameManager.cs +++ b/Assets/Script/Game/GameManager.cs @@ -33,9 +33,7 @@ public class GameManager : Singleton private GameLogic _gameLogic; private StoneController _stoneController; private Canvas _canvas; - - public Sprite[] profileSprites; //패널에서 사용할 테스트 배열 - + private void Start() { // TODO: 음악 관련은 AuidoManager로 분리? @@ -148,6 +146,21 @@ public class GameManager : Singleton } } + + public void UpdateCoinsPanelUI(int coinsChanged) + { + if (_coinsPanel != null) + { + _coinsPanel.AddCoins(coinsChanged, () => + { + + }); + } + else + { + Debug.Log("코인 패널이 null 입니다."); + } + } public void OpenLoadingPanel(bool rotateImage = false, bool animatedText = false, bool flipImage = false) { diff --git a/Assets/Script/Main/NetworkManager.cs b/Assets/Script/Main/NetworkManager.cs index dd3445a..159b098 100644 --- a/Assets/Script/Main/NetworkManager.cs +++ b/Assets/Script/Main/NetworkManager.cs @@ -273,7 +273,7 @@ public class NetworkManager : Singleton public IEnumerator GetCoinsInfoCoroutine(Action success, Action failure) { using (UnityWebRequest www = - new UnityWebRequest(Constants.ServerURL + "/users/coins", UnityWebRequest.kHttpVerbGET)) + new UnityWebRequest(Constants.ServerURL + "/coins", UnityWebRequest.kHttpVerbGET)) { www.downloadHandler = new DownloadHandlerBuffer(); string sid = PlayerPrefs.GetString("sid", ""); @@ -313,4 +313,66 @@ public class NetworkManager : Singleton } } } + + /// + /// 광고 보상 함수 + /// + /// + /// + public void WatchAdForCoins(Action success, Action failure) + { + StartCoroutine(WatchAdForCoinsCoroutine(success, failure)); + } + + private IEnumerator WatchAdForCoinsCoroutine(Action success, Action failure) + { + string jsonString = "{\"adCompleted\": true}"; //테스트를 위해 ture로 설정 + byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(jsonString); + + using (UnityWebRequest www = + new UnityWebRequest(Constants.ServerURL + "/coins/recharge/ad", UnityWebRequest.kHttpVerbPOST)) + { + www.uploadHandler = new UploadHandlerRaw(bodyRaw); + www.downloadHandler = new DownloadHandlerBuffer(); + www.SetRequestHeader("Content-Type", "application/json"); + + string sid = PlayerPrefs.GetString("sid", ""); + if (!string.IsNullOrEmpty(sid)) + { + www.SetRequestHeader("Cookie", sid); + } + else + { + Debug.LogError("SID 값이 없습니다. 로그인 정보가 없습니다."); + failure?.Invoke(); + yield break; + } + + yield return www.SendWebRequest(); + + if (www.result == UnityWebRequest.Result.ConnectionError || + www.result == UnityWebRequest.Result.ProtocolError) + { + Debug.Log("광고 시청 후 코인 충전 실패: " + www.error); + failure?.Invoke(); + } + else + { + var result = www.downloadHandler.text; + var rechargeResult = JsonUtility.FromJson(result); + + if (rechargeResult.result == "SUCCESS") + { + Debug.Log("광고 시청으로 코인 충전 완료: " + rechargeResult.recharged); + UserManager.Instance.SetCoinsInfo(); + success?.Invoke(rechargeResult.recharged); + } + else + { + Debug.Log("광고 시청 후 충전 실패: " + rechargeResult.result); + failure?.Invoke(); + } + } + } + } } \ No newline at end of file diff --git a/Assets/Script/Main/UserManager.cs b/Assets/Script/Main/UserManager.cs index ec7f6b1..6719157 100644 --- a/Assets/Script/Main/UserManager.cs +++ b/Assets/Script/Main/UserManager.cs @@ -20,6 +20,14 @@ public class CoinsInfoResult public int coins; } +public class CoinsAdResult +{ + public string result; + public string message; + public int recharged; // 충전된 코인량 + public int currentCoins; // 현재 보유 코인량 +} + public class UserManager : Singleton { public string UserId { get; private set; } diff --git a/Assets/Script/UI/PanelChildController/ShopItemController.cs b/Assets/Script/UI/PanelChildController/ShopItemController.cs index f928182..2245032 100644 --- a/Assets/Script/UI/PanelChildController/ShopItemController.cs +++ b/Assets/Script/UI/PanelChildController/ShopItemController.cs @@ -15,21 +15,17 @@ public class ShopItemController : MonoBehaviour _shopItem = shopItem; var itemImage = GetComponentsInChildren()[1]; var itemText = GetComponentsInChildren(); - - itemImage.sprite = profileSprites[this._shopItem.ItemSpriteIndex]; + itemText[0].text = this._shopItem.Name; itemText[1].text = this._shopItem.Price; } public void OnClickShopItem() { - Debug.Log(_shopItem.Name + "의 가격은" + _shopItem.Price); - - if (_shopItem.Price == "광고") //첫번째 항목이 광고일 때를 가정하고 작성 + if (_shopItem.Price == "광고") { - Debug.Log("첫번쨰"); //보상형 전면 광고 로드 - FindObjectOfType().ShowRewardedInterstitialAd(); //FindOf 함수는 추후 수정 + FindObjectOfType().ShowRewardedInterstitialAd(); //Todo FindOf 함수 수정 } } } diff --git a/Assets/Script/UI/PanelController/TestPanelController.cs b/Assets/Script/UI/PanelController/TestPanelController.cs index d6b03d1..6dd5f57 100644 --- a/Assets/Script/UI/PanelController/TestPanelController.cs +++ b/Assets/Script/UI/PanelController/TestPanelController.cs @@ -112,7 +112,6 @@ public class TestPanelController : MonoBehaviour { ShopItem shopItem = new ShopItem { - ItemSpriteIndex = Random.Range(0, 1), Name = "코인10개", Price = "광고" }; @@ -122,7 +121,6 @@ public class TestPanelController : MonoBehaviour { ShopItem shopItem = new ShopItem { - ItemSpriteIndex = Random.Range(0, 1), Name = "코인"+i+"개", Price = (i * 1000)+ "원" };