Exemple #1
0
 public void LoadSaveData()
 {
     if (ES3.KeyExists(saveKey))
     {
         saveData = ES3.Load <SaveData>(saveKey);
     }
 }
Exemple #2
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);
        }
Exemple #3
0
    public override void Awake()
    {
        base.Awake();
        settings = new ES3Settings(ES3.EncryptionType.AES);

        if (ES3.KeyExists("IsContinue", "Stage.es3"))
        {
            if (ES3.Load <bool>("IsContinue", "Stage.es3"))
            {
                this.StageLoadData();
            }

            else
            {
                this.NotSaveChpaterEnter();
            }
        }

        else
        {
            this.NotSaveChpaterEnter();
        }

        player = FindObjectOfType <CMovement>();
        portal = this.transform.Find("Portal").GetComponent <CPortal>();
        portal.SetChapterScene(this);
        this.MoveStage();
    }
Exemple #4
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.");
        }
    }
 void LoadResetTime()
 {
     if (ES3.KeyExists("ResetTime"))
     {
         resetTime = ES3.Load <DateTime>("ResetTime");
     }
 }
Exemple #6
0
    private void Start()
    {
        if (SceneManager.GetActiveScene().buildIndex == 0)
        {
            resolutions = Screen.resolutions;
            resolutionDropdown.ClearOptions();

            List <string> options = new List <string>();
            int           currentResolutionIndex = 0;
            for (int i = 0; i < resolutions.Length; i++)
            {
                string option = resolutions[i].width + " x " + resolutions[i].height;
                options.Add(option);

                if (resolutions[i].ToString() == Screen.currentResolution.ToString())
                {
                    currentResolutionIndex = i;
                }
            }
            resolutionDropdown.AddOptions(options);

            if (!ES3.KeyExists("ResolutionIndex"))
            {
                resolutionDropdown.value = currentResolutionIndex;
                resolutionDropdown.RefreshShownValue();
            }

            LoadSettings();
            SetLoadGameButtons();
        }
    }
Exemple #7
0
        public void LoadSavedData()
        {
            if (!ES3.FileExists())
            {
                return;
            }

            if (ES3.KeyExists("Level"))
            {
                GameVo.CurrentLevelID = ES3.Load <int>("Level");
            }

            if (ES3.KeyExists("Vibration"))
            {
                GameVo.Vibration = ES3.Load <bool>("Vibration");
            }

            if (ES3.KeyExists("SFX"))
            {
                GameVo.SFX = ES3.Load <bool>("SFX");
            }

            if (ES3.KeyExists("Coin"))
            {
                GameVo.Coin = ES3.Load <int>("Coin");
            }
        }
    public void LoadData(bool shouldSave)
    {
        foreach (LevelSelectButton levelSelect in allGrassyLevels)
        {
            LevelSelectInfo lSelect    = levelSelect.levelToTravelTo;
            string          loadString = "LevelData_" + lSelect.buildSceneNumber.ToString();
            if (ES3.KeyExists(loadString))
            {
                LevelSaveData loadedData = ES3.Load <LevelSaveData>(loadString);
                lSelect.levelCompletionData             = new LevelCompletionData();
                lSelect.levelCompletionData.completed   = loadedData.completed;
                lSelect.levelCompletionData.earnedStars = loadedData.stars;
                lSelect.levelCompletionData.cratesUsed  = loadedData.cratesDropped;
            }
            else
            {
                lSelect.levelCompletionData             = new LevelCompletionData();
                lSelect.levelCompletionData.completed   = false;
                lSelect.levelCompletionData.earnedStars = 0;
                lSelect.levelCompletionData.cratesUsed  = 0;
                if (shouldSave)
                {
                    SaveProgress(false, 0, 0, true, lSelect);
                }
            }

            levelSelect.UpdateStars(grassyPalette);
        }
        UpdateUnlocks();
    }
Exemple #9
0
    private void InitStoryData()
    {
        if (!ES3.KeyExists(SceneName))
        {
            ES3.Save <Dictionary <string, bool> >(SceneName, StoryData);
        }
        StoryData = ES3.Load <Dictionary <string, bool> >(SceneName);
        if (StoryTriggers.Count <= 0)
        {
            foreach (var VARIABLE in transform.GetComponentsInChildren <StoryTrigger>())
            {
                StoryTriggers.Add(VARIABLE);
            }
        }

        foreach (var VARIABLE in StoryTriggers)
        {
            OnStoryInitFinish += VARIABLE.AutoInvokeStory;
            if (StoryData.ContainsKey(VARIABLE.StoryName))
            {
                VARIABLE.StoryIsFinish = StoryData[VARIABLE.StoryName];
            }
        }
        OnStoryInitFinish?.Invoke();
    }
