Example #1
0
    //切换场景时保存进度,不允许手动保存
    public void SaveOnFile()
    {
        Save save = SaveManager.Instance.CreateSaveGO();

        ES3.Save <Save>("SaveGame", save);
        Debug.Log("SaveGame");
    }
Example #2
0
 public void SetEXP()
 {
     mMonsterKillCnt++;
     mEXP += 5;
     // 경험치를 로컬에 저장
     ES3.Save <int>("2DP_EXP", mEXP);
 }
Example #3
0
 public void switchSceneAndRemoveSave(string name)
 {
     ES3.Save <Vector3>("user-v3", Vector3.zero);
     ES3.Save <float>("user-oxygen", 100f);
     ES3.Save <List <sePuedeRecojer.nombreDePiezas> >("user-ship-parts", new List <sePuedeRecojer.nombreDePiezas>());
     SceneManager.LoadScene(name);
 }
Example #4
0
    public void Save()
    {
        // If we're using caching and we've not already cached this file, cache it.
        if (settings.location == ES3.Location.Cache && !ES3.FileExists(settings))
        {
            ES3.CacheFile(settings);
        }

        if (autoSaves == null || autoSaves.Count == 0)
        {
            ES3.DeleteKey(key, settings);
        }
        else
        {
            var gameObjects = new List <GameObject>();
            foreach (var autoSave in autoSaves)
            {
                // If the ES3AutoSave component is disabled, don't save it.
                if (autoSave.enabled)
                {
                    gameObjects.Add(autoSave.gameObject);
                }
            }
            ES3.Save <GameObject[]>(key, gameObjects.ToArray(), settings);
        }

        if (settings.location == ES3.Location.Cache && ES3.FileExists(settings))
        {
            ES3.StoreCachedFile(settings);
        }
    }
Example #5
0
 // Cargar mapa nuevo
 public void LoadMapLevel(int sceneIndex)
 {
     StartCoroutine(LoadAsynchronously(sceneIndex));
     ES3.Save <int>("ScoreLevel", 0);
     ES3.Save <int>("TimerDragInSeconds", 0);
     ES3.Save <int>("ScoreInSeconds", 0);
 }
 public void SaveGame()
 {
     ES3.Save("TotalGold", totalGameGold);
     ES3.Save("TotalStars", totalGameStars);
     for (int i = 0; i < lm.levels.Count; i++)
     {
         if (lm.levels[i].starsAcquired > 0)
         {
             ES3.Save("Level " + i + " StarsAcquired", lm.levels[i].starsAcquired);
         }
         if (lm.levels[i].goldHighScore > 0)
         {
             ES3.Save("Level " + i + " HighScore", lm.levels[i].goldHighScore);
         }
         ES3.Save("Level " + i + " FirstStarGot", lm.levels[level].firstStarGot);
         ES3.Save("Level " + i + " SecondStarGot", lm.levels[level].secondStarGot);
         ES3.Save("Level " + i + " ThirdStarGot", lm.levels[level].thirdStarGot);
     }
     for (int i = 0; i < itemUnlocks.Count; i++)
     {
         if (itemUnlocks[i] == true)
         {
             ES3.Save("Item " + i + "Unlocked", itemUnlocks[i]);
         }
     }
 }
Example #7
0
 public void WriteToSaveFile()
 {
     ES3.Save("Level", GameVo.CurrentLevelID);
     ES3.Save("Vibration", GameVo.Vibration);
     ES3.Save("SFX", GameVo.SFX);
     ES3.Save("Coin", GameVo.Coin);
 }
    public override void Awake()
    {
        base.Awake();
        animator            = this.GetComponent <Animator>();
        this.fCurrentHealth = this.fStartHealth;
        movement            = this.GetComponent <CMovement>();
        shooter             = this.GetComponent <CShooter>();
        this.flashTime      = 0.25f;

        if (ES3.KeyExists("CurrentHealth", "Player.es3"))
        {
            fCurrentHealth = ES3.Load <float>("CurrentHealth", "Player.es3");
            fMaxHealth     = ES3.Load <float>("MaxHealth", "Player.es3");
            shield         = ES3.Load <int>("Shield", "Player.es3");
        }

        else
        {
            ES3.Save <int>("Shield", shield, "Player.es3");
            ES3.Save <float>("CurrentHealth", fCurrentHealth, "Player.es3");
            ES3.Save <float>("MaxHealth", fMaxHealth, "Player.es3");
        }

        heartUI = GameObject.Find("Heart_UI").GetComponent <CHeartUI>();
        heartUI.SetHeart((int)fCurrentHealth, (int)fMaxHealth, shield);
        onDeath += EndGame;
    }
