示例#1
0
 void Update()
 {
     if (m_initProcStat != InitProcStat.InProgress)
     {
         return;
     }
     if (m_assetBundleLoadStat == AssetBundleLoadStat.None)
     {
         // Start loading the asset bundle.
         m_assetBundleLoadStat = AssetBundleLoadStat.InProgress;
         StartCoroutine(LoadAssetBundle());
     }
     else if (m_assetBundleLoadStat == AssetBundleLoadStat.Success)
     {
         // We've succeeded in loading the asset bundle.
         // Load the XML configuration file from the cache directory, and create the TPTabletUIConfig instance.
         string path = Path.Combine(Application.persistentDataPath, m_filenameXML);
         byte[] bytes;
         try {
             bytes = File.ReadAllBytes(path);
         }catch (Exception e) {
             PutErrorMessage("TPTabletUIManager::Update");
             PutErrorMessage(e.Message);
             m_initProcStat = InitProcStat.Fail;
             return;
         }
         m_config = new TPTabletUIConfig();
         if (!m_config.Parse(bytes))                 // All the GUI data files are loaded during parsing.
         {
             m_config       = null;
             m_initProcStat = InitProcStat.Fail;
             return;
         }
         m_initProcStat = InitProcStat.Success;              // The initialization procedure has successfully ended.
     }
     else if (m_assetBundleLoadStat == AssetBundleLoadStat.Fail)
     {
         // We've failed in loadind the asset bundle.
         m_initProcStat = InitProcStat.Fail;
         return;
     }
 }
示例#2
0
    void Awake()
    {
        bool isChangePrefs = false;

        if (!PlayerPrefs.HasKey("ip_address"))
        {
            PlayerPrefs.SetString("ip_address", "10.120.64.108");
            isChangePrefs = true;
        }
        if (!PlayerPrefs.HasKey("port_number"))
        {
            PlayerPrefs.SetString("port_number", "28000");
            isChangePrefs = true;
        }
        if (!PlayerPrefs.HasKey("clear_cache"))
        {
            PlayerPrefs.SetInt("clear_cache", 1);
            isChangePrefs = true;
        }
        if (!PlayerPrefs.HasKey("debug_mode"))
        {
            PlayerPrefs.SetInt("debug_mode", 0);
            isChangePrefs = true;
        }
        if (!PlayerPrefs.HasKey("auto_connect"))
        {
            PlayerPrefs.SetInt("auto_connect", 1);
            isChangePrefs = true;
        }


        if (isChangePrefs)
        {
            PlayerPrefs.Save();
            Debug.Log("PlayerPrefs updated");
        }

        // Indicate that the initialization procedure has been started.
        m_initProcStat = InitProcStat.InProgress;
        int isClearCache = PlayerPrefs.GetInt("clear_cache");

        PutErrorMessage("[Clear Cache] configuration was set [" + isClearCache.ToString() + "].");
        Debug.Log("[Clear Cache] configuration was set [" + isClearCache.ToString() + "].");
        //PutErrorMessage("[Clear Cache] configuration was set [" + PlayerPrefs.GetString("clear_cache") + "].");

        // Check if we need to download the GUI data.
        //if(PlayerPrefs.GetString("clear_cache", "0") == "1"){
        //if(PlayerPrefs.GetInt("clear_cache") == 1){
        if (isClearCache == 1)
        {
            //if(PlayerPrefs.GetString("clear_cache") == "1"){
            if (!DownloadFiles())
            {
                m_initProcStat = InitProcStat.Fail;                     // The initialization process has failed.
                return;
            }
            // We succeeded in downloading the GUI data, so let us disable the switch.
            //PlayerPrefs.SetString("clear_cache", "0");
            //PlayerPrefs.Save();
        }

        //Application.targetFrameRate = 60;
    }