private void checkIfItsTimeToClaim() { if (GameStorage.Exists(Application.persistentDataPath + savePath)) { lastClaimTime = GameStorage.Load <Clock>(Application.persistentDataPath + savePath); lastLoginDate = lastClaimTime.convertToDateTime(); DateTime rightNow = DateTime.Now; TimeSpan lastLoginUntilNow = rightNow.Subtract(lastLoginDate); if (lastLoginUntilNow.Minutes >= elapsedMinuteRequired) { treasureShouldBeOpen = true; PlayerSaveData psd = bagController.getCurrentSaveData(); psd.ClaimReward(treasureReward); lastClaimTime.SetDataFromDateTime(rightNow); lastLoginDate = lastClaimTime.convertToDateTime(); GameStorage.Save <Clock>(lastClaimTime, Application.persistentDataPath + savePath); } } else { lastLoginDate = DateTime.Now; lastClaimTime = new Clock(Application.persistentDataPath + savePath, lastLoginDate); GameStorage.Save <Clock>(lastClaimTime, Application.persistentDataPath + savePath); } }
protected override void Start() { base.Start(); if (GameStorage.Exists(Application.persistentDataPath + SaveKey.LOGINTIME_KEY)) { lastLoginTime = GameStorage.Load <Clock>(Application.persistentDataPath + SaveKey.LOGINTIME_KEY); DateTime lastLoginDate = lastLoginTime.convertToDateTime(); DateTime rightNow = DateTime.Now; TimeSpan lastLoginUntilNow = rightNow.Subtract(lastLoginDate); if (lastLoginUntilNow.Days >= 1) { if (lastLoginUntilNow.Days > 1) { currentSaveData.ResetStreak(); currentSaveData.ClaimReward(streakRewards[currentSaveData.getLoginStreak()]); //reset reward //get reward } else { currentSaveData.ClaimReward(streakRewards[currentSaveData.getLoginStreak()]); currentSaveData.AddStreak(); //get reward //reward increment } lastLoginTime.SetDataFromDateTime(rightNow); GameStorage.Save <Clock>(lastLoginTime, Application.persistentDataPath + SaveKey.LOGINTIME_KEY); } } else { lastLoginTime = new Clock(Application.persistentDataPath + SaveKey.LOGINTIME_KEY, DateTime.Now); //baru main } }
public override void OnActorDeath() { if (lastVisitedCheckpoint) { GameStorage.Save <Vector3>(lastVisitedCheckpoint.transform.position, Application.persistentDataPath + SaveKey.LASTPLAYERCHECKPOINT_KEY); } if (Level.singleton) { Level.singleton.MissionFail(); } }
public void saveTreeData() { List <int> treeData = new List <int>(); for (int i = 0; i < nodes.Count; i++) { treeData.Add(nodes[i].status); } GameStorage.Save <List <int> >(treeData, Application.persistentDataPath + SaveKey.SKILLTREEDATA_KEY); if (current is SkillNode) { SkillNode currentSkillNode = (SkillNode)current; string companionSkillActionName = currentSkillNode.getActionName(); GameStorage.Save <string>(companionSkillActionName, Application.persistentDataPath + SaveKey.COMPANIONSKILLNAME_KEY); } treeData.Clear(); treeData = null; }
public void Process(RequestForProcessing request) { var data = Converter.Convert(request.Field); Field = new Field(data, StateCalculator); var partSize = request.Steps / request.Parts; var partCounter = 0; var list = new List <string>(); for (int i = 0; i < request.Steps; i++) { var newStep = Field.GetNextState(); list.Add(Converter.Convert(newStep)); if ((i + 1) % partSize == 0) { var part = new Part { Id = Guid.NewGuid(), PartNumber = partCounter, Steps = list, TaskId = request.Id }; GameStorage.Save(part); list = new List <string>(); partCounter++; SendInfo(request.Id, partCounter); } } if (list.Count != 0) { var part = new Part { Id = Guid.NewGuid(), PartNumber = partCounter, Steps = list, TaskId = request.Id }; GameStorage.Save(part); } SendInfo(request.Id, -1); }
public void saveSettings() { currentSettings.musicVolume = musicSlider.value; currentSettings.sfxVolume = sfxSlider.value; GameStorage.Save <Settings>(currentSettings, Application.persistentDataPath + SaveKey.SETTINGSDATA_KEY); }
public override void Yes(string name) { GameStorage.Save <Vector3>(Player.singleton.getLastCheckpointPosition(), Application.persistentDataPath + SaveKey.LASTPLAYERCHECKPOINT_KEY); InterSceneImage.singleton.FinishScene(Application.loadedLevelName); Index = 0; }
public virtual void SaveGameData() { GameStorage.Save <PlayerSaveData>(currentSaveData, Application.persistentDataPath + SaveKey.PLAYERDATA_KEY); }
public void setLastVisitedCheckpoint(Checkpoint c) { lastVisitedCheckpoint = c; GameStorage.Save <Checkpoint>(lastVisitedCheckpoint, Application.persistentDataPath + SaveKey.LASTPLAYERCHECKPOINT_KEY); }