Exemplo n.º 1
0
    public void LoadAll()
    {
        // Simple load of a file (without encryption)
        floatNumber = SaveDataManager.Load("float_file", -1f);

        // Loading en encrypted file
        boolean = SaveDataManager.Load("boolean_file", false, "passwordHere");

        // Load of a list of a custom class without encryption
        listOfDummyClasses = SaveDataManager.Load("listOfDummyClasses_file", new List <DummyClass>(), "", null, true);
    }
Exemplo n.º 2
0
        public override void Load()
        {
            Instance  = this;
            ModLogger = Instance.Logger;

            // Initialize all the things!
            AssetManager.Load();
            LocalizationInitializer.Initialize();
            ILManager.Load();
            SaveDataManager.Load();
            SaveDataManager.Save();
            ChangelogData.PopulateChangelogList(this);
        }
Exemplo n.º 3
0
    public void OnLoadSlot(int _slot)
    {
        if (!lockSlots)
        {
            lockSlots = true;
            if (File.Exists(validFiles[_slot]))
            {
                saveDataManager.Load(validFiles[_slot]);
            }

            lockSlots = false;

            UpdateSaveList();
        }
    }
Exemplo n.º 4
0
 private const int defaultMoney = 200;                   //default start up money
 //loads a save file if it exists if not it generates a new save file
 private void Start()
 {
     dataManager = GameObject.Find("SaveLoadManager").GetComponent <SaveDataManager>();
     //Checks if any user settings exist if not generate new file from scratch
     if (File.Exists(Application.persistentDataPath + "UserData.das"))
     {
         //load existing data
         dataManager.Load();
     }
     else
     {
         // create new set of data
         NewGameSave();
     }
 }
Exemplo n.º 5
0
/*--- 初期化関連 ---*/

    private void InitializeGame()
    {
        SaveData.Load();

        _SelectedBomb = SaveData.PickBombInSavedataList(SaveData.savedata.MyBomb.name);
        BombGenerator.SelectedBomb = _SelectedBomb;
        _SelectedSonar             = SaveData.PickSonarInSavedataList(SaveData.savedata.MySonar.name);
        SonarManager.SelectedSonar = _SelectedSonar;

        // _numOre = SaveData.savedata.numberOfOre;
        _numOre = 0;
        _MaxHP  = SaveData.savedata.MaxHP;
        _HP     = _MaxHP;
        _maxmp  = SaveData.savedata.MaxMP;
        _mp     = _maxmp;
    }
Exemplo n.º 6
0
    public void OnGUI()
    {
        testText = GUI.TextField(new Rect(10, 10, 300, 50), testText);

        if (GUI.Button(new Rect(10, 70, 300, 100), "Save"))
        {
            customStringSavingManager.SetCustomString("Test", testText);
            saveDataManager.Save("Test");
        }

        if (GUI.Button(new Rect(10, 180, 300, 100), "Load"))
        {
            saveDataManager.Load("Test");
            testText = customStringSavingManager.GetCustomString("Test");
        }
    }
Exemplo n.º 7
0
    //Defined Start-Routine
    IEnumerator CheckPrestartConditions()
    {
        //Check if all Saved Data is collected
        Debug.Log(LogTime.Time() + ": Game Starter Script - Loading saved Data...");
        SaveDataManager.Load();
        while (!SaveDataManager.firstDataLoaded)
        {
            yield return(new WaitForEndOfFrame());
        }
        Debug.Log(LogTime.Time() + ": Game Starter Script - All saved Data loaded...");

        //Set Language
        Debug.Log(LogTime.Time() + ": Game Starter Script - Going to apply current Language...");
        if (SaveDataManager.getValue.languageManualySet == false)
        {
            var autoLanguage = Application.systemLanguage == SystemLanguage.German ? SettingsLanguages.German : SettingsLanguages.English;
            SaveDataManager.getValue.settingsLanguage = autoLanguage;
            SaveDataManager.Save();
        }
        LanguageScript.UpdateLanguage();
        Debug.Log(LogTime.Time() + ": Game Starter Script - Language Set...");

        //Set Vibration
        VibrationManager.Setup();

        //Setup Google Play
        GoogleLoginScript.instance.CheckAutoSetup();

        //Debug && FreeShop
        if (ConstantManager.freeShop)
        {
            SaveDataManager.getValue.coinItemLVL         = 0;
            SaveDataManager.getValue.secondChanceItemLVL = 0;
            SaveDataManager.getValue.shieldItemLVL       = 0;
            SaveDataManager.getValue.shootItemLVL        = 0;
            SaveDataManager.getValue.shrinkItemLVL       = 0;
            SaveDataManager.getValue.slideItemLVL        = 0;
            SaveDataManager.Save();
        }

        //Call SceneManager to load whatever needs to be loaded
        Debug.Log(LogTime.Time() + ": Game Starter Script - Calling Scene Manager to load first Scene...");
        SceneManager.instance.startGame();
    }
