Example #1
0
    // Example of assets management feature - https://developers.gamearter.com/docs/unity/assets-management.php

    private void CallbackFunctionForAssets(GarterWWW www)
    {
        if (string.IsNullOrEmpty(www.error))
        {
            GarterAssetsManagement.AssetsCbFormat         responseData = Garter.I.FromJson <GarterAssetsManagement.AssetsCbFormat> (www.text);
            List <GarterAssetsManagement.AssetListMember> listOfAssets = responseData.list;
            uint assetId = responseData.assetId;
            //Texture2D assetImage = responseData.img;
            GarterAssetsManagement.Cloneable clonePermission = responseData.cloneable;
            string assetData = responseData.data;

            Debug.Log("downloadedAssetId: " + assetId);
            Debug.Log("asset - cloneability: " + clonePermission);
            Debug.Log("asset - data: " + assetData);
            if (listOfAssets != null)
            {
                Debug.Log("--- List of assets ---");
                for (int i = 0; i < listOfAssets.Count; i++)
                {
                    Debug.Log("assetId: " + listOfAssets [i].assetId);
                    Debug.Log("asset name: " + listOfAssets [i].name);
                    Debug.Log("asset votes: " + listOfAssets [i].votes);
                    Debug.Log("asset rating: " + listOfAssets [i].rating);
                    Debug.Log("asset downloads: " + listOfAssets [i].downloads);
                    Debug.Log("asset cloneable: " + listOfAssets [i].cloneable);
                    Debug.Log("asset created: " + listOfAssets [i].created);
                    Debug.Log("asset accessability: " + listOfAssets [i].accessability);
                }
            }
        }
        else
        {
            Debug.LogError(www.error);
        }
    }
Example #2
0
 private void ServerCallback(bool export, GarterWWW www)
 {
     if (www.error != null)
     {
         Debug.LogError("Garter | Server Callback | " + www.error);
     }
     else
     {
         Debug.Log("GameArter | Server Callback | " + www.text);
         if (export)
         {
             string requestUrlAddress = Garter.I.GetServerAddress() + "/tmpDataAuthorization?gid=" + projectId + "&pv=" + projectVer;
             Application.OpenURL(requestUrlAddress);
             Debug.LogWarning("If no page in a browser was opened, open a browser manually and request following url address: " + requestUrlAddress);
             // CELAR USER DATA - SERVER + PLAYERPREFS TO PREVENT from ERRORS
             // stop editor
             UnityEditor.EditorApplication.isPlaying = false;
         }
         else                                // clear data
         {
             Garter.I.EditorMode("getInit"); //(hack for download)
         }
     }
 }
 private void SdkInitialized(GarterWWW www)
 {
     Debug.Log("Full SDK Initialized - all data, features and calls are available");
     Debug.Log("UserNick: " + Garter.I.UserNick());
 }
Example #4
0
 private void SdkInitialized(GarterWWW data)
 {
     Debug.Log("SDK initialized - Garter calls are available.");
     // set user data (nickname etc) and load game
 }