public void OnHandleButtonClicked() { ToggleActive(true, false); ActivityData payload = ActivityData.Empty; try { if (!string.IsNullOrWhiteSpace(m_ParentHandle.target.payloadViewController.payload)) { payload = JsonUtility.FromJson <ActivityData>(m_ParentHandle.target.payloadViewController.payload); } } catch (ArgumentException) { // Invalid json Debug.LogWarning("Found invalid json."); } catch (Exception e) { Debug.LogException(e); } DialogComponent dialog = m_DialogFactory.Create(payload, OnActivityPayloadChanged); m_DialogService.SendRequest(DialogRequest.Create(dialog)); }
// bug in dialog system where get stuck on wrong page maybe private IEnumerator InternalDisplayDialog(DialogComponent dc) { _showing = true; _tmp.text = string.Format(dc.dialog, GameController.Instance.playerLuck.item, GameController.Instance.opponentLuck.item); _tmp.maxVisibleCharacters = 0; while (_tmp.maxVisibleCharacters < _tmp.text.Length) { _tmp.maxVisibleCharacters++; yield return(new WaitForSeconds(_RATE)); if (_tmp.maxVisibleCharacters > _tmp.textInfo.pageInfo[_tmp.pageToDisplay - 1].lastCharacterIndex) // condition needs improving { _waiting = true; yield return(new WaitUntil(HasTouched)); _waiting = false; _getNext = false; if (_tmp.pageToDisplay == _tmp.textInfo.pageInfo.Length) { break; } _tmp.pageToDisplay = Mathf.Min(_tmp.textInfo.pageInfo.Length, _tmp.pageToDisplay + 1); } } _showing = false; OnComplete(dc); }
public void DisplayDialog(int dialogId) { DialogComponent dc = gameObject.AddComponent <DialogComponent>(); dc.dialogId = dialogId; dc.dialog = _dialogs[dialogId]; }
private void OnNext(DialogComponent d) { if (d.Current == null) { d.OnNext -= OnNext; started = false; } }
public static DialogComponent Create() { var DialogView = DialogComponent.CreateInstance(); DialogView.MakeFullScreen(); return(DialogView); }
/// <inheritdoc/> public IDialog DisplayMilestoneAchieved(MilestoneData milestoneData) { DialogComponent dialogComponent = m_PopupFactory.Create(milestoneData); DialogRequest request = DialogRequest.Create(dialogComponent, DialogPriority.Low); m_DialogService.SendRequest(request); return(dialogComponent); }
public void Apply(IEntity entity) { var uiComponent = new UIComponent { UIName = uiName, IsDynamic = true, UIType = UIType.UI_DIALOG }; var dialogComponent = new DialogComponent { Title = title, Message = message, Buttons = buttons, Model = model, ModalColor = modelColor }; entity.AddComponents(uiComponent, dialogComponent); entity.AddComponent <ViewComponent>(); }
private void Start(DialogComponent d, string id, Entity to, Action callback = null) { d.Start(id, to); if (callback != null) { d.Dialog.ShowArrow = true; d.Dialog.OnEnd = () => { Timer.Add(callback, 0.1f); return(true); }; } }
public override void OnComponentRemoved(BaseComponent c) { if (c is DialogComponent) { DialogComponent dc = c as DialogComponent; if (dc.dialogId == 43) { GameController.Instance.ClearProgress(); } else if (dc.dialogId == 1) { PlayerPrefs.SetInt("MaxLuck", 5); GameController.Instance.playerLuck.maxLuck = 5; } _tmp.text = ""; _tmp.pageToDisplay = 1; GameController.Instance.dialogStateMachine.SetTrigger("GoodTrigger"); } }
public override void OnComponentAdded(BaseComponent c) { if (c is DialogComponent) { DialogComponent dc = c as DialogComponent; DisplayDialog(dc); } else if (c is TouchComponent) { if (_waiting) { _getNext = true; } else if (_showing) { _tmp.maxVisibleCharacters = _tmp.textInfo.pageInfo[_tmp.pageToDisplay - 1].lastCharacterIndex; } } }
protected DialogDecorator(DialogComponent baseComponent) { m_DialogComponent = baseComponent; }
public void Start(DialogComponent component, string what, Action onEnd) { Current = component; component.Start(what, null, onEnd); }
private void Awake() { m_DialogComponent = GetComponent <DialogComponent>(); }
protected void DisplayDialog(DialogComponent dc) { GameController.Instance.HandleCoroutine(InternalDisplayDialog(dc)); }
protected override void OnComplete(DialogComponent dc) { GameObject.Destroy(dc); GameController.Instance.ClearDice(); }
public WaitBetweenCharDialog(DialogComponent baseComponent) : base(baseComponent) { }