Exemplo n.º 1
0
 void Start()
 {
     save = new Save_progress();
     load = new Loading();
     onLoad();
     save1.onClick.AddListener(() => yousure(1));
     save2.onClick.AddListener(() => yousure(2));
     save3.onClick.AddListener(() => yousure(3));
     save4.onClick.AddListener(() => yousure(4));
     save5.onClick.AddListener(() => yousure(5));
     sure_yes.onClick.AddListener(() => onSave(slot_int));
     sure_no.onClick.AddListener(() => onSaveCancel());
     Savingpanel.SetActive(false);
 }
Exemplo n.º 2
0
    void yousure(int my_slot)
    {
        switch (my_slot)
        {
        case 1:
            if (System.IO.File.Exists(Application.persistentDataPath + "/save1.json"))
            {
                areyousure.SetActive(true);
                slot_int = 1;
            }
            else
            {
                onSave(1);
                Savingpanel.SetActive(false);
            }
            break;

        case 2:
            if (System.IO.File.Exists(Application.persistentDataPath + "/save2.json"))
            {
                areyousure.SetActive(true);
                slot_int = 2;
            }
            else
            {
                onSave(2);
                Savingpanel.SetActive(false);
            }
            break;

        case 3:
            if (System.IO.File.Exists(Application.persistentDataPath + "/save3.json"))
            {
                areyousure.SetActive(true);
                slot_int = 3;
            }
            else
            {
                onSave(3);
                Savingpanel.SetActive(false);
            }
            break;

        case 4:
            if (System.IO.File.Exists(Application.persistentDataPath + "/save4.json"))
            {
                areyousure.SetActive(true);
                slot_int = 4;
            }
            else
            {
                onSave(4);
                Savingpanel.SetActive(false);
            }
            break;

        case 5:
            if (System.IO.File.Exists(Application.persistentDataPath + "/save5.json"))
            {
                areyousure.SetActive(true);
                slot_int = 5;
            }
            else
            {
                onSave(5);
                Savingpanel.SetActive(false);
            }
            break;
        }
    }
