Пример #1
0
    IEnumerator Co_SendUseItem(string itemId)
    {
        string url = string.Format(req_url + "/user-info/use-item/{0}/{1}", PlayerPrefs.GetString("uid", SystemInfo.deviceUniqueIdentifier), itemId.ToString());
        WWW    www = new WWW(url);

        yield return(www);

        Debug.Log(www.text);

        UseItemInfo useItemInfo = JsonUtility.FromJson <UseItemInfo>(www.text);

        if (useItemInfo != null && useItemInfo.result)
        {
            userInfo.hint_item_count  = useItemInfo.hint_item_count;
            userInfo.timer_item_count = useItemInfo.timer_item_count;

            Debug.Log("hint_item_count: " + userInfo.hint_item_count);
            Debug.Log("timer_item_count: " + userInfo.timer_item_count);


            GameManager.Ins.SetUserInfo();
            if (itemId == "hint_item")
            {
                GameManager.Ins.ShowAndHideHint();
            }
            else if (itemId == "timer_item")
            {
                GameManager.Ins.AddStageTimeByItem();
            }
        }
        else
        {
            Debug.LogError("ServerError!");
        }
    }
Пример #2
0
    public ItemInfo(DevItemInfo storedItem, List <DevPerkMap> perks, int stack = 1)
    {
        try
        {
            if (stack == 0)
            {
                stack = 1;
            }

            this.Stack = stack;

            this.Key         = storedItem.Key;
            this.Name        = storedItem.Name;
            this.Description = storedItem.Description;
            this.IconKey     = storedItem.Icon;
            this.UseSound    = storedItem.UseSound;
            this.Type        = storedItem.Type;
            this.SubType     = storedItem.SubType;
            this.StackCap    = storedItem.StackCap;
            this.UseInfo     = storedItem.UseInfo;

            this.Stats = storedItem.Stats.Clone();
            this.Perks = perks;

            Sprites.Clear();
            for (int i = 0; i < storedItem.ItemSprites.Count; i++)
            {
                Sprites.Add(storedItem.ItemSprites[i].PartKey, storedItem.ItemSprites[i].Sprite);
            }
        }
        catch
        {
            Debug.LogError("Problematic Item!");

            this.Stack = 1;

            this.Key         = "unknown";
            this.Name        = "Unknown / Removed Item";
            this.Description = "This item is not existing / causes problems.";
            this.IconKey     = "xIcon";
            this.StackCap    = 1;

            this.Stats = new ItemStats();
            this.Perks = new List <DevPerkMap>();

            Sprites.Clear();
        }
    }
Пример #3
0
    IEnumerator Co_PurchaseItemRequest(string item_id)
    {
        string url = string.Format(req_url + "/user-info/purchase-item/{0}/{1}", PlayerPrefs.GetString("uid", SystemInfo.deviceUniqueIdentifier), item_id);
        WWW    www = new WWW(url);

        yield return(www);

        Debug.Log(www.text);

        UseItemInfo itemInfo = JsonUtility.FromJson <UseItemInfo>(www.text);

        if (itemInfo != null && itemInfo.result)
        {
            var hint_item_count  = itemInfo.hint_item_count;
            var timer_item_count = itemInfo.timer_item_count;

            Debug.Log("hint_item_count: " + hint_item_count);
            Debug.Log("timer_item_count: " + timer_item_count);
        }
        else
        {
            Debug.LogError("ServerError!");
        }
    }
Пример #4
0
 public ClientUseItemEventArgs(UseItemInfo i)
 {
     useinfo = i;
 }
Пример #5
0
 public UseItemChange(UseItemInfo item, int count)
 {
     Item  = item;
     Count = count;
 }