Example #9
0
    public void VerifyMainSaveFile()
    {
        OnSaveFileAccessed();

        if (ES3.FileExists("main.es3"))
        {
            Debug.Log("Main save data exists.");
        }
        else
        {
            Debug.Log("Main save data does not exist.");
        }

        if (ES3.KeyExists("mostRecentStartup", "main.es3"))
        {
            Debug.Log("Welcome back! Last play session was " + ES3.Load <System.DateTime>("mostRecentStartup", "main.es3"));
        }

        ES3.Save <System.DateTime>("mostRecentStartup", System.DateTime.Now, "main.es3");

        if (ES3.DirectoryExists(saveFilesDirectory))
        {
            foreach (var filename in ES3.GetFiles(saveFilesDirectory))
            {
                Debug.Log("Found save file: " + filename);
            }
        }
        else
        {
            Debug.Log("No save files exist.");
        }
    }
Example #10
0
    public void OnBtnClick()
    {
        ES3.Save <BTNType>("btn", currentType);
        switch (currentType)
        {
        case BTNType.newStart:
            SceneManager.LoadScene("Loading");
            break;

        case BTNType.load:
            SceneManager.LoadScene("Loading");
            break;

        case BTNType.sound:
            SceneManager.LoadScene("Setting");
            break;

        case BTNType.quit:
#if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
#else
            Application.Quit()     // 어플리케이션 종료
#endif
            break;

        case BTNType.back:
            Debug.Log("back to the menu");
            break;
        }
    }
Example #11
0
    public void SaveJson <T>(string key, T _data, string fileName)
    {
        if (_data == null)
        {
            throw new UnityException("存储对象为空!");
        }
        ES3Settings _settings = new ES3Settings();

        if (Isenscript)
        {
            _settings.encryptionType     = ES3.EncryptionType.AES;
            _settings.encryptionPassword = secret;
        }
        if (!Directory.Exists(dirPath))
        {
            Directory.CreateDirectory(dirPath);
        }
        if (fileName.IndexOf(".json") > -1)
        {
            fileName = fileName.Replace(".json", "");
        }
        string jsonpath = dirPath + "/" + fileName + ".json";

        _settings.format = ES3.Format.JSON;
        ES3.Save <T>(key, _data, jsonpath, _settings);
        if (IsBackUp)
        {
            ES3.CreateBackup(jsonpath, _settings);
        }
    }
Example #12
0
    public void SavePatientDataFromLocal(PatientSaveGameData data, string _login)
    {
        ES3.Save(_login, data);

        //var json = JsonUtility.ToJson(data);
        //PlayerPrefs.SetString(_login, json);
    }
Example #13
0
 /// <summary>
 /// 暗号化を介して、TempDataからSaveDataを作成。
 /// </summary>
 static void CreateSaveData()
 {
     foreach (var pair in TempData)
     {
         ES3.Save <dynamic> (pair.Key, pair.Value, SaveSettings);
     }
 }
Example #14
0
/// <summary>
/// 清理所有物品数据
/// </summary>
    public void ClearAllItemData()
    {
        SaveData.Datas.Clear();
        SaveData.OnceItemSaveData.Clear();
        ES3.Save <InventorySaveData>(GetSaveName, SaveData);
        OnItemSave?.Invoke(SaveData);
    }
Example #15
0
        public string AddPlayer(string account)
        {
            int iPlayerId = ES3.KeyExists("IncrementPlayerID") ? ES3.Load <int>("IncrementPlayerID") + 1 : 1;

            ES3.Save <int>("IncrementPlayerID", iPlayerId);

            string sPlayerId = iPlayerId.ToString();

            ES3.Save <string>(account, sPlayerId, "Account");
            string filePath = string.Format("{0}/PlayerInfo", sPlayerId);

            ES3.Save <string>("PlayerName", sPlayerId, filePath);
            ES3.Save <int>("GuideStep", 0, filePath);

            AddHero(sPlayerId, 1006);
            AddHero(sPlayerId, 1020);

            filePath = string.Format("{0}/NormalBattle", sPlayerId);
            ES3.Save <int>("Coin", 0, filePath);
            ES3.Save <int>("CurSpawn", 0, filePath);
            ES3.Save <int>("CurWave", 0, filePath);
            ES3.Save <int>("HighestSpawn", 0, filePath);

            return(sPlayerId);
        }
