예제 #1
0
    private void Load()
    {
        GameData data = SaveWorker.Load();

        savedData = data;
        LoadData();
    }
예제 #2
0
 public AsyncSaveModel()
     : base("Save Model", "SaveGSA", "Saves your GSA model from this parametric nightmare",
            Ribbon.CategoryName.Name(),
            Ribbon.SubCategoryName.Cat0())
 {
     BaseWorker = new SaveWorker(); this.Hidden = true;
 }                                                     // sets the initial state of the component to hidden
예제 #3
0
        protected override void SaveWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            var i = 0;

            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
            Thread.Sleep(Delay);
            SaveWorker.ReportProgress(i++, Visibility.Visible);
        }
예제 #4
0
 private bool saveAll()
 {
     setState(false);
     status.Content      = "Saving...";
     progress.Visibility = Visibility.Visible;
     //
     saveTask                  = new SaveWorker();
     saveTask.NpcMgr           = npcMgr;
     saveTask.ItemMgr          = itemMgr;
     saveTask.ScriptMgr        = scriptMgr;
     saveTask.OnStatusChanged += saveTask_OnStatusChanged;
     saveTask.OnComplete      += saveTask_OnComplete;
     saveTask.Run(saveTask_Progress);
     return(true);
 }
예제 #5
0
    private void Start()
    {
        currentScene     = SceneManager.GetActiveScene().name;
        healthController = healthControllerContainer.GetComponent <HealthController>();
        moneySystem      = moneySystemContainer.GetComponent <MoneySystem>();
        questManager     = questContainer.GetComponent <QuestManager>();
        menu             = menuContainer.GetComponent <PauseMenuScript>();
        blacksmith       = blacksmithContainer.GetComponent <BlacksmithController>();

        if (SaveWorker.SaveExists() && PlayerPrefs.GetString("newGame") == "false")
        {
            Load();
        }
        if (currentScene == "FirstScene")
        {
            PlayerPrefs.SetString("newGame", "false");
        }

        Save();
    }
예제 #6
0
    public void Save()
    {
        var data = new GameData();

        data.currentScene = currentScene;
        //reseltion etc
        if (PlayerPrefs.HasKey("Volume"))
        {
            data.volume = PlayerPrefs.GetFloat("Volume");
        }
        if (PlayerPrefs.HasKey("isFullscreen"))
        {
            if (PlayerPrefs.GetString("isFullscreen") == "False")
            {
                data.isFullScreen = false;
            }
            else
            {
                data.isFullScreen = true;
            }
        }
        if (PlayerPrefs.HasKey("ResolutionIndex"))
        {
            data.resolution = PlayerPrefs.GetInt("ResolutionIndex");
        }
        //health
        data.health        = healthController.currentHealth;
        data.healthPotions = healthController.potions;
        data.maxHealth     = healthController.MaxHealth;
        //money
        data.coins = moneySystem.coins;
        //quest
        var quest = questManager.quest;

        data.Description = quest.Description;
        data.Reward      = quest.Reward;
        data.KillCounter = quest.KillCounter;
        data.KillGoal    = quest.KillGoal;
        data.KillType    = quest.KillType;
        data.ArriveType  = quest.ArriveType;
        data.UseType     = quest.UseType;
        data.TalkType    = quest.TalkType;
        data.Finished    = quest.Finished;
        switch (quest.Type)
        {
        case QuestGoal.USE:
            data.Type = 0; break;

        case QuestGoal.KILL:
            data.Type = 1; break;

        case QuestGoal.ARRIVE:
            data.Type = 2; break;

        case QuestGoal.TALK:
            data.Type = 3; break;
        }
        //king barriers
        var ks = king != null?king.GetComponent <KingScript>() : null;

        if (ks != null)
        {
            data.questPart = ks.questPart;
        }
        else if (savedData != null)
        {
            data.questPart = savedData.questPart;
        }
        //armour
        data.armour = blacksmith.slider.value;

        SaveWorker.SaveGame(data);
    }