Exemplo n.º 1
0
 public void ChangeLanguage(FairyGUI.Utils.XML xML)
 {
     UIPackage.SetStringsSource(xML);
     UIPackage.RemoveAllPackages();
     UIPackage.AddPackage("UI/Res_Main");
     UIPackage.AddPackage("UI/Res_Game");
     UIPackage.AddPackage("UI/Res_Component");
     currentUIManager.MainUIManager();
     audioSourceManager.ChangeBGM(0);
     SceneManager.LoadSceneAsync(0);
 }
Exemplo n.º 2
0
    /// <summary>
    /// 获取本地化的文本
    /// </summary>
    /// <returns></returns>
    public void InitLanguage()
    {
        TextAsset lanXML = null;

#if UNITY_EDITOR
        lanXML = Resources.Load <TextAsset>("Lan/" + this.path);
#else
        string      path        = AssetBundlePathConfig.Instance.Path + "/Lan/" + this.path + ".cao";
        AssetBundle assetBundle = AssetBundle.LoadFromFile(path);
        lanXML = assetBundle.LoadAsset(this.path) as TextAsset;
#endif
        if (lanXML != null)
        {
            FairyGUI.Utils.XML xml = new FairyGUI.Utils.XML(lanXML.ToString());
            UIPackage.SetStringsSource(xml);
        }
    }