Authored Unity primitive/object-model shim, VFX layer (control-flow-preserving, InstantVfx never invokes its action -- headless suppression), god-object stubs (GameMgr/EffectMgr/UIManager with faithfully-extracted nested enums), View/UI/Touch tree, LitJson+BetterList+Tuple copied, third-party stubs. Discovered Roslyn header-error masking: fixing class-header type errors unmasks body references, so the true copy closure is ~2570 files (was 782 under masking). Errors: masked-25720 -> 268; our shim files compile clean. Remaining: ~50 residual shim/external types, 24 NGUI UI-base overrides, static-type fixes, plus likely 1-2 more unmask waves.
94 lines
2.1 KiB
C#
94 lines
2.1 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
using Wizard;
|
|
|
|
public class MyPageShopCrystalApeal : MonoBehaviour
|
|
{
|
|
private enum State
|
|
{
|
|
INIT,
|
|
SUCCESS,
|
|
ERROR
|
|
}
|
|
|
|
private const int TIME_LIMIT_BORDER_SECOND = 172800;
|
|
|
|
[SerializeField]
|
|
private UILabel _timeLimit;
|
|
|
|
[SerializeField]
|
|
private GameObject _newIcon;
|
|
|
|
private State _state;
|
|
|
|
public IEnumerator Initialize(double serverTime)
|
|
{
|
|
_state = State.INIT;
|
|
PaymentPC paymentImpl = PaymentPC.GetInstance();
|
|
paymentImpl.initialize();
|
|
paymentImpl.ProductListSucceeded += OnSuccessGetProductList;
|
|
paymentImpl.ProductListFailed += OnFailedGetProductList;
|
|
while (_state == State.INIT)
|
|
{
|
|
yield return null;
|
|
}
|
|
ClearPaymentHandler();
|
|
if (_state == State.ERROR)
|
|
{
|
|
yield break;
|
|
}
|
|
RemainTime remainTime = null;
|
|
foreach (string productId in paymentImpl.ProductIdList)
|
|
{
|
|
if (paymentImpl.ProductCurrentPurchaseCount.ContainsKey(productId))
|
|
{
|
|
int num = paymentImpl.ProductCurrentPurchaseCount[productId];
|
|
int num2 = paymentImpl.ProductPurchaseLimitCount[productId];
|
|
if (num >= num2)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
RemainTime remainTime2 = new RemainTime(paymentImpl.ProductEndTime[productId], serverTime);
|
|
if (remainTime2.Second <= 172800 && remainTime2.Second > 0)
|
|
{
|
|
if (remainTime == null)
|
|
{
|
|
remainTime = remainTime2;
|
|
}
|
|
else if (remainTime2.Second < remainTime.Second)
|
|
{
|
|
remainTime = remainTime2;
|
|
}
|
|
}
|
|
}
|
|
if (remainTime != null)
|
|
{
|
|
_timeLimit.gameObject.SetActive(value: true);
|
|
_timeLimit.text = remainTime.GetShowText();
|
|
}
|
|
else
|
|
{
|
|
_timeLimit.gameObject.SetActive(value: false);
|
|
}
|
|
_newIcon.SetActive(Data.Load.data._userCrystalCount.NeedNewIcon);
|
|
}
|
|
|
|
private void OnSuccessGetProductList()
|
|
{
|
|
_state = State.SUCCESS;
|
|
}
|
|
|
|
private void OnFailedGetProductList()
|
|
{
|
|
_state = State.ERROR;
|
|
}
|
|
|
|
private void ClearPaymentHandler()
|
|
{
|
|
PaymentPC instance = PaymentPC.GetInstance();
|
|
instance.ProductListSucceeded -= OnSuccessGetProductList;
|
|
instance.ProductListFailed -= OnFailedGetProductList;
|
|
}
|
|
}
|