Exemplo n.º 8
0
    // Para Hacer uso del método Hard (este) es recomendable eliminar el script
    // ManagerData debido a que pueden ocurrir confuciones

    void Start()
    {
        // Como Recomendación, para generar una key de encriptación la libreria
        // contiene una función con un algoritmo para generar un texto random,
        // para hacer uso de esa función hacemos los siguiente
        Debug.Log("Texto Random: " + SaveDataManager.RandomId()); // Por defecto crea un texto con 15 caracteres, mayusculas, minusculas y simbolos
        // Si desea cambiar algun parametro de la funcion puede hacerlo de las
        // siguientes maneras
        //
        SaveDataManager.RandomId(Length: 30);        // Esto genera un texto con 30 caracteres de longitud
        SaveDataManager.RandomId(Mayusculas: false); // Esto quita las mayusculas en la generacion del texto
        SaveDataManager.RandomId(minusculas: false); // esto quita las minusculas en la generacion del texto
        SaveDataManager.RandomId(simbolos: false);   // esto quita los simbolos de la generacion del texto
        // asi mismo varias opciones pueden ser anidadas de la siguiente manera
        SaveDataManager.RandomId(Length: 30, simbolos: false);
        // Ojo cada que se llama a esta función genera un nuevo texto random
        // con los parametros indicados, no se guarda la configuración
        // establecida
        //
        // Recomiendo usar esta funcion cambiando el lenght para crear la llave
        // (luego introducirla de manera manual en una variable)


        //Verificamos que los datos existan
        if (!SaveDataManager.Exist(typeof(UserData), _path))
        {
            userData = new UserData();
            // para guardar los datos existen dos maneras, una de ellas es:
            userData.Save <UserData>(_path, _key, true);       // el parametro true no es obligatorio ya que siempre será false, pero este indica si se desea guardar los parametros privados de la clase
            // otra manera es:
            SaveDataManager.Save(userData, _path, _key, true); // el mismo caso para el parámetro true
        }
        else
        {
            // para cargar los datos tenemos dos opciones de igual manera
            userData = SaveDataManager.Load <UserData>(_path, _key, true); // En este caso tenemos que indicar la clase que se desea cargar, la ruta y la llave
            // otra opción es:
            userData.Load <UserData>(_path, _key, true);                   // En este caso se aplican las mismas circunstancias que el anterior
        }
    }
Exemplo n.º 9
0
        internal void OnApplicationPause(bool pause)
        {
            saveDataManager.Load();
            if (!pause)
            {
                var now = DateTime.UtcNow;
                if (lastOrbGenerateTime == DateTime.MinValue)
                {
                    lastOrbGenerateTime = now;
                }
                //                Debug.Log("TIMESPAN : " + (now - lastOrbGenerateTime));

                numOfOrb = 0;

                var timeSpan = now - lastOrbGenerateTime;
                numOfOrb = (int)timeSpan.TotalSeconds / GENERATE_SPAN_SEC;
                if (numOfOrb > orbsManager.GetMaxOrb())
                {
                    numOfOrb = orbsManager.GetMaxOrb();
                }
            }
        }
Exemplo n.º 10
0
 public static void Init() =>
 data = SaveDataManager.Exist(typeof(DataPlayer), DATA_PATH) ?
        SaveDataManager.Load <DataPlayer>(DATA_PATH, KEY_ENCRYPT, loadPrivates: true) :
        new DataPlayer();
 public static void Load() =>
 data =
     SaveDataManager.Exist(typeof(PlayerData), PersistentData.SAVE_PATH) ?
     SaveDataManager.Load <PlayerData>(PersistentData.SAVE_PATH, PersistentData.KEY_ENCRYPT_DATA, true) :
     new PlayerData();
Exemplo n.º 12
0
 public static T Load <T>(bool loadPrivates = false) => SaveDataManager.Load <T>(_path, _key, loadPrivates);
Exemplo n.º 13
0
 private void LoadData()
 {
     ProgressData = SaveDataManager.Load <PlayerProgressData>(ProgressData.DirectoryPath, ProgressData.FileNamePath);
 }
Exemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        startFlag = false;
        readyFlag = false;
        showScore = 0;
        score     = 0;

        hiScoreUpdated = false;

        finished = false;


        ScoreTextFormat = new string('0', ScoreText.text.Length);
        var audio = GetComponents <AudioSource>();

        audioSource = audio[0];
        bgm         = audio[1];

        hiscoreEffects = GameObject.FindGameObjectWithTag("HiScoreEffect").GetComponentsInChildren <ParticleSystem>().ToList();

        // ハイスコア読み込み処理
        savedata = saveDataManager.Load() ?? new SaveData();
        hiScore  = savedata.HiScore;

        HiScoreText.text = hiScore.ToString(ScoreTextFormat);

        // 時間表示の更新
        TimeText.text = MilliSecondsToString.format(GameTimeInMilliSeconds);
        // 背景コントローラーの取得
        backgroundContoroller = GameObject.Find("InfomationBackground").GetComponent <BackgroundController>();

        Score = 0;
        for (var i = 0; i < FieldLength * FieldLength; ++i)
        {
            var obj = Instantiate(blockPrefab);

            float x = i % FieldLength / (BASELENGTH * 2) * BASEX + OffsetXPosition;
            float y = -(i / FieldLength / BASELENGTH * BASEY + OffsetYPosition);
            obj.transform.position = new Vector3(x, y);

            if (i == 0 || i == FieldLength - 1 || i == (FieldLength * (FieldLength - 1)) || i == (FieldLength * FieldLength) - 1)
            {
                // フィールドの角の4つはNONEブロックにする
                obj.Kind = Block.KIND.NONE;
            }
            else
            {
                // ブロックをランダム生成する
                obj.SetRandomBlock();
            }

            if (i % (FieldLength / 2 * (FieldLength * 2)) == 0)
            {
                Debug.Log($"[Center] {x}, {y}");
            }

            obj.name = $"Block[{blocks.Count}](Pos:{x}, {y})";

            blocks.Add(obj);
        }

        cursor = Instantiate(cursorPrefab);
        cursor.SetBlockData(blocks, FieldLength);
        // カーソルの初期位置を設定
        cursor.PositionX = FieldLength / 2;
        cursor.PositionY = FieldLength / 2;

        var settings = new FieldSettings {
            BlockRegenerateFrame = BlockRegenerateTime, FieldWidth = FieldLength
        };

        fieldManager = new FieldManager(blocks, settings);

        // キー操作の定義

        // カーソルを左へ移動
        PlayerInputManager.RegisterOnKeyDownHandler(KEYS.LEFT, (frames) =>
        {
            if (cursor.Hold)
            {
                cursor.SwapLeftBlock();
            }
            else
            {
                cursor.Left();
            }
        });
        PlayerInputManager.RegisterOnKeyDelayHandler(KEYS.LEFT, KeyDelayFrame, null);
        PlayerInputManager.RegisterOnKeyHoldHandler(KEYS.LEFT, KeyRepeatInterval, null);

        // カーソルを右へ移動
        PlayerInputManager.RegisterOnKeyDownHandler(KEYS.RIGHT, (frames) =>
        {
            if (cursor.Hold)
            {
                cursor.SwapRightBlock();
            }
            else
            {
                cursor.Right();
            }
        });
        PlayerInputManager.RegisterOnKeyDelayHandler(KEYS.RIGHT, KeyDelayFrame, null);
        PlayerInputManager.RegisterOnKeyHoldHandler(KEYS.RIGHT, KeyRepeatInterval, null);

        // カーソルを上へ移動
        PlayerInputManager.RegisterOnKeyDownHandler(KEYS.UP, (frames) =>
        {
            if (cursor.Hold)
            {
                cursor.SwapUpBlock();
            }
            else
            {
                cursor.Up();
            }
        });
        PlayerInputManager.RegisterOnKeyDelayHandler(KEYS.UP, KeyDelayFrame, null);
        PlayerInputManager.RegisterOnKeyHoldHandler(KEYS.UP, KeyRepeatInterval, null);

        // カーソルを下へ移動
        PlayerInputManager.RegisterOnKeyDownHandler(KEYS.DOWN, (frames) =>
        {
            if (cursor.Hold)
            {
                cursor.SwapDownBlock();
            }
            else
            {
                cursor.Down();
            }
        });
        PlayerInputManager.RegisterOnKeyDelayHandler(KEYS.DOWN, KeyDelayFrame, null);
        PlayerInputManager.RegisterOnKeyHoldHandler(KEYS.DOWN, KeyRepeatInterval, null);

        // ブロックを選択
        PlayerInputManager.RegisterOnKeyDownHandler(KEYS.BLOCKCHANGE_A, (frames) =>
        {
            if (!startFlag)
            {
                return;
            }
            cursor.Hold = true;
        });
        PlayerInputManager.RegisterOnUpHandler(KEYS.BLOCKCHANGE_A, (frames) =>
        {
            if (!startFlag)
            {
                return;
            }
            cursor.Hold = false;
        });


        // スコアを獲得したときの処理
        fieldManager.onEarnedPointEvent += (r) =>
        {
            Debug.Log($"{r.Reason} {r.Point} {r.Kind}");
            StartCoroutine("BlockDeletePlay", r.Count);
            Score += r.Point;
            backgroundContoroller.ChangeTheme(r.Kind);
        };

        fieldManager.onBlockGenerate += (r) =>
        {
            audioSource.PlayOneShot(BlockRegenerateSE);
        };

        var c = FadeIn(0.05f, () =>
        {
            Debug.Log("Fade finish");
            readyFlag = true;
        });

        StartCoroutine(c);
    }
Exemplo n.º 15
0
 static void Load()
 {
     SaveData data = SaveDataManager.Load(SaveDataManager.SavePath);
     //Debug.Log(data.ToString());
     //Console.WriteLine(data.ToString());
 }
Exemplo n.º 16
0
 public void LoadPlayer()
 {
     player = (Player)SaveDataManager.Load();
 }