[M] login & logout & payment
- login by token - save account info - logout remove accout info - iOS SKU list parser - iOS Pay
This commit is contained in:
@@ -17,6 +17,8 @@ public class SDKTest : MonoBehaviour
|
||||
[SerializeField]
|
||||
private Button _loginFbBtn;
|
||||
[SerializeField]
|
||||
private Button _loginTokenBtn;
|
||||
[SerializeField]
|
||||
private Button _logOutBtn;
|
||||
[SerializeField]
|
||||
private Button _payTestBtn;
|
||||
@@ -27,6 +29,8 @@ public class SDKTest : MonoBehaviour
|
||||
[SerializeField]
|
||||
private Button _gaAppMaxBtn;
|
||||
[SerializeField]
|
||||
private Button _ATTBtn;
|
||||
[SerializeField]
|
||||
private Text _messageTxt;
|
||||
|
||||
void Start()
|
||||
@@ -41,11 +45,13 @@ public class SDKTest : MonoBehaviour
|
||||
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
|
||||
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));
|
||||
_loginFbBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwFacebook));
|
||||
_loginTokenBtn.onClick.AddListener(OnLoginByToken);
|
||||
_logOutBtn.onClick.AddListener(OnLogout);
|
||||
_payTestBtn.onClick.AddListener(OnPayTestBtn);
|
||||
_payListBtn.onClick.AddListener(OnPayListBtn);
|
||||
_gaTestBtn.onClick.AddListener(OnGaBtn);
|
||||
_gaAppMaxBtn.onClick.AddListener(OnAppMaxBtn);
|
||||
_ATTBtn.onClick.AddListener(OnATTBtn);
|
||||
}
|
||||
|
||||
void Init()
|
||||
@@ -99,6 +105,19 @@ public class SDKTest : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnLoginByToken()
|
||||
{
|
||||
_messageTxt.text = string.Empty;
|
||||
Debug.LogError("[AggSdk::OnLoginByToken]");
|
||||
var info = await TYSdkFacade.Instance.LoginByToken();
|
||||
_messageTxt.text = $"Login: {info.isSuccess}";
|
||||
if (info.isSuccess)
|
||||
{
|
||||
_messageTxt.text += $"\n{info.msg}";
|
||||
_messageTxt.text += $"\n{TYSdkFacade.Instance.TYAccountInfo.token}";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLogout()
|
||||
{
|
||||
TYSdkFacade.Instance.Logout();
|
||||
@@ -106,23 +125,45 @@ public class SDKTest : MonoBehaviour
|
||||
|
||||
public async void OnPayTestBtn()
|
||||
{
|
||||
string prodId = "comarkgameft1chooseone0199";
|
||||
string pType = "googleiab.global.app";
|
||||
string prodPrice = "2,616";
|
||||
string prodName = "test:₩2,616";
|
||||
_messageTxt.text = "";
|
||||
if (sku == null){
|
||||
_messageTxt.text = "no product";
|
||||
return;
|
||||
}
|
||||
string prodId = sku.productId;
|
||||
string pType = string.Empty;
|
||||
#if UNITY_ANDROID
|
||||
pType = sku.type;
|
||||
#endif
|
||||
string prodPrice = sku.price;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
string prodName = string.Empty;
|
||||
#elif UNITY_ANDROID
|
||||
string prodName = sku.title;
|
||||
#elif UNITY_IOS
|
||||
string prodName = sku.localizedTitle;
|
||||
#endif
|
||||
int count = 1;
|
||||
|
||||
Debug.LogError($"[AggSdk::Pay] prodId : {prodId} prodPrice : {prodPrice} prodName : {prodName} ");
|
||||
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(prodId, prodPrice, prodName, count, pType);
|
||||
|
||||
_messageTxt.text = "\n" + $"Success : {payResult.isSuccess}";
|
||||
_messageTxt.text += "\n" + $"message : {payResult.msg}";
|
||||
}
|
||||
|
||||
SKUDetail sku = null;
|
||||
public async void OnPayListBtn()
|
||||
{
|
||||
Debug.Log("[AggSdk::PayList]");
|
||||
_messageTxt.text = "";
|
||||
|
||||
ProductListInfo result = await TYSdkFacade.Instance.GetSKUList();
|
||||
if (result.code == 0)
|
||||
{
|
||||
_messageTxt.text = "products count:::" + result.products.Count;
|
||||
_messageTxt.text += "\n" + result.products[0].ToString();
|
||||
sku = result.products[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -155,6 +196,11 @@ public class SDKTest : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void OnATTBtn()
|
||||
{
|
||||
UnityBridgeFunc.RequestATT();
|
||||
}
|
||||
|
||||
private void LoadAd()
|
||||
{
|
||||
Debug.Log($"[AD LOG] LoadAd {AD_ID}");
|
||||
|
||||
Reference in New Issue
Block a user