public void OnSubmit() { string name = nameField.text; Debug.Log("Captain: " + name); PlayerAccountManager pam = PlayerAccountManager.GetInstance(); // Initialize a new player and save it. pam.InitializeNewPlayer(name); pam.SavePlayer(pam.CurrSaveSlot); // Close all the screens and then start loading List <AssetLoadRequestTO> requests = new List <AssetLoadRequestTO>(); AssetLoadRequestTO baseData = AssetLoadRequestTO.CreateMetadataAssetRequest(GameConstants.METADATA_BASE_FILE); requests.Add(baseData); AssetLoadRequestTO ep1 = AssetLoadRequestTO.CreateConversationRequest(GameConstants.EP01); requests.Add(ep1); // load the map csv file. //AssetLoadRequestTO map = AssetLoadRequestTO.CreateMapDataRequest(GameConstants.MAP_1); //requests.Add(map); EventController.GetInstance().RegisterForEvent( EventTypeEnum.AssetsLoadMultipleComplete, OnLoadCompleteEvent); AssetLoader.GetInstance().LoadAssets(requests); }
/// <summary> /// We save a conversation is complete by saving the starting node id. /// </summary> /// <param name="conv"></param> private void SaveConversationComplete(Conversation conv) { ConversationNode startNode = conv.nodeMap[conv.startNodeTitle]; // Flag that whole conversation tree as complete PlayerAccountManager.GetInstance().GetPlayer().SetValue <int>(startNode.treeID, 1); // Auto save the player PlayerAccountManager pm = PlayerAccountManager.GetInstance(); pm.AutoSavePlayerToCurrentSlot(); }
protected override void OnYes() { // Set the current save slot PlayerAccountManager.GetInstance().CurrSaveSlot = SlotNum; Debug.Log("SaveFile Yes"); // Pop the name input screen GameObject MainMenu = GameObject.Find(GameConstants.UI_MAIN_MENU); GameObject nameInputScreen = UIFactory.CreateScreen(UIFactory.SCR_NAME_INPUT, MainMenu); ScreenQueueManager sqm = ScreenQueueManager.GetInstance(); sqm.QueueScreenAsNext(nameInputScreen); sqm.QueueScreen(parentScreen); }
// Use this for initialization public override void Start() { base.Start(); //// add all the save slots for (int i = 0; i < GameConstants.NUM_SAVE_SLOTS; i++) { // Try loading up a save file SaveData save = PlayerAccountManager.GetInstance().LoadSaveFile(PlayerAccountManager.SAVE_FILE_PREFIX + i); // If we didn't find a save file in that slot then make an empty one if (save == null) { save = new SaveData(null); } GetNewSaveFileButton(save, i); } }
private void ApplyParamModifiers(ConversationNode node) { if (node.paramMods == null || node.paramMods.Count < 1) { return; } PlayerAccountManager pm = PlayerAccountManager.GetInstance(); Player player = pm.GetPlayer(); for (int i = 0, count = node.paramMods.Count; i < count; i++) { ConversationParamModifier mod = node.paramMods[i]; // If it's a music parameter then play the transition if (ParameterModifierUtils.IsMusicParameter(mod.paramName)) { if (mod.paramName == MusicController.DIALOG_PARAM_MUSIC_FADEIN) { MusicController.GetInstance().TransitionToNewSong(mod.strValue); } if (mod.paramName == MusicController.DIALOG_PARAM_MUSIC_FADEOUT) { MusicController.GetInstance().FadeOutCurrentSong(); } continue; } if (ParameterModifierUtils.IsScreenParameter(mod.paramName)) { if (mod.paramName == PMOD_SCREEN_QUEUE) { GameObject MainMenu = GameObject.Find(GameConstants.UI_MAIN_MENU); GameObject screen = UIFactory.CreateScreen(mod.strValue, MainMenu); ScreenQueueManager.GetInstance().QueueScreen(screen); } continue; } if (ParameterModifierUtils.IsMapParameter(mod.paramName)) { // Preload a map if (mod.paramName == PMOD_MAP_PRELOAD) { MapController.GetInstance().LoadMapByUID(mod.strValue); } if (mod.paramName == PMOD_MAP_SHOW) { MapController.GetInstance().ShowMap(); } continue; } // Set the string or integer to the given value. if (mod.action == ConversationParamModifier.ModifierActionType.Set) { if (mod.type == ConversationParamModifier.ModifierType.Integer) { player.SetValue <int>(mod.paramName, mod.intValue); } else { player.SetValue <string>(mod.paramName, mod.strValue); } continue; } if (mod.action == ConversationParamModifier.ModifierActionType.Increment) { player.IncrementValue(mod.paramName, mod.intValue); continue; } if (mod.action == ConversationParamModifier.ModifierActionType.Decrement) { player.IncrementValue(mod.paramName, -mod.intValue); continue; } } // Save the player progress at this point. pm.AutoSavePlayerToCurrentSlot(); }
private void SaveDecision(ConversationNode node, int choice) { PlayerAccountManager.GetInstance().GetPlayer().SetValue <int>(node.title, choice); }