public Texture2D LoadImage(string key) { if (ES3.FileExists($"{key}.png")) { return(ES3.LoadImage($"{key}.png")); } else { Debug.Log("Image not found"); return(null); } }
public void LoadSaveGameToButton(SaveGame save) { if (ES3.FileExists(save.SaveGameName + ".png")) { Texture2D texture = ES3.LoadImage(save.SaveGameName + ".png"); Sprite newSprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.05f, 0.05f), 100f); saveImage.sprite = newSprite; } saveTitle.text = save.SaveGameName; activeSaveGame = save; }
public override void Enter() { texture2D.Value = ES3.LoadImage(imagePath.Value, GetSettings()); }
public Project Load(string name) { if (ES3.KeyExists(name + " name")) { //Load size int size = ES3.Load <int>(name + " size"); //Load all the images List <Texture2D> images = new List <Texture2D>(); for (int i = 1; i <= size; i++) { Texture2D pic = ES3.LoadImage("Project " + name + " Frame " + i + " image.jpg"); images.Add(pic); } //Make frames out of lines List <Frame> frames = new List <Frame>(); //List<string> orientations = ES3.Load<List<string>>(name + " orientations"); List <float> transparencies = ES3.Load <List <float> >(name + " transparencies"); for (int i = 1; i <= size; i++) { Frame frame = new Frame(i); int childCount = ES3.Load <int>("Project " + name + " Frame " + i + " Child count"); List <string> lineNms = ES3.Load <List <string> >("Project " + name + " Frame " + i + " Line names"); for (int line = 1; line <= childCount; line++) { DrawingManager.currentLine++; GameObject lin = Instantiate(linePrefab); lin.name = "Line " + DrawingManager.currentLine; LineRenderer lr = lin.GetComponent <LineRenderer>(); Color lineColor = ES3.Load <Color>("Project " + name + " Frame " + i + " " + lineNms[line - 1] + " Color"); float lineThickness = ES3.Load <float>("Project " + name + " Frame " + i + " " + lineNms[line - 1] + " Thickness"); List <Vector3> linePoints = ES3.Load <List <Vector3> >("Project " + name + " Frame " + i + " " + lineNms[line - 1] + " Points"); lr.SetColors(lineColor, lineColor); lr.SetWidth(lineThickness, lineThickness); lr.positionCount = linePoints.Count; for (int d = 0; d < lr.positionCount; d++) { lr.SetPosition(d, linePoints[d]); } lin.transform.parent = frame.getGOSelf().transform; } frame.setPicture(images[i - 1] as Texture); frame.setHasPicture(true); //frame.overrideOrientation(orientations[i - 1]); frame.setTransparency(transparencies[i - 1]); frames.Add(frame); } //Load Audio List <AudioClip> audio = new List <AudioClip>(); if (ES3.KeyExists("Project " + name + " Track Amount")) { int trackCount = ES3.Load <int>("Project " + name + " Track Amount"); if (ES3.KeyExists("Project " + name + " Track 1")) { for (int i = 1; i <= trackCount; i++) { string n = ("Project " + name + " Track " + i); AudioClip clip = ES3.Load <AudioClip>(n); audio.Add(clip); } } else { audio = null; } } //Load fps float fps = ES3.Load <float>(name + " fps"); if (ES3.KeyExists("Project " + name + " Track Amount")) { Project project = new Project(name, "Frame-by-frame", frames, audio, fps); FlikittCore.project = project; UserInterface.fpsSlider.value = fps; return(project); } else { Project project = new Project(name, "Frame-by-frame", frames, null, fps); FlikittCore.project = project; UserInterface.fpsSlider.value = fps; return(project); } return(null); } else { Debug.Log("Did not find project name!"); SceneManager.LoadScene("Splash Screen"); return(null); } }