public void CheckRecipe()
    {
        Recipe recipe = FindReadyRecipe();

        if (recipe != null)
        {
            GameObject obj = GameObject.Find("CollectionCore");
            collectionCore = obj.GetComponent <CollectionCore>();

            Dictionary <string, ConversionFormula> formulas = collectionCore.GetFormulas();
            ConversionFormula formulaToUse = formulas [recipe.formulaName];

            User.CurrentProfile.Entitlements.ApplyConversion(formulaToUse.Id, (ConversionResult result, NPNFError error) => {
                if (error == null)
                {
                    InventoryController ctrler = (InventoryController)AppController.Instance.GetController(Controller.INVENTORY);

                    foreach (Entitlement entitlement in result.Added)
                    {
                        ctrler.OnNewInventory(entitlement.Id);
                    }
                    recipe.isDone = true;
                }
                else if (error != null)
                {
                    Debug.LogError("Conversion failed" + error);
                    AppController.Instance.IsNetworkError(error);
                }
            });
        }
    }
Beispiel #2
0
 public static void RevertChangesToDBValue <T>(this CollectionCore <T> entityCollection) where T : class, IEntity
 {
     foreach (var dirtyEntity in entityCollection.DirtyEntities)
     {
         dirtyEntity.RevertChangesToDBValue();
     }
 }
Beispiel #3
0
    void Awake()
    {
        GameObject obj = GameObject.Find("CollectionCore");

        collectionCore        = obj.GetComponent <CollectionCore>();
        pendingEntitlementIds = new List <string>();
    }
Beispiel #4
0
    void Awake()
    {
        text.text = "";
        gameObject.SetActive(false);
        isShown = false;
        GameObject obj = GameObject.Find("CollectionCore");

        collectionCore = obj.GetComponent <CollectionCore>();
    }
Beispiel #5
0
 public bool Remove(T item)
 {
     return(CollectionCore.Remove(item));
 }