private void Start() { try { StartCoroutine(XMLManager.LoadAsync <Gal>(Application.streamingAssetsPath + "/XML/Core/Gal/gal_" + Global.GetInstance().IndexToString(Global.GetInstance().GalIndex) + ".xml", result => { gal = result; Global.GetInstance().GalIndex++; var bImg = Resources.Load("Textures/Gal/Background/" + gal.bcImg, typeof(Sprite)); background.GetComponent <Image>().sprite = (Sprite)bImg; })); } catch { Debug.Log("本场景无对话内容。"); } finish = false; var cImgs = Resources.LoadAll("Textures/Gal/Characters", typeof(Sprite)); GameController.GetInstance().Invoke(() => { foreach (var cImg in cImgs) { characterImgs.Add((Sprite)cImg); } StartCoroutine(PlayGal()); }, 1f); }
private void button1_Click(object sender, EventArgs e) { double t = Convert.ToDouble(Gal.Text.Trim()); double x = 3.78541; r.Gal(t, x); Gal.Clear(); Gal.Focus(); }
public IEnumerator LoadGal(string path) { WWW www = new WWW(path); yield return(www); if (www.text.Length == 0) { Debug.Log("本场景无对话内容。"); } else { XmlSerializer serializer = new XmlSerializer(typeof(Gal)); StringReader sr = new StringReader(www.text); sr.Read(); //跳过BOM头 gal = serializer.Deserialize(sr) as Gal; sr.Close(); } }