Example #16
0
 private void SaveLastVideoID()
 {
     if (ConfigSettings.Instance.useLocalData)
     {
         ES3.Save <int>("lastVideoID", lastVideoID);
     }
 }
Example #17
0
        private async UniTaskVoid Start()
        {
            var token = this.GetCancellationTokenOnDestroy();

            SetActiveButtons(false);
            await MoveTitle(token);

            SetActiveButtons(true);
            await CallActiveAnimation(true, token);

            var pushedButtonObservables =
                modeButtons.Select(x =>
                                   x.OnClickAsObservable
                                   .Select(_ => x.ModeType)
                                   );

            // 押されたbuttonによってゲームモードを変える
            pushedButtonObservables.Merge()
            .Do(x => ES3.Save <ModeType>(SaveDataKeys.ModeType, x, SaveDataPaths.PuzzleDataPath))
            .Select(x => new GameInfo(x))
            .Subscribe(x => MoveScene(x, token).ToObservable())
            .AddTo(this);

            // 前回のデーターを読み込んで途中から開始
            if (continueButton.gameObject.activeSelf)
            {
                continueButton.OnClickAsObservable
                .Select(_ => new ContinueGameInfo(
                            ES3.Load <ModeType>(SaveDataKeys.ModeType, SaveDataPaths.PuzzleDataPath),
                            ES3.Load <int>(SaveDataKeys.PreviousScore, SaveDataPaths.PuzzleDataPath),
                            ES3.Load <List <TileInfo> >(SaveDataKeys.TileDataList, SaveDataPaths.PuzzleDataPath)))
                .Subscribe(x => MoveScene(x, token).ToObservable())
                .AddTo(this);
            }
        }
Example #18
0
 public void Save()
 {
     ES3.Save <bool>("hasDoubleJump", hasDoubleJump);
     ES3.Save <bool>("hasAirDash", hasAirDash);
     ES3.Save <bool>("hasDashBomb", hasDashBomb);
     ES3.Save <bool>("hasGun", hasGun);
 }
Example #19
0
 public void Clear()
 {
     ES3.Save("Level", 0);
     ES3.Save("Vibration", true);
     ES3.Save("SFX", true);
     ES3.Save("Coin", 100);
 }
Example #20
0
    public void Load()
    {
        if (ES3.FileExists("SaveData"))
        {
            if (ES3.KeyExists("PlayerData", "SaveData"))
            {
                ES3.LoadInto <PlayerData>("PlayerData", "SaveData", this);

                Debug.Log("PlayerDataLoaded " +
                          ", HealthLevel: " + HealthLevel +
                          ", FireRateLevel: " + FireRateLevel +
                          ", BulletDamageLevel:" + BulletDamageLevel +
                          ", BulletNumLevel: " + BulletNumLevel +
                          ", AttractorLevel: " + AttractorLevel +
                          ", Sp: " + Sp);
            }
        }
        else
        {
            HealthLevel       = 1;
            FireRateLevel     = 1;
            BulletDamageLevel = 1;
            BulletNumLevel    = 1;
            AttractorLevel    = 1;
            Sp = 0;
            ES3.Save <PlayerData>("PlayerData", this, "SaveData");
            Debug.Log("SaveData File Not found, PlayerData key created and loaded default values");
        }
    }
 /*
  * This is called whenever the application is quit.
  * This is where we will save our data.
  */
 void OnApplicationQuit()
 {
     // Save the number of created prefabs there are.
     ES3.Save <int>(id + "count", prefabInstances.Count);
     // Save our Transforms.
     ES3.Save <List <Transform> >(id, prefabInstances);
 }
Example #22
0
        public void Save(string saveFile)
        {
            _autoSaveFile = saveFile;

            var gameManager = FindObjectOfType <GameManager>();

            ES3.Save("game manager", gameManager.CaptureState(), saveFile);

            if (gameManager.InCombat())
            {
                var combatManager = FindObjectOfType <CombatManager>();

                ES3.Save("combat manager", combatManager.CaptureState(), saveFile);
            }

            var travelManager = FindObjectOfType <TravelManager>();

            ES3.Save("travel manager", travelManager.CaptureState(), saveFile);

            ES3.Save("day info", $"DAY {travelManager.CurrentDayOfTravel}, {travelManager.Party.Size} Companions", saveFile);
            ES3.Save("datetime info", DateTime.Now.ToString(CultureInfo.CurrentCulture), saveFile);

            var encounterManager = FindObjectOfType <EncounterManager>();

            ES3.Save("encounter manager", encounterManager.CaptureState(), saveFile);
        }
