Beispiel #1
0
 /// <summary>
 /// 更换语言
 /// </summary>
 /// <returns></returns>
 public virtual bool ChangeLanguage()
 {
     if (CurLan == LanName)
     {
         return(false);
     }
     if (Lan == null)
     {
         return(false);
     }
     CurLan = LanName;
     if (uiName != null)
     {
         LanSection = Lan.FindSection(uiName);
         if (LanSection != null)
         {
             if (uiInitializer != null)
             {
                 uiInitializer.ChangeLanguage(LanSection);
             }
         }
     }
     return(true);
 }
    void VersionCheck()
    {
        string    dic     = Application.persistentDataPath + "/";
        string    tempath = dic + "versions.ini";
        INIReader ini     = new INIReader();

        ini.LoadFromFile(tempath);
        string key = "win";

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            key = "ios";
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            key = "and";
        }
        var sec    = ini.FindSection(key);
        var values = sec.values;

        for (int i = 0; i < values.Count; i++)
        {
            var    kv    = values[i];
            string value = PlayerPrefs.GetString(kv.key);
            string path  = dic + kv.key;
            if (value != kv.value | !File.Exists(path))
            {
                OssMission mission = new OssMission();
                mission.dir     = Application.persistentDataPath + "/";
                mission.Name    = kv.key;
                mission.Version = kv.value;
                ossMissions.Add(mission);
                mission.Tip = (o) =>
                {
                    view.Tip.Text = "正在下载资源:" + o.Name;
                    SetProgress(o.Progress);
                };
                mission.Completed = (o) =>
                {
                    OssMission oss = o as OssMission;
                    ossMissions.Remove(oss);
                    PlayerPrefs.SetString(oss.Name, oss.Version);
                    if (oss.Name.Contains(".lzma"))
                    {
                        if (oss.Done)
                        {
                            DecompressLZMA(oss.Name, oss.Version);
                        }
                    }
                };
            }
            else if (kv.key.Contains(".lzma"))
            {
                string str = kv.key;
                str   = str.Replace(".lzma", "");
                value = PlayerPrefs.GetString(str);
                if (value != kv.value)
                {
                    DecompressLZMA(kv.key, kv.value);
                }
            }
        }
    }