From 9336ed0d6f08d1893132c853cfbfb73129611c74 Mon Sep 17 00:00:00 2001 From: sophon Date: Fri, 17 Oct 2025 09:14:59 +0800 Subject: [PATCH] modify scripts --- .../Resources/Popups/MessagePopup.prefab | 465 ++++++++++++++++++ .../Resources/Popups/MessagePopup.prefab.meta | 7 + .../WordConnectGameToolkit/Scenes/main.unity | 3 +- .../Scripts/Editor/EditorMenu.cs | 43 +- .../Scripts/Editor/PopupPreview.cs | 93 ++++ .../Scripts/Editor/PopupPreview.cs.meta | 11 + .../Scripts/Enums/EGameEvent.cs | 1 + .../Editor/WordsToolkii.LevelEditor.asmdef | 6 +- .../Scripts/Popups/ MessagePopup.cs | 21 + .../Scripts/Popups/ MessagePopup.cs.meta | 11 + .../Scripts/Popups/CoinsShop.cs | 39 ++ .../Scripts/Services/IAP/IAPController.cs | 9 +- .../Scripts/Services/IAP/IAPErr.cs | 57 +++ .../Scripts/Services/IAP/IAPErr.cs.meta | 11 + .../Scripts/Services/IAP/IAPManager.cs | 6 + .../Scripts/Services/IAP/IIAPManager.cs | 2 + .../Editor/CandySmith.Settings.Editor.asmdef | 6 +- .../Scripts/System/GameManager.cs | 6 + ProjectSettings/EditorBuildSettings.asset | 3 +- ProjectSettings/ProjectSettings.asset | 2 +- 20 files changed, 778 insertions(+), 24 deletions(-) create mode 100644 Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab create mode 100644 Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab.meta create mode 100644 Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs create mode 100644 Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs.meta create mode 100644 Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs create mode 100644 Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs.meta create mode 100644 Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs create mode 100644 Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs.meta diff --git a/Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab b/Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab new file mode 100644 index 0000000..0191ec2 --- /dev/null +++ b/Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab @@ -0,0 +1,465 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1818791151053463826 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2567939603980722763} + - component: {fileID: 3423675973788078395} + - component: {fileID: 1805814460615924799} + - component: {fileID: 6259068709827928649} + - component: {fileID: 1114516486659757762} + m_Layer: 5 + m_Name: MessageText + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2567939603980722763 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818791151053463826} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1.0007356, y: 1.0007356, z: 1.0007356} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 8034155342639863909} + 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.55041504, y: 120.05658} + m_SizeDelta: {x: 800, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3423675973788078395 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818791151053463826} + m_CullTransparentMesh: 1 +--- !u!114 &1805814460615924799 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818791151053463826} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: New Text + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4279308570 + m_fontColor: {r: 0.103773594, g: 0.06510325, b: 0.06510325, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 48 + m_fontSizeBase: 48 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 1 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!95 &6259068709827928649 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818791151053463826} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!225 &1114516486659757762 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818791151053463826} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!1 &7811482148034564061 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8034155342639863909} + - component: {fileID: 8031136941516792535} + - component: {fileID: 8016891387234896929} + - component: {fileID: 3521832069348138651} + - component: {fileID: 5153632076726711166} + m_Layer: 5 + m_Name: MessagePopup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8034155342639863909 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7811482148034564061} + 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: + - {fileID: 2567939603980722763} + - {fileID: 8729196215722196391} + 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: 1284, y: 400} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8031136941516792535 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7811482148034564061} + m_CullTransparentMesh: 0 +--- !u!95 &8016891387234896929 +Animator: + serializedVersion: 5 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7811482148034564061} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: cac0359e35eca487b8be1ca73b3d159d, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_StabilizeFeet: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorStateOnDisable: 0 + m_WriteDefaultValuesOnDisable: 0 +--- !u!225 &3521832069348138651 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7811482148034564061} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!114 &5153632076726711166 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7811482148034564061} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b00e69d6788d74f1cb21197ea9faaa8d, type: 3} + m_Name: + m_EditorClassIdentifier: + fade: 1 + closeButton: {fileID: 0} + tagsToShow: [] + isPopupAboveTags: 0 + fadeAlpha: 1 + appearSound: {fileID: 0} + disappearSound: {fileID: 0} + messageText: {fileID: 1805814460615924799} +--- !u!1001 &4313604078728082956 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 8034155342639863909} + m_Modifications: + - target: {fileID: 90856562591110198, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.b + value: 0.14509805 + objectReference: {fileID: 0} + - target: {fileID: 90856562591110198, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.g + value: 0.8901961 + objectReference: {fileID: 0} + - target: {fileID: 90856562591110198, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.r + value: 0.10980392 + objectReference: {fileID: 0} + - target: {fileID: 907128453201242062, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Name + value: NO + objectReference: {fileID: 0} + - target: {fileID: 1804143460132237798, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_SizeDelta.x + value: 308.7 + objectReference: {fileID: 0} + - target: {fileID: 1804143460132237798, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_SizeDelta.y + value: 93.683 + objectReference: {fileID: 0} + - target: {fileID: 1804143460132237798, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchoredPosition.x + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 1804143460132237798, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchoredPosition.y + value: 9.76 + objectReference: {fileID: 0} + - target: {fileID: 3661189285963648132, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4641059037314894576, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_text + value: NO + objectReference: {fileID: 0} + - target: {fileID: 4641059037314894576, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: instanceID + value: NO + objectReference: {fileID: 0} + - target: {fileID: 4641059037314894576, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_fontSize + value: 77.4 + objectReference: {fileID: 0} + - target: {fileID: 4641059037314894576, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_sharedMaterial + value: + objectReference: {fileID: 3722732180671858053, guid: 14928a98ac0086a4483452d618f1764c, type: 2} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchorMax.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchorMax.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchorMin.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchorMin.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_SizeDelta.x + value: 422.6 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_SizeDelta.y + value: 80 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalScale.x + value: 1.0007356 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalScale.y + value: 1.0007356 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalScale.z + value: 1.0007356 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchoredPosition.x + value: 242.62836 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_AnchoredPosition.y + value: -7.036865 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8610968763401608209, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8644439777305475629, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.b + value: 0.84313726 + objectReference: {fileID: 0} + - target: {fileID: 8644439777305475629, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.g + value: 0.8039216 + objectReference: {fileID: 0} + - target: {fileID: 8644439777305475629, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.r + value: 0.7921569 + objectReference: {fileID: 0} + - target: {fileID: 8673558434284163724, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.b + value: 0.047058824 + objectReference: {fileID: 0} + - target: {fileID: 8673558434284163724, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.g + value: 0.69803923 + objectReference: {fileID: 0} + - target: {fileID: 8673558434284163724, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + propertyPath: m_Color.r + value: 0.007843138 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: + - {fileID: 6038492710620930376, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + - {fileID: 3661189285963648132, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} +--- !u!224 &8729196215722196391 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 4825982739004869547, guid: e81bbbc218b73d345bfb5f45c5fa7c66, type: 3} + m_PrefabInstance: {fileID: 4313604078728082956} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab.meta b/Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab.meta new file mode 100644 index 0000000..3057440 --- /dev/null +++ b/Assets/WordConnectGameToolkit/Resources/Popups/MessagePopup.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 520cfca0b533043a68fce421523ffd17 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WordConnectGameToolkit/Scenes/main.unity b/Assets/WordConnectGameToolkit/Scenes/main.unity index 181b43a..b969edc 100644 --- a/Assets/WordConnectGameToolkit/Scenes/main.unity +++ b/Assets/WordConnectGameToolkit/Scenes/main.unity @@ -2617,6 +2617,7 @@ MonoBehaviour: m_DeselectOnBackgroundClick: 1 m_PointerBehavior: 0 m_CursorLockBehavior: 0 + m_ScrollDeltaPerTick: 6 --- !u!1 &1251246399 GameObject: m_ObjectHideFlags: 0 @@ -5096,7 +5097,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 862757017896117680, guid: 62f7a9d47df56401f802404b7d45d912, type: 3} propertyPath: m_AnchoredPosition.y - value: -233.00006 + value: -233.00012 objectReference: {fileID: 0} - target: {fileID: 862757017896117680, guid: 62f7a9d47df56401f802404b7d45d912, type: 3} propertyPath: m_LocalEulerAnglesHint.x diff --git a/Assets/WordConnectGameToolkit/Scripts/Editor/EditorMenu.cs b/Assets/WordConnectGameToolkit/Scripts/Editor/EditorMenu.cs index 407f9f7..a44a82d 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Editor/EditorMenu.cs +++ b/Assets/WordConnectGameToolkit/Scripts/Editor/EditorMenu.cs @@ -23,71 +23,71 @@ namespace WordsToolkit.Scripts.Editor public static string WordConnect = "WordConnect"; private static string WordConnectPath = "Assets/WordConnectGameToolkit"; - [MenuItem( nameof(WordConnect) + "/Settings/Shop settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Shop settings")] public static void IAPProducts() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/CoinsShopSettings.asset"); } - [MenuItem( nameof(WordConnect) + "/Settings/Ads settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Ads settings")] public static void AdsSettings() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/AdsSettings.asset"); } //DailyBonusSettings - [MenuItem( nameof(WordConnect) + "/Settings/Daily bonus settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Daily bonus settings")] public static void DailyBonusSettings() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/DailyBonusSettings.asset"); } //GameSettings - [MenuItem( nameof(WordConnect) + "/Settings/Game settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Game settings")] public static void GameSettings() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/GameSettings.asset"); } //SpinSettings - [MenuItem( nameof(WordConnect) + "/Settings/Spin settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Spin settings")] public static void SpinSettings() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/SpinSettings.asset"); } //DebugSettings - [MenuItem( nameof(WordConnect) + "/Settings/Debug settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Debug settings")] public static void DebugSettings() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/DebugSettings.asset"); } - [MenuItem( nameof(WordConnect) + "/Settings/Crossword config")] + [MenuItem(nameof(WordConnect) + "/Settings/Crossword config")] public static void CrosswordConfig() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/CrosswordConfig.asset"); } - [MenuItem( nameof(WordConnect) + "/Settings/Tutorial settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Tutorial settings")] public static void TutorialSettings() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/TutorialSettings.asset"); } - [MenuItem( nameof(WordConnect) + "/Settings/Language configuration")] + [MenuItem(nameof(WordConnect) + "/Settings/Language configuration")] public static void LanguageConfiguration() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/LanguageConfiguration.asset"); } - [MenuItem( nameof(WordConnect) + "/Settings/Gift settings")] + [MenuItem(nameof(WordConnect) + "/Settings/Gift settings")] public static void GiftSettings() { Selection.activeObject = AssetDatabase.LoadMainAssetAtPath(WordConnectPath + "/Resources/Settings/GiftSettings.asset"); } - [MenuItem( nameof(WordConnect) + "/Scenes/Main scene &1", priority = 0)] + [MenuItem(nameof(WordConnect) + "/Scenes/Main scene &1", priority = 0)] public static void MainScene() { EditorSceneManager.OpenScene(WordConnectPath + "/Scenes/main.unity"); @@ -99,7 +99,7 @@ namespace WordsToolkit.Scripts.Editor EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } - [MenuItem( nameof(WordConnect) + "/Scenes/Game scene &2")] + [MenuItem(nameof(WordConnect) + "/Scenes/Game scene &2")] public static void GameScene() { var stateManager = Object.FindObjectOfType(); @@ -107,7 +107,7 @@ namespace WordsToolkit.Scripts.Editor EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); } - [MenuItem( nameof(WordConnect) + "/Editor/Tile editor", priority = 1)] + [MenuItem(nameof(WordConnect) + "/Editor/Tile editor", priority = 1)] public static void ColorEditor() { string folderPath = WordConnectPath + "/Resources/ColorsTile"; @@ -130,37 +130,44 @@ namespace WordsToolkit.Scripts.Editor EditorGUIUtility.PingObject(tileAsset); } - [MenuItem( nameof(WordConnect) + "/Documentation/Main", priority = 2)] + [MenuItem(nameof(WordConnect) + "/Documentation/Main", priority = 2)] public static void MainDoc() { Application.OpenURL("https://candy-smith.gitbook.io/main"); } - [MenuItem( nameof(WordConnect) + "/Documentation/ADS/Setup ads")] + [MenuItem(nameof(WordConnect) + "/Documentation/ADS/Setup ads")] public static void UnityadsDoc() { Application.OpenURL("https://candy-smith.gitbook.io/bubble-shooter-toolkit/tutorials/ads-setup/"); } - [MenuItem( nameof(WordConnect) + "/Documentation/Unity IAP (in-apps)")] + [MenuItem(nameof(WordConnect) + "/Documentation/Unity IAP (in-apps)")] public static void Inapp() { Application.OpenURL("https://candy-smith.gitbook.io/main/block-puzzle-game-toolkit/setting-up-in-app-purchase-products"); } - [MenuItem( nameof(WordConnect) + "/NLP/Training Language Model")] + [MenuItem(nameof(WordConnect) + "/NLP/Training Language Model")] public static void TrainingModel() { Application.OpenURL("https://colab.research.google.com/drive/199zNcB3FPfnrD6E7OiwmwCcf27jMnY1b?usp=sharing"); } - [MenuItem( nameof(WordConnect) + "/Reset PlayerPrefs &e")] + [MenuItem(nameof(WordConnect) + "/Reset PlayerPrefs &e")] private static void ResetPlayerPrefs() { GameDataManager.ClearALlData(); PlayerPrefs.DeleteKey("GameState"); Debug.Log("PlayerPrefs are reset"); } + + // 🔥 新增菜单项,打开 PrefabBatchViewer 窗口 + [MenuItem(nameof(WordConnect) + "/Settings/Prefab Batch Viewer")] + public static void OpenPrefabBatchViewer() + { + PopupPreview.ShowWindow(); + } } } diff --git a/Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs b/Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs new file mode 100644 index 0000000..96c558d --- /dev/null +++ b/Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs @@ -0,0 +1,93 @@ +using UnityEditor; +using UnityEngine; +using System.IO; +using System.Linq; + +public class PopupPreview : EditorWindow +{ + private GameObject[] prefabs; + private int currentIndex = 0; + private GameObject currentInstance; + + [MenuItem("Tools/Prefab Batch Viewer")] + public static void ShowWindow() + { + GetWindow("Prefab Batch Viewer"); + } + + private void OnEnable() + { + string path = "Assets/WordConnectGameToolkit/Resources/Popups"; + string[] prefabPaths = Directory.GetFiles(path, "*.prefab", SearchOption.AllDirectories); + prefabs = prefabPaths + .Select(p => AssetDatabase.LoadAssetAtPath(p)) + .Where(p => p != null) + .ToArray(); + } + + private void OnGUI() + { + if (prefabs == null || prefabs.Length == 0) + { + EditorGUILayout.LabelField("No prefabs found in Resources/Popups."); + return; + } + + EditorGUILayout.LabelField($"Prefab {currentIndex + 1}/{prefabs.Length}", EditorStyles.boldLabel); + EditorGUILayout.ObjectField("Current Prefab", prefabs[currentIndex], typeof(GameObject), false); + + GUILayout.Space(10); + + EditorGUILayout.BeginHorizontal(); + if (GUILayout.Button("Previous")) + { + ShowPreviousPrefab(); + } + if (GUILayout.Button("Next")) + { + ShowNextPrefab(); + } + EditorGUILayout.EndHorizontal(); + + GUILayout.Space(10); + + if (currentInstance == null) + { + if (GUILayout.Button("Instantiate in Scene")) + { + InstantiateCurrentPrefab(); + } + } + else + { + if (GUILayout.Button("Remove Instance")) + { + DestroyImmediate(currentInstance); + } + } + } + + private void ShowPreviousPrefab() + { + currentIndex = (currentIndex - 1 + prefabs.Length) % prefabs.Length; + InstantiateCurrentPrefab(); + } + + private void ShowNextPrefab() + { + currentIndex = (currentIndex + 1) % prefabs.Length; + InstantiateCurrentPrefab(); + } + + private void InstantiateCurrentPrefab() + { + if (currentInstance != null) + { + DestroyImmediate(currentInstance); + } + + currentInstance = (GameObject)PrefabUtility.InstantiatePrefab(prefabs[currentIndex]); + currentInstance.name = prefabs[currentIndex].name + "_Preview"; + Selection.activeGameObject = currentInstance; + } +} diff --git a/Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs.meta b/Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs.meta new file mode 100644 index 0000000..a91f6eb --- /dev/null +++ b/Assets/WordConnectGameToolkit/Scripts/Editor/PopupPreview.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 599a70f1dde3c4f8b879a52397f2416e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WordConnectGameToolkit/Scripts/Enums/EGameEvent.cs b/Assets/WordConnectGameToolkit/Scripts/Enums/EGameEvent.cs index 34a6eb5..31a0bad 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Enums/EGameEvent.cs +++ b/Assets/WordConnectGameToolkit/Scripts/Enums/EGameEvent.cs @@ -26,6 +26,7 @@ namespace WordsToolkit.Scripts.Enums LanguageChanged, TileSelected, PurchaseSucceeded, + PurchaseFailed, ButtonClicked, WordAnimated, ExtraWordClaimed diff --git a/Assets/WordConnectGameToolkit/Scripts/Levels/Editor/WordsToolkii.LevelEditor.asmdef b/Assets/WordConnectGameToolkit/Scripts/Levels/Editor/WordsToolkii.LevelEditor.asmdef index feda967..b3e54ab 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Levels/Editor/WordsToolkii.LevelEditor.asmdef +++ b/Assets/WordConnectGameToolkit/Scripts/Levels/Editor/WordsToolkii.LevelEditor.asmdef @@ -4,7 +4,11 @@ "references": [ "GUID:343deaaf83e0cee4ca978e7df0b80d21", "GUID:d3bf71b33c0c04eb9bc1a8d6513d76bb", - "GUID:b0214a6008ed146ff8f122a6a9c2f6cc" + "GUID:b0214a6008ed146ff8f122a6a9c2f6cc", + "GUID:00dd4a7ac8c24c898083910c81898ecc", + "GUID:ac6e78962cfc743b9a5fc5f5a808aa72", + "GUID:b25ad8286798741e3b2cc3883283e669", + "GUID:75bdbcf23199f4cfb86c610d1d946666" ], "includePlatforms": [ "Editor" diff --git a/Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs b/Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs new file mode 100644 index 0000000..4051a4a --- /dev/null +++ b/Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs @@ -0,0 +1,21 @@ +using UnityEngine; +using TMPro; +using UnityEngine.UI; + +namespace WordsToolkit.Scripts.Popups +{ + public class MessagePopup : Banner + { + [SerializeField] private TextMeshProUGUI messageText; + + public void SetMessage(string message) + { + if (messageText != null) + { + messageText.text = message; + gameObject.SetActive(true); + } + + } + } +} \ No newline at end of file diff --git a/Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs.meta b/Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs.meta new file mode 100644 index 0000000..b4bc674 --- /dev/null +++ b/Assets/WordConnectGameToolkit/Scripts/Popups/ MessagePopup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b00e69d6788d74f1cb21197ea9faaa8d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WordConnectGameToolkit/Scripts/Popups/CoinsShop.cs b/Assets/WordConnectGameToolkit/Scripts/Popups/CoinsShop.cs index cbc3ab4..44715ab 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Popups/CoinsShop.cs +++ b/Assets/WordConnectGameToolkit/Scripts/Popups/CoinsShop.cs @@ -49,6 +49,7 @@ namespace WordsToolkit.Scripts.Popups } EventManager.GetEvent(EGameEvent.PurchaseSucceeded).Subscribe(PurchaseSucceded); + EventManager.GetEvent<(string, string)>(EGameEvent.PurchaseFailed).Subscribe(PurchaseFailed); } private void OnDisable() @@ -85,6 +86,44 @@ namespace WordsToolkit.Scripts.Popups } } + private void PurchaseFailed((string, string) info) + { + var productId = info.Item1; + var errorMessage = info.Item2; + + var errorType = IAPErrorHelper.ParseError(errorMessage); + Debug.LogWarning($"Purchase failed for product {productId}: {errorMessage}, Error Type: {errorType}"); + + switch (errorType) + { + case IAPErrorType.InvalidProductID: + Debug.LogError($"Invalid product ID: {productId}"); + ShowErrorMessage("Invalid product ID. Please try again later."); + break; + case IAPErrorType.UserCancelled: + Debug.LogWarning("Purchase cancelled by user."); + break; + case IAPErrorType.DuplicateTransaction: + Debug.LogWarning($"Duplicate transaction for product {productId}. This usually means the purchase was already completed."); + break; + case IAPErrorType.IAPInitFailed: + Debug.LogError("IAP initialization failed. Please check your IAP settings."); + ShowErrorMessage("IAP initialization failed. Please try again later."); + break; + default: + ShowErrorMessage($"Payment failed: {errorMessage}"); + break; + } + } + private void ShowErrorMessage(string message) + { + var popup = menuManager.ShowPopup(); + if (popup != null) + { + popup.SetMessage(message); + } + } + public void BuyCoins(string id) { // StopInteration(); diff --git a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPController.cs b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPController.cs index 611a988..c26b511 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPController.cs +++ b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPController.cs @@ -25,6 +25,7 @@ namespace WordsToolkit.Scripts.Services.IAP private IExtensionProvider extensionProvider; public static event Action OnSuccessfulPurchase; + public static event Action<(string,string)> OnFailedPurchase; public static event Action> OnRestorePurchasesFinished; public void InitializePurchasing(IEnumerable<(string productId, ProductTypeWrapper.ProductType productType)> products) @@ -111,20 +112,24 @@ namespace WordsToolkit.Scripts.Services.IAP { Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id)); storeController.InitiatePurchase(product); + OnFailedPurchase?.Invoke((productId, "Product not found or not available for purchase.")); // debug only } else { Debug.Log($"BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase {productId}"); + OnFailedPurchase?.Invoke((productId, "InvalidProductID: product not found or not available for purchase.")); } } else { - Debug.Log("BuyProductID FAIL. Not initialized."); + Debug.Log("IAPInitFailed: BuyProductID FAIL. Not initialized."); + OnFailedPurchase?.Invoke((productId, "IAPInitFailed: Not initialized.")); } } catch (Exception e) { Debug.Log("BuyProductID: FAIL. Exception during purchase. " + e); + OnFailedPurchase?.Invoke((productId, "Exception during purchase: " + e.Message)); } } @@ -159,11 +164,13 @@ namespace WordsToolkit.Scripts.Services.IAP public void OnPurchaseFailed(Product product, PurchaseFailureDescription failureDescription) { Debug.Log("OnPurchaseFailed: FAIL. Product: " + product.definition.id + " PurchaseFailureDescription: " + failureDescription); + OnFailedPurchase?.Invoke((product.definition.id, failureDescription.message)); } public void OnPurchaseFailed(Product i, PurchaseFailureReason p) { Debug.Log($"OnPurchaseFailed: FAIL. Product: '{i.definition.id}', PurchaseFailureReason: {p}"); + OnFailedPurchase?.Invoke((i.definition.id, p.ToString())); } public void OnInitializeFailed(InitializationFailureReason reason) diff --git a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs new file mode 100644 index 0000000..5f19696 --- /dev/null +++ b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs @@ -0,0 +1,57 @@ +using System; + +namespace WordsToolkit.Scripts.Services.IAP +{ + /// + /// IAP 典型错误类型枚举 + /// + public enum IAPErrorType + { + None, + UserCancelled, + PaymentDeclined, + InsufficientFunds, + ProductUnavailable, + DuplicateTransaction, + NetworkError, + NetworkUnavailable, + IAPInitFailed, + InvalidProductID, + Unknown + } + + public static class IAPErrorHelper + { + /// + /// 根据错误信息字符串,提取并映射到 IAPErrorType 枚举 + /// + public static IAPErrorType ParseError(string errorMessage) + { + if (string.IsNullOrEmpty(errorMessage)) + return IAPErrorType.Unknown; + + errorMessage = errorMessage.ToLowerInvariant(); + + if (errorMessage.Contains("usercancelled") || errorMessage.Contains("user cancelled")) + return IAPErrorType.UserCancelled; + if (errorMessage.Contains("paymentdeclined") || errorMessage.Contains("payment declined")) + return IAPErrorType.PaymentDeclined; + if (errorMessage.Contains("insufficientfunds") || errorMessage.Contains("insufficient funds")) + return IAPErrorType.InsufficientFunds; + if (errorMessage.Contains("productunavailable") || errorMessage.Contains("product unavailable")) + return IAPErrorType.ProductUnavailable; + if (errorMessage.Contains("duplicatetransaction") || errorMessage.Contains("duplicate transaction")) + return IAPErrorType.DuplicateTransaction; + if (errorMessage.Contains("networkerror") || errorMessage.Contains("network error")) + return IAPErrorType.NetworkError; + if (errorMessage.Contains("networkunavailable") || errorMessage.Contains("network unavailable")) + return IAPErrorType.NetworkUnavailable; + if (errorMessage.Contains("InvalidProductID".ToLowerInvariant()) ) + return IAPErrorType.InvalidProductID; + if (errorMessage.Contains("IAPInitFailed".ToLowerInvariant())) + return IAPErrorType.IAPInitFailed; + + return IAPErrorType.Unknown; + } + } +} \ No newline at end of file diff --git a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs.meta b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs.meta new file mode 100644 index 0000000..f058ba2 --- /dev/null +++ b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPErr.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03eff658508844cfd91bab5657295e76 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPManager.cs b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPManager.cs index d700b63..30111a2 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPManager.cs +++ b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IAPManager.cs @@ -50,6 +50,12 @@ namespace WordsToolkit.Scripts.Services.IAP IAPController.OnSuccessfulPurchase += purchaseHandler; #endif } + public void SubscribeToPurchaseFailedEvent(Action<(string, string)> purchaseHandler) + { + #if UNITY_PURCHASING + IAPController.OnFailedPurchase += purchaseHandler; + #endif + } public void UnsubscribeFromPurchaseEvent(Action purchaseHandler) { diff --git a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IIAPManager.cs b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IIAPManager.cs index 911edab..a680ec3 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IIAPManager.cs +++ b/Assets/WordConnectGameToolkit/Scripts/Services/IAP/IIAPManager.cs @@ -13,6 +13,8 @@ namespace WordsToolkit.Scripts.Services.IAP bool IsProductPurchased(string productId); void RestorePurchases(Action> action); void SubscribeToPurchaseEvent(Action purchaseHandler); + + void SubscribeToPurchaseFailedEvent(Action<(string, string)> purchaseHandler); void UnsubscribeFromPurchaseEvent(Action purchaseHandler); } } \ No newline at end of file diff --git a/Assets/WordConnectGameToolkit/Scripts/Settings/Editor/CandySmith.Settings.Editor.asmdef b/Assets/WordConnectGameToolkit/Scripts/Settings/Editor/CandySmith.Settings.Editor.asmdef index 3f0c0dd..1cda045 100644 --- a/Assets/WordConnectGameToolkit/Scripts/Settings/Editor/CandySmith.Settings.Editor.asmdef +++ b/Assets/WordConnectGameToolkit/Scripts/Settings/Editor/CandySmith.Settings.Editor.asmdef @@ -3,7 +3,11 @@ "rootNamespace": "", "references": [ "GUID:d3bf71b33c0c04eb9bc1a8d6513d76bb", - "GUID:00dd4a7ac8c24c898083910c81898ecc" + "GUID:00dd4a7ac8c24c898083910c81898ecc", + "GUID:ac6e78962cfc743b9a5fc5f5a808aa72", + "GUID:b25ad8286798741e3b2cc3883283e669", + "GUID:75bdbcf23199f4cfb86c610d1d946666", + "GUID:b0214a6008ed146ff8f122a6a9c2f6cc" ], "includePlatforms": [ "Editor" diff --git a/Assets/WordConnectGameToolkit/Scripts/System/GameManager.cs b/Assets/WordConnectGameToolkit/Scripts/System/GameManager.cs index c991ff8..f847009 100644 --- a/Assets/WordConnectGameToolkit/Scripts/System/GameManager.cs +++ b/Assets/WordConnectGameToolkit/Scripts/System/GameManager.cs @@ -103,6 +103,7 @@ namespace WordsToolkit.Scripts.System language = langName; EventManager.GetEvent(EGameEvent.LanguageChanged).Subscribe(LanguageChanged); iapManager.SubscribeToPurchaseEvent(PurchaseSucceeded); + iapManager.SubscribeToPurchaseFailedEvent(PurchaseFailed); stateManager.OnStateChanged.AddListener((state) => { if (state != EScreenStates.MainMenu) @@ -229,6 +230,11 @@ namespace WordsToolkit.Scripts.System { EventManager.GetEvent(EGameEvent.PurchaseSucceeded).Invoke(id); } + public void PurchaseFailed((string, string) info) + { + EventManager.GetEvent<(string, string)>(EGameEvent.PurchaseFailed).Invoke(info); + } + public void SetGameMode(EGameMode gameMode) { diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 7483143..8a85a9c 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -8,4 +8,5 @@ EditorBuildSettings: - enabled: 1 path: Assets/WordConnectGameToolkit/Scenes/main.unity guid: 88c9f51e8542e47d28fa27d5846353d5 - m_configObjects: {} + m_configObjects: + com.unity.adaptiveperformance.simulator.provider_settings: {fileID: 11400000, guid: 3e70720b3e3ab479dbbe59419be4071d, type: 2} diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 0370a8d..5c544f3 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -165,7 +165,7 @@ PlayerSettings: applicationIdentifier: Android: com.CandySmith.WordConnect Standalone: com.DefaultCompany.WordsCompleteProject - iPhone: com.CandySmith.WordConnect + iPhone: com.Sophon-Future-Technology--Shenzhen--Co.--Ltd..WordConnect buildNumber: Standalone: 0 VisionOS: 0