public void Save(int slot) { if (BurikoMemory.Instance.GetGlobalFlag("GUsePrompts").BoolValue()) { StateDialogPrompt prompt = new StateDialogPrompt(PromptType.DialogSave, delegate { DoSave(slot); }, null); GameSystem.Instance.PushStateObject(prompt); GameSystem.Instance.RegisterAction(delegate { PromptController p = prompt.GetPromptController(); if (p == null) { Debug.LogWarning("Prompt does not exist!"); } else { GameSystem.Instance.SceneController.GetScreenshot(delegate(Texture2D tex) { DateTime now = DateTime.Now; string fullText = GameSystem.Instance.TextController.GetFullText(1); string fullText2 = GameSystem.Instance.TextController.GetFullText(0); p.SetScreenshotDetails(tex, now.ToString("ddd MMM dd, yyyy h:mm tt"), fullText, fullText2); }); } }); GameSystem.Instance.ExecuteActions(); } else { DoSave(slot); } }
public StateDialogPrompt(PromptType type, DialogCallback onYes, DialogCallback onNo) { gameSystem = GameSystem.Instance; if (!gameSystem.UsePrompts && type != 0) { Debug.Log("Immediately completing dialog, dialogs disabled in config."); gameSystem.RegisterAction(delegate { if (onYes != null) { onYes(); } gameSystem.PopStateStack(); }); gameSystem.ExecuteActions(); } else { GameObject gameObject = UnityEngine.Object.Instantiate(gameSystem.PromptPrefab); promptController = gameObject.GetComponent <PromptController>(); if (promptController == null) { throw new Exception("Failed to instantiate promptController!"); } promptController.Open(type, onYes, onNo); } }
public ErrorData(string titleToken, string messageToken, Action <DPrompt.ButtonFlags> callback = null) { TitleToken = titleToken; MessageToken = messageToken; Callback = callback; PromptPrefab = null; Buttons = DPrompt.ButtonFlags.None; }
private void Awake() { if (!(PromptController._instance != null) || !(PromptController._instance != this)) { PromptController._instance = this; return; } UnityEngine.Object.Destroy(base.gameObject); }
public static PromptController GetPromptController() { if (_promptController == null) { _promptController = GameObject .FindGameObjectWithTag("PromptController") .GetComponent <PromptController>(); } return(_promptController); }
static void PromptText(string[] args) { actProgress [actIndex] = ActProgress.Started; string speaker = "Self"; if (args.Length > 2) { speaker = args [2]; } PromptController.cutsceneTextPrompted(null, new TextPromptEventArgs(null, args [1], -1, speaker)); }
public void SendPromptEvent(bool overrideEvent) { // PromptController.activePrompt = null; TextPromptEventArgs textE = new TextPromptEventArgs(); textE.text = stringPrompts [promptIndex]; textE.image = images [promptIndex]; textE.overrideDuration = overridePromptDuration; textE.textSpeaker = "???"; textE.chainPrompt = overrideEvent; PromptController.textPrompted(this, textE); }
public virtual void ContinuePrompt() { if (promptIndex < stringPrompts.Length - 1) { promptIndex++; SendPromptEvent(true); } else { PromptController.textPrompted(this, null); } }
public void ExecuteImmediate() { DPrompt.ButtonFlags buttonFlags = DPrompt.ButtonFlags.None; for (int i = 0; i < PromptDefinition.Buttons.Length; i++) { buttonFlags |= PromptDefinition.Buttons[i]; } Sprite image = null; if (!string.IsNullOrEmpty(PromptDefinition.SpriteContentKey.Key)) { image = Content.LoadImmediate(PromptDefinition.SpriteContentKey); } if (!string.IsNullOrEmpty(PromptDefinition.PrefabContentKey.Key)) { PromptController component = Content.LoadImmediate(PromptDefinition.PrefabContentKey).GetComponent <PromptController>(); if (component != null) { Prefab = component; } } string i18nTitleText = PromptDefinition.i18nTitleText; string i18nBodyText = PromptDefinition.i18nBodyText; bool flag = !string.IsNullOrEmpty(titleTextInsert) || !string.IsNullOrEmpty(bodyTextInsert); Localizer localizer = Service.Get <Localizer>(); string text = $"{i18nTitleText}.Desktop"; string text2 = $"{i18nBodyText}.Desktop"; i18nTitleText = (localizer.tokens.ContainsKey(text) ? text : i18nTitleText); i18nBodyText = (localizer.tokens.ContainsKey(text2) ? text2 : i18nBodyText); if (flag) { i18nTitleText = (string.IsNullOrEmpty(titleTextInsert) ? localizer.GetTokenTranslation(i18nTitleText) : string.Format(localizer.GetTokenTranslation(i18nTitleText), titleTextInsert)); i18nBodyText = (string.IsNullOrEmpty(bodyTextInsert) ? localizer.GetTokenTranslation(i18nBodyText) : string.Format(localizer.GetTokenTranslation(i18nBodyText), bodyTextInsert)); } _promptData = new DPrompt(i18nTitleText, i18nBodyText, buttonFlags, image, PromptDefinition.IsModal, PromptDefinition.AutoClose, flag, PromptDefinition.UseCloseButton); List <PromptController.CustomButtonDefinition> list = new List <PromptController.CustomButtonDefinition>(PromptDefinition.CustomButtonKeys.Length); for (int i = 0; i < PromptDefinition.CustomButtonKeys.Length; i++) { CustomButton customButton = Content.LoadImmediate(PromptDefinition.CustomButtonKeys[i]); if (customButton != null) { list.Add(customButton.Definition); } } _promptData.CustomButtons = list.ToArray(); if (onCompleteHandler != null) { onCompleteHandler(this); } }
private void onMembershipPromptLoaded(DPrompt data, bool closeAfterError, GameObject membershipPromptPrefab) { PromptController component = membershipPromptPrefab.GetComponent <PromptController>(); if (closeAfterError) { Service.Get <PromptManager>().ShowPrompt(data, onErrorClosed, component); } else { Service.Get <PromptManager>().ShowPrompt(data, null, component); } }
public GameObject ShowPrompt(DPrompt data, Action <DPrompt.ButtonFlags> callback, PromptController prefab = null) { if (prefab == null) { prefab = PromptPrefab; } GameObject gameObject = UnityEngine.Object.Instantiate(prefab.gameObject); gameObject.transform.SetParent(base.transform, worldPositionStays: false); PromptController component = gameObject.GetComponent <PromptController>(); component.ShowPrompt(data, callback); if (PromptCreated != null) { PromptCreated(gameObject); } return(gameObject); }
private void onMembershipPromptLoaded(DPrompt data, GameObject membershipPromptPrefab) { PromptController component = membershipPromptPrefab.GetComponent <PromptController>(); Service.Get <PromptManager>().ShowPrompt(data, null, component); }
private void OnClick() { if (UICamera.currentTouchID >= -1 && !(cooldown > 0f)) { SlideButtonType type = Type; switch (type) { case SlideButtonType.Log: GameSystem.Instance.SwitchToHistoryScreen(); break; case SlideButtonType.Auto: GameSystem.Instance.IsAuto = true; break; case SlideButtonType.Skip: GameSystem.Instance.IsSkipping = true; break; case SlideButtonType.Menu: GameSystem.Instance.SwitchToRightClickMenu(); break; case SlideButtonType.QuickSave: if (!GameSystem.Instance.CanSave) { AudioController.Instance.PlaySystemSound("sysse04.ogg", 1); return; } GameSystem.Instance.ScriptSystem.SaveQuickSave(); break; case SlideButtonType.QuickLoad: { if (!GameSystem.Instance.CanSave || !GameSystem.Instance.CanLoad) { AudioController.Instance.PlaySystemSound("sysse04.ogg", 1); return; } SaveEntry d = BurikoScriptSystem.Instance.GetQSaveInfo(); if (d == null) { return; } StateDialogPrompt prompt = new StateDialogPrompt(PromptType.DialogLoad, delegate { GameSystem.Instance.ScriptSystem.LoadQuickSave(); }, null); GameSystem.Instance.PushStateObject(prompt); GameSystem.Instance.RegisterAction(delegate { PromptController promptController = prompt.GetPromptController(); if (!(promptController == null)) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(d.Path); Texture2D image = AssetManager.Instance.LoadScreenshot(fileNameWithoutExtension + ".png"); Debug.Log(promptController); Debug.Log(d); promptController.SetScreenshotDetails(image, d.Time.ToString("ddd MMM dd, yyyy h:mm tt"), d.Text, d.TextJp); } }); GameSystem.Instance.ExecuteActions(); break; } } AudioController.Instance.PlaySystemSound("wa_038.ogg", 1); cooldown = 0.5f; } }
protected void Return(object value = null) { gameObject.SetActive(false); PromptController.HidePrompt(); onCompleted(value); }
public void Prompt(PromptConfig config) { var popup = new PromptController(TopViewController, config); Present(popup); }
private void Start() { _playerAnim = Game.GetPlayer().GetComponent <Animator>(); _promptController = Game.GetPromptController(); _gameController = Game.GetGameController(); }
private void OnClick() { if (gameSystem == null) { gameSystem = GameSystem.Instance; } if (gameSystem.GameState == GameState.SaveLoadScreen && !(time > 0f) && UICamera.currentTouchID == -1 && isEnabled) { StateSaveLoad state = gameSystem.GetStateObject() as StateSaveLoad; if (state != null) { switch (base.name) { case "Save": case "0-Save": manager.Save(slot); break; case "Load": case "1-Load": { SaveEntry d = BurikoScriptSystem.Instance.GetSaveInfo(slot); if (d == null) { return; } StateDialogPrompt state2 = new StateDialogPrompt(PromptType.DialogLoad, delegate { state.Leave(delegate { StateTitle stateTitle = gameSystem.GetStateObject() as StateTitle; if (!manager.CanSave()) { stateTitle?.RequestLeaveImmediate(); } (gameSystem.GetStateObject() as StateChapterScreen)?.RequestLeaveImmediate(); GameSystem.Instance.ScriptSystem.LoadGame(slot); }); }, null); gameSystem.PushStateObject(state2); gameSystem.RegisterAction(delegate { PromptController promptController = state2.GetPromptController(); if (!(promptController == null)) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(d.Path); Texture2D image = AssetManager.Instance.LoadScreenshot(fileNameWithoutExtension + ".png"); promptController.SetScreenshotDetails(image, d.Time.ToString("ddd MMM dd, yyyy h:mm tt"), d.Text, d.TextJp); } }); gameSystem.ExecuteActions(); break; } case "2-Edit": { SaveEntry d2 = BurikoScriptSystem.Instance.GetSaveInfo(slot); if (d2 == null) { return; } SaveLoadManager.EditSlot = slot; StateDialogPrompt state3 = new StateDialogPrompt(PromptType.DialogEdit, delegate { }, null); gameSystem.PushStateObject(state3); gameSystem.RegisterAction(delegate { PromptController promptController2 = state3.GetPromptController(); if (!(promptController2 == null)) { string fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(d2.Path); Texture2D image2 = AssetManager.Instance.LoadScreenshot(fileNameWithoutExtension2 + ".png"); promptController2.SetScreenshotDetails(image2, d2.Time.ToString("ddd MMM dd, yyyy h:mm tt"), d2.Text, d2.TextJp); } }); gameSystem.ExecuteActions(); break; } case "3-Delete": { SaveEntry d3 = BurikoScriptSystem.Instance.GetSaveInfo(slot); if (d3 == null) { return; } StateDialogPrompt prompt = new StateDialogPrompt(PromptType.DialogDelete, delegate { BurikoScriptSystem.Instance.DeleteSave(slot); manager.RefreshList(); }, null); GameSystem.Instance.PushStateObject(prompt); GameSystem.Instance.RegisterAction(delegate { PromptController promptController3 = prompt.GetPromptController(); if (!(promptController3 == null)) { string fileNameWithoutExtension3 = Path.GetFileNameWithoutExtension(d3.Path); Texture2D image3 = AssetManager.Instance.LoadScreenshot(fileNameWithoutExtension3 + ".png"); promptController3.SetScreenshotDetails(image3, d3.Time.ToString("ddd MMM dd, yyyy h:mm tt"), d3.Text, d3.TextJp); } }); break; } case "Return": state.Leave(null); break; default: Debug.LogWarning("Unhandled button action!"); break; } AudioController.Instance.PlaySystemSound("wa_038.ogg", 1); time = 0.45f; } } }
public static void EndTextPrompt() { actProgress [actIndex] = ActProgress.Finished; // To clear out text prompt PromptController.cutsceneTextPrompted(null, null); }