private IEnumerator _LoadList(string url) { var files = new List <Uri>(); SetText("thinking"); using (var www = new WWW(url)) { while (!www.isDone) { yield return(null); } var retrode = JsonUtility.FromJson <Retrode>(www.text); foreach (var file in retrode.files) { files.Add(new Uri($"{retrode.url}{file}")); } } if (files.Count == 0) { yield return(StartCoroutine(_ShowText("empty rom\ncheck your cartridge slot", 2f))); OnTouchBack(); } else { var rom = string.Empty; for (var index = 0; index < files.Count; index++) { var file = files[index]; var www = new WWW(file.AbsoluteUri); while (!www.isDone) { SetText($"download ({index+1}/{files.Count})\n[{www.progress:P}]"); SetProgress(www.progress); yield return(null); } var fileext = Path.GetExtension(file.AbsolutePath); var filename = Path.GetFileName(file.AbsolutePath); var filepath = Path.Combine(Application.persistentDataPath, filename); Debug.Log(filepath); File.WriteAllBytes(filepath, www.bytes); if (string.IsNullOrEmpty(rom) && (fileext == ".sfc" || fileext == ".smc")) { rom = filename; } } if (string.IsNullOrEmpty(rom)) { yield return(StartCoroutine(_ShowText("empty rom\ncheck your cartridge slot", 2f))); OnTouchBack(); } else { SetText($"loading"); yield return(new WaitForSeconds(1f)); Frontend.ChangeGame(rom); Frontend.OnMenuOpen(""); } } }
protected virtual void Start() { Frontend = FindObjectOfType <Frontend>(); }
public void OnTouchBack() { Frontend.OnMenuOpen("ui/menus"); }
public void OnTouchBack() { Frontend.OnMenuOpen("ui/settings"); }