Exemple #10
0
    private void Start()
    {
        RealStateDuration = stateDurationMinutes * 60;

        if (ES3.KeyExists("currentStateIndex") == true)
        {
            StateIndex = ES3.Load <int>("currentStateIndex");
            if (StateIndex != 10)
            {
                methodName = "State" + StateIndex;
            }
            else
            {
                methodName = "State1";
            }
        }

        else
        {
            methodName = WorldStartState;
        }

        Type       thisType  = this.GetType();
        MethodInfo theMethod = thisType.GetMethod(methodName);

        theMethod.Invoke(this, null);
    }
    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;
    }
Exemple #12
0
 void LoadNextID()
 {
     if (ES3.KeyExists("NextID"))
     {
         nextID = ES3.Load <int>("NextID");
     }
 }
 private void Start()
 {
     playerController         = GetComponent <CharacterController>();
     playerController.enabled = false;
     tDetection       = GetComponent <TriggerDetection>();
     keys             = GetComponent <playerKeyHolder>();
     playerRb         = GetComponent <Rigidbody>();
     controller       = GetComponent <CharacterController>();
     isMoving         = false;
     isSafe           = false;
     isDead           = false;
     isStarting       = true;
     Physics.gravity *= 2;
     StartCoroutine(WaitForMusic());
     if (ES3.KeyExists("posicao") && ES3.KeyExists("energia"))
     {
         lastCheckpointPos       = ES3.Load <Vector3>("posicao");
         lastCheckpointRot       = ES3.Load <Quaternion>("rotacao");
         Manager.current.turnOff = ES3.Load <bool>("energia");
         transform.position      = lastCheckpointPos;
         transform.rotation      = lastCheckpointRot;
     }
     else
     {
         lastCheckpointPos = transform.position;
         lastCheckpointRot = transform.rotation;
     }
     playerController.enabled = true;
 }
Exemple #14
0
        public void SyncBattleInfo(string playerId)
        {
            string filePath = string.Format("{0}/NormalBattle", playerId);

            SyncCoin(ES3.Load <int>("Coin", filePath));
            SyncCurSpawn(ES3.Load <int>("CurSpawn", filePath));
            SyncHighestSpawn(ES3.Load <int>("HighestSpawn", filePath));

            int count = 0;

            for (int i = 0; i < 5; ++i)
            {
                if (ES3.KeyExists(string.Format("HeroID{0}", i), filePath))
                {
                    ++count;
                }
            }
            for (int i = 0; i < count; ++i)
            {
                SyncBattleHero(playerId, i);
            }

            ByteBuffer data = new ByteBuffer();

            data.writeByte(102);
            data.writeByte(BattleService.BATTLE_START);
            ServiceManager.PostMessageShortEx(data);

            SyncCurWave(ES3.Load <int>("CurWave", filePath));
        }
Exemple #15
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");
        }
    }
Exemple #16
0
 public void GetSaveData <T>(SaveEnum key, T obj) where T : Transform
 {
     if (ES3.KeyExists(key.ToString()))
     {
         ES3.LoadInto <T>(key.ToString(), obj);
     }
 }
Exemple #17
0
 void LoadHasYetGot()
 {
     if (ES3.KeyExists("hasYetGot_DailyReward"))
     {
         hasYetGot = ES3.Load <bool>("hasYetGot_DailyReward");
     }
 }
Exemple #18
0
 public int GetInt(string settingName, int defaultValue)
 {
     if (ES3.KeyExists(settingName))
     {
         return(ES3.Load <int>(settingName));
     }
     return(defaultValue);
 }
Exemple #19
0
 public float GetFloat(string settingName, float defaultValue)
 {
     if (ES3.KeyExists(settingName))
     {
         return(ES3.Load <float>(settingName));
     }
     return(defaultValue);
 }
Exemple #20
0
 private void Awake()
 {
     //checking if this is our first startup
     if (ES3.KeyExists("ShotsFired") == true)
     {
         Load();
     }
 }
Exemple #21
0
 public string GetString(string settingName, string defaultValue)
 {
     if (ES3.KeyExists(settingName))
     {
         return(ES3.Load <string>(settingName));
     }
     return(defaultValue);
 }
Exemple #22
0
 private void Start()
 {
     AudioManager.sharedInstance.ChangeMusic(AudioManager.MusicType.Menu);
     if (!ES3.KeyExists("posicao"))
     {
         continuarButton.interactable = false;
     }
 }
 public void MakeFileLoad()
 {
     if (!ES3.KeyExists("bIsMade", "MakeWeapon.es3"))
     {
         weaponMakePopup.MakeFileSave();
     }
     this.bIsMade = ES3.Load <bool[]>("bIsMade", "MakeWeapon.es3");
 }
