Пример #1
0
    public void ConsumableItemUsed(E_ItemID id)
    {
        int index = PlayerData.InventoryList.Items.FindIndex(p => p.ID == id);

        if (index < 0)
        {
            return;
        }

        PPIItemData itemData = PlayerData.InventoryList.Items[index];

        MFDebugUtils.Assert(itemData.IsValid());

        itemData.Count--;
        PlayerData.InventoryList.Items[index] = itemData;

        if (uLink.Network.isServer)
        {
            //SEND TO CLOUD !!!!
            ItemSettings settings = ItemSettingsManager.Instance.Get(id);

            CloudServices.GetInstance()
            .ModifyItem(PrimaryKey,
                        PPIManager.ProductID,
                        settings.GUID,
                        "Count",
                        itemData.Count.ToString(),
                        CloudConfiguration.DedicatedServerPasswordHash);
        }
    }
Пример #2
0
    public void LeaderboardsUpdateScore()
    {
        List <CloudServices.S_LeaderBoardScoreInfo> scores = new List <CloudServices.S_LeaderBoardScoreInfo>();
        List <CloudServices.S_LeaderBoardScoreInfo> daily  = new List <CloudServices.S_LeaderBoardScoreInfo>();

        foreach (PlayerPersistantInfo ppi in PPIs)
        {
            if (ppi.IsValid)
            {
                scores.Add(new CloudServices.S_LeaderBoardScoreInfo(ppi.Experience, ppi.PrimaryKey));
                daily.Add(new CloudServices.S_LeaderBoardScoreInfo(ppi.Score.Score, ppi.PrimaryKey));
            }
        }

        CloudServices.GetInstance()
        .LeaderboardSetScores(PPIManager.ProductID, "Default", CloudConfiguration.DedicatedServerPasswordHash, scores.ToArray());
    }
Пример #3
0
    void Update()
    {
        switch (m_State)
        {
        case E_State.E_STATE_INIT:
        {
            m_LoadShopItemsAsyncOp = CloudServices.GetInstance().ProductGetParam(PPIManager.ProductID, CloudServices.PROP_ID_SHOP_ITEMS, "");

            m_State = E_State.E_STATE_LOADING_SHOP_ITEMS;
        }
        break;

        case E_State.E_STATE_LOADING_SHOP_ITEMS:
        {
            if (m_LoadShopItemsAsyncOp != null)
            {
                if (m_LoadShopItemsAsyncOp.m_Finished)
                {
                    if (m_LoadShopItemsAsyncOp.m_Res)
                    {
                        m_ShopItemsJSON = m_LoadShopItemsAsyncOp.m_ResultDesc;

                        UpdateSettingsManagers();
                        //Debug.Log("Loaded shop settings from cloud");

                        m_State = E_State.E_STATE_OK;
                    }
                    else
                    {
                        Debug.LogError("Unable to load shop settings from cloud");

                        m_State = E_State.E_STATE_FAILED;
                    }
                }
            }
            else
            {
                Debug.LogError("Unable to load shop settings from cloud");

                m_State = E_State.E_STATE_FAILED;
            }
        }
        break;
        }
    }
Пример #4
0
    public void SynchronizePendingPPIChanges()
    {
        MFDebugUtils.Assert(IsValid);

        if (PlayerDataChanged)
        {
            string PPIAsJSON = GetPlayerDataAsJsonStr();

            /*CloudServices.AsyncOpResult	res;
             *
             * res =*/
            CloudServices.GetInstance()
            .UserSetPerProductData(PrimaryKey,
                                   PPIManager.ProductID,
                                   CloudServices.PROP_ID_PLAYER_DATA,
                                   PPIAsJSON,
                                   CloudConfiguration.DedicatedServerPasswordHash,
                                   PPISyncToCloudFinished);

            PlayerDataChanged = false;
        }
    }
Пример #5
0
 protected override CloudServices.AsyncOpResult GetCloudAsyncOp()
 {
     return(CloudServices.GetInstance().LeaderboardGetRanks(userID.primaryKey, userID.productID, leaderBoardName, userID.passwordHash, users));
 }