// Update is called once per frame void LateUpdate() { if (!initTree) { if (!GameStorage.Exists(Application.persistentDataPath + SaveKey.SKILLTREEDATA_KEY)) { root.recursivelyChangeStatus(2); current = root; } else { List <int> nodeStatusData = GameStorage.Load <List <int> >(Application.persistentDataPath + SaveKey.SKILLTREEDATA_KEY); for (int i = 0; i < nodeStatusData.Count; i++) { nodes[i].status = nodeStatusData[i]; if (nodes[i].status == 2) { current = nodes[i]; } Debug.Log(nodeStatusData[i]); } } initTree = true; } }
/// <summary> /// Updates the info panel to show a comparison between the equipped itm for a slot and the unequipped one /// </summary> /// <param name="equipped">The equipped item</param> /// <param name="inInvName">Name of the unequipped item</param> private void UpdateComparison(EquippableBase equipped, string inInvName) { Text[] children = itemInfo.transform.GetComponentsInChildren <Text>(); UpdateBaseInfo(children, inInvName); EquippableBase inInv = ((EquippableBase)Registry.ItemRegistry[inInvName]); //Removes the previous info texts for (int i = 2; i < children.Length; i++) { Destroy(itemInfo.transform.GetChild(i).gameObject); } foreach (Stats stat in (Stats[])Enum.GetValues(typeof(Stats))) { if (equipped.stats.ContainsKey(stat) || inInv.stats.ContainsKey(stat)) { Text text = Instantiate(itemInfoTextPrefab, itemInfo.transform).GetComponent <Text>(); string statName = GameStorage.StatToString(stat); bool isPercent = statName.Contains("Effectiveness") || statName.Contains("Receptiveness") || statName.Contains("Lifesteal") || statName.Contains("Chance"); int equippedStat = equipped.stats.ContainsKey(stat) ? equipped.stats[stat] : 0; int inInvStat = inInv.stats.ContainsKey(stat) ? inInv.stats[stat] : 0; text.text = statName + ": " + ((isPercent && equippedStat > 0) ? "+" : "") + equippedStat + (isPercent ? "%" : "") + " -> " + ((isPercent && inInvStat > 0) ? "+" : "") + inInvStat + (isPercent ? "%" : ""); } } Text flavorText = Instantiate(itemInfoTextPrefab, itemInfo.transform).GetComponent <Text>(); flavorText.text = inInv.FlavorText; Text sellText = Instantiate(itemInfoTextPrefab, itemInfo.transform).GetComponent <Text>(); sellText.text = "Sells for: " + inInv.SellAmount; }
public void Render() { if (GameStorage.Get().Player.Quests.Count == 0) { Console.WriteLine("You have no current Quest!"); } if (_availableQuests.Count > 0) { Console.WriteLine("\nChoose a Quest!"); for (int i = 0; i < _availableQuests.Count; i++) { Quest q = _availableQuests[i]; Console.WriteLine($"{i + 1}: {q.Name} - {q.Type}"); } } else { Console.WriteLine("No Quests Available"); } List <Quest> completed = GameStorage.Get().Player.Quests.Where(q => q.IsFinished).ToList(); if (completed.Count > 0) { Console.WriteLine("\nCompleted Quests:"); foreach (Quest q in completed) { Console.WriteLine(q.Name); } Console.WriteLine("\n 'C' to turn in all Quests"); } }
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); } }
private void ValidatePath(bool debug = false) { var executable = GameStorage.GetExecutableName(game.GameType); var path = game.Directory; var isValid = false; if (!string.IsNullOrEmpty(path)) { DirectoryInfo directory = new DirectoryInfo(game.Directory); FileInfo file = new FileInfo(game.Directory + "\\" + executable); isValid = file.Exists; } if (isValid) { //TODO add tick here.. Button_Start.Enabled = true; Picture_Status.Image = Image.FromFile("Resources/tick.png"); } else { Button_Start.Enabled = false; Picture_Status.Image = Image.FromFile("Resources/cross.png"); if (debug) { MessageBox.Show(string.Format("Failed to find correct executable: {0}!", executable), "Toolkit", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public override void Initialize(IApplication application) { base.Initialize(application); #if DEBUG if (WaveServices.Storage.Exists <GameStorage>()) { WaveServices.Storage.Delete <GameStorage>(); } #endif // Load storage game data if (WaveServices.Storage.Exists <GameStorage>()) { _gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { _gameStorage = new GameStorage { IsMusicEnabled = true, AreSoundsEnabled = true, Record = 0 }; } Catalog.RegisterItem(_gameStorage); WaveServices.RegisterService(new SimpleSoundService()); StartMusic(); var screenContext = new ScreenContext(new MainMenuScene(), new PlayersPopupScene(), new RulesScene()); var transition = new ColorFadeTransition(Color.White, TimeSpan.FromSeconds(1)); WaveServices.ScreenContextManager.To(screenContext, transition); }
private void Destroyed() { explosionParticle.SetActive(true); meshRender.enabled = false; exploded = true; GameStorage.getInstance().addToExplodeList(this); }
// Use this for initialization protected virtual void Start() { GameObject so = Resources.Load("Settings Object") as GameObject; GameObject op = Resources.Load("Object Pool") as GameObject; op = Instantiate(op); objectPool = op.GetComponent <ObjectPool>(); menuButtons = new List <MenuButton>(FindObjectsOfType <MenuButton>()); if (GameStorage.Exists(Application.persistentDataPath + SaveKey.PLAYERDATA_KEY)) { currentSaveData = GameStorage.Load <PlayerSaveData>(Application.persistentDataPath + SaveKey.PLAYERDATA_KEY); Debug.Log(currentSaveData.getCompanionData().mySkills.Count); for (int i = 0; i < menuButtons.Count; i++) { menuButtons[i].NotifyThatPlayerHasSavedBefore(); } } else { currentSaveData = new PlayerSaveData(Application.persistentDataPath + SaveKey.PLAYERDATA_KEY); playerShouldBeTutored = true; } SceneNavigation.singleton.saveGameContent += SaveGameData; settingsObject = objectPool.registerObject <SettingsObject>(so); objectPool.activateObject(settingsObject); }
public string HandleInput(ConsoleKeyInfo input) { int number = ConsoleKeyParser.GetIntFromKey(input); if (number >= 1 && number <= _availableQuests.Count) { _data.Player.Quests.Add(_availableQuests[number - 1]); _availableQuests.RemoveAt(number - 1); } if (input.Key == ConsoleKey.C) { List <Quest> completed = GameStorage.Get().Player.Quests.Where(q => q.IsFinished).ToList(); if (completed.Count > 0) { foreach (Quest q in completed) { GameStorage.Get().Player.TurnInQuest(q); } } else { return("No Completed Quests!"); } } return(""); }
/// <summary> /// Creates the scene. /// </summary> /// <remarks> /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized. /// </remarks> protected override void CreateScene() { Entity camera = new Entity() .AddComponent(new Camera2D() { ClearFlags = ClearFlags.DepthAndStencil, // Allow transparent background BackgroundColor = Color.Transparent, }); EntityManager.Add(camera); this.gameStorage = Catalog.GetItem <GameStorage>(); this.gameScene = WaveServices.ScreenContextManager.FindContextByName("GameBackContext") .FindScene <GameScene>(); if (this.gameStorage.BestScore < this.gameScene.CurrentScore) { // Update best score this.gameStorage.BestScore = this.gameScene.CurrentScore; // Save storage game data GameStorage gameStorage = Catalog.GetItem <GameStorage>(); WaveServices.Storage.Write <GameStorage>(gameStorage); } this.CreateUI(); #if DEBUG this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PreUpdate); #endif }
/// <summary> /// Displays and updates the item info card if the player is mousing over an item /// </summary> /// <param name="index">The index of the item you are mousing over</param> public override void MouseOverItem(int index) { Text[] children = itemInfo.transform.GetComponentsInChildren <Text>(); itemInfo.SetActive(true); itemInfo.transform.position = Input.mousePosition + new Vector3(2, -2, 0); itemInfo.transform.GetChild(0).GetComponent <Text>().text = itemList[index].Name; //Has to display extra stat information if the item is an equippable if (Registry.ItemRegistry[itemList[index].Name] is EquippableBase) { EquippableBase item = ((EquippableBase)Registry.ItemRegistry[itemList[index].Name]); children[1].text = "Equipment type: " + item.equipSlot.ToString(); foreach (Stats stat in (Stats[])Enum.GetValues(typeof(Stats))) { if (item.stats.ContainsKey(stat)) { string statName = GameStorage.StatToString(stat); bool isPercent = statName.Contains("Effectiveness") || statName.Contains("Receptiveness") || statName.Contains("Lifesteal") || statName.Contains("Chance"); children[1].text += "\n" + statName + ": " + item.stats[stat] + (isPercent ? "%" : ""); } } } else { children[1].text = itemList[index].amount + "/" + Registry.ItemRegistry[itemList[index].Name].MaxStack; } children[1].text += "\n" + Registry.ItemRegistry[itemList[index].Name].FlavorText; children[1].text += "\nSells for: " + Registry.ItemRegistry[itemList[index].Name].SellAmount; base.MouseOverItem(index); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; ScreenContext screenContext = new ScreenContext(new MainMenuScene()); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Sounds.bg_music_mp3)); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem <GameStorage>(gameStorage); // Register the SoundManager service WaveServices.RegisterService <SoundManager>(new SoundManager()); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Audio.bg_music_mp3)); WaveServices.MusicPlayer.IsRepeat = true; // GameBackContext is visible always at the background. // For this reason the behavior is set to Draw and Update when the scene is in background. var backContext = new ScreenContext("GameBackContext", new GameScene()); backContext.Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground; //On init show the Main menu WaveServices.ScreenContextManager.Push(backContext); WaveServices.ScreenContextManager.Push(new ScreenContext("MenuContext", new MenuScene())); }
/// <summary> /// Initializes the specified adapter. /// </summary> /// <param name="application">The application.</param> public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; ViewportManager vm = WaveServices.ViewportManager; vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(Directories.SoundsPath + "bg_music.mp3")); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.ScreenContextManager.To(new ScreenContext(new MainMenuScene())); }
protected override void CreateScene() { var camera2D = new FixedCamera2D("Camera2D") { ClearFlags = ClearFlags.DepthAndStencil, BackgroundColor = Color.Transparent }; EntityManager.Add(camera2D); this.gameStorage = Catalog.GetItem <GameStorage>(); this.gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlay") .FindScene <GamePlayScene>(); if (this.gameStorage.BestScore < this.gameScene.CurrentScore) { // Update best score this.gameStorage.BestScore = this.gameScene.CurrentScore; // Save storage game data GameStorage gameStorage = Catalog.GetItem <GameStorage>(); WaveServices.Storage.Write <GameStorage>(gameStorage); } this.CreateUI(); // Music Volume WaveServices.MusicPlayer.Volume = 0.2f; // Animations Duration duration = TimeSpan.FromSeconds(1); this.scaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back); this.opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; //ViewportManager vm = WaveServices.ViewportManager; //vm.Activate(768, 1024, ViewportManager.StretchMode.Fill); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
/// <summary> /// Turns the gear to the save option and saves /// </summary> public void ToSave() { innerGear.moveToButton(5); ClosePlayerSelection(); pauseInventory.Close(); GameStorage.SaveAll(0); }
public GameState Transition(GameStorage storage, GameManager manager) { TimeSinceLastUpdate = 0; var result = Evaluate(storage, manager); return(result); }
public void setSelection(GameObject block, int lev) { if (States.selectedLevel == lev) { GamePhaseController.showLoading(); GameStorage.getInstance().loadLevel(lev); } if (States.selectedLevel != lev) { if (lev % 2 == 0) { ((UnityEngine.UI.Image)((UnityEngine.UI.Button)block.GetComponentsInChildren <UnityEngine.UI.Button>()[0]).gameObject.GetComponentsInChildren <UnityEngine.UI.Image>()[0]).overrideSprite = ((UnityEngine.UI.Button)block.GetComponentsInChildren <UnityEngine.UI.Button>()[0]).spriteState.pressedSprite; ((UnityEngine.UI.Button)block.GetComponentsInChildren <UnityEngine.UI.Button>()[0]).spriteState = selectedState; } if (lev % 2 == 1) { ((UnityEngine.UI.Image)((UnityEngine.UI.Button)block.GetComponentsInChildren <UnityEngine.UI.Button>()[1]).gameObject.GetComponentsInChildren <UnityEngine.UI.Image>()[0]).overrideSprite = ((UnityEngine.UI.Button)block.GetComponentsInChildren <UnityEngine.UI.Button>()[1]).spriteState.pressedSprite; ((UnityEngine.UI.Button)block.GetComponentsInChildren <UnityEngine.UI.Button>()[1]).spriteState = selectedState; } descriptionPanel.GetComponentsInChildren <UnityEngine.UI.Text>()[0].text = ((Templates.LevelInfo)Templates.getInstance().getLevel((int)States.currentCampaign.levels[lev])).levelName; descriptionPanel.GetComponentsInChildren <UnityEngine.UI.Text>()[1].text = ((Templates.LevelInfo)Templates.getInstance().getLevel((int)States.currentCampaign.levels[lev])).description; States.selectedLevel = lev; start_but.SetActive(true); } }
public void InitExplorerSettings() { folderView.Nodes.Clear(); game = GameStorage.Instance.GetSelectedGame(); pcDirectory = new DirectoryInfo(game.Directory); launcher = new FileInfo(pcDirectory.FullName + "/" + GameStorage.GetExecutableName(game.GameType)); if (!launcher.Exists) { DialogResult result = MessageBox.Show("Could not find executable! Would you like to change the selected game?", "Toolkit", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); if (result == DialogResult.OK) { OpenGameSelectorWindow(); } //Close(); return; } InitTreeView(); string path = pcDirectory.FullName + "/edit/tables/FrameProps.bin"; if (File.Exists(path)) { FileInfo info = new FileInfo(path); FrameProps props = new FrameProps(info); SceneData.FrameProperties = props; } }
override void CreateScene() { this.Load(WaveContent.Scenes.GameOverScene); this.EntityManager.Find("defaultCamera2D").FindComponent <Camera2D>().CenterScreen(); this.gameStorage = Catalog.GetItem <GameStorage>(); this.gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlay") .FindScene <GamePlayScene>(); if (this.gameStorage.BestScore < this.gameScene.CurrentScore) { // Update best score this.gameStorage.BestScore = this.gameScene.CurrentScore; // Save storage game data GameStorage gameStorage = Catalog.GetItem <GameStorage>(); WaveServices.Storage.Write <GameStorage>(gameStorage); #if ANDROID await WaveServices.GetService <SocialService>().AddNewScore(LeaderboardCode, this.gameScene.CurrentScore); await WaveServices.GetService <SocialService>().ShowLeaderboard(LeaderboardCode); #endif } this.CreateUI(); // Music Volume WaveServices.MusicPlayer.Volume = 0.2f; }
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 } }
internal void LoadBoard(Thakur thakur) { Thakur = thakur; var boardData = GameStorage.GetBoard(LevelNumber, BoardNumber); _level = new Level(Thakur, boardData.BoardData); }
public void OnGet() { GameId = Guid.NewGuid(); var gameManager = GameStorage.GetOrCreateGame(GameId); GameRepresentation = gameManager.GetActualGameState(); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1024, 768, ViewportManager.StretchMode.UniformToFill); ScreenContext screenContext = new ScreenContext(new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground }; WaveServices.ScreenContextManager.To(screenContext); }
private void DestroyedGas() { //explosionParticle.SetActive(true); //meshRender.enabled=false; this.transform.position = MisslePoolManager.getInstance().stackPos; exploded = true; GameStorage.getInstance().addToExplodeList(this); }
protected override void Initialize() { base.Initialize(); this.gameStorage = Catalog.GetItem <GameStorage>(); this.scoreText = this.Owner.FindChild("scoreText").FindComponent <TextComponent>(); this.bestText = this.Owner.FindChild("bestText").FindComponent <TextComponent>(); }
public void runButtonCallback() { if (!States.WorldRunning) { //DebugConsole.getInstance().Log("FA"); GameStorage.getInstance().launchStep(); } }
public void nextButtonCallback() { States.retries = 0; GamePhaseController.showLoading(); pausePanel.SetActive(false); States.selectedLevel++; GameStorage.getInstance().loadLevel(States.selectedLevel); }
public void Destroyed() { explosionParticle.SetActive(true); bodyCollider.enabled = false; exploded = true; GameStorage.getInstance().removeFromList(this); GameStorage.getInstance().addToExplodeList(this); }
public static GameStorage getInstance() { if (instance == null) { instance = new GameStorage(); } return(instance); }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem<GameStorage>(gameStorage); // Register the SoundManager service WaveServices.RegisterService<SoundManager>(new SoundManager()); // Use ViewportManager to ensure scaling in all devices WaveServices.ViewportManager.Activate( 1024, 768, ViewportManager.StretchMode.Uniform); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(Sounds.BG_MUSIC)); WaveServices.MusicPlayer.IsRepeat = true; // GameBackContext is visible always at the background. // For this reason the behavior is set to Draw and Update when the scene is in background. var backContext = new ScreenContext("GameBackContext", new GameScene()); backContext.Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground; //On init show the Main menu WaveServices.ScreenContextManager.Push(backContext); WaveServices.ScreenContextManager.Push(new ScreenContext("MenuContext", new MenuScene())); }
public PointsHistory(GameMap map) { this.map = map; maxPointsStorage = GameStorageKeys.MaxPoints(map); }
public static GameStorage getInstance() { if(instance==null) instance=new GameStorage(); return instance; }