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));
        }
Ejemplo n.º 2
0
    // 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);
    }
Ejemplo n.º 3
0
    public void DisplayDialog(int dialogId)
    {
        DialogComponent dc = gameObject.AddComponent <DialogComponent>();

        dc.dialogId = dialogId;
        dc.dialog   = _dialogs[dialogId];
    }
Ejemplo n.º 4
0
 private void OnNext(DialogComponent d)
 {
     if (d.Current == null)
     {
         d.OnNext -= OnNext;
         started   = false;
     }
 }
Ejemplo n.º 5
0
        public static DialogComponent Create()
        {
            var DialogView = DialogComponent.CreateInstance();

            DialogView.MakeFullScreen();

            return(DialogView);
        }
Ejemplo n.º 6
0
        /// <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);
        }
Ejemplo n.º 7
0
        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>();
        }
Ejemplo n.º 8
0
            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);
                    };
                }
            }
Ejemplo n.º 9
0
 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");
     }
 }
Ejemplo n.º 10
0
 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;
         }
     }
 }
Ejemplo n.º 11
0
 protected DialogDecorator(DialogComponent baseComponent)
 {
     m_DialogComponent = baseComponent;
 }
Ejemplo n.º 12
0
 public void Start(DialogComponent component, string what, Action onEnd)
 {
     Current = component;
     component.Start(what, null, onEnd);
 }
Ejemplo n.º 13
0
 private void Awake()
 {
     m_DialogComponent = GetComponent <DialogComponent>();
 }
Ejemplo n.º 14
0
 protected void DisplayDialog(DialogComponent dc)
 {
     GameController.Instance.HandleCoroutine(InternalDisplayDialog(dc));
 }
Ejemplo n.º 15
0
 protected override void OnComplete(DialogComponent dc)
 {
     GameObject.Destroy(dc);
     GameController.Instance.ClearDice();
 }
Ejemplo n.º 16
0
 public WaitBetweenCharDialog(DialogComponent baseComponent)
     : base(baseComponent)
 {
 }