void Start() { Button btn = GetComponent <Button>(); Text _text = GetComponentInChildren <Text>(); btn.onClick.AddListener(Load); // If not newgame, see if file exists and change btn text if (!newgame) { bool r = SAVELOAD.LoadFileCheck(filename); if (r) { _text.text = filename; } return; } if (newgame) { _text.text = "Start New"; // Should deactivate the New Game Button if this happens if (SAVELOAD.LoadFileCheck("file1.steameng") && SAVELOAD.LoadFileCheck("file1.steameng") && SAVELOAD.LoadFileCheck("file1.steameng")) { _text.text = "Overwrite 1"; } newgame = true; return; } }
/// <summary> /// Bound to the button OnClick event /// If not new game, tries to load the file via ILoad /// ILoad loads new scene async, waits until completed /// Sets new scene activate, then moves moves/loads objects /// Unloads scene /// <para><param name="filename"> serialized file name</param></para> /// <para><param name="saveslot"> which file slot to load</param></para> /// </summary> void Load() { // If not new game, load game if (!newgame) { bool r = SAVELOAD.Load(filename); loadSystem.Load(saveslot); // Set fileName for new games SETTINGS.saveFileName = filename; SETTINGS.saveSlot = saveslot; StartCoroutine(ILoad()); return; } // If new game, first find an open slot if (newgame) { if (!SAVELOAD.LoadFileCheck("file1.steameng")) { SETTINGS.saveFileName = "file1.steameng"; SETTINGS.saveSlot = "1"; StartCoroutine(ILoad()); return; } if (!SAVELOAD.LoadFileCheck("file2.steameng")) { SETTINGS.saveFileName = "file2.steameng"; SETTINGS.saveSlot = "2"; StartCoroutine(ILoad()); return; } if (!SAVELOAD.LoadFileCheck("file3.steameng")) { SETTINGS.saveFileName = "file3.steameng"; SETTINGS.saveSlot = "3"; StartCoroutine(ILoad()); return; } } // Default Settings for New Games SETTINGS.saveFileName = "file1.steameng"; SETTINGS.saveSlot = "1"; StartCoroutine(ILoad()); }
public void Run() { string _s = SETTINGS.saveFileName; // switch(SETTINGS.saveFileName) // { // case "file0.steameng": // _s = "file0.steameng"; // break; // case "file1.steameng": // _s = "file1.steameng"; // break; // case "file2.steameng": // _s = "file2.steameng"; // break; // } // Appears we need both, one for settings, one for scripatable objects saveSystem.Save(saveslot: SETTINGS.saveSlot); SAVELOAD.Save(_s); Debug.Log(_s); }
public PlayerData(SAVELOAD saveload) { GC = saveload.ShowInfo("GC"); Name = saveload.ShowInfo("Name"); Planet0 = saveload.ShowInfo("Planet0"); }
// Use this for initialization void Awake() { //GETManagement = GameObject.Find("GameManagement").GetComponent<GameManagement>(); SAVE = GameObject.Find("SAVELOAD").GetComponent <SAVELOAD>(); }
private void Start() { SL = GameObject.Find("SL").GetComponent <SAVELOAD>(); cameraMove = GetComponent <CameraMove>(); admob = GetComponent <ADMOBManager>(); rCam = GameObject.Find("RatingCamera"); sCam = GameObject.Find("SpaceCamera"); pCam = GameObject.Find("PlanetCamera"); Planet = GameObject.Find("PlanetLevel"); Space = GameObject.Find("CanvasSpaces"); Rating = GameObject.Find("CanvasRatings"); UI = GameObject.Find("CanvasUI"); CanvasSpace = UI.transform.Find("CanvasSpace").gameObject; CanvasRating = UI.transform.Find("CanvasRating").gameObject; CanvasPlanet = UI.transform.Find("CanvasPlanet").gameObject; objTable = GameObject.Find("Table"); objBlack = CanvasPlanet.transform.Find("Black").gameObject; objHint = CanvasPlanet.transform.Find("Hint").gameObject; Score = CanvasPlanet.transform.Find("Overlay/Score").GetComponent <Score>(); statistic = CanvasPlanet.transform.Find("Overlay/Statistic").GetComponent <Statistic>(); objBonusF = CanvasPlanet.transform.Find("Overlay/BonusF").gameObject; objBonusR = CanvasPlanet.transform.Find("Overlay/BonusR").gameObject; objBonusC = CanvasPlanet.transform.Find("Overlay/BonusC").gameObject; PlanetInfo = Planet.GetComponent <PlanetInfo>(); Mines = Planet.transform.Find("Mines").GetComponent <Mines>(); objEl = Planet.transform.Find("Up/Elevator").gameObject; objFac = Planet.transform.Find("Up/Factory").gameObject; objLab = Planet.transform.Find("Up/Lab").gameObject; objStock = Planet.transform.Find("Up/Stock").gameObject; objBoer = Planet.transform.Find("Up/Boer").gameObject; objRock = Planet.transform.Find("Up/RocketPlace").gameObject; objRJ = Planet.transform.Find("RobotEnginer").gameObject; Miniature = Planet.transform.Find("Miniature").GetComponent <Miniature>(); objBat = Planet.transform.Find("Miniature/BatteryF").gameObject; Builds = Planet.transform.Find("Up").GetComponentsInChildren <Builds>(); cameraUpDown = objEl.GetComponent <CameraUpDown>(); BuySourse = Planet.transform.Find("Up").GetComponent <AudioSource>(); BonusSourse = Planet.transform.Find("Mines").GetComponent <AudioSource>(); MineSource = Planet.GetComponent <AudioSource>(); CrashSource = Planet.transform.Find("Up/Forest").GetComponent <AudioSource>(); BtnSource = GameObject.Find("CanvasUI").GetComponent <AudioSource>(); DynSource = Planet.transform.Find("bgPlanet0").GetComponent <AudioSource>(); ErrorSource = GameObject.Find("SL").GetComponent <AudioSource>(); Elevator = objStock.GetComponent <Elevator>(); Factory = objFac.GetComponent <Factory>(); Rocket = objRock.GetComponent <Rocket>(); btnL = objLab.transform.Find("Btn").gameObject; iconBtnL = btnL.transform.GetComponentInChildren <Button>(); btnE = objStock.transform.Find("Btn").gameObject; iconBtnE = btnE.transform.GetComponentInChildren <Button>(); btnF = objFac.transform.Find("Btn").gameObject; iconBtnF = btnF.transform.GetComponentInChildren <Button>(); btnR = objRock.transform.Find("Btn").gameObject; iconBtnR = btnR.transform.GetComponentInChildren <Button>(); table = GetComponent <Table>(); objRegTableCont = objTable.transform.Find("RegisterContent").gameObject; objBonusTableCont = objTable.transform.Find("BonusContent").gameObject; objRatingTableCont = objTable.transform.Find("RatingContent").gameObject; displayPlayers = Rating.GetComponent <DisplayPlayers>(); ContentRating = Rating.transform.Find("Scroll View/Viewport/Content"); addUser = Rating.GetComponent <AddUser>(); cameraMove.enabled = false; // table.Load(); // cameraUpDown.Load(); // PlanetInfo.Load(); // SL.Load(); //Score.Load(); rCam.SetActive(false); sCam.SetActive(false); pCam.SetActive(false); Planet.SetActive(false); Rating.SetActive(false); CanvasRating.SetActive(false); CanvasPlanet.SetActive(false); objTable.SetActive(false); objBlack.SetActive(false); objHint.SetActive(false); objBonusF.SetActive(false); objBonusR.SetActive(false); objBonusC.SetActive(false); }