59 lines
2.4 KiB
C#
59 lines
2.4 KiB
C#
using System;
|
|
|
|
namespace TKS.OutGame
|
|
{
|
|
/// <summary>
|
|
/// 결제 창구(PD 2026-11-26 요청서 2절 3) — 기기 세이브 모드 = 시험 결제(화면이 확인 팝업 「시험 결제」를 띄운 뒤 바로 성공) ·
|
|
/// 구글 플레이 결제 = 인터페이스만(실제 연결 = 플레이 콘솔 상품 등록 뒤 · 범위 밖 · 상품 id = tks_<s_id> · 소모성 = 보옥 · 패키지 · 월정액 · 성장 패스 / 비소모성 = 광고 제거).
|
|
/// </summary>
|
|
public interface ITradeStore
|
|
{
|
|
/// <summary>시험 결제(돈이 나가지 않음 · 화면에 「시험 결제」 표시).</summary>
|
|
bool IsTest { get; }
|
|
|
|
/// <summary>결제 요청 → done(성공, 실패 사유). 지급은 부르는 쪽(OutGameSession.TradePurchase)이 한다.</summary>
|
|
void Purchase(string productId, int krw, Action<bool, string> done);
|
|
|
|
/// <summary>비소모성 구매 복원(광고 제거 · 기기를 바꿨을 때) → done(복원할 상품 id 목록).</summary>
|
|
void Restore(Action<string[]> done);
|
|
}
|
|
|
|
/// <summary>기기 세이브 모드의 시험 결제 — 확인 팝업은 화면이 띄우고 여기서는 바로 성공.</summary>
|
|
public class TestTradeStore : ITradeStore
|
|
{
|
|
public bool IsTest { get { return true; } }
|
|
|
|
public void Purchase(string productId, int krw, Action<bool, string> done)
|
|
{
|
|
done(true, null);
|
|
}
|
|
|
|
public void Restore(Action<string[]> done)
|
|
{
|
|
done(new string[0]);
|
|
}
|
|
}
|
|
|
|
/// <summary>구글 플레이 결제(Play Billing) — 인터페이스만 · 연결 전 = 실패(플레이 콘솔 상품 등록 · 결제 라이브러리 연결 = 후속).</summary>
|
|
public class GooglePlayTradeStore : ITradeStore
|
|
{
|
|
public bool IsTest { get { return false; } }
|
|
|
|
public void Purchase(string productId, int krw, Action<bool, string> done)
|
|
{
|
|
done(false, TradeText.T("trade_store_not_linked"));
|
|
}
|
|
|
|
public void Restore(Action<string[]> done)
|
|
{
|
|
done(new string[0]);
|
|
}
|
|
}
|
|
|
|
public static class TradeStore
|
|
{
|
|
/// <summary>지금 결제 창구(기본 = 시험 결제 · 구글 플레이 연결 뒤 GooglePlayTradeStore 로 바꿈).</summary>
|
|
public static ITradeStore Current = new TestTradeStore();
|
|
}
|
|
}
|