90 lines
2.6 KiB
C#
90 lines
2.6 KiB
C#
using System.Collections.Generic;
|
|
using tysdk;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SDKTest : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Button _loginGuestBtn;
|
|
[SerializeField]
|
|
private Button _loginGoogleBtn;
|
|
[SerializeField]
|
|
private Button _loginFbBtn;
|
|
[SerializeField]
|
|
private Button _logOutBtn;
|
|
[SerializeField]
|
|
private Button _payTestBtn;
|
|
[SerializeField]
|
|
private Button _payListBtn;
|
|
[SerializeField]
|
|
private Button _gaTestBtn;
|
|
[SerializeField]
|
|
private Button _gaAppMaxBtn;
|
|
[SerializeField]
|
|
private Text _messageTxt;
|
|
|
|
void Start()
|
|
{
|
|
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
|
|
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));
|
|
_loginFbBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwFacebook));
|
|
_logOutBtn.onClick.AddListener(OnLogout);
|
|
_payTestBtn.onClick.AddListener(OnPayTestBtn);
|
|
_payListBtn.onClick.AddListener(OnPayListBtn);
|
|
_gaTestBtn.onClick.AddListener(OnGaBtn);
|
|
_gaAppMaxBtn.onClick.AddListener(OnAppMaxBtn);
|
|
}
|
|
|
|
private async void OnLogin(EAccoutType accoutType)
|
|
{
|
|
_messageTxt.text = string.Empty;
|
|
var info = await TYSdkFacade.Instance.Login(accoutType);
|
|
_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();
|
|
}
|
|
|
|
public async void OnPayTestBtn()
|
|
{
|
|
string prodId = "comarkgameft1chooseone0199";
|
|
string pType = "googleiab.global.app";
|
|
string prodPrice = "2,616";
|
|
string prodName = "test:₩2,616";
|
|
int count = 1;
|
|
|
|
Debug.LogError($"[AggSdk::Pay] prodId : {prodId} prodPrice : {prodPrice} prodName : {prodName} ");
|
|
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(prodId, prodPrice, prodName, count, pType);
|
|
|
|
}
|
|
|
|
public async void OnPayListBtn()
|
|
{
|
|
Debug.LogError("PayList ask");
|
|
var result = await TYSdkFacade.Instance.ThirdExtend();
|
|
}
|
|
|
|
public void OnGaBtn()
|
|
{
|
|
Debug.LogError("Ga ask");
|
|
using ( var e = GAEvent.TackEvent("idcheckdone") )
|
|
{
|
|
e.AddContent("test ga", true);
|
|
}
|
|
}
|
|
|
|
public void OnAppMaxBtn()
|
|
{
|
|
// TYSdkFacade.Instance.PlayAd();
|
|
}
|
|
|
|
}
|