Example #1
0
 public void ShowMsgHaveBtn(string msg, bool isOneBtn, DialogDelegate dealMethod)
 {
     dialogBtnEvent = null;
     objOneBtn.SetActive(isOneBtn);
     objTwoBtn.SetActive(!isOneBtn);
     labMsg.text    = msg;
     dialogBtnEvent = dealMethod;
 }
Example #2
0
    public void ShowTutorial(int index, string title, string message)
    {
        GameLogicManager.Instance.Pause();
        DialogDelegate okDialog = delegate { Destroy(currentTutorial); currentTutorial = null; GameLogicManager.Instance.Resume(); };

        PopupDialogManager.Instance.CreatePopupDialog(title, message, okDialog, TextAlignmentOptions.Bottom, true);
        currentTutorial = Instantiate(tutorialAnimPrefabs[index], transform);
    }
Example #3
0
    public override void Back()
    {
        base.Back();
        DialogDelegate yesDelegate = QuitGame;
        DialogDelegate noDelegate  = delegate { gameObject.SetActive(true); };

        PopupDialogManager.Instance.CreatePopupDialog("QUIT GAME", "Are you sure you want to quit this game? Q-Q", true, yesDelegate, noDelegate);
    }
    public PopupDialog CreatePopupDialog(string t, string m, bool hasYesAndNo, DialogDelegate yesDelegate, DialogDelegate noDelegate, DialogDelegate okDelegate)
    {
        GameObject  go     = Instantiate(dialogPrefab, canvasTransform);
        PopupDialog script = go.GetComponent <PopupDialog>();

        script.Setup(t, m, hasYesAndNo, yesDelegate, noDelegate, okDelegate);
        return(script);
    }
        public void Create_Valid_DialogDelegateDirective()
        {
            var actual = new DialogDelegate {
                UpdatedIntent = GetUpdatedIntent()
            };

            Assert.True(CompareJson(actual, "DialogDelegate.json"));
        }
Example #6
0
	public void ShowMsgHaveBtn (string msg, bool isOneBtn, DialogDelegate dealMethod)
	{
		dialogBtnEvent = null;
		objOneBtn.SetActive (isOneBtn);
		objTwoBtn.SetActive (!isOneBtn);
		labMsg.text = msg;
		dialogBtnEvent = dealMethod;
	}
    public PopupDialog CreatePopupDialog(string t, string m, DialogDelegate okDelegate, TextAlignmentOptions alignment, bool darkenBackground)
    {
        PopupDialog script = CreatePopupDialog(t, m, okDelegate);

        script.ChangeMessageAllignment(alignment);
        if (darkenBackground)
        {
            script.DarkenBackground();
        }
        return(script);
    }
Example #8
0
    public void Setup(string t, string m, bool hasYesAndNo, DialogDelegate yesDelegate, DialogDelegate noDelegate, DialogDelegate okDelegate)
    {
        title.text   = t;
        message.text = m;

        if (hasYesAndNo)
        {
            OneButtonPanel.SetActive(false);
            TwoButtonPanel.SetActive(true);
            yesButton.onClick.AddListener(delegate { if (yesDelegate != null)
                                                     {
                                                         yesDelegate();
                                                     }
                                                     Destroy(gameObject); SFXManager.Instance.ButtonClick(); });
            noButton.onClick.AddListener(delegate { if (noDelegate != null)
                                                    {
                                                        noDelegate();
                                                    }
                                                    Destroy(gameObject); SFXManager.Instance.ButtonClick(); });
            closeButton.onClick.AddListener(delegate { if (noDelegate != null)
                                                       {
                                                           noDelegate();
                                                       }
                                                       Destroy(gameObject); SFXManager.Instance.ButtonClick(); });
        }
        else
        {
            OneButtonPanel.SetActive(true);
            TwoButtonPanel.SetActive(false);
            okButton.onClick.AddListener(delegate {
                if (okDelegate != null)
                {
                    okDelegate();
                }
                Destroy(gameObject);
                SFXManager.Instance.ButtonClick();
            });
            closeButton.onClick.AddListener(delegate { if (okDelegate != null)
                                                       {
                                                           okDelegate();
                                                       }
                                                       Destroy(gameObject); SFXManager.Instance.ButtonClick(); });
        }
    }
Example #9
0
 public void OpenMessageBox(string newText, float newDelay, float newScale, DialogDelegate resultFunction)
 {
     scaleOffset = newScale;
     collision.enabled = true;
     dialogBox.renderer.enabled = true;
     dialogText.renderer.enabled = true;
     opened = true;
     timer = 0.01f;
     dialogText.text = newText;
     delay = newDelay;
     if (resultFunction != null) {
         tapToDismiss = false;
         dialogDelegate = resultFunction;
         okButton.renderer.enabled = true;
         cancelButton.renderer.enabled = false;
         okButton.GetComponent<BoxCollider>().enabled = true;
         cancelButton.GetComponent<BoxCollider>().enabled = false;
     }
 }
        internal static SkillResponse CommonModelToAlexa(CommonModel commonModel)
        {
            var response = new SkillResponse()
            {
                Version  = "1.0",
                Response = new ResponseBody()
            };

            if (commonModel.Request.State == "STARTED" || commonModel.Request.State == "IN_PROGRESS")
            {
                var directive = new DialogDelegate
                {
                    UpdatedIntent = new Alexa.NET.Request.Intent
                    {
                        Name  = commonModel.Request.Intent,
                        Slots = commonModel.Request.Parameters?.ToDictionary(p => p.Key, p => new Slot {
                            Name = p.Key, Value = p.Value
                        })
                    }
                };

                response.Response.Directives.Add(directive);
                response.Response.ShouldEndSession = false;

                return(response);
            }

            if (string.IsNullOrWhiteSpace(commonModel.Response.Ssml))
            {
                response.Response.OutputSpeech = new PlainTextOutputSpeech
                {
                    Text = commonModel.Response.Text
                };
            }
            else
            {
                response.Response.OutputSpeech = new SsmlOutputSpeech {
                    Ssml = "<speak>" + commonModel.Response.Ssml + "</speak>"
                };
            }

            if (commonModel.Response.Card != null)
            {
                response.Response.Card = new SimpleCard
                {
                    Title   = commonModel.Response.Card.Title,
                    Content = commonModel.Response.Card.Text
                };
            }

            if (!string.IsNullOrWhiteSpace(commonModel.Response.Prompt))
            {
                response.Response.Reprompt = new Reprompt
                {
                    OutputSpeech = new PlainTextOutputSpeech
                    {
                        Text = commonModel.Response.Prompt
                    }
                }
            }
            ;

            response.Response.ShouldEndSession = commonModel.Session.EndSession;

            return(response);
        }
 public PopupDialog CreatePopupDialog(string t, string m, bool hasYesAndNo, DialogDelegate yesDelegate, DialogDelegate noDelegate)
 {
     return(CreatePopupDialog(t, m, hasYesAndNo, yesDelegate, noDelegate, null));
 }
 public PopupDialog CreatePopupDialog(string t, string m, DialogDelegate okDelegate)
 {
     return(CreatePopupDialog(t, m, false, null, null, okDelegate));
 }