Exemplo n.º 1
0
    public List <RARC_ShipSaveData> FindGameData(int saveSlot)
    {
        //List Of Saves
        List <RARC_ShipSaveData> saveData_List = new List <RARC_ShipSaveData>();

        try
        {
            //Loop each possible week save file
            for (int i = 0; i < 53; i++)
            {
                string fileName = "Saves/ShipData " + saveSlot + " (Week " + i + ").rarc";
                ship_SaveData = RARC_Serializer.Load <RARC_ShipSaveData>(fileName);

                //If The File Does Not Exist ??? (COULD BE INF LOAD RECURSION???)
                if (ship_SaveData != null)
                {
                    saveData_List.Add(ship_SaveData);
                }
                else
                {
                    //print("Test Code: BLANK");
                }
            }
        }
        catch (Exception error)
        {
            //Error Message
            Debug.Log("Save System is Broken, Wrong Version? " + error);
            Application.Quit();
        }

        return(saveData_List);
    }
Exemplo n.º 2
0
    public void LoadPanel(RARC_ShipSaveData saveData)
    {
        saveSlot_New.SetActive(false);
        saveSlot_Load.SetActive(true);
        newSlotHardToggle.gameObject.SetActive(false);

        if (saveData.difficulty == RARC_ShipSaveData.difficultyType.NORMAL)
        {
            hardmode_Text.gameObject.SetActive(false);
        }
        else if (saveData.difficulty == RARC_ShipSaveData.difficultyType.HARD)
        {
            hardmode_Text.gameObject.SetActive(true);
        }

        weeks_Text.text = "Weeks Survived: " + saveData.shipInfo_WeeksSurvived;
        fuel_Text.text  = "x" + saveData.shipResource_Fuel.resourceCount.ToString();
        scrap_Text.text = "x" + saveData.shipResource_Scrap.resourceCount.ToString();
        food_Text.text  = "x" + saveData.shipResource_Food.resourceCount.ToString();

        humans_Text.text = "x" + saveData.shipData_Crew_List.Count.ToString();
        bots_Text.text   = "x" + saveData.shipData_Bots_List.Count.ToString();
    }
Exemplo n.º 3
0
    public void Button_PlaySelectSlot(int saveSlot)
    {
        //CHeck Save Slot
        switch (saveSlot)
        {
        case 1:

            if (RARC_DatabaseController.Instance.saveDataSet1_List.Count == 0)
            {
                //Create New Data
                RARC_ShipSaveData shipData = new RARC_ShipSaveData();
                shipData.CreateNewSave();
                if (saveSlot1.newSlotHardToggle.isOn)
                {
                    shipData.difficulty = RARC_ShipSaveData.difficultyType.HARD;
                }
                else
                {
                    shipData.difficulty = RARC_ShipSaveData.difficultyType.NORMAL;
                }

                //Set Transmission Data to Database
                RARC_DatabaseController.Instance.ship_SaveSlot = saveSlot;
                RARC_DatabaseController.Instance.ship_SaveData = shipData;

                //Load Scene
                SceneManager.LoadScene("RARC_Game");
            }
            else
            {
                //Load Data
                RARC_ShipSaveData shipData = RARC_DatabaseController.Instance.saveDataSet1_List[RARC_DatabaseController.Instance.saveDataSet1_List.Count - 1];

                //Set Transmission Data to Database
                RARC_DatabaseController.Instance.ship_SaveSlot = saveSlot;
                RARC_DatabaseController.Instance.ship_SaveData = shipData;

                //Load Scene
                SceneManager.LoadScene("RARC_Game");
            }
            break;

        case 2:

            if (RARC_DatabaseController.Instance.saveDataSet2_List.Count == 0)
            {
                //Create New Data
                RARC_ShipSaveData shipData = new RARC_ShipSaveData();
                shipData.CreateNewSave();
                if (saveSlot2.newSlotHardToggle.isOn)
                {
                    shipData.difficulty = RARC_ShipSaveData.difficultyType.HARD;
                }
                else
                {
                    shipData.difficulty = RARC_ShipSaveData.difficultyType.NORMAL;
                }

                //Set Transmission Data to Database
                RARC_DatabaseController.Instance.ship_SaveSlot = saveSlot;
                RARC_DatabaseController.Instance.ship_SaveData = shipData;

                //Load Scene
                SceneManager.LoadScene("RARC_Game");
            }
            else
            {
                //Load Data
                RARC_ShipSaveData shipData = RARC_DatabaseController.Instance.saveDataSet2_List[RARC_DatabaseController.Instance.saveDataSet2_List.Count - 1];

                //Set Transmission Data to Database
                RARC_DatabaseController.Instance.ship_SaveSlot = saveSlot;
                RARC_DatabaseController.Instance.ship_SaveData = shipData;

                //Load Scene
                SceneManager.LoadScene("RARC_Game");
            }
            break;

        case 3:

            if (RARC_DatabaseController.Instance.saveDataSet3_List.Count == 0)
            {
                //Create New Data
                RARC_ShipSaveData shipData = new RARC_ShipSaveData();
                shipData.CreateNewSave();
                if (saveSlot3.newSlotHardToggle.isOn)
                {
                    shipData.difficulty = RARC_ShipSaveData.difficultyType.HARD;
                }
                else
                {
                    shipData.difficulty = RARC_ShipSaveData.difficultyType.NORMAL;
                }

                //Set Transmission Data to Database
                RARC_DatabaseController.Instance.ship_SaveSlot = saveSlot;
                RARC_DatabaseController.Instance.ship_SaveData = shipData;

                //Load Scene
                SceneManager.LoadScene("RARC_Game");
            }
            else
            {
                //Load Data
                RARC_ShipSaveData shipData = RARC_DatabaseController.Instance.saveDataSet3_List[RARC_DatabaseController.Instance.saveDataSet3_List.Count - 1];

                //Set Transmission Data to Database
                RARC_DatabaseController.Instance.ship_SaveSlot = saveSlot;
                RARC_DatabaseController.Instance.ship_SaveData = shipData;

                //Load Scene
                SceneManager.LoadScene("RARC_Game");
            }
            break;
        }
    }