public static long CreateTask(Action action, float delay) { var id = CRandom.GetRandom(999999, 9999999); CreateTask(action, id, delay, null); return(id); }
public static int CreateTask(Action task, float delay) { var id = (int)CRandom.GetRandom(999999); Tasks.Add(id); Instance.StartCoroutine(Coroutine(task, id, delay)); return(id); }
private void QueryInventorySucceededEvent(Inventory inventory) { var purchases = inventory.GetAllPurchases(); if (purchases.Any()) { WriteLog("query inventory succeeded, purchases owned: {0}", string.Join(", ", purchases.Select(i => i.Sku).ToArray())); if (_sku == null) { foreach (var purchase in purchases) { WriteLog("restoring owned purchase: {0}", purchase.Sku); Purchased(purchase); } } else { var purchase = purchases.SingleOrDefault(i => i.Sku == _sku); if (purchase != null) { WriteLog("restoring owned purchase: {0}", purchase.Sku); Purchased(purchase); } } } else { WriteLog("query inventory succeeded, owned purchases not found"); } #if UNITY_IPHONE if (_sku == null) { WriteLog("restoring transactions (iOS)..."); OpenIAB.restoreTransactions(); } #endif #if UNITY_ANDROID || UNITY_WEBPLAYER if (_sku == null || inventory.HasPurchase(_sku)) { CompleteTask(RestoreCompleted, "purchases successfully restored (inventory check)"); } #endif else { WriteLog("purchasing product: {0}", _sku); OpenIAB.purchaseProduct(_sku, Convert.ToString(CRandom.GetRandom(0, 1000000))); } }
public static void CreateTask(Action action, float delay, Action callback) { CreateTask(action, CRandom.GetRandom(999999), delay, callback); }
public static List <T> Shuffle <T>(this List <T> source) { source.Sort((i, j) => CRandom.GetRandom(3) - 1); return(source); }