public void Save(string name, byte[] data) { if (data == null) { return; } string path = null; //#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_WIN // path = Environment.CurrentDirectory + "\\Assets\\StreamingAssets\\"; //#else // Debug.Log("I don't know where to save data on this platform."); //#endif path = LoaderScript.getPath(); if (path != null) { try { File.WriteAllBytes(path + name + ".sav", data); } catch (System.Exception e) { Debug.Log("Couldn't save data file."); Debug.Log(e.Message); } } }
void Update() { // Input foreach (KeyValuePair <KeyCode, EmulatorBase.Button> entry in _keyMapping) { if (this.transform.parent.transform.position.x == 0) { if (Input.GetKeyDown(entry.Key)) { Emulator.SetInput(entry.Value, true); } else if (Input.GetKeyUp(entry.Key)) { Emulator.SetInput(entry.Value, false); } } } if (Input.GetKeyDown(KeyCode.T)) { byte[] screenshot = ((DefaultVideoOutput)Emulator.Video).Texture.EncodeToPNG(); File.WriteAllBytes(LoaderScript.getPath() + "screenshot" + DateTime.Today.Year.ToString() + DateTime.Today.Month.ToString() + DateTime.Today.Day.ToString() + DateTime.Today.Hour.ToString() + DateTime.Today.Minute.ToString() + DateTime.Today.Second.ToString() + ".png", screenshot); Debug.Log("Screenshot saved. " + LoaderScript.getPath()); } }
void process() { if ((LoaderScript.romIndex < (LoaderScript.fileInfo.Length - 1)) && (LoaderScript.fileInfo != null)) { LoaderScript.romIndex = LoaderScript.romIndex + 1; LoaderScript.findRoms(); } }
void process() { if ((LoaderScript.romIndex > 0) && (LoaderScript.fileInfo != null)) { LoaderScript.romIndex = LoaderScript.romIndex - 1; LoaderScript.findRoms(); } }
void Update() { /* Manually slows down loading time - Loading screen doesn´t flash, even if there's no much content on next scene. * It takes the minimum time to load. */ if (Input.GetKeyDown("escape")) { Debug.Log("Esc pressed."); Application.Quit(); } count += 0.1f; if (isFirstUpdate && count >= time) { isFirstUpdate = false; LoaderScript.LoaderCallback(); } }
public byte[] Load(string name) { string path = null; path = LoaderScript.getPath(); byte[] loadedData = null; if (path != null) { try { loadedData = File.ReadAllBytes(path + name + ".sav"); } catch (System.Exception e) { Debug.Log("Couldn't load data file."); Debug.Log(e.Message); } } return(loadedData); }
private IEnumerator LoadRom(string filename) { LoaderScript.findRoms(); string path; path = "file://" + LoaderScript.getPath() + filename; Debug.Log("Loading rom: " + path); WWW www = new WWW(path); yield return(www); if (www.error == null) { Emulator.LoadRom(www.bytes); StartCoroutine(Run()); } else { Debug.Log("Error during loading the rom.\n" + www.error); } }
private void Start() { loaderScript = GameObject.FindObjectOfType <LoaderScript>(); gm = GameManager.Instance; }
// Start is called before the first frame update void Start() { loader = FindObjectOfType <LoaderScript>(); }
private void Start() { loaderScript = GameObject.FindObjectOfType <LoaderScript>(); }
public void nextScene() { LoaderScript.Load(LoaderScript.Scene.WellScene); }