public void Execute(string tutorialID) { GameModel game = AmbitionApp.Game; if (game.Tutorials.Contains(tutorialID)) { UFlowSvc uflow = AmbitionApp.GetService <UFlowSvc>(); UMachine machine = uflow.IsActiveFlow(tutorialID) ? null : uflow.Invoke(tutorialID); } }
private void HandleSnapShot(byte[] snapshot) { LocalizationModel loc = AmbitionApp.GetModel <LocalizationModel>(); GameModel model = AmbitionApp.GetModel <GameModel>(); IncidentModel incident = AmbitionApp.GetModel <IncidentModel>(); string path = Path.Combine(UnityEngine.Application.persistentDataPath, Filepath.SAVE_FILE); List <string[]> saves; string result; string saveID = loc?.HeaderTitlePhrase; string snapshotPath = DateTime.Now.Ticks.ToString() + ".jpg"; if (File.Exists(path)) { result = File.ReadAllText(path); saves = JsonConvert.DeserializeObject <List <string[]> >(result); } else { saves = new List <string[]>(); } if (!string.IsNullOrEmpty(saveID)) { saveID = AmbitionApp.Localize(saveID); saveID = string.IsNullOrEmpty(saveID) ? model.PlayerName + " - " + loc.HeaderTitlePhrase + " - " + DateTime.Now.ToString() : model.PlayerName + " - " + saveID + " - " + DateTime.Now.ToString(); } else { saveID = model.PlayerName + " - " + DateTime.Now.ToString(); } string[] savedGame = new string[] { saveID, snapshotPath, AmbitionApp.GetService <ModelSvc>().Save() }; if (snapshot != null) { snapshotPath = Path.Combine(UnityEngine.Application.persistentDataPath, snapshotPath); System.IO.File.WriteAllBytes(snapshotPath, snapshot); } model.SaveSlotID = saves.Count; saves.Add(savedGame); result = JsonConvert.SerializeObject(saves); File.WriteAllText(path, result); }
public override void OnClose() { AudioSvc audio = AmbitionApp.GetService <AudioSvc>(); string path = Path.Combine(UnityEngine.Application.persistentDataPath, Filepath.SETTINGS); _settings.Volume = new Dictionary <AudioChannel, int>() { { AudioChannel.Ambient, audio.GetVolume(AudioChannel.Ambient) }, { AudioChannel.Sfx, audio.GetVolume(AudioChannel.Sfx) }, { AudioChannel.Music, audio.GetVolume(AudioChannel.Music) }, { AudioChannel.Master, audio.GetVolume(AudioChannel.Master) } }; _settings.Resolution = Screen.currentResolution; _settings.Language = _languages[LocSelector.value]; File.WriteAllText(path, JsonConvert.SerializeObject(_settings)); }
public void OnVolumeChanged() { AmbitionApp.GetService <AudioSvc>().SetVolume(Channel, (int)Slider.value); }
void OnEnable() { Slider.value = AmbitionApp.GetService <AudioSvc>().GetVolume(Channel); }
public void Execute(string tutorialID) { AmbitionApp.Game.Tutorials.RemoveAll(t => t == tutorialID); AmbitionApp.GetService <UFlow.UFlowSvc>().Unregister(tutorialID); }