Example #23
0
 public void OnDisable()
 {
     ES3.Save <int>("playerWoodCount", m_currentWoodCount);
     ES3.Save <int>("playerCoalCount", m_currentCoalCount);
     ES3.Save <int>("playerJambonBoursinCount", m_currentJambonBoursinCount);
     ES3.Save <int>("playerCrewCount", m_currentCrewCount);
 }
Example #24
0
        public void NormalBattleSaveCurSpawn(string playerId, int curSpawn)
        {
            string filePath = string.Format("{0}/NormalBattle", playerId);

            ES3.Save <int>("CurSpawn", curSpawn, filePath);
            SyncCurSpawn(curSpawn);
            NormalBattleSaveCurWave(playerId, 0);

            filePath = string.Format("{0}/NormalBattle", playerId);
            if (curSpawn > ES3.Load <int>("HighestSpawn", filePath))
            {
                ES3.Save <int>("HighestSpawn", curSpawn, filePath);
                ConfigTable tbl = ConfigData.GetValue("NormalTask_Client");
                if (tbl.m_Data.ContainsKey(curSpawn.ToString()))
                {
                    ConfigRow row = tbl.GetRow(curSpawn.ToString());
                    switch (row.GetValue("Type"))
                    {
                    case "1":
                    {
                        int heroId = int.Parse(row.GetValue("Value"));
                        AddHero(playerId, heroId);
                        SyncHero(playerId, heroId);

                        break;
                    }
                    }
                    SyncBattleTask(curSpawn);
                }
            }
        }
Example #25
0
 public void OnClick()
 {
     //Debug.Log(songPos);
     //Debug.Log(Mathf.Abs(nextBeatTime - songPos));
     //Debug.Log(Mathf.Abs(pastBeatTime - songPos));
     if (!finished.activeInHierarchy)
     {
         if (Mathf.Abs(nextBeatTime - songPos) > Mathf.Abs(pastBeatTime - songPos))
         {
             diff = pastBeatTime - songPos;
             //Debug.Log("past" + diff);
         }
         else
         {
             diff = nextBeatTime - songPos;
         }
         offDisplay.text = (diff * 1000).ToString("F0") + " ms";
         diffSum        += diff;
         clickCount++;
         countDisplay.text = clickCount.ToString() + "/30";
         calibrationOffset = diffSum / clickCount;
         if (clickCount == 30)
         {
             ES3.Save("inputOffset", calibrationOffset);
             finished.GetComponent <OffsetDisplay>().UpdateRec();
             finished.SetActive(true);
         }
     }
 }
Example #26
0
        public void NormalBattleSaveCurWave(string playerId, int curWave)
        {
            string filePath = string.Format("{0}/NormalBattle", playerId);

            ES3.Save <int>("CurWave", curWave, filePath);
            SyncCurWave(curWave);
        }
Example #27
0
    public void SetResolution(int resolutionIndex)
    {
        Resolution resolution = resolutions[resolutionIndex];

        Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
        ES3.Save("ResolutionIndex", resolutionIndex);
    }
Example #28
0
        public void NormalBattleSaveHighestSpawn(string playerId, int highestSpawn)
        {
            string filePath = string.Format("{0}/NormalBattle", playerId);

            ES3.Save <int>("HighestSpawn", highestSpawn, filePath);
            SyncHighestSpawn(highestSpawn);
        }
Example #29
0
        public override void Enter()
        {
            // Get FSMVariables objects required based on whether the user wants to save local variables, global variables or both.
            var variableLists = new List <FsmVariables>();

            if (saveFsmVariables.Value)
            {
                variableLists.Add(Fsm.Variables);
            }
            if (saveGlobalVariables.Value)
            {
                variableLists.Add(FsmVariables.GlobalVariables);
            }

            var dict = new Dictionary <string, object>();

            foreach (var variableList in variableLists)
            {
                foreach (var fsmVariable in variableList.GetAllNamedVariables())
                {
                    dict.Add(fsmVariable.Name, fsmVariable.RawValue);
                }
            }
            ES3.Save <Dictionary <string, object> >(key.Value, dict, GetSettings());
        }
Example #30
0
 public void SaveStatus()
 {
     bool[] status = new bool[2] {
         isHaving, isUsing
     };
     ES3.Save <bool[]>("paletteItemStatus_" + paletteName, status);
 }