public void FacadeDeserializeToTemplatedObject()
        {
            string   json     = "\r\n                {\r\n                  \"title\"  : \"First\",\r\n                  \"name\"   : \"First Window\",\r\n                  \"width\"  : 640,\r\n                  \"height\" : 480\r\n                }";
            UiWindow uiWindow = null;

            uiWindow = JSONManager.getTemplatedTypeForJson <UiWindow>(json);
            Assert.IsNotNull(uiWindow);
            Assert.AreEqual(uiWindow.title, "First");
            Assert.AreEqual(uiWindow.name, "First Window");
            Assert.AreEqual(uiWindow.width, 640);
            Assert.AreEqual(uiWindow.height, 480);
        }
Exemple #2
0
    private IEnumerator StartResourceVersionCheck()
    {
        if (ResourceVersioncheckInProgress)
        {
        }
        ResourceVersioncheckInProgress = true;
        string url = GetAMPSAssetListInfoCallURL();
        WWW    www = new WWW(url);

        yield return(www);

        bool noErrors = www.isDone && www.error == null && www.text != null;

        if (www.error != null)
        {
            DisneyMobile.CoreUnitySystems.Logger.LogWarning(this, "DoResourceVersionCheck  www.error=" + www.error);
            ShowAMPSDownloadError("Msg_DownloadFailLong", "UIManagerOz::StartResourceVersionCheck error=" + www.error);
            noErrors = false;
        }
        if (noErrors)
        {
            try
            {
                AMPSAssetList = JSONManager.getTemplatedTypeForJson <AMPVersionResultData>(www.text);
                if (AMPSAssetList == null)
                {
                    DisneyMobile.CoreUnitySystems.Logger.LogFatal(this, "Deserialization AMPS asset list data failed " + url);
                    noErrors = false;
                }
            }
            catch (Exception ex)
            {
                Debug.LogError("deserialization exception " + url + " exception=" + ex);
                ShowAMPSDownloadError("Msg_DownloadFailLong", "UIManagerOz::StartResourceVersionCheck: deserialization exception. url=" + url + " exception=" + ex);
                noErrors = false;
            }
        }
        if (noErrors)
        {
            OnCatalogDownloaded(AMPSAssetList.GetResourceCatalog());
        }
        else
        {
            OnCatalogDownloaded(null);
        }
        ResourceVersioncheckInProgress = false;
    }
Exemple #3
0
    private void LoadResourceCatalog()
    {
        string text = FileManager.LoadTextFile(AppResource.ResourceSaveLocation, "AppResourceCatalog.txt");

        if (string.IsNullOrEmpty(text))
        {
            ResourceCatalog = new Dictionary <string, AppResource>();
            DisneyMobile.CoreUnitySystems.Logger.LogInfo(this, "Resource catalog is empty ");
            return;
        }
        DisneyMobile.CoreUnitySystems.Logger.LogInfo(this, "=============== Resource catalog = " + text);
        List <AppResource> list = (TestCatalog = JSONManager.getTemplatedTypeForJson <List <AppResource> >(text));

        ResourceCatalog = new Dictionary <string, AppResource>();
        foreach (AppResource item in list)
        {
            if (item.isRequired && item.HasNewer())
            {
                item.inDownloadQueue = true;
            }
            ResourceCatalog.Add(item.assetName, item);
        }
    }
Exemple #4
0
 public static GeomListJson Deserialize(string jsonstring)
 {
     return(JSONManager.getTemplatedTypeForJson <GeomListJson>(jsonstring));
 }