diff --git a/Assets/Huawei/Demos/IAP/Second Demo-Menu_Store.meta b/Assets/Huawei/Demos/IAP/Second Demo-Menu_Store.meta new file mode 100644 index 00000000..c840cb0a --- /dev/null +++ b/Assets/Huawei/Demos/IAP/Second Demo-Menu_Store.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c9a74e9394a7a7c45af2f4534ba22b4d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Huawei/Demos/IAP/Second Demo-Menu_Store/MainMenuManager.cs b/Assets/Huawei/Demos/IAP/Second Demo-Menu_Store/MainMenuManager.cs new file mode 100644 index 00000000..1d9ad426 --- /dev/null +++ b/Assets/Huawei/Demos/IAP/Second Demo-Menu_Store/MainMenuManager.cs @@ -0,0 +1,199 @@ +using HmsPlugin; +using HuaweiMobileServices.IAP; +using HuaweiMobileServices.Id; +using HuaweiMobileServices.Utils; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.UI; + +/* This demo scene has been created to show how to use IAP and Account kit in multiple scenes. +* Here are the steps to use this demo. +* 1. Complete the quick start steps. https://evilminddevs.gitbook.io/hms-unity-plugin/getting-started/quick-start +* 2. Enable Account kit - IAP from kit settings. https://evilminddevs.gitbook.io/hms-unity-plugin/getting-started/quick-start/connect-your-game-with-the-hms-kit-managers +* 3. Make sure you enabled IAP and Account kit services in the AppGallery console. https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/config-agc-0000001050033072#section382112213818 +* 4. Add These products to your project. (with same productID) https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/config-product-0000001050033076 +* a. Product ID: coin100 - Type: consumable +* b. Product ID: coin1000 - Type: consumable +* c. Product ID: removeAds - Type: non-consumable +* d. Product ID: premium - Type: subscription (1 week) +* 5. Add these products to IAP tab. Unity > Huawei > Kit Settings > IAP. Then click create constant classes +* +* Have a question? You can ask by creating an issue in our project on Github or via our discord channel. +*/ + + +public class MainMenuManager : MonoBehaviour +{ + string TAG = "[MainMenuManager]:"; + + Button playBtn, storeBtn, signinBtn; + Text userTxt, coinTxt; + void Start() + { + Screen.orientation = ScreenOrientation.Landscape; + + playBtn = GameObject.Find("Play").GetComponent