Exemple #24
0

        
Exemple #25
0
 public bool GetBool(string settingName, bool defaultValue)
 {
     if (ES3.KeyExists(settingName))
     {
         return(ES3.Load <bool>(settingName));
     }
     return(defaultValue);
 }
 private void Start()
 {
     if (!ES3.KeyExists("CurrentHealth", "Player.es3") || ES3.Load <float>("CurrentHealth", "Player.es3") == 0)
     {
         StartCoroutine(SceneOpening());
     }
     InitPlayerData();
 }
Exemple #27
0
 //TODO 不同的存储文件
 public T GetSaveData <T>(SaveEnum key)
 {
     if (ES3.KeyExists(key.ToString()))
     {
         return(ES3.Load <T>(key.ToString()));
     }
     return(ES3.Load <T>(key.ToString(), default(T)));
 }
Exemple #28
0
    // Creates a new Story object with the compiled story which we can then play!
    public void StartStory()
    {
        HideCanvas(false);

        if (clearOnNewStory)
        {
            ClearChildren();
        }

        lastText         = "";
        lastSaveableTags = "";
        story            = new ClayStory(inkStoryObject.inkJsonAsset.text);
        inkStoryObject.Init();
        //string savedJson = PlayerPrefs.GetString(inkStoryObject.storyName + "savedInkStory");
        string savedJson = "";

        if (ES3.KeyExists("LDJam47_HasSaved"))
        {
            if (ES3.KeyExists(inkStoryObject.storyName + "savedInkStory"))
            {
                savedJson = ES3.Load <string> (inkStoryObject.storyName + "savedInkStory");
            }
            ;
            if (savedJson != "")
            {
                InkWriter.main.story.state.LoadJson(savedJson);
                Debug.Log("Loading story");
                lastText         = (string)InkWriter.main.story.variablesState["lastSavedString"];
                lastSaveableTags = (string)InkWriter.main.story.variablesState["lastSavedTags"];
                Debug.Log("Tags at load point: " + lastSaveableTags);
                loading = true;
                if (mainWriter && eventToGoToInCaseOfLoad != "")
                {
                    GoToKnot(eventToGoToInCaseOfLoad);
                }
                ;
            }
            else     // no saved json -> go to "start" knot
            {
                if (mainWriter)
                {
                    GoToKnot("start");
                }
                ;
            }
        }
        else     // no saved json -> go to "start" knot
        {
            ES3.DeleteKey(inkStoryObject.storyName + "savedInkStory");
            if (mainWriter)
            {
                GoToKnot("start");
            }
            ;
        }
        InkWriter.main.story.variablesState["debug"] = false;
        RefreshView();
    }
Exemple #29
0
    public void ReturnLobby()
    {
        if (ES3.FileExists("WeaponList.es3"))
        {
            var keys = ES3.GetKeys("WeaponList.es3");
            for (int i = 0; i < keys.Length; i++)
            {
                if (ES3.KeyExists(i.ToString(), "WeaponList.es3"))
                {
                    ES3.DeleteKey(i.ToString(), "WeaponList.es3");
                }
            }
        }

        if (this.weaponParent == null)
        {
            this.weaponParent = GameObject.Find("GunSlot").transform;
        }

        weaponList.Clear();
        GameObject weaponObj;
        CWeapon    weapon;

        if (ES3.KeyExists("BaseGun", "Weapon.es3"))
        {
            string weaponName = ES3.Load <string>("BaseGun", "Weapon.es3");
            weaponObj = GameObject.Instantiate(CResourceManager.Instance.GetObjectForKey("Prefabs/Gun/" +
                                                                                         weaponName), this.weaponParent);

            weapon         = weaponObj.GetComponent <CWeapon>();
            weapon.gunName = weaponName;
        }

        else
        {
            weaponObj      = GameObject.Instantiate(CResourceManager.Instance.GetObjectForKey("Prefabs/Gun/DAKGUN"), this.weaponParent);
            weapon         = weaponObj.GetComponent <CWeapon>();
            weapon.gunName = "DAKGUN";
        }


        weapon.SetGunImageSetting();
        bulletArray[0] = weapon.GetMaxBullet();
        for (int i = 1; i < bulletArray.Length; i++)
        {
            bulletArray[i] = -1;
        }

        if (this.weaponParent == null)
        {
            this.weaponParent = GameObject.Find("GunSlot").transform;
        }

        this.SetCurrentWeapon(weapon);
        this.AddWeapon(weapon);
        ES3.Save <int>("CurrentWeaponIndex", this.currentWeaponIndex, "Weapon.es3");
        ES3.Save <string>("BaseGun", weapon.gunName, "Weapon.es3");
    }
Exemple #30
0
 // Start is called before the first frame update
 private void Awake()
 {
     TextMesh = GetComponent <TextMeshPro>();
     if (ES3.KeyExists("PostProcessing"))
     {
         OnOff = ES3.Load <bool>("PostProcessing");
     }
     SetPostState();
 }