Exemplo n.º 3
0
    public void onSave(int slot)
    {
        DateTime theTime  = DateTime.Now;
        string   datetime = theTime.ToString("yyyy-MM-dd - HH:mm:ss ");

        save.date = datetime;

        save.currentHealth       = player.GetComponent <PlayerHealth>().currentHealth;
        save.lovelevel_Yola      = Yola.GetComponent <NPCConversation>().lovelevel;
        save.nextlevel_Yola      = Yola.GetComponent <NPCConversation>().nextlevel;
        save.hatelevel_Yola      = Yola.GetComponent <NPCConversation>().hatelevel;
        save.hate_Yola           = Yola.GetComponent <NPCConversation>().hate;
        save.lovelevel_Bobo      = Bobo.GetComponent <NPCConversation>().lovelevel;
        save.nextlevel_Bobo      = Bobo.GetComponent <NPCConversation>().nextlevel;
        save.hatelevel_Bobo      = Bobo.GetComponent <NPCConversation>().hatelevel;
        save.hate_Bobo           = Bobo.GetComponent <NPCConversation>().hate;
        save.lovelevel_Gru       = Gru.GetComponent <NPCConversation>().lovelevel;
        save.nextlevel_Gru       = Gru.GetComponent <NPCConversation>().nextlevel;
        save.hatelevel_Gru       = Gru.GetComponent <NPCConversation>().hatelevel;
        save.hate_Gru            = Gru.GetComponent <NPCConversation>().hate;
        save.lovelevel_Fenris    = Fenris.GetComponent <NPCConversation>().lovelevel;
        save.nextlevel_Fenris    = Fenris.GetComponent <NPCConversation>().nextlevel;
        save.hatelevel_Fenris    = Fenris.GetComponent <NPCConversation>().hatelevel;
        save.hate_Fenris         = Fenris.GetComponent <NPCConversation>().hate;
        save.lovelevel_Catherine = Catherine.GetComponent <NPCConversation>().lovelevel;
        save.nextlevel_Catherine = Catherine.GetComponent <NPCConversation>().nextlevel;
        save.hatelevel_Catherine = Catherine.GetComponent <NPCConversation>().hatelevel;
        save.hate_Catherine      = Catherine.GetComponent <NPCConversation>().hate;
        save.lovelevel_Therion   = Therion.GetComponent <NPCConversation>().lovelevel;
        save.nextlevel_Therion   = Therion.GetComponent <NPCConversation>().nextlevel;
        save.hatelevel_Therion   = Therion.GetComponent <NPCConversation>().hatelevel;
        save.hate_Therion        = Therion.GetComponent <NPCConversation>().hate;
        save.YolaQ                  = Dialogues.GetComponent <DialogueLists>().YolaQ;
        save.BoboQ                  = Dialogues.GetComponent <DialogueLists>().BoboQ;
        save.GruQ                   = Dialogues.GetComponent <DialogueLists>().GruQ;
        save.FenrisQ                = Dialogues.GetComponent <DialogueLists>().FenrisQ;
        save.CatherineQ             = Dialogues.GetComponent <DialogueLists>().CatherineQ;
        save.TherionQ               = Dialogues.GetComponent <DialogueLists>().TherionQ;
        save.YolaF                  = Dialogues.GetComponent <DialogueLists>().YolaF;
        save.BoboF                  = Dialogues.GetComponent <DialogueLists>().BoboF;
        save.GruF                   = Dialogues.GetComponent <DialogueLists>().GruF;
        save.FenrisF                = Dialogues.GetComponent <DialogueLists>().FenrisF;
        save.CatherineF             = Dialogues.GetComponent <DialogueLists>().CatherineF;
        save.TherionF               = Dialogues.GetComponent <DialogueLists>().TherionF;
        save.YolaQUEST              = Dialogues.GetComponent <DialogueLists>().YolaQUEST;
        save.BoboQUEST              = Dialogues.GetComponent <DialogueLists>().BoboQUEST;
        save.GruQUEST               = Dialogues.GetComponent <DialogueLists>().GruQUEST;
        save.FenrisQUEST            = Dialogues.GetComponent <DialogueLists>().FenrisQUEST;
        save.CatherineQUEST         = Dialogues.GetComponent <DialogueLists>().CatherineQUEST;
        save.TherionQUEST           = Dialogues.GetComponent <DialogueLists>().TherionQUEST;
        save.YolaQuestOngoing       = Dialogues.GetComponent <DialogueLists>().YolaQuestOngoing;
        save.BoboQuestOngoing       = Dialogues.GetComponent <DialogueLists>().BoboQuestOngoing;
        save.GruQuestOngoing        = Dialogues.GetComponent <DialogueLists>().GruQuestOngoing;
        save.FenrisQuestOngoing     = Dialogues.GetComponent <DialogueLists>().FenrisQuestOngoing;
        save.CatherineQuestOngoing  = Dialogues.GetComponent <DialogueLists>().CatherineQuestOngoing;
        save.TherionQuestOngoing    = Dialogues.GetComponent <DialogueLists>().TherionQuestOngoing;
        save.howManyMonstersHateYou = Dialogues.GetComponent <DialogueLists>().howManyMonstersHateYou;
        save.howManyObjectsOfLove   = Dialogues.GetComponent <DialogueLists>().howManyObjectsOfLove;
        save.tutorialPlayed         = Dialogues.GetComponent <DialogueLists>().tutorialPlayed;

        string jsonData = JsonUtility.ToJson(save, true);

        switch (slot)
        {
        case 1:
            File.WriteAllText(Application.persistentDataPath + "/save1.json", jsonData);
            break;

        case 2:
            File.WriteAllText(Application.persistentDataPath + "/save2.json", jsonData);
            break;

        case 3:
            File.WriteAllText(Application.persistentDataPath + "/save3.json", jsonData);
            break;

        case 4:
            File.WriteAllText(Application.persistentDataPath + "/save4.json", jsonData);
            break;

        case 5:
            File.WriteAllText(Application.persistentDataPath + "/save5.json", jsonData);
            break;

        case 6:
            File.WriteAllText(Application.persistentDataPath + "/saveDay.json", jsonData);
            break;

        default:
            break;
        }
        areyousure.SetActive(false);
        Savingpanel.SetActive(false);
    }